code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static Field read(DataInputStream is) throws IOException {
final byte tag = is.readByte();
final Field result;
switch (tag) {
case 0x0f:
case 0x10:
case 0x11:
result = new NumberField(tag, is);
break;
case 0x14:
result = new BinaryField(is);
break;
case 0x26:
result = new StringField(is);
break;
default:
throw new IOException("Unable to read a field with type tag " + tag);
}
logger.debug("..received> {}", result);
return result;
} | class class_name[name] begin[{]
method[read, return_type[type[Field]], modifier[public static], parameter[is]] begin[{]
local_variable[type[byte], tag]
local_variable[type[Field], result]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x0f), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x10), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x11)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=is, 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=NumberField, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x14)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=is, 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=BinaryField, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x26)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=is, 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=StringField, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to read a field with type tag "), operandr=MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)])], expression=MemberReference(member=tag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
call[logger.debug, parameter[literal["..received> {}"], member[.result]]]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Field] identifier[read] operator[SEP] identifier[DataInputStream] identifier[is] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] Keyword[byte] identifier[tag] operator[=] identifier[is] operator[SEP] identifier[readByte] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Field] identifier[result] operator[SEP] Keyword[switch] operator[SEP] identifier[tag] operator[SEP] {
Keyword[case] literal[Integer] operator[:] Keyword[case] literal[Integer] operator[:] Keyword[case] literal[Integer] operator[:] identifier[result] operator[=] Keyword[new] identifier[NumberField] operator[SEP] identifier[tag] , identifier[is] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[Integer] operator[:] identifier[result] operator[=] Keyword[new] identifier[BinaryField] operator[SEP] identifier[is] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[Integer] operator[:] identifier[result] operator[=] Keyword[new] identifier[StringField] operator[SEP] identifier[is] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[tag] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[result] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public static float sum( InterleavedF32 img ) {
if( BoofConcurrency.USE_CONCURRENT ) {
return ImplImageStatistics_MT.sum(img);
} else {
return ImplImageStatistics.sum(img);
}
} | class class_name[name] begin[{]
method[sum, return_type[type[float]], modifier[public static], parameter[img]] begin[{]
if[member[BoofConcurrency.USE_CONCURRENT]] begin[{]
return[call[ImplImageStatistics_MT.sum, parameter[member[.img]]]]
else begin[{]
return[call[ImplImageStatistics.sum, parameter[member[.img]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[float] identifier[sum] operator[SEP] identifier[InterleavedF32] identifier[img] operator[SEP] {
Keyword[if] operator[SEP] identifier[BoofConcurrency] operator[SEP] identifier[USE_CONCURRENT] operator[SEP] {
Keyword[return] identifier[ImplImageStatistics_MT] operator[SEP] identifier[sum] operator[SEP] identifier[img] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[ImplImageStatistics] operator[SEP] identifier[sum] operator[SEP] identifier[img] operator[SEP] operator[SEP]
}
}
|
public void updateFragementWithSelectedCorpus(Set<String> corpora)
{
if (corpora != null && !corpora.isEmpty())
{
String fragment = "_c=" + Helper.encodeBase64URL(StringUtils.
join(corpora, ","));
UI.getCurrent().getPage().setUriFragment(fragment);
}
else
{
UI.getCurrent().getPage().setUriFragment("");
}
} | class class_name[name] begin[{]
method[updateFragementWithSelectedCorpus, return_type[void], modifier[public], parameter[corpora]] begin[{]
if[binary_operation[binary_operation[member[.corpora], !=, literal[null]], &&, call[corpora.isEmpty, parameter[]]]] begin[{]
local_variable[type[String], fragment]
call[UI.getCurrent, parameter[]]
else begin[{]
call[UI.getCurrent, parameter[]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[updateFragementWithSelectedCorpus] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[corpora] operator[SEP] {
Keyword[if] operator[SEP] identifier[corpora] operator[!=] Other[null] operator[&&] operator[!] identifier[corpora] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[fragment] operator[=] literal[String] operator[+] identifier[Helper] operator[SEP] identifier[encodeBase64URL] operator[SEP] identifier[StringUtils] operator[SEP] identifier[join] operator[SEP] identifier[corpora] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[UI] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] identifier[getPage] operator[SEP] operator[SEP] operator[SEP] identifier[setUriFragment] operator[SEP] identifier[fragment] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[UI] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] identifier[getPage] operator[SEP] operator[SEP] operator[SEP] identifier[setUriFragment] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
protected void renderBundleLinks(ResourceBundlePathsIterator it, BundleRendererContext ctx, boolean debugOn,
Writer out) throws IOException {
String contextPath = ctx.getContextPath();
boolean useGzip = ctx.isUseGzip();
boolean isSslRequest = ctx.isSslRequest();
// Add resources to the page as links.
Random randomSeed = new Random();
while (it.hasNext()) {
BundlePath bundlePath = it.nextPath();
if (bundlePath != null) {
String resourceName = bundlePath.getPath();
if (resourceName != null) {
// Handle external URL
if (bundlePath.isExternalURL()) {
out.write(renderLink(resourceName));
} else if (debugOn && useRandomParam) {
// In debug mode, all the resources are included
// separately
// and
// use a random parameter to avoid caching.
// If useRandomParam is set to false, the links are
// created
// without the random parameter.
int random = randomSeed.nextInt();
if (random < 0) {
random *= -1;
}
out.write(createBundleLink(resourceName, bundlePath.getBundlePrefix(), "d=" + random,
contextPath, isSslRequest));
// } else if (!debugOn && bundlePath.isProductionURL())
// {
// out.write(renderLink(resourceName));
} else if (!debugOn && useGzip) {
out.write(createGzipBundleLink(resourceName, bundlePath.getBundlePrefix(), contextPath,
isSslRequest));
} else {
out.write(createBundleLink(resourceName, bundlePath.getBundlePrefix(), null, contextPath,
isSslRequest));
}
if (debugOn && !ctx.getIncludedResources().add(resourceName)) {
addComment("The resource '" + resourceName + "' is already included in the page.", out);
}
}
}
}
} | class class_name[name] begin[{]
method[renderBundleLinks, return_type[void], modifier[protected], parameter[it, ctx, debugOn, out]] begin[{]
local_variable[type[String], contextPath]
local_variable[type[boolean], useGzip]
local_variable[type[boolean], isSslRequest]
local_variable[type[Random], randomSeed]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[BundlePath], bundlePath]
if[binary_operation[member[.bundlePath], !=, literal[null]]] begin[{]
local_variable[type[String], resourceName]
if[binary_operation[member[.resourceName], !=, literal[null]]] begin[{]
if[call[bundlePath.isExternalURL, parameter[]]] begin[{]
call[out.write, parameter[call[.renderLink, parameter[member[.resourceName]]]]]
else begin[{]
if[binary_operation[member[.debugOn], &&, member[.useRandomParam]]] begin[{]
local_variable[type[int], random]
if[binary_operation[member[.random], <, literal[0]]] begin[{]
assign[member[.random], literal[1]]
else begin[{]
None
end[}]
call[out.write, parameter[call[.createBundleLink, parameter[member[.resourceName], call[bundlePath.getBundlePrefix, parameter[]], binary_operation[literal["d="], +, member[.random]], member[.contextPath], member[.isSslRequest]]]]]
else begin[{]
if[binary_operation[member[.debugOn], &&, member[.useGzip]]] begin[{]
call[out.write, parameter[call[.createGzipBundleLink, parameter[member[.resourceName], call[bundlePath.getBundlePrefix, parameter[]], member[.contextPath], member[.isSslRequest]]]]]
else begin[{]
call[out.write, parameter[call[.createBundleLink, parameter[member[.resourceName], call[bundlePath.getBundlePrefix, parameter[]], literal[null], member[.contextPath], member[.isSslRequest]]]]]
end[}]
end[}]
end[}]
if[binary_operation[member[.debugOn], &&, call[ctx.getIncludedResources, parameter[]]]] begin[{]
call[.addComment, parameter[binary_operation[binary_operation[literal["The resource '"], +, member[.resourceName]], +, literal["' is already included in the page."]], member[.out]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[renderBundleLinks] operator[SEP] identifier[ResourceBundlePathsIterator] identifier[it] , identifier[BundleRendererContext] identifier[ctx] , Keyword[boolean] identifier[debugOn] , identifier[Writer] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[contextPath] operator[=] identifier[ctx] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[useGzip] operator[=] identifier[ctx] operator[SEP] identifier[isUseGzip] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isSslRequest] operator[=] identifier[ctx] operator[SEP] identifier[isSslRequest] operator[SEP] operator[SEP] operator[SEP] identifier[Random] identifier[randomSeed] operator[=] Keyword[new] identifier[Random] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[BundlePath] identifier[bundlePath] operator[=] identifier[it] operator[SEP] identifier[nextPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bundlePath] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[resourceName] operator[=] identifier[bundlePath] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resourceName] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[bundlePath] operator[SEP] identifier[isExternalURL] operator[SEP] operator[SEP] operator[SEP] {
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[renderLink] operator[SEP] identifier[resourceName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[debugOn] operator[&&] identifier[useRandomParam] operator[SEP] {
Keyword[int] identifier[random] operator[=] identifier[randomSeed] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[random] operator[<] Other[0] operator[SEP] {
identifier[random] operator[*=] operator[-] Other[1] operator[SEP]
}
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[createBundleLink] operator[SEP] identifier[resourceName] , identifier[bundlePath] operator[SEP] identifier[getBundlePrefix] operator[SEP] operator[SEP] , literal[String] operator[+] identifier[random] , identifier[contextPath] , identifier[isSslRequest] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[debugOn] operator[&&] identifier[useGzip] operator[SEP] {
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[createGzipBundleLink] operator[SEP] identifier[resourceName] , identifier[bundlePath] operator[SEP] identifier[getBundlePrefix] operator[SEP] operator[SEP] , identifier[contextPath] , identifier[isSslRequest] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[createBundleLink] operator[SEP] identifier[resourceName] , identifier[bundlePath] operator[SEP] identifier[getBundlePrefix] operator[SEP] operator[SEP] , Other[null] , identifier[contextPath] , identifier[isSslRequest] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[debugOn] operator[&&] operator[!] identifier[ctx] operator[SEP] identifier[getIncludedResources] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[resourceName] operator[SEP] operator[SEP] {
identifier[addComment] operator[SEP] literal[String] operator[+] identifier[resourceName] operator[+] literal[String] , identifier[out] operator[SEP] operator[SEP]
}
}
}
}
}
|
public javax.sip.address.SipURI createRecordRouteURI(boolean usePublicAddress) {
try {
String host = getIpAddress(usePublicAddress);
SipURI sipUri = SipFactoryImpl.addressFactory.createSipURI(null, host);
sipUri.setPort(port);
sipUri.setTransportParam(transport);
// Do we want to add an ID here?
return sipUri;
} catch (ParseException ex) {
logger.error ("Unexpected error while creating a record route URI",ex);
throw new IllegalArgumentException("Unexpected exception when creating a record route URI", ex);
}
} | class class_name[name] begin[{]
method[createRecordRouteURI, return_type[type[javax]], modifier[public], parameter[usePublicAddress]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=usePublicAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIpAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=host)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createSipURI, postfix_operators=[], prefix_operators=[], qualifier=SipFactoryImpl.addressFactory, selectors=[], type_arguments=None), name=sipUri)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SipURI, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPort, postfix_operators=[], prefix_operators=[], qualifier=sipUri, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=transport, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTransportParam, postfix_operators=[], prefix_operators=[], qualifier=sipUri, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=sipUri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected error while creating a record route URI"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected exception when creating a record route URI"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['ParseException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[javax] operator[SEP] identifier[sip] operator[SEP] identifier[address] operator[SEP] identifier[SipURI] identifier[createRecordRouteURI] operator[SEP] Keyword[boolean] identifier[usePublicAddress] operator[SEP] {
Keyword[try] {
identifier[String] identifier[host] operator[=] identifier[getIpAddress] operator[SEP] identifier[usePublicAddress] operator[SEP] operator[SEP] identifier[SipURI] identifier[sipUri] operator[=] identifier[SipFactoryImpl] operator[SEP] identifier[addressFactory] operator[SEP] identifier[createSipURI] operator[SEP] Other[null] , identifier[host] operator[SEP] operator[SEP] identifier[sipUri] operator[SEP] identifier[setPort] operator[SEP] identifier[port] operator[SEP] operator[SEP] identifier[sipUri] operator[SEP] identifier[setTransportParam] operator[SEP] identifier[transport] operator[SEP] operator[SEP] Keyword[return] identifier[sipUri] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ParseException] identifier[ex] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
private void processRetryableTaskFailure(Throwable failure, ClassLoader loader, short consecutiveFailureCount, Config config, String taskName) {
taskName = taskName == null || taskName.length() == 0 || taskName.length() == 1 && taskName.charAt(0) == ' ' ? String.valueOf(taskId) // empty task name
: taskId + " (" + taskName + ")";
TaskStore taskStore = persistentExecutor.taskStore;
TransactionManager tranMgr = persistentExecutor.tranMgrRef.getServiceWithException();
boolean retry = false;
try {
Throwable failed = null;
// Auto purge if we reached the failure limit and auto purge is enabled
if (config.retryLimit >= 0
&& consecutiveFailureCount > config.retryLimit
&& (binaryFlags & TaskRecord.Flags.AUTO_PURGE_ALWAYS.bit) != 0) {
if (failure == null)
Tr.warning(tc, "CWWKC1510.retry.limit.reached.rollback", persistentExecutor.name, taskName, consecutiveFailureCount);
else
Tr.warning(tc, "CWWKC1511.retry.limit.reached.failed", persistentExecutor.name, taskName, consecutiveFailureCount, failure);
tranMgr.begin();
try {
taskStore.remove(taskId, null, false);
} catch (Throwable x) {
failed = x;
} finally {
if (failed == null)
tranMgr.commit();
else
tranMgr.rollback();
}
} else {
// Update database with new count
tranMgr.begin();
try {
if (config.retryLimit < 0 || consecutiveFailureCount <= config.retryLimit)
consecutiveFailureCount = taskStore.incrementFailureCount(taskId);
if (config.retryLimit >= 0 && consecutiveFailureCount > config.retryLimit) {
if (failure == null)
Tr.warning(tc, "CWWKC1510.retry.limit.reached.rollback", persistentExecutor.name, taskName, consecutiveFailureCount);
else
Tr.warning(tc, "CWWKC1511.retry.limit.reached.failed", persistentExecutor.name, taskName, consecutiveFailureCount, failure);
TaskFailure taskFailure = new TaskFailure(failure, failure == null ? null : loader, persistentExecutor, TaskFailure.FAILURE_LIMIT_REACHED, Short.toString(consecutiveFailureCount));
// Update database with the result and state if we reached the limit
TaskRecord updates = new TaskRecord(false);
updates.setConsecutiveFailureCount(consecutiveFailureCount);
updates.setResult(persistentExecutor.serialize(taskFailure));
updates.setState((short) (TaskState.ENDED.bit | TaskState.FAILURE_LIMIT_REACHED.bit));
TaskRecord expected = new TaskRecord(false);
expected.setId(taskId);
taskStore.persist(updates, expected);
} else {
// -1 indicates the task is no longer in the persistent store
retry = consecutiveFailureCount != -1;
if (retry) {
String seconds = consecutiveFailureCount == 1 || config.retryInterval == 0L ? "0" : NumberFormat.getInstance().format(config.retryInterval / 1000.0);
if (failure == null)
Tr.warning(tc, "CWWKC1500.task.rollback.retry", persistentExecutor.name, taskName, seconds);
else
Tr.warning(tc, "CWWKC1501.task.failure.retry", persistentExecutor.name, taskName, failure, seconds);
} else if (failure == null)
Tr.warning(tc, "CWWKC1502.task.rollback", persistentExecutor.name, taskName);
else
Tr.warning(tc, "CWWKC1503.task.failure", persistentExecutor.name, taskName, failure);
}
} catch (Throwable x) {
failed = x;
retry = true;
} finally {
if (failed == null)
tranMgr.commit();
else
tranMgr.rollback();
}
}
} catch (Throwable x) {
retry = true;
}
if (retry == true) {
// Always retry the first failure immediately
if (consecutiveFailureCount == 1 || config.retryInterval == 0L)
persistentExecutor.scheduledExecutor.submit(this);
else {
persistentExecutor.scheduledExecutor.schedule(this, config.retryInterval, TimeUnit.MILLISECONDS);
}
}
} | class class_name[name] begin[{]
method[processRetryableTaskFailure, return_type[void], modifier[private], parameter[failure, loader, consecutiveFailureCount, config, taskName]] begin[{]
assign[member[.taskName], TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=taskName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operator=||), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=taskName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=taskName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator===), operator=&&), operator=||), if_false=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=taskId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ("), operator=+), operandr=MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+), if_true=MethodInvocation(arguments=[MemberReference(member=taskId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None))]
local_variable[type[TaskStore], taskStore]
local_variable[type[TransactionManager], tranMgr]
local_variable[type[boolean], retry]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=failed)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=retryLimit, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=retryLimit, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operator=>), operator=&&), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=binaryFlags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bit, postfix_operators=[], prefix_operators=[], qualifier=TaskRecord.Flags.AUTO_PURGE_ALWAYS, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=begin, postfix_operators=[], prefix_operators=[], qualifier=tranMgr, selectors=[], type_arguments=None), label=None), TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=retryLimit, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=retryLimit, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operator=<=), operator=||), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=taskId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=incrementFailureCount, postfix_operators=[], prefix_operators=[], qualifier=taskStore, selectors=[], type_arguments=None)), label=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=retryLimit, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=retryLimit, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operator=>), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=retry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=)), label=None), IfStatement(condition=MemberReference(member=retry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWKC1503.task.failure"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=persistentExecutor, selectors=[]), MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWKC1502.task.rollback"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=persistentExecutor, selectors=[]), MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), operandr=BinaryOperation(operandl=MemberReference(member=retryInterval, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0L), operator===), operator=||), if_false=MethodInvocation(arguments=[], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=NumberFormat, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=retryInterval, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000.0), operator=/)], member=format, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="0")), name=seconds)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWKC1501.task.failure.retry"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=persistentExecutor, selectors=[]), MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seconds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWKC1500.task.rollback.retry"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=persistentExecutor, selectors=[]), MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seconds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None))]))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWKC1511.retry.limit.reached.failed"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=persistentExecutor, selectors=[]), MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWKC1510.retry.limit.reached.rollback"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=persistentExecutor, selectors=[]), MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=loader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), MemberReference(member=persistentExecutor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=FAILURE_LIMIT_REACHED, postfix_operators=[], prefix_operators=[], qualifier=TaskFailure, selectors=[]), MethodInvocation(arguments=[MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Short, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TaskFailure, sub_type=None)), name=taskFailure)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TaskFailure, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TaskRecord, sub_type=None)), name=updates)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TaskRecord, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setConsecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=updates, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=taskFailure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serialize, postfix_operators=[], prefix_operators=[], qualifier=persistentExecutor, selectors=[], type_arguments=None)], member=setResult, postfix_operators=[], prefix_operators=[], qualifier=updates, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=BinaryOperation(operandl=MemberReference(member=bit, postfix_operators=[], prefix_operators=[], qualifier=TaskState.ENDED, selectors=[]), operandr=MemberReference(member=bit, postfix_operators=[], prefix_operators=[], qualifier=TaskState.FAILURE_LIMIT_REACHED, selectors=[]), operator=|), type=BasicType(dimensions=[], name=short))], member=setState, postfix_operators=[], prefix_operators=[], qualifier=updates, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TaskRecord, sub_type=None)), name=expected)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TaskRecord, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=taskId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setId, postfix_operators=[], prefix_operators=[], qualifier=expected, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=updates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=expected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=persist, postfix_operators=[], prefix_operators=[], qualifier=taskStore, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=retry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['Throwable']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=rollback, postfix_operators=[], prefix_operators=[], qualifier=tranMgr, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=commit, postfix_operators=[], prefix_operators=[], qualifier=tranMgr, selectors=[], type_arguments=None), label=None))], label=None, resources=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWKC1511.retry.limit.reached.failed"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=persistentExecutor, selectors=[]), MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=failure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWKC1510.retry.limit.reached.rollback"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=persistentExecutor, selectors=[]), MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=consecutiveFailureCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=begin, postfix_operators=[], prefix_operators=[], qualifier=tranMgr, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=taskId, 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=false)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=taskStore, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['Throwable']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=rollback, postfix_operators=[], prefix_operators=[], qualifier=tranMgr, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=commit, postfix_operators=[], prefix_operators=[], qualifier=tranMgr, selectors=[], type_arguments=None), label=None))], label=None, resources=None)]))], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=retry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['Throwable']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.retry], ==, literal[true]]] begin[{]
if[binary_operation[binary_operation[member[.consecutiveFailureCount], ==, literal[1]], ||, binary_operation[member[config.retryInterval], ==, literal[0L]]]] begin[{]
call[persistentExecutor.scheduledExecutor.submit, parameter[THIS[]]]
else begin[{]
call[persistentExecutor.scheduledExecutor.schedule, parameter[THIS[], member[config.retryInterval], member[TimeUnit.MILLISECONDS]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[processRetryableTaskFailure] operator[SEP] identifier[Throwable] identifier[failure] , identifier[ClassLoader] identifier[loader] , Keyword[short] identifier[consecutiveFailureCount] , identifier[Config] identifier[config] , identifier[String] identifier[taskName] operator[SEP] {
identifier[taskName] operator[=] identifier[taskName] operator[==] Other[null] operator[||] identifier[taskName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[||] identifier[taskName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[1] operator[&&] identifier[taskName] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[==] literal[String] operator[?] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[taskId] operator[SEP] operator[:] identifier[taskId] operator[+] literal[String] operator[+] identifier[taskName] operator[+] literal[String] operator[SEP] identifier[TaskStore] identifier[taskStore] operator[=] identifier[persistentExecutor] operator[SEP] identifier[taskStore] operator[SEP] identifier[TransactionManager] identifier[tranMgr] operator[=] identifier[persistentExecutor] operator[SEP] identifier[tranMgrRef] operator[SEP] identifier[getServiceWithException] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[retry] operator[=] literal[boolean] operator[SEP] Keyword[try] {
identifier[Throwable] identifier[failed] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[retryLimit] operator[>=] Other[0] operator[&&] identifier[consecutiveFailureCount] operator[>] identifier[config] operator[SEP] identifier[retryLimit] operator[&&] operator[SEP] identifier[binaryFlags] operator[&] identifier[TaskRecord] operator[SEP] identifier[Flags] operator[SEP] identifier[AUTO_PURGE_ALWAYS] operator[SEP] identifier[bit] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[failure] operator[==] Other[null] operator[SEP] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , identifier[persistentExecutor] operator[SEP] identifier[name] , identifier[taskName] , identifier[consecutiveFailureCount] operator[SEP] operator[SEP] Keyword[else] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , identifier[persistentExecutor] operator[SEP] identifier[name] , identifier[taskName] , identifier[consecutiveFailureCount] , identifier[failure] operator[SEP] operator[SEP] identifier[tranMgr] operator[SEP] identifier[begin] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[taskStore] operator[SEP] identifier[remove] operator[SEP] identifier[taskId] , Other[null] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[x] operator[SEP] {
identifier[failed] operator[=] identifier[x] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[failed] operator[==] Other[null] operator[SEP] identifier[tranMgr] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[tranMgr] operator[SEP] identifier[rollback] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[tranMgr] operator[SEP] identifier[begin] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[retryLimit] operator[<] Other[0] operator[||] identifier[consecutiveFailureCount] operator[<=] identifier[config] operator[SEP] identifier[retryLimit] operator[SEP] identifier[consecutiveFailureCount] operator[=] identifier[taskStore] operator[SEP] identifier[incrementFailureCount] operator[SEP] identifier[taskId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[retryLimit] operator[>=] Other[0] operator[&&] identifier[consecutiveFailureCount] operator[>] identifier[config] operator[SEP] identifier[retryLimit] operator[SEP] {
Keyword[if] operator[SEP] identifier[failure] operator[==] Other[null] operator[SEP] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , identifier[persistentExecutor] operator[SEP] identifier[name] , identifier[taskName] , identifier[consecutiveFailureCount] operator[SEP] operator[SEP] Keyword[else] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , identifier[persistentExecutor] operator[SEP] identifier[name] , identifier[taskName] , identifier[consecutiveFailureCount] , identifier[failure] operator[SEP] operator[SEP] identifier[TaskFailure] identifier[taskFailure] operator[=] Keyword[new] identifier[TaskFailure] operator[SEP] identifier[failure] , identifier[failure] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[loader] , identifier[persistentExecutor] , identifier[TaskFailure] operator[SEP] identifier[FAILURE_LIMIT_REACHED] , identifier[Short] operator[SEP] identifier[toString] operator[SEP] identifier[consecutiveFailureCount] operator[SEP] operator[SEP] operator[SEP] identifier[TaskRecord] identifier[updates] operator[=] Keyword[new] identifier[TaskRecord] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[updates] operator[SEP] identifier[setConsecutiveFailureCount] operator[SEP] identifier[consecutiveFailureCount] operator[SEP] operator[SEP] identifier[updates] operator[SEP] identifier[setResult] operator[SEP] identifier[persistentExecutor] operator[SEP] identifier[serialize] operator[SEP] identifier[taskFailure] operator[SEP] operator[SEP] operator[SEP] identifier[updates] operator[SEP] identifier[setState] operator[SEP] operator[SEP] Keyword[short] operator[SEP] operator[SEP] identifier[TaskState] operator[SEP] identifier[ENDED] operator[SEP] identifier[bit] operator[|] identifier[TaskState] operator[SEP] identifier[FAILURE_LIMIT_REACHED] operator[SEP] identifier[bit] operator[SEP] operator[SEP] operator[SEP] identifier[TaskRecord] identifier[expected] operator[=] Keyword[new] identifier[TaskRecord] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[expected] operator[SEP] identifier[setId] operator[SEP] identifier[taskId] operator[SEP] operator[SEP] identifier[taskStore] operator[SEP] identifier[persist] operator[SEP] identifier[updates] , identifier[expected] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[retry] operator[=] identifier[consecutiveFailureCount] operator[!=] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[retry] operator[SEP] {
identifier[String] identifier[seconds] operator[=] identifier[consecutiveFailureCount] operator[==] Other[1] operator[||] identifier[config] operator[SEP] identifier[retryInterval] operator[==] Other[0L] operator[?] literal[String] operator[:] identifier[NumberFormat] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[format] operator[SEP] identifier[config] operator[SEP] identifier[retryInterval] operator[/] literal[Float] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[failure] operator[==] Other[null] operator[SEP] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , identifier[persistentExecutor] operator[SEP] identifier[name] , identifier[taskName] , identifier[seconds] operator[SEP] operator[SEP] Keyword[else] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , identifier[persistentExecutor] operator[SEP] identifier[name] , identifier[taskName] , identifier[failure] , identifier[seconds] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[failure] operator[==] Other[null] operator[SEP] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , identifier[persistentExecutor] operator[SEP] identifier[name] , identifier[taskName] operator[SEP] operator[SEP] Keyword[else] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , identifier[persistentExecutor] operator[SEP] identifier[name] , identifier[taskName] , identifier[failure] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[x] operator[SEP] {
identifier[failed] operator[=] identifier[x] operator[SEP] identifier[retry] operator[=] literal[boolean] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[failed] operator[==] Other[null] operator[SEP] identifier[tranMgr] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[tranMgr] operator[SEP] identifier[rollback] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[x] operator[SEP] {
identifier[retry] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[retry] operator[==] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] identifier[consecutiveFailureCount] operator[==] Other[1] operator[||] identifier[config] operator[SEP] identifier[retryInterval] operator[==] Other[0L] operator[SEP] identifier[persistentExecutor] operator[SEP] identifier[scheduledExecutor] operator[SEP] identifier[submit] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[else] {
identifier[persistentExecutor] operator[SEP] identifier[scheduledExecutor] operator[SEP] identifier[schedule] operator[SEP] Keyword[this] , identifier[config] operator[SEP] identifier[retryInterval] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
}
}
|
public void register(EventDefinition eventDefinition, IEventListener listener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
register(listenersPost, eventDefinition, listener, true);
} else {
register(listeners, eventDefinition, listener, false);
}
} | class class_name[name] begin[{]
method[register, return_type[void], modifier[public], parameter[eventDefinition, listener]] begin[{]
if[binary_operation[call[eventDefinition.getType, parameter[]], ==, member[EventDefinition.TYPE_POST]]] begin[{]
call[.register, parameter[member[.listenersPost], member[.eventDefinition], member[.listener], literal[true]]]
else begin[{]
call[.register, parameter[member[.listeners], member[.eventDefinition], member[.listener], literal[false]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[register] operator[SEP] identifier[EventDefinition] identifier[eventDefinition] , identifier[IEventListener] identifier[listener] operator[SEP] {
Keyword[if] operator[SEP] identifier[eventDefinition] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[EventDefinition] operator[SEP] identifier[TYPE_POST] operator[SEP] {
identifier[register] operator[SEP] identifier[listenersPost] , identifier[eventDefinition] , identifier[listener] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[register] operator[SEP] identifier[listeners] , identifier[eventDefinition] , identifier[listener] , literal[boolean] operator[SEP] operator[SEP]
}
}
|
@BetaApi
public final ListImagesPagedResponse listImages(String project) {
ListImagesHttpRequest request = ListImagesHttpRequest.newBuilder().setProject(project).build();
return listImages(request);
} | class class_name[name] begin[{]
method[listImages, return_type[type[ListImagesPagedResponse]], modifier[final public], parameter[project]] begin[{]
local_variable[type[ListImagesHttpRequest], request]
return[call[.listImages, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[BetaApi] Keyword[public] Keyword[final] identifier[ListImagesPagedResponse] identifier[listImages] operator[SEP] identifier[String] identifier[project] operator[SEP] {
identifier[ListImagesHttpRequest] identifier[request] operator[=] identifier[ListImagesHttpRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setProject] operator[SEP] identifier[project] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[listImages] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static void blurBitmap(
final Bitmap dest, final Bitmap src, final Context context, final int radius) {
Preconditions.checkNotNull(dest);
Preconditions.checkNotNull(src);
Preconditions.checkNotNull(context);
Preconditions.checkArgument(radius > 0 && radius <= BLUR_MAX_RADIUS);
RenderScript rs = null;
try {
rs = RenderScript.create(context);
// Create an Intrinsic Blur Script using the Renderscript
ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
// Create the input/output allocations with Renderscript and the src/dest bitmaps
Allocation allIn = Allocation.createFromBitmap(rs, src);
Allocation allOut = Allocation.createFromBitmap(rs, dest);
// Set the radius of the blur
blurScript.setRadius(radius);
blurScript.setInput(allIn);
blurScript.forEach(allOut);
allOut.copyTo(dest);
} finally {
if (rs != null) {
rs.destroy();
}
}
} | class class_name[name] begin[{]
method[blurBitmap, return_type[void], modifier[public static], parameter[dest, src, context, radius]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.dest]]]
call[Preconditions.checkNotNull, parameter[member[.src]]]
call[Preconditions.checkNotNull, parameter[member[.context]]]
call[Preconditions.checkArgument, parameter[binary_operation[binary_operation[member[.radius], >, literal[0]], &&, binary_operation[member[.radius], <=, member[.BLUR_MAX_RADIUS]]]]]
local_variable[type[RenderScript], rs]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=create, postfix_operators=[], prefix_operators=[], qualifier=RenderScript, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=U8_4, postfix_operators=[], prefix_operators=[], qualifier=Element, selectors=[], type_arguments=None)], member=create, postfix_operators=[], prefix_operators=[], qualifier=ScriptIntrinsicBlur, selectors=[], type_arguments=None), name=blurScript)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ScriptIntrinsicBlur, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=src, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createFromBitmap, postfix_operators=[], prefix_operators=[], qualifier=Allocation, selectors=[], type_arguments=None), name=allIn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Allocation, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createFromBitmap, postfix_operators=[], prefix_operators=[], qualifier=Allocation, selectors=[], type_arguments=None), name=allOut)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Allocation, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=radius, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRadius, postfix_operators=[], prefix_operators=[], qualifier=blurScript, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=allIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setInput, postfix_operators=[], prefix_operators=[], qualifier=blurScript, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=allOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forEach, postfix_operators=[], prefix_operators=[], qualifier=blurScript, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copyTo, postfix_operators=[], prefix_operators=[], qualifier=allOut, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=destroy, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[RequiresApi] operator[SEP] identifier[Build] operator[SEP] identifier[VERSION_CODES] operator[SEP] identifier[JELLY_BEAN_MR1] operator[SEP] Keyword[public] Keyword[static] Keyword[void] identifier[blurBitmap] operator[SEP] Keyword[final] identifier[Bitmap] identifier[dest] , Keyword[final] identifier[Bitmap] identifier[src] , Keyword[final] identifier[Context] identifier[context] , Keyword[final] Keyword[int] identifier[radius] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[dest] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[src] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[radius] operator[>] Other[0] operator[&&] identifier[radius] operator[<=] identifier[BLUR_MAX_RADIUS] operator[SEP] operator[SEP] identifier[RenderScript] identifier[rs] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[rs] operator[=] identifier[RenderScript] operator[SEP] identifier[create] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[ScriptIntrinsicBlur] identifier[blurScript] operator[=] identifier[ScriptIntrinsicBlur] operator[SEP] identifier[create] operator[SEP] identifier[rs] , identifier[Element] operator[SEP] identifier[U8_4] operator[SEP] identifier[rs] operator[SEP] operator[SEP] operator[SEP] identifier[Allocation] identifier[allIn] operator[=] identifier[Allocation] operator[SEP] identifier[createFromBitmap] operator[SEP] identifier[rs] , identifier[src] operator[SEP] operator[SEP] identifier[Allocation] identifier[allOut] operator[=] identifier[Allocation] operator[SEP] identifier[createFromBitmap] operator[SEP] identifier[rs] , identifier[dest] operator[SEP] operator[SEP] identifier[blurScript] operator[SEP] identifier[setRadius] operator[SEP] identifier[radius] operator[SEP] operator[SEP] identifier[blurScript] operator[SEP] identifier[setInput] operator[SEP] identifier[allIn] operator[SEP] operator[SEP] identifier[blurScript] operator[SEP] identifier[forEach] operator[SEP] identifier[allOut] operator[SEP] operator[SEP] identifier[allOut] operator[SEP] identifier[copyTo] operator[SEP] identifier[dest] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[rs] operator[!=] Other[null] operator[SEP] {
identifier[rs] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public void setAmbientLight(float r, float g, float b, Vector3D v) {
float ambient[] = { r, g, b, 255 };
float position[] = { (float)v.getX(), (float)v.getY(), (float)v.getZ(), 1.0f };
normalize(ambient);
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0);
gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, position, 0);
gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, ambient, 0);
} | class class_name[name] begin[{]
method[setAmbientLight, return_type[void], modifier[public], parameter[r, g, b, v]] begin[{]
local_variable[type[float], ambient]
local_variable[type[float], position]
call[.normalize, parameter[member[.ambient]]]
call[gl.glEnable, parameter[member[GL2.GL_LIGHTING]]]
call[gl.glEnable, parameter[member[GL2.GL_LIGHT0]]]
call[gl.glLightfv, parameter[member[GL2.GL_LIGHT0], member[GL2.GL_POSITION], member[.position], literal[0]]]
call[gl.glLightfv, parameter[member[GL2.GL_LIGHT0], member[GL2.GL_AMBIENT], member[.ambient], literal[0]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setAmbientLight] operator[SEP] Keyword[float] identifier[r] , Keyword[float] identifier[g] , Keyword[float] identifier[b] , identifier[Vector3D] identifier[v] operator[SEP] {
Keyword[float] identifier[ambient] operator[SEP] operator[SEP] operator[=] {
identifier[r] , identifier[g] , identifier[b] , Other[255]
} operator[SEP] Keyword[float] identifier[position] operator[SEP] operator[SEP] operator[=] {
operator[SEP] Keyword[float] operator[SEP] identifier[v] operator[SEP] identifier[getX] operator[SEP] operator[SEP] , operator[SEP] Keyword[float] operator[SEP] identifier[v] operator[SEP] identifier[getY] operator[SEP] operator[SEP] , operator[SEP] Keyword[float] operator[SEP] identifier[v] operator[SEP] identifier[getZ] operator[SEP] operator[SEP] , literal[Float]
} operator[SEP] identifier[normalize] operator[SEP] identifier[ambient] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glEnable] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_LIGHTING] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glEnable] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_LIGHT0] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glLightfv] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_LIGHT0] , identifier[GL2] operator[SEP] identifier[GL_POSITION] , identifier[position] , Other[0] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glLightfv] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_LIGHT0] , identifier[GL2] operator[SEP] identifier[GL_AMBIENT] , identifier[ambient] , Other[0] operator[SEP] operator[SEP]
}
|
synchronized long dumpState(OutputStream snapshotOutputStream) throws IOException {
try {
ObjectMapper mapper = new ObjectMapper();
// by default Jackson 'takes ownership' of a closeable passed
// to it and _closes_ it after writing a value. this is probably
// OK if we're writing a set of JSON nodes contained in a
// single root object. however, since we're writing a set of
// objects without a root object we have to disable this
// behavior so that all values are written to the underlying stream
mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
for (Map.Entry<String, String> entry : entries.entrySet()) {
mapper.writeValue(snapshotOutputStream, new KeyValue(entry.getKey(), entry.getValue()));
}
return lastAppliedIndex;
} finally {
Closeables.close(snapshotOutputStream, true);
}
} | class class_name[name] begin[{]
method[dumpState, return_type[type[long]], modifier[synchronized], parameter[snapshotOutputStream]] begin[{]
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=ObjectMapper, sub_type=None)), name=mapper)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ObjectMapper, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=AUTO_CLOSE_TARGET, postfix_operators=[], prefix_operators=[], qualifier=JsonGenerator.Feature, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=configure, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=snapshotOutputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=KeyValue, sub_type=None))], member=writeValue, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=entries, 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=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None), ReturnStatement(expression=MemberReference(member=lastAppliedIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=snapshotOutputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=close, postfix_operators=[], prefix_operators=[], qualifier=Closeables, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[synchronized] Keyword[long] identifier[dumpState] operator[SEP] identifier[OutputStream] identifier[snapshotOutputStream] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] {
identifier[ObjectMapper] identifier[mapper] operator[=] Keyword[new] identifier[ObjectMapper] operator[SEP] operator[SEP] operator[SEP] identifier[mapper] operator[SEP] identifier[configure] operator[SEP] identifier[JsonGenerator] operator[SEP] identifier[Feature] operator[SEP] identifier[AUTO_CLOSE_TARGET] , literal[boolean] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[>] identifier[entry] operator[:] identifier[entries] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[mapper] operator[SEP] identifier[writeValue] operator[SEP] identifier[snapshotOutputStream] , Keyword[new] identifier[KeyValue] 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[lastAppliedIndex] operator[SEP]
}
Keyword[finally] {
identifier[Closeables] operator[SEP] identifier[close] operator[SEP] identifier[snapshotOutputStream] , literal[boolean] operator[SEP] operator[SEP]
}
}
|
private void sendJGroupsMessage(UpdateOpteration operation, String path,
String auth) throws Exception {
if(!this.isAuth(auth)) {
throw new Exception("Unauthorized!");
}
log.trace("Sending jGroups message with operation {} and path {}", operation, path);
ApiEndpointAccessRequest messageBody = new ApiEndpointAccessRequest();
messageBody.setEndpoint(path);
messageBody.setOperation(operation);
Message<ApiEndpointAccessRequest> msg = new Message<ApiEndpointAccessRequest>(ProtocolMessage.API_ENDPOINT_ACCESS, messageBody);
log.trace("Sending jgroups message: "+msg);
sender.sendMessage(msg, null);
} | class class_name[name] begin[{]
method[sendJGroupsMessage, return_type[void], modifier[private], parameter[operation, path, auth]] begin[{]
if[THIS[call[None.isAuth, parameter[member[.auth]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unauthorized!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[log.trace, parameter[literal["Sending jGroups message with operation {} and path {}"], member[.operation], member[.path]]]
local_variable[type[ApiEndpointAccessRequest], messageBody]
call[messageBody.setEndpoint, parameter[member[.path]]]
call[messageBody.setOperation, parameter[member[.operation]]]
local_variable[type[Message], msg]
call[log.trace, parameter[binary_operation[literal["Sending jgroups message: "], +, member[.msg]]]]
call[sender.sendMessage, parameter[member[.msg], literal[null]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[sendJGroupsMessage] operator[SEP] identifier[UpdateOpteration] identifier[operation] , identifier[String] identifier[path] , identifier[String] identifier[auth] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[isAuth] operator[SEP] identifier[auth] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[operation] , identifier[path] operator[SEP] operator[SEP] identifier[ApiEndpointAccessRequest] identifier[messageBody] operator[=] Keyword[new] identifier[ApiEndpointAccessRequest] operator[SEP] operator[SEP] operator[SEP] identifier[messageBody] operator[SEP] identifier[setEndpoint] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[messageBody] operator[SEP] identifier[setOperation] operator[SEP] identifier[operation] operator[SEP] operator[SEP] identifier[Message] operator[<] identifier[ApiEndpointAccessRequest] operator[>] identifier[msg] operator[=] Keyword[new] identifier[Message] operator[<] identifier[ApiEndpointAccessRequest] operator[>] operator[SEP] identifier[ProtocolMessage] operator[SEP] identifier[API_ENDPOINT_ACCESS] , identifier[messageBody] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] identifier[msg] operator[SEP] operator[SEP] identifier[sender] operator[SEP] identifier[sendMessage] operator[SEP] identifier[msg] , Other[null] operator[SEP] operator[SEP]
}
|
public JmxServerBuilder environmentProperties(Properties environmentProperties) {
HashMap<String, Object> properties = new HashMap<>(environmentProperties.size());
for (Map.Entry<Object, Object> entry : environmentProperties.entrySet()) {
properties.put(entry.getKey().toString(), entry.getValue());
}
endpoint.getEndpointConfiguration().setEnvironmentProperties(properties);
return this;
} | class class_name[name] begin[{]
method[environmentProperties, return_type[type[JmxServerBuilder]], modifier[public], parameter[environmentProperties]] begin[{]
local_variable[type[HashMap], properties]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=environmentProperties, 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=Object, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
call[endpoint.getEndpointConfiguration, parameter[]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[JmxServerBuilder] identifier[environmentProperties] operator[SEP] identifier[Properties] identifier[environmentProperties] operator[SEP] {
identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] identifier[environmentProperties] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[Object] , identifier[Object] operator[>] identifier[entry] operator[:] identifier[environmentProperties] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[properties] operator[SEP] identifier[put] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[endpoint] operator[SEP] identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[setEnvironmentProperties] operator[SEP] identifier[properties] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public String buildAuthorizationHeaderValue(HttpRequest request, byte[] body, OAuth1Credentials oauth1Credentials) {
Map<String, String> oauthParameters = commonOAuthParameters(oauth1Credentials.getConsumerKey());
oauthParameters.put("oauth_token", oauth1Credentials.getAccessToken());
MultiValueMap<String, String> additionalParameters = union(readFormParameters(request.getHeaders().getContentType(), body), parseFormParameters(request.getURI().getRawQuery()));
return buildAuthorizationHeaderValue(request.getMethod(), request.getURI(), oauthParameters, additionalParameters, oauth1Credentials.getConsumerSecret(), oauth1Credentials.getAccessTokenSecret());
} | class class_name[name] begin[{]
method[buildAuthorizationHeaderValue, return_type[type[String]], modifier[public], parameter[request, body, oauth1Credentials]] begin[{]
local_variable[type[Map], oauthParameters]
call[oauthParameters.put, parameter[literal["oauth_token"], call[oauth1Credentials.getAccessToken, parameter[]]]]
local_variable[type[MultiValueMap], additionalParameters]
return[call[.buildAuthorizationHeaderValue, parameter[call[request.getMethod, parameter[]], call[request.getURI, parameter[]], member[.oauthParameters], member[.additionalParameters], call[oauth1Credentials.getConsumerSecret, parameter[]], call[oauth1Credentials.getAccessTokenSecret, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[buildAuthorizationHeaderValue] operator[SEP] identifier[HttpRequest] identifier[request] , Keyword[byte] operator[SEP] operator[SEP] identifier[body] , identifier[OAuth1Credentials] identifier[oauth1Credentials] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[oauthParameters] operator[=] identifier[commonOAuthParameters] operator[SEP] identifier[oauth1Credentials] operator[SEP] identifier[getConsumerKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[oauthParameters] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[oauth1Credentials] operator[SEP] identifier[getAccessToken] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[MultiValueMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[additionalParameters] operator[=] identifier[union] operator[SEP] identifier[readFormParameters] operator[SEP] identifier[request] operator[SEP] identifier[getHeaders] operator[SEP] operator[SEP] operator[SEP] identifier[getContentType] operator[SEP] operator[SEP] , identifier[body] operator[SEP] , identifier[parseFormParameters] operator[SEP] identifier[request] operator[SEP] identifier[getURI] operator[SEP] operator[SEP] operator[SEP] identifier[getRawQuery] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[buildAuthorizationHeaderValue] operator[SEP] identifier[request] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] , identifier[request] operator[SEP] identifier[getURI] operator[SEP] operator[SEP] , identifier[oauthParameters] , identifier[additionalParameters] , identifier[oauth1Credentials] operator[SEP] identifier[getConsumerSecret] operator[SEP] operator[SEP] , identifier[oauth1Credentials] operator[SEP] identifier[getAccessTokenSecret] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void initialize(
Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
String id,
CacheKey cacheKey,
Object callerContext,
@Nullable ImmutableList<DrawableFactory> customDrawableFactories,
@Nullable ImageOriginListener imageOriginListener) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("PipelineDraweeController#initialize");
}
super.initialize(id, callerContext);
init(dataSourceSupplier);
mCacheKey = cacheKey;
setCustomDrawableFactories(customDrawableFactories);
clearImageOriginListeners();
maybeUpdateDebugOverlay(null);
addImageOriginListener(imageOriginListener);
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
} | class class_name[name] begin[{]
method[initialize, return_type[void], modifier[public], parameter[dataSourceSupplier, id, cacheKey, callerContext, customDrawableFactories, imageOriginListener]] begin[{]
if[call[FrescoSystrace.isTracing, parameter[]]] begin[{]
call[FrescoSystrace.beginSection, parameter[literal["PipelineDraweeController#initialize"]]]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=callerContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initialize, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[.init, parameter[member[.dataSourceSupplier]]]
assign[member[.mCacheKey], member[.cacheKey]]
call[.setCustomDrawableFactories, parameter[member[.customDrawableFactories]]]
call[.clearImageOriginListeners, parameter[]]
call[.maybeUpdateDebugOverlay, parameter[literal[null]]]
call[.addImageOriginListener, parameter[member[.imageOriginListener]]]
if[call[FrescoSystrace.isTracing, parameter[]]] begin[{]
call[FrescoSystrace.endSection, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[initialize] operator[SEP] identifier[Supplier] operator[<] identifier[DataSource] operator[<] identifier[CloseableReference] operator[<] identifier[CloseableImage] operator[>] operator[>] operator[>] identifier[dataSourceSupplier] , identifier[String] identifier[id] , identifier[CacheKey] identifier[cacheKey] , identifier[Object] identifier[callerContext] , annotation[@] identifier[Nullable] identifier[ImmutableList] operator[<] identifier[DrawableFactory] operator[>] identifier[customDrawableFactories] , annotation[@] identifier[Nullable] identifier[ImageOriginListener] identifier[imageOriginListener] operator[SEP] {
Keyword[if] operator[SEP] identifier[FrescoSystrace] operator[SEP] identifier[isTracing] operator[SEP] operator[SEP] operator[SEP] {
identifier[FrescoSystrace] operator[SEP] identifier[beginSection] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[initialize] operator[SEP] identifier[id] , identifier[callerContext] operator[SEP] operator[SEP] identifier[init] operator[SEP] identifier[dataSourceSupplier] operator[SEP] operator[SEP] identifier[mCacheKey] operator[=] identifier[cacheKey] operator[SEP] identifier[setCustomDrawableFactories] operator[SEP] identifier[customDrawableFactories] operator[SEP] operator[SEP] identifier[clearImageOriginListeners] operator[SEP] operator[SEP] operator[SEP] identifier[maybeUpdateDebugOverlay] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[addImageOriginListener] operator[SEP] identifier[imageOriginListener] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[FrescoSystrace] operator[SEP] identifier[isTracing] operator[SEP] operator[SEP] operator[SEP] {
identifier[FrescoSystrace] operator[SEP] identifier[endSection] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void init() {
registerBeanDefinitionParser("application", new SpringApplicationBeanDefinitionParser());
registerBeanDefinitionParser("page", new SpringPageFactoryBeanDefinitionParser());
registerBeanDefinitionParser("classResolver", new SpringClassResolverDefinitionParser());
registerBeanDefinitionParser("injectionProvider", new SpringInjectionResolverDefinitionParser());
registerBeanDefinitionParser("filter", new SpringFilterFactoryBeanDefinitionParser());
registerBeanDefinitionParser("autoPageMounter", new SpringAutoPageMounterDefinitionParser());
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[]] begin[{]
call[.registerBeanDefinitionParser, parameter[literal["application"], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SpringApplicationBeanDefinitionParser, sub_type=None))]]
call[.registerBeanDefinitionParser, parameter[literal["page"], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SpringPageFactoryBeanDefinitionParser, sub_type=None))]]
call[.registerBeanDefinitionParser, parameter[literal["classResolver"], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SpringClassResolverDefinitionParser, sub_type=None))]]
call[.registerBeanDefinitionParser, parameter[literal["injectionProvider"], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SpringInjectionResolverDefinitionParser, sub_type=None))]]
call[.registerBeanDefinitionParser, parameter[literal["filter"], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SpringFilterFactoryBeanDefinitionParser, sub_type=None))]]
call[.registerBeanDefinitionParser, parameter[literal["autoPageMounter"], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SpringAutoPageMounterDefinitionParser, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[init] operator[SEP] operator[SEP] {
identifier[registerBeanDefinitionParser] operator[SEP] literal[String] , Keyword[new] identifier[SpringApplicationBeanDefinitionParser] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerBeanDefinitionParser] operator[SEP] literal[String] , Keyword[new] identifier[SpringPageFactoryBeanDefinitionParser] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerBeanDefinitionParser] operator[SEP] literal[String] , Keyword[new] identifier[SpringClassResolverDefinitionParser] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerBeanDefinitionParser] operator[SEP] literal[String] , Keyword[new] identifier[SpringInjectionResolverDefinitionParser] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerBeanDefinitionParser] operator[SEP] literal[String] , Keyword[new] identifier[SpringFilterFactoryBeanDefinitionParser] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerBeanDefinitionParser] operator[SEP] literal[String] , Keyword[new] identifier[SpringAutoPageMounterDefinitionParser] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Bills getBillsByCategoryYearState(String categoryId, String year) throws VoteSmartException, VoteSmartErrorException {
return api.query("Votes.getBillsByCategoryYearState", new ArgMap("categoryId", categoryId, "year", year), Bills.class );
} | class class_name[name] begin[{]
method[getBillsByCategoryYearState, return_type[type[Bills]], modifier[public], parameter[categoryId, year]] begin[{]
return[call[api.query, parameter[literal["Votes.getBillsByCategoryYearState"], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="categoryId"), MemberReference(member=categoryId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="year"), MemberReference(member=year, 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=ArgMap, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Bills, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[Bills] identifier[getBillsByCategoryYearState] operator[SEP] identifier[String] identifier[categoryId] , identifier[String] identifier[year] operator[SEP] Keyword[throws] identifier[VoteSmartException] , identifier[VoteSmartErrorException] {
Keyword[return] identifier[api] operator[SEP] identifier[query] operator[SEP] literal[String] , Keyword[new] identifier[ArgMap] operator[SEP] literal[String] , identifier[categoryId] , literal[String] , identifier[year] operator[SEP] , identifier[Bills] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "valueOfParameter")
public JAXBElement<OperationParameterRefType> createValueOfParameter(OperationParameterRefType value) {
return new JAXBElement<OperationParameterRefType>(_ValueOfParameter_QNAME, OperationParameterRefType.class, null, value);
} | class class_name[name] begin[{]
method[createValueOfParameter, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_ValueOfParameter_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OperationParameterRefType, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=OperationParameterRefType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[OperationParameterRefType] operator[>] identifier[createValueOfParameter] operator[SEP] identifier[OperationParameterRefType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[OperationParameterRefType] operator[>] operator[SEP] identifier[_ValueOfParameter_QNAME] , identifier[OperationParameterRefType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
public Element attribute(String attribute, long value)
{
if (attributeMap==null)
attributeMap=new Hashtable(10);
attributeMap.put(attribute,Long.toString(value));
return this;
} | class class_name[name] begin[{]
method[attribute, return_type[type[Element]], modifier[public], parameter[attribute, value]] begin[{]
if[binary_operation[member[.attributeMap], ==, literal[null]]] begin[{]
assign[member[.attributeMap], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Hashtable, sub_type=None))]
else begin[{]
None
end[}]
call[attributeMap.put, parameter[member[.attribute], call[Long.toString, parameter[member[.value]]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Element] identifier[attribute] operator[SEP] identifier[String] identifier[attribute] , Keyword[long] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[attributeMap] operator[==] Other[null] operator[SEP] identifier[attributeMap] operator[=] Keyword[new] identifier[Hashtable] operator[SEP] Other[10] operator[SEP] operator[SEP] identifier[attributeMap] operator[SEP] identifier[put] operator[SEP] identifier[attribute] , identifier[Long] operator[SEP] identifier[toString] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private boolean checkMerchant(PurchaseDataModel details) {
if (developerMerchantId == null) //omit merchant id checking
return true;
if (details.getPurchaseTime().before(dateMerchantLimit1)) //new format [merchantId].[orderId] applied or not?
return true;
if (details.getPurchaseTime().after(dateMerchantLimit2)) //newest format applied
return true;
if (details.getOrderId() == null || details.getOrderId() .trim().length() == 0)
return false;
int index = details.getOrderId() .indexOf('.');
if (index <= 0)
return false; //protect on missing merchant id
//extract merchant id
String merchantId = details.getOrderId().substring(0, index);
return merchantId.compareTo(developerMerchantId) == 0;
} | class class_name[name] begin[{]
method[checkMerchant, return_type[type[boolean]], modifier[private], parameter[details]] begin[{]
if[binary_operation[member[.developerMerchantId], ==, literal[null]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[call[details.getPurchaseTime, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[call[details.getPurchaseTime, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[details.getOrderId, parameter[]], ==, literal[null]], ||, binary_operation[call[details.getOrderId, parameter[]], ==, literal[0]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[int], index]
if[binary_operation[member[.index], <=, literal[0]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[String], merchantId]
return[binary_operation[call[merchantId.compareTo, parameter[member[.developerMerchantId]]], ==, literal[0]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[checkMerchant] operator[SEP] identifier[PurchaseDataModel] identifier[details] operator[SEP] {
Keyword[if] operator[SEP] identifier[developerMerchantId] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[details] operator[SEP] identifier[getPurchaseTime] operator[SEP] operator[SEP] operator[SEP] identifier[before] operator[SEP] identifier[dateMerchantLimit1] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[details] operator[SEP] identifier[getPurchaseTime] operator[SEP] operator[SEP] operator[SEP] identifier[after] operator[SEP] identifier[dateMerchantLimit2] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[details] operator[SEP] identifier[getOrderId] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[details] operator[SEP] identifier[getOrderId] operator[SEP] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[details] operator[SEP] identifier[getOrderId] operator[SEP] operator[SEP] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[<=] Other[0] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[String] identifier[merchantId] operator[=] identifier[details] operator[SEP] identifier[getOrderId] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[index] operator[SEP] operator[SEP] Keyword[return] identifier[merchantId] operator[SEP] identifier[compareTo] operator[SEP] identifier[developerMerchantId] operator[SEP] operator[==] Other[0] operator[SEP]
}
|
@Override
public void release() {
super.release();
setBase64Expr(null);
setAlignExpr(null);
setAltExpr(null);
setBorderExpr(null);
setDirExpr(null);
setDisabledExpr(null);
setLangExpr(null);
setOnblurExpr(null);
setOnchangeExpr(null);
setOnclickExpr(null);
setOndblclickExpr(null);
setOnfocusExpr(null);
setOnkeydownExpr(null);
setOnkeypressExpr(null);
setOnkeyupExpr(null);
setOnmousedownExpr(null);
setOnmousemoveExpr(null);
setOnmouseoutExpr(null);
setOnmouseoverExpr(null);
setOnmouseupExpr(null);
setSrcExpr(null);
setStyleExpr(null);
setStyleClassExpr(null);
setStyleIdExpr(null);
setTabindexExpr(null);
setTitleExpr(null);
setValueExpr(null);
} | class class_name[name] begin[{]
method[release, return_type[void], modifier[public], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=release, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[.setBase64Expr, parameter[literal[null]]]
call[.setAlignExpr, parameter[literal[null]]]
call[.setAltExpr, parameter[literal[null]]]
call[.setBorderExpr, parameter[literal[null]]]
call[.setDirExpr, parameter[literal[null]]]
call[.setDisabledExpr, parameter[literal[null]]]
call[.setLangExpr, parameter[literal[null]]]
call[.setOnblurExpr, parameter[literal[null]]]
call[.setOnchangeExpr, parameter[literal[null]]]
call[.setOnclickExpr, parameter[literal[null]]]
call[.setOndblclickExpr, parameter[literal[null]]]
call[.setOnfocusExpr, parameter[literal[null]]]
call[.setOnkeydownExpr, parameter[literal[null]]]
call[.setOnkeypressExpr, parameter[literal[null]]]
call[.setOnkeyupExpr, parameter[literal[null]]]
call[.setOnmousedownExpr, parameter[literal[null]]]
call[.setOnmousemoveExpr, parameter[literal[null]]]
call[.setOnmouseoutExpr, parameter[literal[null]]]
call[.setOnmouseoverExpr, parameter[literal[null]]]
call[.setOnmouseupExpr, parameter[literal[null]]]
call[.setSrcExpr, parameter[literal[null]]]
call[.setStyleExpr, parameter[literal[null]]]
call[.setStyleClassExpr, parameter[literal[null]]]
call[.setStyleIdExpr, parameter[literal[null]]]
call[.setTabindexExpr, parameter[literal[null]]]
call[.setTitleExpr, parameter[literal[null]]]
call[.setValueExpr, parameter[literal[null]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[release] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[release] operator[SEP] operator[SEP] operator[SEP] identifier[setBase64Expr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setAlignExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setAltExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setBorderExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setDirExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setDisabledExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setLangExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnblurExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnchangeExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnclickExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOndblclickExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnfocusExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnkeydownExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnkeypressExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnkeyupExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnmousedownExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnmousemoveExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnmouseoutExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnmouseoverExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setOnmouseupExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setSrcExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setStyleExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setStyleClassExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setStyleIdExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setTabindexExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setTitleExpr] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[setValueExpr] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
|
public static Spliterator.OfDouble spliteratorUnknownSize(PrimitiveIterator.OfDouble iterator,
int characteristics) {
return new DoubleIteratorSpliterator(Objects.requireNonNull(iterator), characteristics);
} | class class_name[name] begin[{]
method[spliteratorUnknownSize, return_type[type[Spliterator]], modifier[public static], parameter[iterator, characteristics]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=iterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=requireNonNull, postfix_operators=[], prefix_operators=[], qualifier=Objects, selectors=[], type_arguments=None), MemberReference(member=characteristics, 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=DoubleIteratorSpliterator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Spliterator] operator[SEP] identifier[OfDouble] identifier[spliteratorUnknownSize] operator[SEP] identifier[PrimitiveIterator] operator[SEP] identifier[OfDouble] identifier[iterator] , Keyword[int] identifier[characteristics] operator[SEP] {
Keyword[return] Keyword[new] identifier[DoubleIteratorSpliterator] operator[SEP] identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[iterator] operator[SEP] , identifier[characteristics] operator[SEP] operator[SEP]
}
|
private void addConstructorByKeyRef() {
context.constructorByKeyRef = MethodSpec.constructorBuilder().addParameter(keyRefSpec);
addCommonParameters(context.constructorByKeyRef);
if (isBaseClass()) {
assignKeyRefAndValue();
} else {
callParentByKeyRef();
}
} | class class_name[name] begin[{]
method[addConstructorByKeyRef, return_type[void], modifier[private], parameter[]] begin[{]
assign[member[context.constructorByKeyRef], call[MethodSpec.constructorBuilder, parameter[]]]
call[.addCommonParameters, parameter[member[context.constructorByKeyRef]]]
if[call[.isBaseClass, parameter[]]] begin[{]
call[.assignKeyRefAndValue, parameter[]]
else begin[{]
call[.callParentByKeyRef, parameter[]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addConstructorByKeyRef] operator[SEP] operator[SEP] {
identifier[context] operator[SEP] identifier[constructorByKeyRef] operator[=] identifier[MethodSpec] operator[SEP] identifier[constructorBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[addParameter] operator[SEP] identifier[keyRefSpec] operator[SEP] operator[SEP] identifier[addCommonParameters] operator[SEP] identifier[context] operator[SEP] identifier[constructorByKeyRef] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isBaseClass] operator[SEP] operator[SEP] operator[SEP] {
identifier[assignKeyRefAndValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[callParentByKeyRef] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void refresh() throws LockException, RepositoryException
{
if (!isLive())
throw new LockException("Lock is not live");
LockData newLockData =
new LockData(lockData.getNodeIdentifier(), lockData.getTokenHash(), lockData.isDeep(), lockData
.isSessionScoped(), lockData.getOwner(), lockData.getTimeOut());
lockManager.refresh(newLockData);
lockData = newLockData;
} | class class_name[name] begin[{]
method[refresh, return_type[void], modifier[public], parameter[]] begin[{]
if[call[.isLive, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Lock is not live")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LockException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[LockData], newLockData]
call[lockManager.refresh, parameter[member[.newLockData]]]
assign[member[.lockData], member[.newLockData]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[refresh] operator[SEP] operator[SEP] Keyword[throws] identifier[LockException] , identifier[RepositoryException] {
Keyword[if] operator[SEP] operator[!] identifier[isLive] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[LockException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[LockData] identifier[newLockData] operator[=] Keyword[new] identifier[LockData] operator[SEP] identifier[lockData] operator[SEP] identifier[getNodeIdentifier] operator[SEP] operator[SEP] , identifier[lockData] operator[SEP] identifier[getTokenHash] operator[SEP] operator[SEP] , identifier[lockData] operator[SEP] identifier[isDeep] operator[SEP] operator[SEP] , identifier[lockData] operator[SEP] identifier[isSessionScoped] operator[SEP] operator[SEP] , identifier[lockData] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] , identifier[lockData] operator[SEP] identifier[getTimeOut] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[lockManager] operator[SEP] identifier[refresh] operator[SEP] identifier[newLockData] operator[SEP] operator[SEP] identifier[lockData] operator[=] identifier[newLockData] operator[SEP]
}
|
public static String getSegmentName(int segmentType)
{
String segmentName = "(Unknown segment type)";
segmentName = segValues.get(segmentType);
if (segmentName == null)
segmentName = "(Unknown segment type)";
return segmentName;
} | class class_name[name] begin[{]
method[getSegmentName, return_type[type[String]], modifier[public static], parameter[segmentType]] begin[{]
local_variable[type[String], segmentName]
assign[member[.segmentName], call[segValues.get, parameter[member[.segmentType]]]]
if[binary_operation[member[.segmentName], ==, literal[null]]] begin[{]
assign[member[.segmentName], literal["(Unknown segment type)"]]
else begin[{]
None
end[}]
return[member[.segmentName]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getSegmentName] operator[SEP] Keyword[int] identifier[segmentType] operator[SEP] {
identifier[String] identifier[segmentName] operator[=] literal[String] operator[SEP] identifier[segmentName] operator[=] identifier[segValues] operator[SEP] identifier[get] operator[SEP] identifier[segmentType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[segmentName] operator[==] Other[null] operator[SEP] identifier[segmentName] operator[=] literal[String] operator[SEP] Keyword[return] identifier[segmentName] operator[SEP]
}
|
@Override
protected Object readInternal(Class<? extends Object> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
try {
AmfTrace trace = null;
if (log.isDebugEnabled()) {
trace = new AmfTrace();
}
Object result = null;
if (clazz.equals(ActionMessage.class)) {
result = readActionMessage(inputMessage, trace);
} else {
result = readObject(inputMessage, trace);
}
if (log.isDebugEnabled()) {
log.debug("Read AMF message:\n" + trace);
}
return result;
} finally {
FlexContext.clearThreadLocalObjects();
SerializationContext.clearThreadLocalObjects();
}
} | class class_name[name] begin[{]
method[readInternal, return_type[type[Object]], modifier[protected], parameter[clazz, inputMessage]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=trace)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AmfTrace, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=trace, 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=AmfTrace, sub_type=None))), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ActionMessage, sub_type=None))], member=equals, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=inputMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=inputMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=trace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readActionMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Read AMF message:\n"), operandr=MemberReference(member=trace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=clearThreadLocalObjects, postfix_operators=[], prefix_operators=[], qualifier=FlexContext, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clearThreadLocalObjects, postfix_operators=[], prefix_operators=[], qualifier=SerializationContext, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[Object] identifier[readInternal] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Object] operator[>] identifier[clazz] , identifier[HttpInputMessage] identifier[inputMessage] operator[SEP] Keyword[throws] identifier[IOException] , identifier[HttpMessageNotReadableException] {
Keyword[try] {
identifier[AmfTrace] identifier[trace] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[trace] operator[=] Keyword[new] identifier[AmfTrace] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Object] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[clazz] operator[SEP] identifier[equals] operator[SEP] identifier[ActionMessage] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[readActionMessage] operator[SEP] identifier[inputMessage] , identifier[trace] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[result] operator[=] identifier[readObject] operator[SEP] identifier[inputMessage] , identifier[trace] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[trace] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
Keyword[finally] {
identifier[FlexContext] operator[SEP] identifier[clearThreadLocalObjects] operator[SEP] operator[SEP] operator[SEP] identifier[SerializationContext] operator[SEP] identifier[clearThreadLocalObjects] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public List<Action> matchActions(ElementPath elementPath) {
List<Action> actionList;
if ((actionList = fullPathMatch(elementPath)) != null) {
return actionList;
} else if ((actionList = suffixMatch(elementPath)) != null) {
return actionList;
} else if ((actionList = prefixMatch(elementPath)) != null) {
return actionList;
} else if ((actionList = middleMatch(elementPath)) != null) {
return actionList;
} else {
return null;
}
} | class class_name[name] begin[{]
method[matchActions, return_type[type[List]], modifier[public], parameter[elementPath]] begin[{]
local_variable[type[List], actionList]
if[binary_operation[assign[member[.actionList], call[.fullPathMatch, parameter[member[.elementPath]]]], !=, literal[null]]] begin[{]
return[member[.actionList]]
else begin[{]
if[binary_operation[assign[member[.actionList], call[.suffixMatch, parameter[member[.elementPath]]]], !=, literal[null]]] begin[{]
return[member[.actionList]]
else begin[{]
if[binary_operation[assign[member[.actionList], call[.prefixMatch, parameter[member[.elementPath]]]], !=, literal[null]]] begin[{]
return[member[.actionList]]
else begin[{]
if[binary_operation[assign[member[.actionList], call[.middleMatch, parameter[member[.elementPath]]]], !=, literal[null]]] begin[{]
return[member[.actionList]]
else begin[{]
return[literal[null]]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Action] operator[>] identifier[matchActions] operator[SEP] identifier[ElementPath] identifier[elementPath] operator[SEP] {
identifier[List] operator[<] identifier[Action] operator[>] identifier[actionList] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[actionList] operator[=] identifier[fullPathMatch] operator[SEP] identifier[elementPath] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[actionList] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[actionList] operator[=] identifier[suffixMatch] operator[SEP] identifier[elementPath] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[actionList] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[actionList] operator[=] identifier[prefixMatch] operator[SEP] identifier[elementPath] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[actionList] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[actionList] operator[=] identifier[middleMatch] operator[SEP] identifier[elementPath] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[actionList] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public void createOrMigrateSchemaDirectory(String schemaDirectory,
boolean createTableAndFamilies) throws InterruptedException {
List<String> schemaStrings;
if (schemaDirectory.startsWith(CLASSPATH_PREFIX)) {
URL dirURL = getClass().getClassLoader().getResource(
schemaDirectory.substring(CLASSPATH_PREFIX.length()));
if (dirURL != null && dirURL.getProtocol().equals("file")) {
try {
schemaStrings = getSchemaStringsFromDir(new File(dirURL.toURI()));
} catch (URISyntaxException e) {
throw new DatasetException(e);
}
} else if (dirURL != null && dirURL.getProtocol().equals("jar")) {
String jarPath = dirURL.getPath().substring(5,
dirURL.getPath().indexOf("!"));
schemaStrings = getSchemaStringsFromJar(jarPath,
schemaDirectory.substring(CLASSPATH_PREFIX.length()));
} else {
String msg = "Could not find classpath resource: " + schemaDirectory;
LOG.error(msg);
throw new DatasetException(msg);
}
} else {
schemaStrings = getSchemaStringsFromDir(new File(schemaDirectory));
}
Map<String, List<String>> tableEntitySchemaMap = new HashMap<String, List<String>>();
for (String schemaString : schemaStrings) {
List<String> tables = getTablesFromSchemaString(schemaString);
for (String table : tables) {
if (tableEntitySchemaMap.containsKey(table)) {
tableEntitySchemaMap.get(table).add(schemaString);
} else {
List<String> entityList = new ArrayList<String>();
entityList.add(schemaString);
tableEntitySchemaMap.put(table, entityList);
}
}
}
// Validate if for every key schema there is atleast one entity schemas
for (Entry<String, List<String>> entry : tableEntitySchemaMap.entrySet()) {
String table = entry.getKey();
List<String> entitySchemas = entry.getValue();
if (entitySchemas.size() == 0) {
String msg =
"Table requested, but no entity schemas for Table: " + table;
LOG.error(msg);
throw new ValidationException(msg);
}
}
// Migrate the schemas in a batch, collect all the table descriptors
// that require a schema migration
Collection<HTableDescriptor> tableDescriptors = Lists.newArrayList();
for (Entry<String, List<String>> entry : tableEntitySchemaMap.entrySet()) {
String table = entry.getKey();
for (String entitySchemaString : entry.getValue()) {
boolean migrationRequired = prepareManagedSchema(table, entitySchemaString);
// Optimization: If no migration is req, then no change in the table
if (migrationRequired) {
tableDescriptors.add(
prepareTableDescriptor(table, entitySchemaString));
}
}
}
if (createTableAndFamilies) {
createTables(tableDescriptors);
}
} | class class_name[name] begin[{]
method[createOrMigrateSchemaDirectory, return_type[void], modifier[public], parameter[schemaDirectory, createTableAndFamilies]] begin[{]
local_variable[type[List], schemaStrings]
if[call[schemaDirectory.startsWith, parameter[member[.CLASSPATH_PREFIX]]]] begin[{]
local_variable[type[URL], dirURL]
if[binary_operation[binary_operation[member[.dirURL], !=, literal[null]], &&, call[dirURL.getProtocol, parameter[]]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=schemaStrings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=toURI, postfix_operators=[], prefix_operators=[], qualifier=dirURL, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))], member=getSchemaStringsFromDir, 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=DatasetException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
else begin[{]
if[binary_operation[binary_operation[member[.dirURL], !=, literal[null]], &&, call[dirURL.getProtocol, parameter[]]]] begin[{]
local_variable[type[String], jarPath]
assign[member[.schemaStrings], call[.getSchemaStringsFromJar, parameter[member[.jarPath], call[schemaDirectory.substring, parameter[call[CLASSPATH_PREFIX.length, parameter[]]]]]]]
else begin[{]
local_variable[type[String], msg]
call[LOG.error, parameter[member[.msg]]]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DatasetException, sub_type=None)), label=None)
end[}]
end[}]
else begin[{]
assign[member[.schemaStrings], call[.getSchemaStringsFromDir, parameter[ClassCreator(arguments=[MemberReference(member=schemaDirectory, 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=File, sub_type=None))]]]
end[}]
local_variable[type[Map], tableEntitySchemaMap]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=schemaString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTablesFromSchemaString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=tables)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=tableEntitySchemaMap, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=entityList)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=schemaString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=entityList, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=entityList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=tableEntitySchemaMap, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tableEntitySchemaMap, selectors=[MethodInvocation(arguments=[MemberReference(member=schemaString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=tables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=table)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=schemaStrings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=schemaString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=table)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=entitySchemas)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=entitySchemas, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Table requested, but no entity schemas for Table: "), operandr=MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ValidationException, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=tableEntitySchemaMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
local_variable[type[Collection], tableDescriptors]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=table)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=entitySchemaString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepareManagedSchema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=migrationRequired)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MemberReference(member=migrationRequired, 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=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=entitySchemaString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepareTableDescriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=tableDescriptors, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entitySchemaString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=tableEntitySchemaMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
if[member[.createTableAndFamilies]] begin[{]
call[.createTables, parameter[member[.tableDescriptors]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[createOrMigrateSchemaDirectory] operator[SEP] identifier[String] identifier[schemaDirectory] , Keyword[boolean] identifier[createTableAndFamilies] operator[SEP] Keyword[throws] identifier[InterruptedException] {
identifier[List] operator[<] identifier[String] operator[>] identifier[schemaStrings] operator[SEP] Keyword[if] operator[SEP] identifier[schemaDirectory] operator[SEP] identifier[startsWith] operator[SEP] identifier[CLASSPATH_PREFIX] operator[SEP] operator[SEP] {
identifier[URL] identifier[dirURL] operator[=] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] identifier[getResource] operator[SEP] identifier[schemaDirectory] operator[SEP] identifier[substring] operator[SEP] identifier[CLASSPATH_PREFIX] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dirURL] operator[!=] Other[null] operator[&&] identifier[dirURL] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[schemaStrings] operator[=] identifier[getSchemaStringsFromDir] operator[SEP] Keyword[new] identifier[File] operator[SEP] identifier[dirURL] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DatasetException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[dirURL] operator[!=] Other[null] operator[&&] identifier[dirURL] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[jarPath] operator[=] identifier[dirURL] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[5] , identifier[dirURL] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[schemaStrings] operator[=] identifier[getSchemaStringsFromJar] operator[SEP] identifier[jarPath] , identifier[schemaDirectory] operator[SEP] identifier[substring] operator[SEP] identifier[CLASSPATH_PREFIX] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[schemaDirectory] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[msg] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[DatasetException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[schemaStrings] operator[=] identifier[getSchemaStringsFromDir] operator[SEP] Keyword[new] identifier[File] operator[SEP] identifier[schemaDirectory] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[tableEntitySchemaMap] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[schemaString] operator[:] identifier[schemaStrings] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[tables] operator[=] identifier[getTablesFromSchemaString] operator[SEP] identifier[schemaString] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[table] operator[:] identifier[tables] operator[SEP] {
Keyword[if] operator[SEP] identifier[tableEntitySchemaMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[table] operator[SEP] operator[SEP] {
identifier[tableEntitySchemaMap] operator[SEP] identifier[get] operator[SEP] identifier[table] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[schemaString] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[List] operator[<] identifier[String] operator[>] identifier[entityList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[entityList] operator[SEP] identifier[add] operator[SEP] identifier[schemaString] operator[SEP] operator[SEP] identifier[tableEntitySchemaMap] operator[SEP] identifier[put] operator[SEP] identifier[table] , identifier[entityList] operator[SEP] operator[SEP]
}
}
}
Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[entry] operator[:] identifier[tableEntitySchemaMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[table] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[entitySchemas] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entitySchemas] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[table] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[msg] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ValidationException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
}
identifier[Collection] operator[<] identifier[HTableDescriptor] operator[>] identifier[tableDescriptors] operator[=] identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[entry] operator[:] identifier[tableEntitySchemaMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[table] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[entitySchemaString] operator[:] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[migrationRequired] operator[=] identifier[prepareManagedSchema] operator[SEP] identifier[table] , identifier[entitySchemaString] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[migrationRequired] operator[SEP] {
identifier[tableDescriptors] operator[SEP] identifier[add] operator[SEP] identifier[prepareTableDescriptor] operator[SEP] identifier[table] , identifier[entitySchemaString] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[createTableAndFamilies] operator[SEP] {
identifier[createTables] operator[SEP] identifier[tableDescriptors] operator[SEP] operator[SEP]
}
}
|
static void initializeAutoTaggingAndResubscription(Object target, ObservableGroup group) {
Class<?> cls = target.getClass();
String clsName = cls.getName();
while (cls != null && !clsName.startsWith("android.") && !clsName.startsWith("java.")) {
initializeAutoTaggingAndResubscriptionInTargetClassOnly(target, cls, group);
cls = cls.getSuperclass();
if (cls != null) {
clsName = cls.getName();
}
}
} | class class_name[name] begin[{]
method[initializeAutoTaggingAndResubscription, return_type[void], modifier[static], parameter[target, group]] begin[{]
local_variable[type[Class], cls]
local_variable[type[String], clsName]
while[binary_operation[binary_operation[binary_operation[member[.cls], !=, literal[null]], &&, call[clsName.startsWith, parameter[literal["android."]]]], &&, call[clsName.startsWith, parameter[literal["java."]]]]] begin[{]
call[.initializeAutoTaggingAndResubscriptionInTargetClassOnly, parameter[member[.target], member[.cls], member[.group]]]
assign[member[.cls], call[cls.getSuperclass, parameter[]]]
if[binary_operation[member[.cls], !=, literal[null]]] begin[{]
assign[member[.clsName], call[cls.getName, parameter[]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[static] Keyword[void] identifier[initializeAutoTaggingAndResubscription] operator[SEP] identifier[Object] identifier[target] , identifier[ObservableGroup] identifier[group] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[cls] operator[=] identifier[target] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[clsName] operator[=] identifier[cls] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[cls] operator[!=] Other[null] operator[&&] operator[!] identifier[clsName] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[clsName] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[initializeAutoTaggingAndResubscriptionInTargetClassOnly] operator[SEP] identifier[target] , identifier[cls] , identifier[group] operator[SEP] operator[SEP] identifier[cls] operator[=] identifier[cls] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cls] operator[!=] Other[null] operator[SEP] {
identifier[clsName] operator[=] identifier[cls] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static List<Field> getDeclaredFields(Class<?> cls) {
if (cls == null || Object.class.equals(cls)) {
return Collections.emptyList();
}
final List<Field> fields = new ArrayList<Field>();
final Set<String> fieldNames = new HashSet<String>();
for (Field field : cls.getDeclaredFields()) {
fields.add(field);
fieldNames.add(field.getName());
}
for (Field field : getDeclaredFields(cls.getSuperclass())) {
if (!fieldNames.contains(field.getName())) {
fields.add(field);
}
}
return fields;
} | class class_name[name] begin[{]
method[getDeclaredFields, return_type[type[List]], modifier[public static], parameter[cls]] begin[{]
if[binary_operation[binary_operation[member[.cls], ==, literal[null]], ||, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]] begin[{]
return[call[Collections.emptyList, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[List], fields]
local_variable[type[Set], fieldNames]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=fieldNames, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDeclaredFields, postfix_operators=[], prefix_operators=[], qualifier=cls, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=fieldNames, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSuperclass, postfix_operators=[], prefix_operators=[], qualifier=cls, selectors=[], type_arguments=None)], member=getDeclaredFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))), label=None)
return[member[.fields]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Field] operator[>] identifier[getDeclaredFields] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[cls] operator[SEP] {
Keyword[if] operator[SEP] identifier[cls] operator[==] Other[null] operator[||] identifier[Object] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[cls] operator[SEP] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[Field] operator[>] identifier[fields] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Field] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[fieldNames] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Field] identifier[field] operator[:] identifier[cls] operator[SEP] identifier[getDeclaredFields] operator[SEP] operator[SEP] operator[SEP] {
identifier[fields] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP] identifier[fieldNames] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Field] identifier[field] operator[:] identifier[getDeclaredFields] operator[SEP] identifier[cls] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[fieldNames] operator[SEP] identifier[contains] operator[SEP] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[fields] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[fields] operator[SEP]
}
|
public static void main(String[] args) throws Exception {
// if we need to daemonize, do it first,
// (Non : http://fr.wikipedia.org/wiki/Nohup devrait suffire en général)
// for (int i = 0; i < args.length; i++) {
// if (args[i].startsWith("--daemon")) {
// // load the daemonization code
// ClassLoader cl = new URLClassLoader(
// new URL[] {
// extractFromJar("WEB-INF/lib/jna-3.0.9.jar", "jna", "jar").toURI()
// .toURL(),
// extractFromJar("WEB-INF/lib/akuma-1.1.jar", "akuma", "jar").toURI()
// .toURL(), });
// Class $daemon = cl.loadClass("com.sun.akuma.Daemon");
// Object daemon = $daemon.newInstance();
//
// // tell the user that we'll be starting as a daemon.
// Method isDaemonized = $daemon.getMethod("isDaemonized", new Class[] {});
// if (!((Boolean) isDaemonized.invoke(daemon, new Object[0])).booleanValue()) {
// System.out.println("Forking into background to run as a daemon.");
// if (!hasLogOption(args))
// System.out.println("Use --logfile to redirect output to a file");
// }
//
// Method m = $daemon.getMethod("all", new Class[] { boolean.class });
// m.invoke(daemon, new Object[] { Boolean.TRUE });
// }
// }
// en commentaire car bug JENKINS-3272 (sous windows)
// if the output should be redirect to a file, do it now
// for (int i = 0; i < args.length; i++) {
// if (args[i].startsWith("--logfile=")) {
// final LogFileOutputStream los = new LogFileOutputStream(new File(args[i]
// .substring("--logfile=".length())));
// final PrintStream ps = new PrintStream(los);
// System.setOut(ps);
// System.setErr(ps);
// // don't let winstone see this
// final List myArgs = new ArrayList(Arrays.asList(args));
// myArgs.remove(i);
// args = (String[]) myArgs.toArray(new String[myArgs.size()]);
// break;
// }
// }
// this is so that JRobin can work nicely even if we are launched as a daemon
System.setProperty("java.awt.headless", "true");
final File me = whoAmI();
getSystemOutputStream().println("Running from: " + me);
System.setProperty("executable-war", me.getAbsolutePath()); // remember the location so that we can access it from within webapp
// put winstone jar in a file system so that we can load jars from there
final File tmpJar = extractFromJar("/winstone-jenkins.jar", "winstone", "jar");
// clean up any previously extracted copy, since
// winstone doesn't do so and that causes problems when newer version is deployed.
final File tempFile = File.createTempFile("dummy", "dummy");
deleteContents(new File(tempFile.getParent(), "winstone/" + me.getName()));
deleteFile(tempFile);
// locate the Winstone launcher
final ClassLoader cl = new URLClassLoader(new URL[] { tmpJar.toURI().toURL() });
final Class<?> launcher = cl.loadClass("winstone.Launcher");
final Method mainMethod = launcher.getMethod("main", new Class<?>[] { String[].class });
// figure out the arguments
final List<String> arguments = new ArrayList<String>(Arrays.asList(args));
arguments.add(0, "--warfile=" + me.getAbsolutePath());
// override the usage screen
final Field usage = launcher.getField("USAGE");
usage.set(null, "JavaMelody Monitoring Collect Server " + "\n"
+ "Usage: java -jar javamelody.war [--option=value] [--option=value]\n" + "\n"
+ "Options:\n"
+ " --config = load configuration properties from here. Default is ./winstone.properties\n"
+ " --prefix = add this prefix to all URLs (eg http://localhost:8080/prefix/resource). Default is none\n"
+ " --commonLibFolder = folder for additional jar files. Default is ./lib\n"
+ " \n"
+ " --logThrowingLineNo = show the line no that logged the message (slow). Default is false\n"
+ " --logThrowingThread = show the thread that logged the message. Default is false\n"
+ " --debug = set the level of debug msgs (1-9). Default is 5 (INFO level)\n"
+ "\n"
+ " --httpPort = set the http listening port. -1 to disable, Default is 8080\n"
+ " --httpListenAddress = set the http listening address. Default is all interfaces\n"
+ " --httpDoHostnameLookups = enable host name lookups on incoming http connections (true/false). Default is false\n"
+ " --httpKeepAliveTimeout = how long idle HTTP keep-alive connections are kept around (in ms; default 5000)?\n"
+ " --httpsPort = set the https listening port. -1 to disable, Default is disabled\n"
+ " if neither --httpsCertificate nor --httpsKeyStore are specified,\n"
+ " https is run with one-time self-signed certificate.\n"
+ " --httpsListenAddress = set the https listening address. Default is all interfaces\n"
+ " --httpsDoHostnameLookups = enable host name lookups on incoming https connections (true/false). Default is false\n"
+ " --httpsKeepAliveTimeout = how long idle HTTPS keep-alive connections are kept around (in ms; default 5000)?\n"
+ " --httpsKeyStore = the location of the SSL KeyStore file.\n"
+ " --httpsKeyStorePassword = the password for the SSL KeyStore file. Default is null\n"
+ " --httpsCertificate = the location of the PEM-encoded SSL certificate file.\n"
+ " (the one that starts with '-----BEGIN CERTIFICATE-----')\n"
+ " must be used with --httpsPrivateKey.\n"
+ " --httpsPrivateKey = the location of the PEM-encoded SSL private key.\n"
+ " (the one that starts with '-----BEGIN RSA PRIVATE KEY-----')\n"
+ " --httpsKeyManagerType = the SSL KeyManagerFactory type (eg SunX509, IbmX509). Default is SunX509\n"
+ " --spdy = Enable SPDY. See http://wiki.eclipse.org/Jetty/Feature/NPN\n"
+ " --ajp13Port = set the ajp13 listening port. -1 to disable, Default is disabled\n"
+ " --ajp13ListenAddress = set the ajp13 listening address. Default is all interfaces\n"
+ " --controlPort = set the shutdown/control port. -1 to disable, Default disabled\n"
+ " \n"
+ " --handlerCountStartup = set the no of worker threads to spawn at startup. Default is 5\n"
+ " --handlerCountMax = set the max no of worker threads to allow. Default is 40\n"
+ " --handlerCountMaxIdle = set the max no of idle worker threads to allow. Default is 5\n"
+ " \n"
+ " --sessionTimeout = set the http session timeout value in minutes. Default to what webapp specifies, and then to 60 minutes\n"
+ " --mimeTypes=ARG = define additional MIME type mappings. ARG would be EXT=MIMETYPE:EXT=MIMETYPE:...\n"
+ " (e.g., xls=application/vnd.ms-excel:wmf=application/x-msmetafile)\n"
+ " --maxParamCount=N = set the max number of parameters allowed in a form submission to protect\n"
+ " against hash DoS attack (oCERT #2011-003). Default is 10000.\n"
+ " --usage / --help = show this message\n" + " \n"
// For security of the collect server, see https://github.com/javamelody/javamelody/wiki/UserGuideAdvanced#5-security-with-a-collect-server
// (-Djavamelody.authorized-users=user1:pwd1,user2:pwd2)
// + "Security options:\n"
// + " --realmClassName = Set the realm class to use for user authentication. Defaults to ArgumentsRealm class\n"
// + " \n"
// + " --argumentsRealm.passwd.<user> = Password for user <user>. Only valid for the ArgumentsRealm realm class\n"
// + " --argumentsRealm.roles.<user> = Roles for user <user> (comma separated). Only valid for the ArgumentsRealm realm class\n"
// + " \n"
// + " --fileRealm.configFile = File containing users/passwds/roles. Only valid for the FileRealm realm class\n"
// + " \n"
+ "Access logging:\n"
+ " --accessLoggerClassName = Set the access logger class to use for user authentication. Defaults to disabled\n"
+ " --simpleAccessLogger.format = The log format to use. Supports combined/common/resin/custom (SimpleAccessLogger only)\n"
+ " --simpleAccessLogger.file = The location pattern for the log file(SimpleAccessLogger only)");
// run
mainMethod.invoke(null, new Object[] { arguments.toArray(new String[arguments.size()]) });
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
call[System.setProperty, parameter[literal["java.awt.headless"], literal["true"]]]
local_variable[type[File], me]
call[.getSystemOutputStream, parameter[]]
call[System.setProperty, parameter[literal["executable-war"], call[me.getAbsolutePath, parameter[]]]]
local_variable[type[File], tmpJar]
local_variable[type[File], tempFile]
call[.deleteContents, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getParent, postfix_operators=[], prefix_operators=[], qualifier=tempFile, selectors=[], type_arguments=None), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="winstone/"), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=me, 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=File, sub_type=None))]]
call[.deleteFile, parameter[member[.tempFile]]]
local_variable[type[ClassLoader], cl]
local_variable[type[Class], launcher]
local_variable[type[Method], mainMethod]
local_variable[type[List], arguments]
call[arguments.add, parameter[literal[0], binary_operation[literal["--warfile="], +, call[me.getAbsolutePath, parameter[]]]]]
local_variable[type[Field], usage]
call[usage.set, parameter[literal[null], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["JavaMelody Monitoring Collect Server "], +, literal["\n"]], +, literal["Usage: java -jar javamelody.war [--option=value] [--option=value]\n"]], +, literal["\n"]], +, literal["Options:\n"]], +, literal[" --config = load configuration properties from here. Default is ./winstone.properties\n"]], +, literal[" --prefix = add this prefix to all URLs (eg http://localhost:8080/prefix/resource). Default is none\n"]], +, literal[" --commonLibFolder = folder for additional jar files. Default is ./lib\n"]], +, literal[" \n"]], +, literal[" --logThrowingLineNo = show the line no that logged the message (slow). Default is false\n"]], +, literal[" --logThrowingThread = show the thread that logged the message. Default is false\n"]], +, literal[" --debug = set the level of debug msgs (1-9). Default is 5 (INFO level)\n"]], +, literal["\n"]], +, literal[" --httpPort = set the http listening port. -1 to disable, Default is 8080\n"]], +, literal[" --httpListenAddress = set the http listening address. Default is all interfaces\n"]], +, literal[" --httpDoHostnameLookups = enable host name lookups on incoming http connections (true/false). Default is false\n"]], +, literal[" --httpKeepAliveTimeout = how long idle HTTP keep-alive connections are kept around (in ms; default 5000)?\n"]], +, literal[" --httpsPort = set the https listening port. -1 to disable, Default is disabled\n"]], +, literal[" if neither --httpsCertificate nor --httpsKeyStore are specified,\n"]], +, literal[" https is run with one-time self-signed certificate.\n"]], +, literal[" --httpsListenAddress = set the https listening address. Default is all interfaces\n"]], +, literal[" --httpsDoHostnameLookups = enable host name lookups on incoming https connections (true/false). Default is false\n"]], +, literal[" --httpsKeepAliveTimeout = how long idle HTTPS keep-alive connections are kept around (in ms; default 5000)?\n"]], +, literal[" --httpsKeyStore = the location of the SSL KeyStore file.\n"]], +, literal[" --httpsKeyStorePassword = the password for the SSL KeyStore file. Default is null\n"]], +, literal[" --httpsCertificate = the location of the PEM-encoded SSL certificate file.\n"]], +, literal[" (the one that starts with '-----BEGIN CERTIFICATE-----')\n"]], +, literal[" must be used with --httpsPrivateKey.\n"]], +, literal[" --httpsPrivateKey = the location of the PEM-encoded SSL private key.\n"]], +, literal[" (the one that starts with '-----BEGIN RSA PRIVATE KEY-----')\n"]], +, literal[" --httpsKeyManagerType = the SSL KeyManagerFactory type (eg SunX509, IbmX509). Default is SunX509\n"]], +, literal[" --spdy = Enable SPDY. See http://wiki.eclipse.org/Jetty/Feature/NPN\n"]], +, literal[" --ajp13Port = set the ajp13 listening port. -1 to disable, Default is disabled\n"]], +, literal[" --ajp13ListenAddress = set the ajp13 listening address. Default is all interfaces\n"]], +, literal[" --controlPort = set the shutdown/control port. -1 to disable, Default disabled\n"]], +, literal[" \n"]], +, literal[" --handlerCountStartup = set the no of worker threads to spawn at startup. Default is 5\n"]], +, literal[" --handlerCountMax = set the max no of worker threads to allow. Default is 40\n"]], +, literal[" --handlerCountMaxIdle = set the max no of idle worker threads to allow. Default is 5\n"]], +, literal[" \n"]], +, literal[" --sessionTimeout = set the http session timeout value in minutes. Default to what webapp specifies, and then to 60 minutes\n"]], +, literal[" --mimeTypes=ARG = define additional MIME type mappings. ARG would be EXT=MIMETYPE:EXT=MIMETYPE:...\n"]], +, literal[" (e.g., xls=application/vnd.ms-excel:wmf=application/x-msmetafile)\n"]], +, literal[" --maxParamCount=N = set the max number of parameters allowed in a form submission to protect\n"]], +, literal[" against hash DoS attack (oCERT #2011-003). Default is 10000.\n"]], +, literal[" --usage / --help = show this message\n"]], +, literal[" \n"]], +, literal["Access logging:\n"]], +, literal[" --accessLoggerClassName = Set the access logger class to use for user authentication. Defaults to disabled\n"]], +, literal[" --simpleAccessLogger.format = The log format to use. Supports combined/common/resin/custom (SimpleAccessLogger only)\n"]], +, literal[" --simpleAccessLogger.file = The location pattern for the log file(SimpleAccessLogger only)"]]]]
call[mainMethod.invoke, parameter[literal[null], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=arguments, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=arguments, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[System] operator[SEP] identifier[setProperty] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[File] identifier[me] operator[=] identifier[whoAmI] operator[SEP] operator[SEP] operator[SEP] identifier[getSystemOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[me] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[setProperty] operator[SEP] literal[String] , identifier[me] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[File] identifier[tmpJar] operator[=] identifier[extractFromJar] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[File] identifier[tempFile] operator[=] identifier[File] operator[SEP] identifier[createTempFile] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[deleteContents] operator[SEP] Keyword[new] identifier[File] operator[SEP] identifier[tempFile] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] , literal[String] operator[+] identifier[me] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[deleteFile] operator[SEP] identifier[tempFile] operator[SEP] operator[SEP] Keyword[final] identifier[ClassLoader] identifier[cl] operator[=] Keyword[new] identifier[URLClassLoader] operator[SEP] Keyword[new] identifier[URL] operator[SEP] operator[SEP] {
identifier[tmpJar] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] identifier[toURL] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[launcher] operator[=] identifier[cl] operator[SEP] identifier[loadClass] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Method] identifier[mainMethod] operator[=] identifier[launcher] operator[SEP] identifier[getMethod] operator[SEP] literal[String] , Keyword[new] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] operator[SEP] Keyword[class]
} operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[arguments] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[args] operator[SEP] operator[SEP] operator[SEP] identifier[arguments] operator[SEP] identifier[add] operator[SEP] Other[0] , literal[String] operator[+] identifier[me] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Field] identifier[usage] operator[=] identifier[launcher] operator[SEP] identifier[getField] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[usage] operator[SEP] identifier[set] operator[SEP] Other[null] , literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] identifier[mainMethod] operator[SEP] identifier[invoke] operator[SEP] Other[null] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[arguments] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[arguments] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
public void visit(final WebAppListener webAppListener) {
NullArgumentException.validateNotNull(webAppListener,
"Web app listener");
final EventListener listener = webAppListener.getListener();
if (listener != null) {
//CHECKSTYLE:OFF
try {
webContainer.unregisterEventListener(listener);
} catch (Exception ignore) {
LOG.warn("Unregistration exception. Skipping.", ignore);
}
//CHECKSTYLE:ON
}
} | class class_name[name] begin[{]
method[visit, return_type[void], modifier[public], parameter[webAppListener]] begin[{]
call[NullArgumentException.validateNotNull, parameter[member[.webAppListener], literal["Web app listener"]]]
local_variable[type[EventListener], listener]
if[binary_operation[member[.listener], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unregisterEventListener, postfix_operators=[], prefix_operators=[], qualifier=webContainer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unregistration exception. Skipping."), MemberReference(member=ignore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignore, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[visit] operator[SEP] Keyword[final] identifier[WebAppListener] identifier[webAppListener] operator[SEP] {
identifier[NullArgumentException] operator[SEP] identifier[validateNotNull] operator[SEP] identifier[webAppListener] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[EventListener] identifier[listener] operator[=] identifier[webAppListener] operator[SEP] identifier[getListener] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listener] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[webContainer] operator[SEP] identifier[unregisterEventListener] operator[SEP] identifier[listener] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ignore] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[ignore] operator[SEP] operator[SEP]
}
}
}
|
@Override
public boolean rename(String database, String newDatabase) {
GeoPackageMetadata metadata = getGeoPackageMetadata(database);
if (metadata != null) {
GeoPackageMetadataDb metadataDb = new GeoPackageMetadataDb(
context);
metadataDb.open();
try {
GeoPackageMetadataDataSource dataSource = new GeoPackageMetadataDataSource(metadataDb);
dataSource.rename(metadata, newDatabase);
} finally {
metadataDb.close();
}
}
if ((metadata == null || !metadata.isExternal()) && copy(database, newDatabase)) {
delete(database);
}
return exists(newDatabase);
} | class class_name[name] begin[{]
method[rename, return_type[type[boolean]], modifier[public], parameter[database, newDatabase]] begin[{]
local_variable[type[GeoPackageMetadata], metadata]
if[binary_operation[member[.metadata], !=, literal[null]]] begin[{]
local_variable[type[GeoPackageMetadataDb], metadataDb]
call[metadataDb.open, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=metadataDb, 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=GeoPackageMetadataDataSource, sub_type=None)), name=dataSource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=GeoPackageMetadataDataSource, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=metadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newDatabase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rename, postfix_operators=[], prefix_operators=[], qualifier=dataSource, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=metadataDb, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.metadata], ==, literal[null]], ||, call[metadata.isExternal, parameter[]]], &&, call[.copy, parameter[member[.database], member[.newDatabase]]]]] begin[{]
call[.delete, parameter[member[.database]]]
else begin[{]
None
end[}]
return[call[.exists, parameter[member[.newDatabase]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[rename] operator[SEP] identifier[String] identifier[database] , identifier[String] identifier[newDatabase] operator[SEP] {
identifier[GeoPackageMetadata] identifier[metadata] operator[=] identifier[getGeoPackageMetadata] operator[SEP] identifier[database] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[metadata] operator[!=] Other[null] operator[SEP] {
identifier[GeoPackageMetadataDb] identifier[metadataDb] operator[=] Keyword[new] identifier[GeoPackageMetadataDb] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[metadataDb] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[GeoPackageMetadataDataSource] identifier[dataSource] operator[=] Keyword[new] identifier[GeoPackageMetadataDataSource] operator[SEP] identifier[metadataDb] operator[SEP] operator[SEP] identifier[dataSource] operator[SEP] identifier[rename] operator[SEP] identifier[metadata] , identifier[newDatabase] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[metadataDb] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[SEP] identifier[metadata] operator[==] Other[null] operator[||] operator[!] identifier[metadata] operator[SEP] identifier[isExternal] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[copy] operator[SEP] identifier[database] , identifier[newDatabase] operator[SEP] operator[SEP] {
identifier[delete] operator[SEP] identifier[database] operator[SEP] operator[SEP]
}
Keyword[return] identifier[exists] operator[SEP] identifier[newDatabase] operator[SEP] operator[SEP]
}
|
public static CharsetPreference valueOf(final String str) {
final String[] parts = str.split(";");
if(parts.length<=2) {
final String charsetName =parts[0].trim();
if("*".equals(charsetName) || TOKEN_MATCHER.matchesAllOf(charsetName)) {
int weight=MAX_WEIGHT;
if(parts.length==2) {
final String weightValue=parts[1].trim();
final Matcher matcher = QUALITY_PATTERN.matcher(weightValue);
if(!matcher.matches()) {
return null;
}
if(weightValue.charAt(2)=='0') {
weight=Integer.parseInt(Strings.padEnd(weightValue.substring(4),3,'0'));
}
}
return new CharsetPreference(charsetName,weight);
}
}
return null;
} | class class_name[name] begin[{]
method[valueOf, return_type[type[CharsetPreference]], modifier[public static], parameter[str]] begin[{]
local_variable[type[String], parts]
if[binary_operation[member[parts.length], <=, literal[2]]] begin[{]
local_variable[type[String], charsetName]
if[binary_operation[literal["*"], ||, call[TOKEN_MATCHER.matchesAllOf, parameter[member[.charsetName]]]]] begin[{]
local_variable[type[int], weight]
if[binary_operation[member[parts.length], ==, literal[2]]] begin[{]
local_variable[type[String], weightValue]
local_variable[type[Matcher], matcher]
if[call[matcher.matches, parameter[]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[call[weightValue.charAt, parameter[literal[2]]], ==, literal['0']]] begin[{]
assign[member[.weight], call[Integer.parseInt, parameter[call[Strings.padEnd, parameter[call[weightValue.substring, parameter[literal[4]]], literal[3], literal['0']]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=charsetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=weight, 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=CharsetPreference, sub_type=None))]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CharsetPreference] identifier[valueOf] operator[SEP] Keyword[final] identifier[String] identifier[str] operator[SEP] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[parts] operator[=] identifier[str] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parts] operator[SEP] identifier[length] operator[<=] Other[2] operator[SEP] {
Keyword[final] identifier[String] identifier[charsetName] operator[=] identifier[parts] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[charsetName] operator[SEP] operator[||] identifier[TOKEN_MATCHER] operator[SEP] identifier[matchesAllOf] operator[SEP] identifier[charsetName] operator[SEP] operator[SEP] {
Keyword[int] identifier[weight] operator[=] identifier[MAX_WEIGHT] operator[SEP] Keyword[if] operator[SEP] identifier[parts] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
Keyword[final] identifier[String] identifier[weightValue] operator[=] identifier[parts] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Matcher] identifier[matcher] operator[=] identifier[QUALITY_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[weightValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[matcher] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[weightValue] operator[SEP] identifier[charAt] operator[SEP] Other[2] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[weight] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[Strings] operator[SEP] identifier[padEnd] operator[SEP] identifier[weightValue] operator[SEP] identifier[substring] operator[SEP] Other[4] operator[SEP] , Other[3] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[CharsetPreference] operator[SEP] identifier[charsetName] , identifier[weight] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public static RequestScoper scopeRequest(Map<Key<?>, Object> seedMap) {
Preconditions.checkArgument(
null != seedMap, "Seed map cannot be null, try passing in Collections.emptyMap() instead.");
// Copy the seed values into our local scope map.
final Context context = new Context();
Map<Key<?>, Object> validatedAndCanonicalizedMap =
Maps.transformEntries(
seedMap,
new EntryTransformer<Key<?>, Object, Object>() {
@Override
public Object transformEntry(Key<?> key, Object value) {
return validateAndCanonicalizeValue(key, value);
}
});
context.map.putAll(validatedAndCanonicalizedMap);
return new RequestScoper() {
@Override
public CloseableScope open() {
checkScopingState(
null == GuiceFilter.localContext.get(),
"An HTTP request is already in progress, cannot scope a new request in this thread.");
checkScopingState(
null == requestScopeContext.get(),
"A request scope is already in progress, cannot scope a new request in this thread.");
return context.open();
}
};
} | class class_name[name] begin[{]
method[scopeRequest, return_type[type[RequestScoper]], modifier[public static], parameter[seedMap]] begin[{]
call[Preconditions.checkArgument, parameter[binary_operation[literal[null], !=, member[.seedMap]], literal["Seed map cannot be null, try passing in Collections.emptyMap() instead."]]]
local_variable[type[Context], context]
local_variable[type[Map], validatedAndCanonicalizedMap]
call[context.map.putAll, parameter[member[.validatedAndCanonicalizedMap]]]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=GuiceFilter.localContext, selectors=[], type_arguments=None), operator===), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An HTTP request is already in progress, cannot scope a new request in this thread.")], member=checkScopingState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=requestScopeContext, selectors=[], type_arguments=None), operator===), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="A request scope is already in progress, cannot scope a new request in this thread.")], member=checkScopingState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=open, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=open, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=CloseableScope, 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=RequestScoper, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[RequestScoper] identifier[scopeRequest] operator[SEP] identifier[Map] operator[<] identifier[Key] operator[<] operator[?] operator[>] , identifier[Object] operator[>] identifier[seedMap] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] Other[null] operator[!=] identifier[seedMap] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Context] identifier[context] operator[=] Keyword[new] identifier[Context] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[Key] operator[<] operator[?] operator[>] , identifier[Object] operator[>] identifier[validatedAndCanonicalizedMap] operator[=] identifier[Maps] operator[SEP] identifier[transformEntries] operator[SEP] identifier[seedMap] , Keyword[new] identifier[EntryTransformer] operator[<] identifier[Key] operator[<] operator[?] operator[>] , identifier[Object] , identifier[Object] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[transformEntry] operator[SEP] identifier[Key] operator[<] operator[?] operator[>] identifier[key] , identifier[Object] identifier[value] operator[SEP] {
Keyword[return] identifier[validateAndCanonicalizeValue] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[map] operator[SEP] identifier[putAll] operator[SEP] identifier[validatedAndCanonicalizedMap] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[RequestScoper] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[CloseableScope] identifier[open] operator[SEP] operator[SEP] {
identifier[checkScopingState] operator[SEP] Other[null] operator[==] identifier[GuiceFilter] operator[SEP] identifier[localContext] operator[SEP] identifier[get] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[checkScopingState] operator[SEP] Other[null] operator[==] identifier[requestScopeContext] operator[SEP] identifier[get] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[context] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
private boolean isUpload(String action) {
if (StringUtils.hasText(action) && action.equals(OperationType.UPLOAD.toString())) {
return true;
}
return false;
} | class class_name[name] begin[{]
method[isUpload, return_type[type[boolean]], modifier[private], parameter[action]] begin[{]
if[binary_operation[call[StringUtils.hasText, parameter[member[.action]]], &&, call[action.equals, parameter[call[OperationType.UPLOAD.toString, parameter[]]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[isUpload] operator[SEP] identifier[String] identifier[action] operator[SEP] {
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[hasText] operator[SEP] identifier[action] operator[SEP] operator[&&] identifier[action] operator[SEP] identifier[equals] operator[SEP] identifier[OperationType] operator[SEP] identifier[UPLOAD] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void scheduleBlockReport(long delay) {
if (delay > 0) { // send BR after random delay
lastBlockReport = System.currentTimeMillis()
- ( anode.blockReportInterval - R.nextInt((int)(delay)));
} else { // send at next heartbeat
lastBlockReport = lastHeartbeat - anode.blockReportInterval;
}
resetBlockReportTime = true; // reset future BRs for randomness
} | class class_name[name] begin[{]
method[scheduleBlockReport, return_type[void], modifier[public], parameter[delay]] begin[{]
if[binary_operation[member[.delay], >, literal[0]]] begin[{]
assign[member[.lastBlockReport], binary_operation[call[System.currentTimeMillis, parameter[]], -, binary_operation[member[anode.blockReportInterval], -, call[R.nextInt, parameter[Cast(expression=MemberReference(member=delay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))]]]]]
else begin[{]
assign[member[.lastBlockReport], binary_operation[member[.lastHeartbeat], -, member[anode.blockReportInterval]]]
end[}]
assign[member[.resetBlockReportTime], literal[true]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[scheduleBlockReport] operator[SEP] Keyword[long] identifier[delay] operator[SEP] {
Keyword[if] operator[SEP] identifier[delay] operator[>] Other[0] operator[SEP] {
identifier[lastBlockReport] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] operator[SEP] identifier[anode] operator[SEP] identifier[blockReportInterval] operator[-] identifier[R] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[delay] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[lastBlockReport] operator[=] identifier[lastHeartbeat] operator[-] identifier[anode] operator[SEP] identifier[blockReportInterval] operator[SEP]
}
identifier[resetBlockReportTime] operator[=] literal[boolean] operator[SEP]
}
|
public void transfromHeadline ()
{
if (m_nHeadlineDepth > 0)
return;
int nLevel = 0;
final Line aLine = m_aLines;
if (aLine.m_bIsEmpty)
return;
int nStart = aLine.m_nLeading;
while (nStart < aLine.m_sValue.length () && aLine.m_sValue.charAt (nStart) == '#')
{
nLevel++;
nStart++;
}
while (nStart < aLine.m_sValue.length () && aLine.m_sValue.charAt (nStart) == ' ')
nStart++;
if (nStart >= aLine.m_sValue.length ())
{
aLine.setEmpty ();
}
else
{
int nEnd = aLine.m_sValue.length () - aLine.m_nTrailing - 1;
while (aLine.m_sValue.charAt (nEnd) == '#')
nEnd--;
while (aLine.m_sValue.charAt (nEnd) == ' ')
nEnd--;
aLine.m_sValue = aLine.m_sValue.substring (nStart, nEnd + 1);
aLine.m_nLeading = aLine.m_nTrailing = 0;
}
m_nHeadlineDepth = Math.min (nLevel, 6);
} | class class_name[name] begin[{]
method[transfromHeadline, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.m_nHeadlineDepth], >, literal[0]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[int], nLevel]
local_variable[type[Line], aLine]
if[member[aLine.m_bIsEmpty]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[int], nStart]
while[binary_operation[binary_operation[member[.nStart], <, call[aLine.m_sValue.length, parameter[]]], &&, binary_operation[call[aLine.m_sValue.charAt, parameter[member[.nStart]]], ==, literal['#']]]] begin[{]
member[.nLevel]
member[.nStart]
end[}]
while[binary_operation[binary_operation[member[.nStart], <, call[aLine.m_sValue.length, parameter[]]], &&, binary_operation[call[aLine.m_sValue.charAt, parameter[member[.nStart]]], ==, literal[' ']]]] begin[{]
member[.nStart]
end[}]
if[binary_operation[member[.nStart], >=, call[aLine.m_sValue.length, parameter[]]]] begin[{]
call[aLine.setEmpty, parameter[]]
else begin[{]
local_variable[type[int], nEnd]
while[binary_operation[call[aLine.m_sValue.charAt, parameter[member[.nEnd]]], ==, literal['#']]] begin[{]
member[.nEnd]
end[}]
while[binary_operation[call[aLine.m_sValue.charAt, parameter[member[.nEnd]]], ==, literal[' ']]] begin[{]
member[.nEnd]
end[}]
assign[member[aLine.m_sValue], call[aLine.m_sValue.substring, parameter[member[.nStart], binary_operation[member[.nEnd], +, literal[1]]]]]
assign[member[aLine.m_nLeading], assign[member[aLine.m_nTrailing], literal[0]]]
end[}]
assign[member[.m_nHeadlineDepth], call[Math.min, parameter[member[.nLevel], literal[6]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[transfromHeadline] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_nHeadlineDepth] operator[>] Other[0] operator[SEP] Keyword[return] operator[SEP] Keyword[int] identifier[nLevel] operator[=] Other[0] operator[SEP] Keyword[final] identifier[Line] identifier[aLine] operator[=] identifier[m_aLines] operator[SEP] Keyword[if] operator[SEP] identifier[aLine] operator[SEP] identifier[m_bIsEmpty] operator[SEP] Keyword[return] operator[SEP] Keyword[int] identifier[nStart] operator[=] identifier[aLine] operator[SEP] identifier[m_nLeading] operator[SEP] Keyword[while] operator[SEP] identifier[nStart] operator[<] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[&&] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[charAt] operator[SEP] identifier[nStart] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[nLevel] operator[++] operator[SEP] identifier[nStart] operator[++] operator[SEP]
}
Keyword[while] operator[SEP] identifier[nStart] operator[<] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[&&] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[charAt] operator[SEP] identifier[nStart] operator[SEP] operator[==] literal[String] operator[SEP] identifier[nStart] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[nStart] operator[>=] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
identifier[aLine] operator[SEP] identifier[setEmpty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[nEnd] operator[=] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[aLine] operator[SEP] identifier[m_nTrailing] operator[-] Other[1] operator[SEP] Keyword[while] operator[SEP] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[charAt] operator[SEP] identifier[nEnd] operator[SEP] operator[==] literal[String] operator[SEP] identifier[nEnd] operator[--] operator[SEP] Keyword[while] operator[SEP] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[charAt] operator[SEP] identifier[nEnd] operator[SEP] operator[==] literal[String] operator[SEP] identifier[nEnd] operator[--] operator[SEP] identifier[aLine] operator[SEP] identifier[m_sValue] operator[=] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[substring] operator[SEP] identifier[nStart] , identifier[nEnd] operator[+] Other[1] operator[SEP] operator[SEP] identifier[aLine] operator[SEP] identifier[m_nLeading] operator[=] identifier[aLine] operator[SEP] identifier[m_nTrailing] operator[=] Other[0] operator[SEP]
}
identifier[m_nHeadlineDepth] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[nLevel] , Other[6] operator[SEP] operator[SEP]
}
|
public IParsedElement findAncestorParsedElementByType( Class... parsedElementClasses )
{
IParsedElement parent = getParent();
while( (parent != null) && !(elementIsOneOfType( parent, parsedElementClasses )) )
{
parent = parent.getParent();
}
if( parent != null )
{
return parent;
}
else
{
return null;
}
} | class class_name[name] begin[{]
method[findAncestorParsedElementByType, return_type[type[IParsedElement]], modifier[public], parameter[parsedElementClasses]] begin[{]
local_variable[type[IParsedElement], parent]
while[binary_operation[binary_operation[member[.parent], !=, literal[null]], &&, call[.elementIsOneOfType, parameter[member[.parent], member[.parsedElementClasses]]]]] begin[{]
assign[member[.parent], call[parent.getParent, parameter[]]]
end[}]
if[binary_operation[member[.parent], !=, literal[null]]] begin[{]
return[member[.parent]]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}] | Keyword[public] identifier[IParsedElement] identifier[findAncestorParsedElementByType] operator[SEP] identifier[Class] operator[...] identifier[parsedElementClasses] operator[SEP] {
identifier[IParsedElement] identifier[parent] operator[=] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[parent] operator[!=] Other[null] operator[SEP] operator[&&] operator[!] operator[SEP] identifier[elementIsOneOfType] operator[SEP] identifier[parent] , identifier[parsedElementClasses] operator[SEP] operator[SEP] operator[SEP] {
identifier[parent] operator[=] identifier[parent] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[parent] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[parent] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public PagedList<ManagedInstanceEncryptionProtectorInner> listByInstanceNext(final String nextPageLink) {
ServiceResponse<Page<ManagedInstanceEncryptionProtectorInner>> response = listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<ManagedInstanceEncryptionProtectorInner>(response.body()) {
@Override
public Page<ManagedInstanceEncryptionProtectorInner> nextPage(String nextPageLink) {
return listByInstanceNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
} | class class_name[name] begin[{]
method[listByInstanceNext, return_type[type[PagedList]], modifier[public], parameter[nextPageLink]] begin[{]
local_variable[type[ServiceResponse], response]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=body, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=nextPageLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listByInstanceNextSinglePageAsync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=toBlocking, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=single, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=body, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=nextPage, 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=None, dimensions=[], name=ManagedInstanceEncryptionProtectorInner, sub_type=None))], dimensions=[], name=Page, 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=ManagedInstanceEncryptionProtectorInner, sub_type=None))], dimensions=None, name=PagedList, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[PagedList] operator[<] identifier[ManagedInstanceEncryptionProtectorInner] operator[>] identifier[listByInstanceNext] operator[SEP] Keyword[final] identifier[String] identifier[nextPageLink] operator[SEP] {
identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[ManagedInstanceEncryptionProtectorInner] operator[>] operator[>] identifier[response] operator[=] identifier[listByInstanceNextSinglePageAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PagedList] operator[<] identifier[ManagedInstanceEncryptionProtectorInner] operator[>] operator[SEP] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[ManagedInstanceEncryptionProtectorInner] operator[>] identifier[nextPage] operator[SEP] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listByInstanceNextSinglePageAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
@Override
public Period until(ChronoLocalDate endDateExclusive) {
LocalDate end = LocalDate.from(endDateExclusive);
long totalMonths = end.getProlepticMonth() - this.getProlepticMonth(); // safe
int days = end.day - this.day;
if (totalMonths > 0 && days < 0) {
totalMonths--;
LocalDate calcDate = this.plusMonths(totalMonths);
days = (int) (end.toEpochDay() - calcDate.toEpochDay()); // safe
} else if (totalMonths < 0 && days > 0) {
totalMonths++;
days -= end.lengthOfMonth();
}
long years = totalMonths / 12; // safe
int months = (int) (totalMonths % 12); // safe
return Period.of(Math.toIntExact(years), months, days);
} | class class_name[name] begin[{]
method[until, return_type[type[Period]], modifier[public], parameter[endDateExclusive]] begin[{]
local_variable[type[LocalDate], end]
local_variable[type[long], totalMonths]
local_variable[type[int], days]
if[binary_operation[binary_operation[member[.totalMonths], >, literal[0]], &&, binary_operation[member[.days], <, literal[0]]]] begin[{]
member[.totalMonths]
local_variable[type[LocalDate], calcDate]
assign[member[.days], Cast(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=toEpochDay, postfix_operators=[], prefix_operators=[], qualifier=end, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=toEpochDay, postfix_operators=[], prefix_operators=[], qualifier=calcDate, selectors=[], type_arguments=None), operator=-), type=BasicType(dimensions=[], name=int))]
else begin[{]
if[binary_operation[binary_operation[member[.totalMonths], <, literal[0]], &&, binary_operation[member[.days], >, literal[0]]]] begin[{]
member[.totalMonths]
assign[member[.days], call[end.lengthOfMonth, parameter[]]]
else begin[{]
None
end[}]
end[}]
local_variable[type[long], years]
local_variable[type[int], months]
return[call[Period.of, parameter[call[Math.toIntExact, parameter[member[.years]]], member[.months], member[.days]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Period] identifier[until] operator[SEP] identifier[ChronoLocalDate] identifier[endDateExclusive] operator[SEP] {
identifier[LocalDate] identifier[end] operator[=] identifier[LocalDate] operator[SEP] identifier[from] operator[SEP] identifier[endDateExclusive] operator[SEP] operator[SEP] Keyword[long] identifier[totalMonths] operator[=] identifier[end] operator[SEP] identifier[getProlepticMonth] operator[SEP] operator[SEP] operator[-] Keyword[this] operator[SEP] identifier[getProlepticMonth] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[days] operator[=] identifier[end] operator[SEP] identifier[day] operator[-] Keyword[this] operator[SEP] identifier[day] operator[SEP] Keyword[if] operator[SEP] identifier[totalMonths] operator[>] Other[0] operator[&&] identifier[days] operator[<] Other[0] operator[SEP] {
identifier[totalMonths] operator[--] operator[SEP] identifier[LocalDate] identifier[calcDate] operator[=] Keyword[this] operator[SEP] identifier[plusMonths] operator[SEP] identifier[totalMonths] operator[SEP] operator[SEP] identifier[days] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[end] operator[SEP] identifier[toEpochDay] operator[SEP] operator[SEP] operator[-] identifier[calcDate] operator[SEP] identifier[toEpochDay] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[totalMonths] operator[<] Other[0] operator[&&] identifier[days] operator[>] Other[0] operator[SEP] {
identifier[totalMonths] operator[++] operator[SEP] identifier[days] operator[-=] identifier[end] operator[SEP] identifier[lengthOfMonth] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[long] identifier[years] operator[=] identifier[totalMonths] operator[/] Other[12] operator[SEP] Keyword[int] identifier[months] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[totalMonths] operator[%] Other[12] operator[SEP] operator[SEP] Keyword[return] identifier[Period] operator[SEP] identifier[of] operator[SEP] identifier[Math] operator[SEP] identifier[toIntExact] operator[SEP] identifier[years] operator[SEP] , identifier[months] , identifier[days] operator[SEP] operator[SEP]
}
|
public void enable(AjaxRequestTarget ajaxRequestTarget, int index)
{
ajaxRequestTarget.appendJavaScript(this.enable(index).render().toString());
} | class class_name[name] begin[{]
method[enable, return_type[void], modifier[public], parameter[ajaxRequestTarget, index]] begin[{]
call[ajaxRequestTarget.appendJavaScript, parameter[THIS[call[None.enable, parameter[member[.index]]]call[None.render, parameter[]]call[None.toString, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[enable] operator[SEP] identifier[AjaxRequestTarget] identifier[ajaxRequestTarget] , Keyword[int] identifier[index] operator[SEP] {
identifier[ajaxRequestTarget] operator[SEP] identifier[appendJavaScript] operator[SEP] Keyword[this] operator[SEP] identifier[enable] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[render] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public double rand() {
if (k - Math.floor(k) != 0.0) {
throw new IllegalArgumentException("Gamma random number generator support only integer shape parameter.");
}
double r = 0.0;
for (int i = 0; i < k; i++) {
r += Math.log(Math.random());
}
r *= -theta;
return r;
} | class class_name[name] begin[{]
method[rand, return_type[type[double]], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[member[.k], -, call[Math.floor, parameter[member[.k]]]], !=, literal[0.0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Gamma random number generator support only integer shape parameter.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[double], r]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=random, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], member=log, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=k, 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[member[.r], member[.theta]]
return[member[.r]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[rand] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[k] operator[-] identifier[Math] operator[SEP] identifier[floor] operator[SEP] identifier[k] operator[SEP] operator[!=] literal[Float] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[double] identifier[r] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[k] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[r] operator[+=] identifier[Math] operator[SEP] identifier[log] operator[SEP] identifier[Math] operator[SEP] identifier[random] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[r] operator[*=] operator[-] identifier[theta] operator[SEP] Keyword[return] identifier[r] operator[SEP]
}
|
public void readBytes (Object to, long offset, int count) throws KryoException {
int copyCount = Math.min(limit - position, count);
while (true) {
unsafe.copyMemory(buffer, byteArrayBaseOffset + position, to, offset, copyCount);
position += copyCount;
count -= copyCount;
if (count == 0) break;
offset += copyCount;
copyCount = Math.min(count, capacity);
require(copyCount);
}
} | class class_name[name] begin[{]
method[readBytes, return_type[void], modifier[public], parameter[to, offset, count]] begin[{]
local_variable[type[int], copyCount]
while[literal[true]] begin[{]
call[unsafe.copyMemory, parameter[member[.buffer], binary_operation[member[.byteArrayBaseOffset], +, member[.position]], member[.to], member[.offset], member[.copyCount]]]
assign[member[.position], member[.copyCount]]
assign[member[.count], member[.copyCount]]
if[binary_operation[member[.count], ==, literal[0]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.offset], member[.copyCount]]
assign[member[.copyCount], call[Math.min, parameter[member[.count], member[.capacity]]]]
call[.require, parameter[member[.copyCount]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[readBytes] operator[SEP] identifier[Object] identifier[to] , Keyword[long] identifier[offset] , Keyword[int] identifier[count] operator[SEP] Keyword[throws] identifier[KryoException] {
Keyword[int] identifier[copyCount] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[limit] operator[-] identifier[position] , identifier[count] operator[SEP] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[unsafe] operator[SEP] identifier[copyMemory] operator[SEP] identifier[buffer] , identifier[byteArrayBaseOffset] operator[+] identifier[position] , identifier[to] , identifier[offset] , identifier[copyCount] operator[SEP] operator[SEP] identifier[position] operator[+=] identifier[copyCount] operator[SEP] identifier[count] operator[-=] identifier[copyCount] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[==] Other[0] operator[SEP] Keyword[break] operator[SEP] identifier[offset] operator[+=] identifier[copyCount] operator[SEP] identifier[copyCount] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[count] , identifier[capacity] operator[SEP] operator[SEP] identifier[require] operator[SEP] identifier[copyCount] operator[SEP] operator[SEP]
}
}
|
public static long count_filtered(nitro_service service, String wlmname, String filter) throws Exception{
lbwlm_lbvserver_binding obj = new lbwlm_lbvserver_binding();
obj.set_wlmname(wlmname);
options option = new options();
option.set_count(true);
option.set_filter(filter);
lbwlm_lbvserver_binding[] response = (lbwlm_lbvserver_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | class class_name[name] begin[{]
method[count_filtered, return_type[type[long]], modifier[public static], parameter[service, wlmname, filter]] begin[{]
local_variable[type[lbwlm_lbvserver_binding], obj]
call[obj.set_wlmname, parameter[member[.wlmname]]]
local_variable[type[options], option]
call[option.set_count, parameter[literal[true]]]
call[option.set_filter, parameter[member[.filter]]]
local_variable[type[lbwlm_lbvserver_binding], response]
if[binary_operation[member[.response], !=, literal[null]]] begin[{]
return[member[.response]]
else begin[{]
None
end[}]
return[literal[0]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[count_filtered] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[wlmname] , identifier[String] identifier[filter] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[lbwlm_lbvserver_binding] identifier[obj] operator[=] Keyword[new] identifier[lbwlm_lbvserver_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_wlmname] operator[SEP] identifier[wlmname] operator[SEP] operator[SEP] identifier[options] identifier[option] operator[=] Keyword[new] identifier[options] operator[SEP] operator[SEP] operator[SEP] identifier[option] operator[SEP] identifier[set_count] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[option] operator[SEP] identifier[set_filter] operator[SEP] identifier[filter] operator[SEP] operator[SEP] identifier[lbwlm_lbvserver_binding] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[lbwlm_lbvserver_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[getfiltered] operator[SEP] identifier[service] , identifier[option] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[response] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[__count] operator[SEP]
}
Keyword[return] Other[0] operator[SEP]
}
|
public Query<T> setRange(N start, N finish, boolean reversed, int count) {
slicePredicate.setRange(start, finish, reversed, count);
return this;
} | class class_name[name] begin[{]
method[setRange, return_type[type[Query]], modifier[public], parameter[start, finish, reversed, count]] begin[{]
call[slicePredicate.setRange, parameter[member[.start], member[.finish], member[.reversed], member[.count]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Query] operator[<] identifier[T] operator[>] identifier[setRange] operator[SEP] identifier[N] identifier[start] , identifier[N] identifier[finish] , Keyword[boolean] identifier[reversed] , Keyword[int] identifier[count] operator[SEP] {
identifier[slicePredicate] operator[SEP] identifier[setRange] operator[SEP] identifier[start] , identifier[finish] , identifier[reversed] , identifier[count] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public boolean canMerge(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing side)
{
IBlockState state = world.getBlockState(pos);
if (isCorner(state))
return false;
return EnumFacingUtils.getRealSide(state, side) != EnumFacing.NORTH;
} | class class_name[name] begin[{]
method[canMerge, return_type[type[boolean]], modifier[public], parameter[itemStack, player, world, pos, side]] begin[{]
local_variable[type[IBlockState], state]
if[call[.isCorner, parameter[member[.state]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[call[EnumFacingUtils.getRealSide, parameter[member[.state], member[.side]]], !=, member[EnumFacing.NORTH]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[canMerge] operator[SEP] identifier[ItemStack] identifier[itemStack] , identifier[EntityPlayer] identifier[player] , identifier[World] identifier[world] , identifier[BlockPos] identifier[pos] , identifier[EnumFacing] identifier[side] operator[SEP] {
identifier[IBlockState] identifier[state] operator[=] identifier[world] operator[SEP] identifier[getBlockState] operator[SEP] identifier[pos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isCorner] operator[SEP] identifier[state] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] identifier[EnumFacingUtils] operator[SEP] identifier[getRealSide] operator[SEP] identifier[state] , identifier[side] operator[SEP] operator[!=] identifier[EnumFacing] operator[SEP] identifier[NORTH] operator[SEP]
}
|
private void setData(BridgeStatusInfo bridgeStatusInfo) {
setCpuUsage(bridgeStatusInfo.getCpuUsage());
setMemoryUsage(bridgeStatusInfo.getMemoryUsage());
threadCount = bridgeStatusInfo.getThreadCount();
totalMemory = bridgeStatusInfo.getTotalMemory();
intervalAverageJitter = bridgeStatusInfo.getAvgIntervalJitter();
intervalAverageRtt = bridgeStatusInfo.getAvgIntervalRtt();
totalRtpLostPackets = (long) bridgeStatusInfo.getTotalLoss();
audioFabricCount = bridgeStatusInfo.getAudioFabricCount();
videoFabricCount = bridgeStatusInfo.getVideoFabricCount();
conferenceCount = bridgeStatusInfo.getConferenceCount();
intervalDownloadBitrate = bridgeStatusInfo.getIntervalDownloadBitRate();
intervalUploadBitrate = bridgeStatusInfo.getIntervalUploadBitRate();
participantsCount = bridgeStatusInfo.getParticipantsCount();
intervalReceivedBytes = bridgeStatusInfo.getIntervalReceivedBytes();
intervalSentBytes = bridgeStatusInfo.getIntervalSentBytes();
intervalRtpFractionLoss = bridgeStatusInfo.getIntervalRtpFractionLoss();
} | class class_name[name] begin[{]
method[setData, return_type[void], modifier[private], parameter[bridgeStatusInfo]] begin[{]
call[.setCpuUsage, parameter[call[bridgeStatusInfo.getCpuUsage, parameter[]]]]
call[.setMemoryUsage, parameter[call[bridgeStatusInfo.getMemoryUsage, parameter[]]]]
assign[member[.threadCount], call[bridgeStatusInfo.getThreadCount, parameter[]]]
assign[member[.totalMemory], call[bridgeStatusInfo.getTotalMemory, parameter[]]]
assign[member[.intervalAverageJitter], call[bridgeStatusInfo.getAvgIntervalJitter, parameter[]]]
assign[member[.intervalAverageRtt], call[bridgeStatusInfo.getAvgIntervalRtt, parameter[]]]
assign[member[.totalRtpLostPackets], Cast(expression=MethodInvocation(arguments=[], member=getTotalLoss, postfix_operators=[], prefix_operators=[], qualifier=bridgeStatusInfo, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=long))]
assign[member[.audioFabricCount], call[bridgeStatusInfo.getAudioFabricCount, parameter[]]]
assign[member[.videoFabricCount], call[bridgeStatusInfo.getVideoFabricCount, parameter[]]]
assign[member[.conferenceCount], call[bridgeStatusInfo.getConferenceCount, parameter[]]]
assign[member[.intervalDownloadBitrate], call[bridgeStatusInfo.getIntervalDownloadBitRate, parameter[]]]
assign[member[.intervalUploadBitrate], call[bridgeStatusInfo.getIntervalUploadBitRate, parameter[]]]
assign[member[.participantsCount], call[bridgeStatusInfo.getParticipantsCount, parameter[]]]
assign[member[.intervalReceivedBytes], call[bridgeStatusInfo.getIntervalReceivedBytes, parameter[]]]
assign[member[.intervalSentBytes], call[bridgeStatusInfo.getIntervalSentBytes, parameter[]]]
assign[member[.intervalRtpFractionLoss], call[bridgeStatusInfo.getIntervalRtpFractionLoss, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setData] operator[SEP] identifier[BridgeStatusInfo] identifier[bridgeStatusInfo] operator[SEP] {
identifier[setCpuUsage] operator[SEP] identifier[bridgeStatusInfo] operator[SEP] identifier[getCpuUsage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setMemoryUsage] operator[SEP] identifier[bridgeStatusInfo] operator[SEP] identifier[getMemoryUsage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[threadCount] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getThreadCount] operator[SEP] operator[SEP] operator[SEP] identifier[totalMemory] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getTotalMemory] operator[SEP] operator[SEP] operator[SEP] identifier[intervalAverageJitter] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getAvgIntervalJitter] operator[SEP] operator[SEP] operator[SEP] identifier[intervalAverageRtt] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getAvgIntervalRtt] operator[SEP] operator[SEP] operator[SEP] identifier[totalRtpLostPackets] operator[=] operator[SEP] Keyword[long] operator[SEP] identifier[bridgeStatusInfo] operator[SEP] identifier[getTotalLoss] operator[SEP] operator[SEP] operator[SEP] identifier[audioFabricCount] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getAudioFabricCount] operator[SEP] operator[SEP] operator[SEP] identifier[videoFabricCount] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getVideoFabricCount] operator[SEP] operator[SEP] operator[SEP] identifier[conferenceCount] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getConferenceCount] operator[SEP] operator[SEP] operator[SEP] identifier[intervalDownloadBitrate] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getIntervalDownloadBitRate] operator[SEP] operator[SEP] operator[SEP] identifier[intervalUploadBitrate] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getIntervalUploadBitRate] operator[SEP] operator[SEP] operator[SEP] identifier[participantsCount] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getParticipantsCount] operator[SEP] operator[SEP] operator[SEP] identifier[intervalReceivedBytes] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getIntervalReceivedBytes] operator[SEP] operator[SEP] operator[SEP] identifier[intervalSentBytes] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getIntervalSentBytes] operator[SEP] operator[SEP] operator[SEP] identifier[intervalRtpFractionLoss] operator[=] identifier[bridgeStatusInfo] operator[SEP] identifier[getIntervalRtpFractionLoss] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public final int next() throws XMLStreamException
{
/* 24-Sep-2006, TSa: We may have deferred an exception that occurred
* during parsing of the previous event. If so, now it needs to
* be thrown.
*/
if (mPendingException != null) {
XMLStreamException strEx = mPendingException;
mPendingException = null;
throw strEx;
}
/* Note: can not yet accurately record the location, since the
* previous event might not yet be completely finished...
*/
if (mParseState == STATE_TREE) {
int type = nextFromTree();
mCurrToken = type;
if (mTokenState < mStTextThreshold) { // incomplete?
/* Can remain incomplete if lazy parsing is enabled,
* and this is not a validatable text segment; otherwise
* must finish
*/
if (!mCfgLazyParsing ||
(mValidateText && (type == CHARACTERS || type == CDATA))) {
finishToken(false);
}
}
/* Special cases -- sometimes (when coalescing text, or
* when specifically configured to do so), CDATA and SPACE are
* to be reported as CHARACTERS, although we still will
* internally keep track of the real type.
*/
if (type == CDATA) {
if (mValidateText) {
mElementStack.validateText(mTextBuffer, false);
}
if (mCfgCoalesceText || mCfgReportTextAsChars) {
return CHARACTERS;
}
/*
} else if (type == SPACE) {
//if (mValidateText) { throw new IllegalStateException("Internal error: trying to validate SPACE event"); }
*/
mCurrTextLength += mTextBuffer.size();
verifyLimit("Text size", mConfig.getMaxTextLength(), mCurrTextLength);
} else if (type == CHARACTERS) {
if (mValidateText) {
/* We may be able to determine that there will be
* no more text coming for this element: but only
* seeing the end tag marker ("</") is certain
* (PIs and comments won't do, nor CDATA; start
* element possibly... but that indicates mixed
* content that's generally non-validatable)
*/
if ((mInputPtr+1) < mInputEnd
&& mInputBuffer[mInputPtr] == '<'
&& mInputBuffer[mInputPtr+1] == '/') {
// yup, it's all there is
mElementStack.validateText(mTextBuffer, true);
} else {
mElementStack.validateText(mTextBuffer, false);
}
}
mCurrTextLength += mTextBuffer.size();
verifyLimit("Text size", mConfig.getMaxTextLength(), mCurrTextLength);
} else if (type == START_ELEMENT || type == END_ELEMENT) {
this.mCurrTextLength = 0;
}
return type;
}
if (mParseState == STATE_PROLOG) {
nextFromProlog(true);
} else if (mParseState == STATE_EPILOG) {
if (nextFromProlog(false)) {
// We'll return END_DOCUMENT, need to mark it 'as consumed'
mSecondaryToken = 0;
}
} else if (mParseState == STATE_MULTIDOC_HACK) {
mCurrToken = nextFromMultiDocState();
} else { // == STATE_CLOSED
if (mSecondaryToken == END_DOCUMENT) { // marker
mSecondaryToken = 0; // mark end doc as consumed
return END_DOCUMENT;
}
throw new java.util.NoSuchElementException();
}
return mCurrToken;
} | class class_name[name] begin[{]
method[next, return_type[type[int]], modifier[final public], parameter[]] begin[{]
if[binary_operation[member[.mPendingException], !=, literal[null]]] begin[{]
local_variable[type[XMLStreamException], strEx]
assign[member[.mPendingException], literal[null]]
ThrowStatement(expression=MemberReference(member=strEx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.mParseState], ==, member[.STATE_TREE]]] begin[{]
local_variable[type[int], type]
assign[member[.mCurrToken], member[.type]]
if[binary_operation[member[.mTokenState], <, member[.mStTextThreshold]]] begin[{]
if[binary_operation[member[.mCfgLazyParsing], ||, binary_operation[member[.mValidateText], &&, binary_operation[binary_operation[member[.type], ==, member[.CHARACTERS]], ||, binary_operation[member[.type], ==, member[.CDATA]]]]]] begin[{]
call[.finishToken, parameter[literal[false]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.type], ==, member[.CDATA]]] begin[{]
if[member[.mValidateText]] begin[{]
call[mElementStack.validateText, parameter[member[.mTextBuffer], literal[false]]]
else begin[{]
None
end[}]
if[binary_operation[member[.mCfgCoalesceText], ||, member[.mCfgReportTextAsChars]]] begin[{]
return[member[.CHARACTERS]]
else begin[{]
None
end[}]
assign[member[.mCurrTextLength], call[mTextBuffer.size, parameter[]]]
call[.verifyLimit, parameter[literal["Text size"], call[mConfig.getMaxTextLength, parameter[]], member[.mCurrTextLength]]]
else begin[{]
if[binary_operation[member[.type], ==, member[.CHARACTERS]]] begin[{]
if[member[.mValidateText]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.mInputPtr], +, literal[1]], <, member[.mInputEnd]], &&, binary_operation[member[.mInputBuffer], ==, literal['<']]], &&, binary_operation[member[.mInputBuffer], ==, literal['/']]]] begin[{]
call[mElementStack.validateText, parameter[member[.mTextBuffer], literal[true]]]
else begin[{]
call[mElementStack.validateText, parameter[member[.mTextBuffer], literal[false]]]
end[}]
else begin[{]
None
end[}]
assign[member[.mCurrTextLength], call[mTextBuffer.size, parameter[]]]
call[.verifyLimit, parameter[literal["Text size"], call[mConfig.getMaxTextLength, parameter[]], member[.mCurrTextLength]]]
else begin[{]
if[binary_operation[binary_operation[member[.type], ==, member[.START_ELEMENT]], ||, binary_operation[member[.type], ==, member[.END_ELEMENT]]]] begin[{]
assign[THIS[member[None.mCurrTextLength]], literal[0]]
else begin[{]
None
end[}]
end[}]
end[}]
return[member[.type]]
else begin[{]
None
end[}]
if[binary_operation[member[.mParseState], ==, member[.STATE_PROLOG]]] begin[{]
call[.nextFromProlog, parameter[literal[true]]]
else begin[{]
if[binary_operation[member[.mParseState], ==, member[.STATE_EPILOG]]] begin[{]
if[call[.nextFromProlog, parameter[literal[false]]]] begin[{]
assign[member[.mSecondaryToken], literal[0]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.mParseState], ==, member[.STATE_MULTIDOC_HACK]]] begin[{]
assign[member[.mCurrToken], call[.nextFromMultiDocState, parameter[]]]
else begin[{]
if[binary_operation[member[.mSecondaryToken], ==, member[.END_DOCUMENT]]] begin[{]
assign[member[.mSecondaryToken], literal[0]]
return[member[.END_DOCUMENT]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=None, dimensions=None, name=NoSuchElementException, sub_type=None)))), label=None)
end[}]
end[}]
end[}]
return[member[.mCurrToken]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[int] identifier[next] operator[SEP] operator[SEP] Keyword[throws] identifier[XMLStreamException] {
Keyword[if] operator[SEP] identifier[mPendingException] operator[!=] Other[null] operator[SEP] {
identifier[XMLStreamException] identifier[strEx] operator[=] identifier[mPendingException] operator[SEP] identifier[mPendingException] operator[=] Other[null] operator[SEP] Keyword[throw] identifier[strEx] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mParseState] operator[==] identifier[STATE_TREE] operator[SEP] {
Keyword[int] identifier[type] operator[=] identifier[nextFromTree] operator[SEP] operator[SEP] operator[SEP] identifier[mCurrToken] operator[=] identifier[type] operator[SEP] Keyword[if] operator[SEP] identifier[mTokenState] operator[<] identifier[mStTextThreshold] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[mCfgLazyParsing] operator[||] operator[SEP] identifier[mValidateText] operator[&&] operator[SEP] identifier[type] operator[==] identifier[CHARACTERS] operator[||] identifier[type] operator[==] identifier[CDATA] operator[SEP] operator[SEP] operator[SEP] {
identifier[finishToken] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[type] operator[==] identifier[CDATA] operator[SEP] {
Keyword[if] operator[SEP] identifier[mValidateText] operator[SEP] {
identifier[mElementStack] operator[SEP] identifier[validateText] operator[SEP] identifier[mTextBuffer] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mCfgCoalesceText] operator[||] identifier[mCfgReportTextAsChars] operator[SEP] {
Keyword[return] identifier[CHARACTERS] operator[SEP]
}
identifier[mCurrTextLength] operator[+=] identifier[mTextBuffer] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[verifyLimit] operator[SEP] literal[String] , identifier[mConfig] operator[SEP] identifier[getMaxTextLength] operator[SEP] operator[SEP] , identifier[mCurrTextLength] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[CHARACTERS] operator[SEP] {
Keyword[if] operator[SEP] identifier[mValidateText] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[mInputPtr] operator[+] Other[1] operator[SEP] operator[<] identifier[mInputEnd] operator[&&] identifier[mInputBuffer] operator[SEP] identifier[mInputPtr] operator[SEP] operator[==] literal[String] operator[&&] identifier[mInputBuffer] operator[SEP] identifier[mInputPtr] operator[+] Other[1] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[mElementStack] operator[SEP] identifier[validateText] operator[SEP] identifier[mTextBuffer] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[mElementStack] operator[SEP] identifier[validateText] operator[SEP] identifier[mTextBuffer] , literal[boolean] operator[SEP] operator[SEP]
}
}
identifier[mCurrTextLength] operator[+=] identifier[mTextBuffer] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[verifyLimit] operator[SEP] literal[String] , identifier[mConfig] operator[SEP] identifier[getMaxTextLength] operator[SEP] operator[SEP] , identifier[mCurrTextLength] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[START_ELEMENT] operator[||] identifier[type] operator[==] identifier[END_ELEMENT] operator[SEP] {
Keyword[this] operator[SEP] identifier[mCurrTextLength] operator[=] Other[0] operator[SEP]
}
Keyword[return] identifier[type] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mParseState] operator[==] identifier[STATE_PROLOG] operator[SEP] {
identifier[nextFromProlog] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[mParseState] operator[==] identifier[STATE_EPILOG] operator[SEP] {
Keyword[if] operator[SEP] identifier[nextFromProlog] operator[SEP] literal[boolean] operator[SEP] operator[SEP] {
identifier[mSecondaryToken] operator[=] Other[0] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[mParseState] operator[==] identifier[STATE_MULTIDOC_HACK] operator[SEP] {
identifier[mCurrToken] operator[=] identifier[nextFromMultiDocState] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[mSecondaryToken] operator[==] identifier[END_DOCUMENT] operator[SEP] {
identifier[mSecondaryToken] operator[=] Other[0] operator[SEP] Keyword[return] identifier[END_DOCUMENT] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[NoSuchElementException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[mCurrToken] operator[SEP]
}
|
public String formatPOJO2JSON(Object pojo) {
StringWriter stringWriter = new StringWriter();
String json = "";
try {
JsonGenerator gen = new JsonFactory()
.createJsonGenerator(stringWriter);
MAPPER.writeValue(gen, pojo);
gen.close();
json = stringWriter.toString();
} catch (Exception e) {
LOGGER.error(pojo.getClass().getName() + "转json出错", e);
}
return json;
} | class class_name[name] begin[{]
method[formatPOJO2JSON, return_type[type[String]], modifier[public], parameter[pojo]] begin[{]
local_variable[type[StringWriter], stringWriter]
local_variable[type[String], json]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=stringWriter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createJsonGenerator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JsonFactory, sub_type=None)), name=gen)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonGenerator, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pojo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeValue, postfix_operators=[], prefix_operators=[], qualifier=MAPPER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=gen, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=json, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=stringWriter, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=pojo, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="转json出错"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.json]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[formatPOJO2JSON] operator[SEP] identifier[Object] identifier[pojo] operator[SEP] {
identifier[StringWriter] identifier[stringWriter] operator[=] Keyword[new] identifier[StringWriter] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[json] operator[=] literal[String] operator[SEP] Keyword[try] {
identifier[JsonGenerator] identifier[gen] operator[=] Keyword[new] identifier[JsonFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createJsonGenerator] operator[SEP] identifier[stringWriter] operator[SEP] operator[SEP] identifier[MAPPER] operator[SEP] identifier[writeValue] operator[SEP] identifier[gen] , identifier[pojo] operator[SEP] operator[SEP] identifier[gen] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[json] operator[=] identifier[stringWriter] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] identifier[pojo] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[json] operator[SEP]
}
|
private static boolean isBundledInJre(String className) {
if (className.startsWith("javax.accessibility.")
|| className.startsWith("javax.activation.")
|| className.startsWith("javax.activity.")
|| className.startsWith("javax.annotation.")
|| className.startsWith("javax.crypto.")
|| className.startsWith("javax.imageio.")
|| className.startsWith("javax.jws.")
|| className.startsWith("javax.lang.model.")
|| className.startsWith("javax.management.")
|| className.startsWith("javax.naming.")
|| className.startsWith("javax.net.")
|| className.startsWith("javax.print.")
|| className.startsWith("javax.rmi.")
|| className.startsWith("javax.script.")
|| className.startsWith("javax.security.")
|| className.startsWith("javax.sound.")
|| className.startsWith("javax.sql.")
|| className.startsWith("javax.swing.")
|| className.startsWith("javax.tools.")
|| className.startsWith("javax.transaction.")
|| className.startsWith("javax.xml.")) {
return true;
}
return false;
} | class class_name[name] begin[{]
method[isBundledInJre, return_type[type[boolean]], modifier[private static], parameter[className]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[call[className.startsWith, parameter[literal["javax.accessibility."]]], ||, call[className.startsWith, parameter[literal["javax.activation."]]]], ||, call[className.startsWith, parameter[literal["javax.activity."]]]], ||, call[className.startsWith, parameter[literal["javax.annotation."]]]], ||, call[className.startsWith, parameter[literal["javax.crypto."]]]], ||, call[className.startsWith, parameter[literal["javax.imageio."]]]], ||, call[className.startsWith, parameter[literal["javax.jws."]]]], ||, call[className.startsWith, parameter[literal["javax.lang.model."]]]], ||, call[className.startsWith, parameter[literal["javax.management."]]]], ||, call[className.startsWith, parameter[literal["javax.naming."]]]], ||, call[className.startsWith, parameter[literal["javax.net."]]]], ||, call[className.startsWith, parameter[literal["javax.print."]]]], ||, call[className.startsWith, parameter[literal["javax.rmi."]]]], ||, call[className.startsWith, parameter[literal["javax.script."]]]], ||, call[className.startsWith, parameter[literal["javax.security."]]]], ||, call[className.startsWith, parameter[literal["javax.sound."]]]], ||, call[className.startsWith, parameter[literal["javax.sql."]]]], ||, call[className.startsWith, parameter[literal["javax.swing."]]]], ||, call[className.startsWith, parameter[literal["javax.tools."]]]], ||, call[className.startsWith, parameter[literal["javax.transaction."]]]], ||, call[className.startsWith, parameter[literal["javax.xml."]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[isBundledInJre] operator[SEP] identifier[String] identifier[className] operator[SEP] {
Keyword[if] operator[SEP] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public List<SAXParseException> getInstanceErrors(Source instance) {
try {
return problemToExceptionList(validator.validateInstance(instance).
getProblems());
} catch (XMLUnitException e) {
throw new XMLUnitRuntimeException(e.getMessage(), e.getCause());
}
} | class class_name[name] begin[{]
method[getInstanceErrors, return_type[type[List]], modifier[public], parameter[instance]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=instance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=validateInstance, postfix_operators=[], prefix_operators=[], qualifier=validator, selectors=[MethodInvocation(arguments=[], member=getProblems, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=problemToExceptionList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XMLUnitRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['XMLUnitException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[SAXParseException] operator[>] identifier[getInstanceErrors] operator[SEP] identifier[Source] identifier[instance] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[problemToExceptionList] operator[SEP] identifier[validator] operator[SEP] identifier[validateInstance] operator[SEP] identifier[instance] operator[SEP] operator[SEP] identifier[getProblems] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[XMLUnitException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[XMLUnitRuntimeException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public String getEthernetAddress() {
if (m_ethernetAddress == null) {
String address = getExtProperty("server.ethernet.address");
m_ethernetAddress = CmsStringUtil.isNotEmpty(address) ? address : CmsStringUtil.getEthernetAddress();
}
return m_ethernetAddress;
} | class class_name[name] begin[{]
method[getEthernetAddress, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.m_ethernetAddress], ==, literal[null]]] begin[{]
local_variable[type[String], address]
assign[member[.m_ethernetAddress], TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotEmpty, postfix_operators=[], prefix_operators=[], qualifier=CmsStringUtil, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[], member=getEthernetAddress, postfix_operators=[], prefix_operators=[], qualifier=CmsStringUtil, selectors=[], type_arguments=None), if_true=MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
else begin[{]
None
end[}]
return[member[.m_ethernetAddress]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getEthernetAddress] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_ethernetAddress] operator[==] Other[null] operator[SEP] {
identifier[String] identifier[address] operator[=] identifier[getExtProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[m_ethernetAddress] operator[=] identifier[CmsStringUtil] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[address] operator[SEP] operator[?] identifier[address] operator[:] identifier[CmsStringUtil] operator[SEP] identifier[getEthernetAddress] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[m_ethernetAddress] operator[SEP]
}
|
public void sendAuditEvent(AuditEventMessage[] msgs, InetAddress destination, int port) throws Exception
{
if (!EventUtils.isEmptyOrNull(msgs)) {
// Check to validate port
int portToUse = getTransportPort(port);
DatagramSocket socket = new DatagramSocket();
for (int i=0; i<msgs.length; i++) {
byte[] msgBytes = getTransportPayload(msgs[i]);
send(msgBytes, socket, destination, portToUse);
}
socket.close();
}
} | class class_name[name] begin[{]
method[sendAuditEvent, return_type[void], modifier[public], parameter[msgs, destination, port]] begin[{]
if[call[EventUtils.isEmptyOrNull, parameter[member[.msgs]]]] begin[{]
local_variable[type[int], portToUse]
local_variable[type[DatagramSocket], socket]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=getTransportPayload, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=msgBytes)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=msgBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=socket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=portToUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=send, 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=length, postfix_operators=[], prefix_operators=[], qualifier=msgs, 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[socket.close, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[sendAuditEvent] operator[SEP] identifier[AuditEventMessage] operator[SEP] operator[SEP] identifier[msgs] , identifier[InetAddress] identifier[destination] , Keyword[int] identifier[port] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] operator[!] identifier[EventUtils] operator[SEP] identifier[isEmptyOrNull] operator[SEP] identifier[msgs] operator[SEP] operator[SEP] {
Keyword[int] identifier[portToUse] operator[=] identifier[getTransportPort] operator[SEP] identifier[port] operator[SEP] operator[SEP] identifier[DatagramSocket] identifier[socket] operator[=] Keyword[new] identifier[DatagramSocket] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[msgs] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[msgBytes] operator[=] identifier[getTransportPayload] operator[SEP] identifier[msgs] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[send] operator[SEP] identifier[msgBytes] , identifier[socket] , identifier[destination] , identifier[portToUse] operator[SEP] operator[SEP]
}
identifier[socket] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "coord")
public JAXBElement<CoordType> createCoord(CoordType value) {
return new JAXBElement<CoordType>(_Coord_QNAME, CoordType.class, null, value);
} | class class_name[name] begin[{]
method[createCoord, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_Coord_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CoordType, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CoordType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[CoordType] operator[>] identifier[createCoord] operator[SEP] identifier[CoordType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[CoordType] operator[>] operator[SEP] identifier[_Coord_QNAME] , identifier[CoordType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public Document loadDocument( String location ) throws Exception
{
File file = fileAt( location );
if (!file.exists()) throw new DocumentNotFoundException( file.getAbsolutePath() );
return loadHtmlDocument( file );
} | class class_name[name] begin[{]
method[loadDocument, return_type[type[Document]], modifier[public], parameter[location]] begin[{]
local_variable[type[File], file]
if[call[file.exists, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DocumentNotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.loadHtmlDocument, parameter[member[.file]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Document] identifier[loadDocument] operator[SEP] identifier[String] identifier[location] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[File] identifier[file] operator[=] identifier[fileAt] operator[SEP] identifier[location] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[file] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[DocumentNotFoundException] operator[SEP] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[loadHtmlDocument] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
|
protected void error(E error) {
this.error = checkNotNull(error);
this.completed = true;
for (Callback<T, E> callback : toBeNotified) {
callback.error(error);
}
} | class class_name[name] begin[{]
method[error, return_type[void], modifier[protected], parameter[error]] begin[{]
assign[THIS[member[None.error]], call[.checkNotNull, parameter[member[.error]]]]
assign[THIS[member[None.completed]], literal[true]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=callback, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=toBeNotified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=callback)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=[], name=Callback, sub_type=None))), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[error] operator[SEP] identifier[E] identifier[error] operator[SEP] {
Keyword[this] operator[SEP] identifier[error] operator[=] identifier[checkNotNull] operator[SEP] identifier[error] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[completed] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Callback] operator[<] identifier[T] , identifier[E] operator[>] identifier[callback] operator[:] identifier[toBeNotified] operator[SEP] {
identifier[callback] operator[SEP] identifier[error] operator[SEP] identifier[error] operator[SEP] operator[SEP]
}
}
|
protected String translateFilePathUsingPrefix(String file, String prefix) throws IOException {
if (file.equals(prefix)) {
return ".";
}
String result = new File(file).getCanonicalPath().substring(prefix.length() + 1);
if (File.separatorChar != '/') {
result = result.replace(File.separatorChar, '/');
}
return result;
} | class class_name[name] begin[{]
method[translateFilePathUsingPrefix, return_type[type[String]], modifier[protected], parameter[file, prefix]] begin[{]
if[call[file.equals, parameter[member[.prefix]]]] begin[{]
return[literal["."]]
else begin[{]
None
end[}]
local_variable[type[String], result]
if[binary_operation[member[File.separatorChar], !=, literal['/']]] begin[{]
assign[member[.result], call[result.replace, parameter[member[File.separatorChar], literal['/']]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[translateFilePathUsingPrefix] operator[SEP] identifier[String] identifier[file] , identifier[String] identifier[prefix] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[equals] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
identifier[String] identifier[result] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[getCanonicalPath] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] identifier[prefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[File] operator[SEP] identifier[separatorChar] operator[!=] literal[String] operator[SEP] {
identifier[result] operator[=] identifier[result] operator[SEP] identifier[replace] operator[SEP] identifier[File] operator[SEP] identifier[separatorChar] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
protected ConversionDirectionType getDirection(Conversion conv, Pathway pathway, Control cont)
{
for (Control ctrl : getControlChain(cont, conv))
{
ConversionDirectionType dir = getCatalysisDirection(ctrl);
if (dir != null) return dir;
}
Set<StepDirection> dirs = new HashSet<StepDirection>();
Set<PathwayStep> convSteps = conv.getStepProcessOf();
// maybe the direction is embedded in a pathway step
for (PathwayStep step : cont.getStepProcessOf())
{
if (pathway != null && !step.getPathwayOrderOf().equals(pathway)) continue;
if (step instanceof BiochemicalPathwayStep && convSteps.contains(step))
{
StepDirection dir = ((BiochemicalPathwayStep) step).getStepDirection();
if (dir != null) dirs.add(dir);
}
}
if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE;
else if (!dirs.isEmpty()) return convertStepDirection(dirs.iterator().next());
return getDirection(conv);
} | class class_name[name] begin[{]
method[getDirection, return_type[type[ConversionDirectionType]], modifier[protected], parameter[conv, pathway, cont]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ctrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCatalysisDirection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=dir)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ConversionDirectionType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dir, 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=ReturnStatement(expression=MemberReference(member=dir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=cont, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=conv, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getControlChain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ctrl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Control, sub_type=None))), label=None)
local_variable[type[Set], dirs]
local_variable[type[Set], convSteps]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=pathway, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=getPathwayOrderOf, postfix_operators=[], prefix_operators=['!'], qualifier=step, selectors=[MethodInvocation(arguments=[MemberReference(member=pathway, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=BiochemicalPathwayStep, sub_type=None), operator=instanceof), operandr=MethodInvocation(arguments=[MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=convSteps, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BiochemicalPathwayStep, sub_type=None)), name=dir)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StepDirection, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dir, 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=dir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=dirs, selectors=[], type_arguments=None), label=None))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getStepProcessOf, postfix_operators=[], prefix_operators=[], qualifier=cont, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=step)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PathwayStep, sub_type=None))), label=None)
if[binary_operation[call[dirs.size, parameter[]], >, literal[1]]] begin[{]
return[member[ConversionDirectionType.REVERSIBLE]]
else begin[{]
if[call[dirs.isEmpty, parameter[]]] begin[{]
return[call[.convertStepDirection, parameter[call[dirs.iterator, parameter[]]]]]
else begin[{]
None
end[}]
end[}]
return[call[.getDirection, parameter[member[.conv]]]]
end[}]
END[}] | Keyword[protected] identifier[ConversionDirectionType] identifier[getDirection] operator[SEP] identifier[Conversion] identifier[conv] , identifier[Pathway] identifier[pathway] , identifier[Control] identifier[cont] operator[SEP] {
Keyword[for] operator[SEP] identifier[Control] identifier[ctrl] operator[:] identifier[getControlChain] operator[SEP] identifier[cont] , identifier[conv] operator[SEP] operator[SEP] {
identifier[ConversionDirectionType] identifier[dir] operator[=] identifier[getCatalysisDirection] operator[SEP] identifier[ctrl] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dir] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[dir] operator[SEP]
}
identifier[Set] operator[<] identifier[StepDirection] operator[>] identifier[dirs] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[StepDirection] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[PathwayStep] operator[>] identifier[convSteps] operator[=] identifier[conv] operator[SEP] identifier[getStepProcessOf] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[PathwayStep] identifier[step] operator[:] identifier[cont] operator[SEP] identifier[getStepProcessOf] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[pathway] operator[!=] Other[null] operator[&&] operator[!] identifier[step] operator[SEP] identifier[getPathwayOrderOf] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[pathway] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[if] operator[SEP] identifier[step] Keyword[instanceof] identifier[BiochemicalPathwayStep] operator[&&] identifier[convSteps] operator[SEP] identifier[contains] operator[SEP] identifier[step] operator[SEP] operator[SEP] {
identifier[StepDirection] identifier[dir] operator[=] operator[SEP] operator[SEP] identifier[BiochemicalPathwayStep] operator[SEP] identifier[step] operator[SEP] operator[SEP] identifier[getStepDirection] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dir] operator[!=] Other[null] operator[SEP] identifier[dirs] operator[SEP] identifier[add] operator[SEP] identifier[dir] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[dirs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] Keyword[return] identifier[ConversionDirectionType] operator[SEP] identifier[REVERSIBLE] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[dirs] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[convertStepDirection] operator[SEP] identifier[dirs] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getDirection] operator[SEP] identifier[conv] operator[SEP] operator[SEP]
}
|
protected String getStringSetting(String name, String defaultValue) {
if (settings.containsKey(name)) {
return settings.get(name).toString();
} else {
return defaultValue;
}
} | class class_name[name] begin[{]
method[getStringSetting, return_type[type[String]], modifier[protected], parameter[name, defaultValue]] begin[{]
if[call[settings.containsKey, parameter[member[.name]]]] begin[{]
return[call[settings.get, parameter[member[.name]]]]
else begin[{]
return[member[.defaultValue]]
end[}]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[getStringSetting] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[defaultValue] operator[SEP] {
Keyword[if] operator[SEP] identifier[settings] operator[SEP] identifier[containsKey] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[settings] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[defaultValue] operator[SEP]
}
}
|
@SuppressWarnings({"rawtypes"})
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector)
{
super.open(conf, context, collector);
Number timeout = (Number) conf.get(KESTREL_TIMEOUT);
this.messageTimeoutMs = (int) TimeUnit.SECONDS.toMillis(timeout.intValue());
this.restrictWatcher = new RestrictWatcher(this.restrictFilePath);
// Spoutの番号に併せて取得対象となるQueue番号をQueue名称に設定
int componentIndex = context.getThisTaskIndex();
String baseQueueName = getQueueName();
String queueName = baseQueueName + "_" + componentIndex;
setQueueName(queueName);
} | class class_name[name] begin[{]
method[open, return_type[void], modifier[public], parameter[conf, context, collector]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=conf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=collector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=open, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[Number], timeout]
assign[THIS[member[None.messageTimeoutMs]], Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=intValue, postfix_operators=[], prefix_operators=[], qualifier=timeout, selectors=[], type_arguments=None)], member=toMillis, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit.SECONDS, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]
assign[THIS[member[None.restrictWatcher]], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=restrictFilePath, 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=RestrictWatcher, sub_type=None))]
local_variable[type[int], componentIndex]
local_variable[type[String], baseQueueName]
local_variable[type[String], queueName]
call[.setQueueName, parameter[member[.queueName]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String]
} operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[open] operator[SEP] identifier[Map] identifier[conf] , identifier[TopologyContext] identifier[context] , identifier[SpoutOutputCollector] identifier[collector] operator[SEP] {
Keyword[super] operator[SEP] identifier[open] operator[SEP] identifier[conf] , identifier[context] , identifier[collector] operator[SEP] operator[SEP] identifier[Number] identifier[timeout] operator[=] operator[SEP] identifier[Number] operator[SEP] identifier[conf] operator[SEP] identifier[get] operator[SEP] identifier[KESTREL_TIMEOUT] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[messageTimeoutMs] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] identifier[toMillis] operator[SEP] identifier[timeout] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[restrictWatcher] operator[=] Keyword[new] identifier[RestrictWatcher] operator[SEP] Keyword[this] operator[SEP] identifier[restrictFilePath] operator[SEP] operator[SEP] Keyword[int] identifier[componentIndex] operator[=] identifier[context] operator[SEP] identifier[getThisTaskIndex] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[baseQueueName] operator[=] identifier[getQueueName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[queueName] operator[=] identifier[baseQueueName] operator[+] literal[String] operator[+] identifier[componentIndex] operator[SEP] identifier[setQueueName] operator[SEP] identifier[queueName] operator[SEP] operator[SEP]
}
|
public static List<File> listFileWithWildcardFileName(final File rootDir, final String fileNamePattern) {
return Files.fileTreeTraverser().preOrderTraversal(rootDir).filter(new WildcardFileNameFilter(fileNamePattern))
.toList();
} | class class_name[name] begin[{]
method[listFileWithWildcardFileName, return_type[type[List]], modifier[public static], parameter[rootDir, fileNamePattern]] begin[{]
return[call[Files.fileTreeTraverser, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[File] operator[>] identifier[listFileWithWildcardFileName] operator[SEP] Keyword[final] identifier[File] identifier[rootDir] , Keyword[final] identifier[String] identifier[fileNamePattern] operator[SEP] {
Keyword[return] identifier[Files] operator[SEP] identifier[fileTreeTraverser] operator[SEP] operator[SEP] operator[SEP] identifier[preOrderTraversal] operator[SEP] identifier[rootDir] operator[SEP] operator[SEP] identifier[filter] operator[SEP] Keyword[new] identifier[WildcardFileNameFilter] operator[SEP] identifier[fileNamePattern] operator[SEP] operator[SEP] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP]
}
|
private ResourceBundle getBundle(Locale locale) {
return ResourceBundle.getBundle(bundleName, locale, loader, new UTF8Control());
} | class class_name[name] begin[{]
method[getBundle, return_type[type[ResourceBundle]], modifier[private], parameter[locale]] begin[{]
return[call[ResourceBundle.getBundle, parameter[member[.bundleName], member[.locale], member[.loader], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UTF8Control, sub_type=None))]]]
end[}]
END[}] | Keyword[private] identifier[ResourceBundle] identifier[getBundle] operator[SEP] identifier[Locale] identifier[locale] operator[SEP] {
Keyword[return] identifier[ResourceBundle] operator[SEP] identifier[getBundle] operator[SEP] identifier[bundleName] , identifier[locale] , identifier[loader] , Keyword[new] identifier[UTF8Control] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Collection toCollection( JSONArray jsonArray, Class objectClass ) {
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setRootClass( objectClass );
return toCollection( jsonArray, jsonConfig );
} | class class_name[name] begin[{]
method[toCollection, return_type[type[Collection]], modifier[public static], parameter[jsonArray, objectClass]] begin[{]
local_variable[type[JsonConfig], jsonConfig]
call[jsonConfig.setRootClass, parameter[member[.objectClass]]]
return[call[.toCollection, parameter[member[.jsonArray], member[.jsonConfig]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Collection] identifier[toCollection] operator[SEP] identifier[JSONArray] identifier[jsonArray] , identifier[Class] identifier[objectClass] operator[SEP] {
identifier[JsonConfig] identifier[jsonConfig] operator[=] Keyword[new] identifier[JsonConfig] operator[SEP] operator[SEP] operator[SEP] identifier[jsonConfig] operator[SEP] identifier[setRootClass] operator[SEP] identifier[objectClass] operator[SEP] operator[SEP] Keyword[return] identifier[toCollection] operator[SEP] identifier[jsonArray] , identifier[jsonConfig] operator[SEP] operator[SEP]
}
|
public void init(BaseMessageManager manager, String strQueueName, String strQueueType)
{
super.init(manager, strQueueName, strQueueType);
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[manager, strQueueName, strQueueType]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=manager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=strQueueName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=strQueueType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[init] operator[SEP] identifier[BaseMessageManager] identifier[manager] , identifier[String] identifier[strQueueName] , identifier[String] identifier[strQueueType] operator[SEP] {
Keyword[super] operator[SEP] identifier[init] operator[SEP] identifier[manager] , identifier[strQueueName] , identifier[strQueueType] operator[SEP] operator[SEP]
}
|
public static Date parseDateWithLeniency(String str, Locale locale, String[] parsePatterns, boolean lenient) throws ParseException {
if (str == null || parsePatterns == null) {
throw new IllegalArgumentException("Date and Patterns must not be null");
}
SimpleDateFormat parser;
if (locale == null) {
parser = new SimpleDateFormat();
} else {
parser = new SimpleDateFormat("", locale);
}
parser.setLenient(lenient);
ParsePosition pos = new ParsePosition(0);
for (String parsePattern : parsePatterns) {
String pattern = parsePattern;
// LANG-530 - need to make sure 'ZZ' output doesn't get passed to SimpleDateFormat
if (parsePattern.endsWith("ZZ")) {
pattern = pattern.substring(0, pattern.length() - 1);
}
parser.applyPattern(pattern);
pos.setIndex(0);
String str2 = str;
// LANG-530 - need to make sure 'ZZ' output doesn't hit SimpleDateFormat as it will ParseException
if (parsePattern.endsWith("ZZ")) {
str2 = str.replaceAll("([-+][0-9][0-9]):([0-9][0-9])$", "$1$2");
}
Date date = parser.parse(str2, pos);
if (date != null && pos.getIndex() == str2.length()) {
return date;
}
}
throw new ParseException("Unable to parse the date: " + str, -1);
} | class class_name[name] begin[{]
method[parseDateWithLeniency, return_type[type[Date]], modifier[public static], parameter[str, locale, parsePatterns, lenient]] begin[{]
if[binary_operation[binary_operation[member[.str], ==, literal[null]], ||, binary_operation[member[.parsePatterns], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Date and Patterns must not be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[SimpleDateFormat], parser]
if[binary_operation[member[.locale], ==, literal[null]]] begin[{]
assign[member[.parser], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SimpleDateFormat, sub_type=None))]
else begin[{]
assign[member[.parser], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=locale, 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=SimpleDateFormat, sub_type=None))]
end[}]
call[parser.setLenient, parameter[member[.lenient]]]
local_variable[type[ParsePosition], pos]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=parsePattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=pattern)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ZZ")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=parsePattern, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=pattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=applyPattern, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=setIndex, postfix_operators=[], prefix_operators=[], qualifier=pos, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=str2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ZZ")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=parsePattern, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=str2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="([-+][0-9][0-9]):([0-9][0-9])$"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="$1$2")], member=replaceAll, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=str2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), name=date)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getIndex, postfix_operators=[], prefix_operators=[], qualifier=pos, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=str2, selectors=[], type_arguments=None), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=parsePatterns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=parsePattern)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to parse the date: "), operandr=MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Date] identifier[parseDateWithLeniency] operator[SEP] identifier[String] identifier[str] , identifier[Locale] identifier[locale] , identifier[String] operator[SEP] operator[SEP] identifier[parsePatterns] , Keyword[boolean] identifier[lenient] operator[SEP] Keyword[throws] identifier[ParseException] {
Keyword[if] operator[SEP] identifier[str] operator[==] Other[null] operator[||] identifier[parsePatterns] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[SimpleDateFormat] identifier[parser] operator[SEP] Keyword[if] operator[SEP] identifier[locale] operator[==] Other[null] operator[SEP] {
identifier[parser] operator[=] Keyword[new] identifier[SimpleDateFormat] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[parser] operator[=] Keyword[new] identifier[SimpleDateFormat] operator[SEP] literal[String] , identifier[locale] operator[SEP] operator[SEP]
}
identifier[parser] operator[SEP] identifier[setLenient] operator[SEP] identifier[lenient] operator[SEP] operator[SEP] identifier[ParsePosition] identifier[pos] operator[=] Keyword[new] identifier[ParsePosition] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[parsePattern] operator[:] identifier[parsePatterns] operator[SEP] {
identifier[String] identifier[pattern] operator[=] identifier[parsePattern] operator[SEP] Keyword[if] operator[SEP] identifier[parsePattern] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[pattern] operator[=] identifier[pattern] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[pattern] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
identifier[parser] operator[SEP] identifier[applyPattern] operator[SEP] identifier[pattern] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[setIndex] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[String] identifier[str2] operator[=] identifier[str] operator[SEP] Keyword[if] operator[SEP] identifier[parsePattern] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[str2] operator[=] identifier[str] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
identifier[Date] identifier[date] operator[=] identifier[parser] operator[SEP] identifier[parse] operator[SEP] identifier[str2] , identifier[pos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[date] operator[!=] Other[null] operator[&&] identifier[pos] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[==] identifier[str2] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[date] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[ParseException] operator[SEP] literal[String] operator[+] identifier[str] , operator[-] Other[1] operator[SEP] operator[SEP]
}
|
public static <T> boolean intersectsAll(T[] a1, T[] a2) {
for (T anA1 : a1) {
if (!contains(a2, anA1)) {
return false;
}
}
for (T anA2 : a2) {
if (!contains(a1, anA2)) {
return false;
}
}
return true;
} | class class_name[name] begin[{]
method[intersectsAll, return_type[type[boolean]], modifier[public static], parameter[a1, a2]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=a2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=anA1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=a1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=anA1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=a1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=anA2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=a2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=anA2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))), label=None)
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[boolean] identifier[intersectsAll] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[a1] , identifier[T] operator[SEP] operator[SEP] identifier[a2] operator[SEP] {
Keyword[for] operator[SEP] identifier[T] identifier[anA1] operator[:] identifier[a1] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[contains] operator[SEP] identifier[a2] , identifier[anA1] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[T] identifier[anA2] operator[:] identifier[a2] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[contains] operator[SEP] identifier[a1] , identifier[anA2] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.w3.org/1998/Math/MathML", name = "limit")
public JAXBElement<LimitType> createLimit(LimitType value) {
return new JAXBElement<LimitType>(_Limit_QNAME, LimitType.class, null, value);
} | class class_name[name] begin[{]
method[createLimit, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_Limit_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LimitType, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=LimitType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[LimitType] operator[>] identifier[createLimit] operator[SEP] identifier[LimitType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[LimitType] operator[>] operator[SEP] identifier[_Limit_QNAME] , identifier[LimitType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
public VALUE get( KEY key ) {
CacheEntry<KEY, VALUE> cacheEntry = map.get( key );
if ( cacheEntry != null ) {
cacheEntry.readCount.incrementAndGet();
return cacheEntry.value;
} else {
return null;
}
} | class class_name[name] begin[{]
method[get, return_type[type[VALUE]], modifier[public], parameter[key]] begin[{]
local_variable[type[CacheEntry], cacheEntry]
if[binary_operation[member[.cacheEntry], !=, literal[null]]] begin[{]
call[cacheEntry.readCount.incrementAndGet, parameter[]]
return[member[cacheEntry.value]]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}] | Keyword[public] identifier[VALUE] identifier[get] operator[SEP] identifier[KEY] identifier[key] operator[SEP] {
identifier[CacheEntry] operator[<] identifier[KEY] , identifier[VALUE] operator[>] identifier[cacheEntry] operator[=] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cacheEntry] operator[!=] Other[null] operator[SEP] {
identifier[cacheEntry] operator[SEP] identifier[readCount] operator[SEP] identifier[incrementAndGet] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[cacheEntry] operator[SEP] identifier[value] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
@XmlElementDecl(namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/", name = "extension", scope = SetContentStreamResponse.class)
public JAXBElement<CmisExtensionType> createSetContentStreamResponseExtension(
CmisExtensionType value) {
return new JAXBElement<CmisExtensionType>(
_GetPropertiesExtension_QNAME, CmisExtensionType.class,
SetContentStreamResponse.class, value);
} | class class_name[name] begin[{]
method[createSetContentStreamResponseExtension, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_GetPropertiesExtension_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmisExtensionType, sub_type=None)), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SetContentStreamResponse, sub_type=None)), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CmisExtensionType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] , identifier[scope] operator[=] identifier[SetContentStreamResponse] operator[SEP] Keyword[class] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[CmisExtensionType] operator[>] identifier[createSetContentStreamResponseExtension] operator[SEP] identifier[CmisExtensionType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[CmisExtensionType] operator[>] operator[SEP] identifier[_GetPropertiesExtension_QNAME] , identifier[CmisExtensionType] operator[SEP] Keyword[class] , identifier[SetContentStreamResponse] operator[SEP] Keyword[class] , identifier[value] operator[SEP] operator[SEP]
}
|
boolean canRemoveProperty( Name primaryTypeNameOfParent,
List<Name> mixinTypeNamesOfParent,
Name propertyName,
boolean skipProtected ) {
return nodeTypes().canRemoveProperty(primaryTypeNameOfParent, mixinTypeNamesOfParent, propertyName, skipProtected);
} | class class_name[name] begin[{]
method[canRemoveProperty, return_type[type[boolean]], modifier[default], parameter[primaryTypeNameOfParent, mixinTypeNamesOfParent, propertyName, skipProtected]] begin[{]
return[call[.nodeTypes, parameter[]]]
end[}]
END[}] | Keyword[boolean] identifier[canRemoveProperty] operator[SEP] identifier[Name] identifier[primaryTypeNameOfParent] , identifier[List] operator[<] identifier[Name] operator[>] identifier[mixinTypeNamesOfParent] , identifier[Name] identifier[propertyName] , Keyword[boolean] identifier[skipProtected] operator[SEP] {
Keyword[return] identifier[nodeTypes] operator[SEP] operator[SEP] operator[SEP] identifier[canRemoveProperty] operator[SEP] identifier[primaryTypeNameOfParent] , identifier[mixinTypeNamesOfParent] , identifier[propertyName] , identifier[skipProtected] operator[SEP] operator[SEP]
}
|
@UiThread
public List<Line> create(@NonNull FeatureCollection featureCollection) {
List<Feature> features = featureCollection.features();
List<LineOptions> options = new ArrayList<>();
if (features != null) {
for (Feature feature : features) {
LineOptions option = LineOptions.fromFeature(feature);
if (option != null) {
options.add(option);
}
}
}
return create(options);
} | class class_name[name] begin[{]
method[create, return_type[type[List]], modifier[public], parameter[featureCollection]] begin[{]
local_variable[type[List], features]
local_variable[type[List], options]
if[binary_operation[member[.features], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=feature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromFeature, postfix_operators=[], prefix_operators=[], qualifier=LineOptions, selectors=[], type_arguments=None), name=option)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LineOptions, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=option, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=option, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=features, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=feature)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Feature, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[call[.create, parameter[member[.options]]]]
end[}]
END[}] | annotation[@] identifier[UiThread] Keyword[public] identifier[List] operator[<] identifier[Line] operator[>] identifier[create] operator[SEP] annotation[@] identifier[NonNull] identifier[FeatureCollection] identifier[featureCollection] operator[SEP] {
identifier[List] operator[<] identifier[Feature] operator[>] identifier[features] operator[=] identifier[featureCollection] operator[SEP] identifier[features] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[LineOptions] operator[>] identifier[options] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[features] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Feature] identifier[feature] operator[:] identifier[features] operator[SEP] {
identifier[LineOptions] identifier[option] operator[=] identifier[LineOptions] operator[SEP] identifier[fromFeature] operator[SEP] identifier[feature] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[option] operator[!=] Other[null] operator[SEP] {
identifier[options] operator[SEP] identifier[add] operator[SEP] identifier[option] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[create] operator[SEP] identifier[options] operator[SEP] operator[SEP]
}
|
public void setSelection(long identifier) {
if (identifier == -1) {
mAdapter.deselect();
}
int count = mAdapter.getItemCount();
for (int i = 0; i < count; i++) {
IDrawerItem item = mAdapter.getItem(i);
if (item.getIdentifier() == identifier && !item.isSelected()) {
mAdapter.deselect();
mAdapter.select(i);
}
}
} | class class_name[name] begin[{]
method[setSelection, return_type[void], modifier[public], parameter[identifier]] begin[{]
if[binary_operation[member[.identifier], ==, literal[1]]] begin[{]
call[mAdapter.deselect, parameter[]]
else begin[{]
None
end[}]
local_variable[type[int], count]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getItem, postfix_operators=[], prefix_operators=[], qualifier=mAdapter, selectors=[], type_arguments=None), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IDrawerItem, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getIdentifier, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), operandr=MemberReference(member=identifier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=MethodInvocation(arguments=[], member=isSelected, postfix_operators=[], prefix_operators=['!'], qualifier=item, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=deselect, postfix_operators=[], prefix_operators=[], qualifier=mAdapter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=select, postfix_operators=[], prefix_operators=[], qualifier=mAdapter, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, 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[}]
END[}] | Keyword[public] Keyword[void] identifier[setSelection] operator[SEP] Keyword[long] identifier[identifier] operator[SEP] {
Keyword[if] operator[SEP] identifier[identifier] operator[==] operator[-] Other[1] operator[SEP] {
identifier[mAdapter] operator[SEP] identifier[deselect] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[count] operator[=] identifier[mAdapter] operator[SEP] identifier[getItemCount] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[count] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[IDrawerItem] identifier[item] operator[=] identifier[mAdapter] operator[SEP] identifier[getItem] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[item] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] operator[==] identifier[identifier] operator[&&] operator[!] identifier[item] operator[SEP] identifier[isSelected] operator[SEP] operator[SEP] operator[SEP] {
identifier[mAdapter] operator[SEP] identifier[deselect] operator[SEP] operator[SEP] operator[SEP] identifier[mAdapter] operator[SEP] identifier[select] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
}
|
public static PdfFileSpecification fileExtern(PdfWriter writer, String filePath) {
PdfFileSpecification fs = new PdfFileSpecification();
fs.writer = writer;
fs.put(PdfName.F, new PdfString(filePath));
fs.setUnicodeFileName(filePath, false);
return fs;
} | class class_name[name] begin[{]
method[fileExtern, return_type[type[PdfFileSpecification]], modifier[public static], parameter[writer, filePath]] begin[{]
local_variable[type[PdfFileSpecification], fs]
assign[member[fs.writer], member[.writer]]
call[fs.put, parameter[member[PdfName.F], ClassCreator(arguments=[MemberReference(member=filePath, 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=PdfString, sub_type=None))]]
call[fs.setUnicodeFileName, parameter[member[.filePath], literal[false]]]
return[member[.fs]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PdfFileSpecification] identifier[fileExtern] operator[SEP] identifier[PdfWriter] identifier[writer] , identifier[String] identifier[filePath] operator[SEP] {
identifier[PdfFileSpecification] identifier[fs] operator[=] Keyword[new] identifier[PdfFileSpecification] operator[SEP] operator[SEP] operator[SEP] identifier[fs] operator[SEP] identifier[writer] operator[=] identifier[writer] operator[SEP] identifier[fs] operator[SEP] identifier[put] operator[SEP] identifier[PdfName] operator[SEP] identifier[F] , Keyword[new] identifier[PdfString] operator[SEP] identifier[filePath] operator[SEP] operator[SEP] operator[SEP] identifier[fs] operator[SEP] identifier[setUnicodeFileName] operator[SEP] identifier[filePath] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[fs] operator[SEP]
}
|
public static String hmac(String string) throws NoSuchAlgorithmException, InvalidKeyException {
String code = "";
KeyGenerator keyGenerator = KeyGenerator.getInstance("HmacMD5");
SecretKey secretKey = keyGenerator.generateKey();
SecretKey secretKey2 = new SecretKeySpec(secretKey.getEncoded(), "HmacMD5");
Mac mac = Mac.getInstance(secretKey.getAlgorithm());
mac.init(secretKey2);
return code;
} | class class_name[name] begin[{]
method[hmac, return_type[type[String]], modifier[public static], parameter[string]] begin[{]
local_variable[type[String], code]
local_variable[type[KeyGenerator], keyGenerator]
local_variable[type[SecretKey], secretKey]
local_variable[type[SecretKey], secretKey2]
local_variable[type[Mac], mac]
call[mac.init, parameter[member[.secretKey2]]]
return[member[.code]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[hmac] operator[SEP] identifier[String] identifier[string] operator[SEP] Keyword[throws] identifier[NoSuchAlgorithmException] , identifier[InvalidKeyException] {
identifier[String] identifier[code] operator[=] literal[String] operator[SEP] identifier[KeyGenerator] identifier[keyGenerator] operator[=] identifier[KeyGenerator] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[SecretKey] identifier[secretKey] operator[=] identifier[keyGenerator] operator[SEP] identifier[generateKey] operator[SEP] operator[SEP] operator[SEP] identifier[SecretKey] identifier[secretKey2] operator[=] Keyword[new] identifier[SecretKeySpec] operator[SEP] identifier[secretKey] operator[SEP] identifier[getEncoded] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[Mac] identifier[mac] operator[=] identifier[Mac] operator[SEP] identifier[getInstance] operator[SEP] identifier[secretKey] operator[SEP] identifier[getAlgorithm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[mac] operator[SEP] identifier[init] operator[SEP] identifier[secretKey2] operator[SEP] operator[SEP] Keyword[return] identifier[code] operator[SEP]
}
|
@Override
public boolean add(D item) throws UnsupportedOperationException {
readOnlyGuardCondition();
instance.addRelation(entity, writeAttributeName, item);
entity.save();
return true;
} | class class_name[name] begin[{]
method[add, return_type[type[boolean]], modifier[public], parameter[item]] begin[{]
call[.readOnlyGuardCondition, parameter[]]
call[instance.addRelation, parameter[member[.entity], member[.writeAttributeName], member[.item]]]
call[entity.save, parameter[]]
return[literal[true]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[add] operator[SEP] identifier[D] identifier[item] operator[SEP] Keyword[throws] identifier[UnsupportedOperationException] {
identifier[readOnlyGuardCondition] operator[SEP] operator[SEP] operator[SEP] identifier[instance] operator[SEP] identifier[addRelation] operator[SEP] identifier[entity] , identifier[writeAttributeName] , identifier[item] operator[SEP] operator[SEP] identifier[entity] operator[SEP] identifier[save] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public static List<JPEGSegment> readSegments(final ImageInputStream stream, final Map<Integer, List<String>> segmentIdentifiers) throws IOException {
readSOI(notNull(stream, "stream"));
List<JPEGSegment> segments = Collections.emptyList();
JPEGSegment segment;
try {
do {
segment = readSegment(stream, segmentIdentifiers);
// System.err.println("segment: " + segment);
if (isRequested(segment, segmentIdentifiers)) {
if (segments == Collections.EMPTY_LIST) {
segments = new ArrayList<>();
}
segments.add(segment);
}
}
while (!isImageDone(segment));
}
catch (EOFException ignore) {
// Just end here, in case of malformed stream
}
// TODO: Should probably skip until EOI, so that multiple invocations succeeds for multiple image streams.
return segments;
} | class class_name[name] begin[{]
method[readSegments, return_type[type[List]], modifier[public static], parameter[stream, segmentIdentifiers]] begin[{]
call[.readSOI, parameter[call[.notNull, parameter[member[.stream], literal["stream"]]]]]
local_variable[type[List], segments]
local_variable[type[JPEGSegment], segment]
TryStatement(block=[DoStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=segmentIdentifiers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readSegment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=segmentIdentifiers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isRequested, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=segments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=EMPTY_LIST, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=segments, 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=[], dimensions=None, name=ArrayList, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=segments, selectors=[], type_arguments=None), label=None)]))]), condition=MethodInvocation(arguments=[MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isImageDone, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignore, types=['EOFException']))], finally_block=None, label=None, resources=None)
return[member[.segments]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[JPEGSegment] operator[>] identifier[readSegments] operator[SEP] Keyword[final] identifier[ImageInputStream] identifier[stream] , Keyword[final] identifier[Map] operator[<] identifier[Integer] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[segmentIdentifiers] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[readSOI] operator[SEP] identifier[notNull] operator[SEP] identifier[stream] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[JPEGSegment] operator[>] identifier[segments] operator[=] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP] identifier[JPEGSegment] identifier[segment] operator[SEP] Keyword[try] {
Keyword[do] {
identifier[segment] operator[=] identifier[readSegment] operator[SEP] identifier[stream] , identifier[segmentIdentifiers] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isRequested] operator[SEP] identifier[segment] , identifier[segmentIdentifiers] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[segments] operator[==] identifier[Collections] operator[SEP] identifier[EMPTY_LIST] operator[SEP] {
identifier[segments] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[segments] operator[SEP] identifier[add] operator[SEP] identifier[segment] operator[SEP] operator[SEP]
}
}
Keyword[while] operator[SEP] operator[!] identifier[isImageDone] operator[SEP] identifier[segment] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[EOFException] identifier[ignore] operator[SEP] {
}
Keyword[return] identifier[segments] operator[SEP]
}
|
@Nullable
private static Node getEnclosingTarget(Node targetNode) {
checkState(checkNotNull(targetNode).isValidAssignmentTarget(), targetNode);
Node parent = checkNotNull(targetNode.getParent(), targetNode);
boolean targetIsFirstChild = parent.getFirstChild() == targetNode;
if (parent.isDefaultValue() || parent.isRest()) {
// in `([something = targetNode] = x)` targetNode isn't actually acting
// as a target.
checkState(targetIsFirstChild, parent);
// The DEFAULT_VALUE or REST occupies the place where the assignment target it contains would
// otherwise be in the AST, so pretend it is the target for the logic below.
targetNode = parent;
parent = checkNotNull(targetNode.getParent());
targetIsFirstChild = targetNode == parent.getFirstChild();
}
switch (parent.getToken()) {
case ARRAY_PATTERN:
// e.g. ([targetNode] = something)
return parent;
case OBJECT_PATTERN:
// e.g. ({...rest} = something);
return parent;
case COMPUTED_PROP:
// e.g. ({[expression]: targetNode} = something)
// e.g. ({[expression]: targetNode = default} = something)
// make sure the effective target (targetNode or DEFAULT_VALUE containing it)
// isn't the expression part
checkState(!targetIsFirstChild, parent);
// otherwise the same as STRING_KEY so fall through
case STRING_KEY:
// e.g. ({parent: targetNode} = something)
Node grandparent = checkNotNull(parent.getParent(), parent);
checkState(grandparent.isObjectPattern(), grandparent);
return grandparent;
case PARAM_LIST:
// e.g. `function foo(targetNode) {}`
case LET:
case CONST:
case VAR:
// non-destructured declarations
// e.g. `let targetNode = 3;`
return null;
case FUNCTION:
case CLASS:
// e.g. `function targetNode() {}`
// e.g. `class targetNode {}`
checkState(targetIsFirstChild, targetNode);
return null;
case FOR_IN:
case FOR_OF:
case FOR_AWAIT_OF:
// e.g. `for ({length} in obj) {}` // targetNode is `{length}`
// e.g. `for ({length} of obj) {}` // targetNode is `{length}`
checkState(targetIsFirstChild, targetNode);
return null;
case DESTRUCTURING_LHS:
// destructured declarations
// e.g. `let [a] = 3`; // targetNode is `[a]`
checkState(targetIsFirstChild, targetNode);
return null;
case IMPORT:
// e.g. `import targetNode from './foo/bar';`
return null;
case IMPORT_SPEC:
// e.g. `import {bar as targetNode} from './foo/bar';`
// e.g. `import {targetNode} from './foo/bar';` // AST will have {targetNode as targetNode}
checkState(!targetIsFirstChild, parent);
return null;
case CATCH:
// e.g. `try {} catch (foo) {}`
return null;
default:
// e.g. targetNode = something
checkState(isAssignmentOp(parent) && targetIsFirstChild, parent);
return null;
}
} | class class_name[name] begin[{]
method[getEnclosingTarget, return_type[type[Node]], modifier[private static], parameter[targetNode]] begin[{]
call[.checkState, parameter[call[.checkNotNull, parameter[member[.targetNode]]], member[.targetNode]]]
local_variable[type[Node], parent]
local_variable[type[boolean], targetIsFirstChild]
if[binary_operation[call[parent.isDefaultValue, parameter[]], ||, call[parent.isRest, parameter[]]]] begin[{]
call[.checkState, parameter[member[.targetIsFirstChild], member[.parent]]]
assign[member[.targetNode], member[.parent]]
assign[member[.parent], call[.checkNotNull, parameter[call[targetNode.getParent, parameter[]]]]]
assign[member[.targetIsFirstChild], binary_operation[member[.targetNode], ==, call[parent.getFirstChild, parameter[]]]]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=['ARRAY_PATTERN'], statements=[ReturnStatement(expression=MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['OBJECT_PATTERN'], statements=[ReturnStatement(expression=MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['COMPUTED_PROP'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=targetIsFirstChild, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['STRING_KEY'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParent, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[], type_arguments=None), MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkNotNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=grandparent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=isObjectPattern, postfix_operators=[], prefix_operators=[], qualifier=grandparent, selectors=[], type_arguments=None), MemberReference(member=grandparent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=grandparent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['PARAM_LIST', 'LET', 'CONST', 'VAR'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), SwitchStatementCase(case=['FUNCTION', 'CLASS'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=targetIsFirstChild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=targetNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), SwitchStatementCase(case=['FOR_IN', 'FOR_OF', 'FOR_AWAIT_OF'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=targetIsFirstChild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=targetNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), SwitchStatementCase(case=['DESTRUCTURING_LHS'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=targetIsFirstChild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=targetNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), SwitchStatementCase(case=['IMPORT'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), SwitchStatementCase(case=['IMPORT_SPEC'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=targetIsFirstChild, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), SwitchStatementCase(case=['CATCH'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignmentOp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MemberReference(member=targetIsFirstChild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&&), MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)])], expression=MethodInvocation(arguments=[], member=getToken, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[private] Keyword[static] identifier[Node] identifier[getEnclosingTarget] operator[SEP] identifier[Node] identifier[targetNode] operator[SEP] {
identifier[checkState] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[targetNode] operator[SEP] operator[SEP] identifier[isValidAssignmentTarget] operator[SEP] operator[SEP] , identifier[targetNode] operator[SEP] operator[SEP] identifier[Node] identifier[parent] operator[=] identifier[checkNotNull] operator[SEP] identifier[targetNode] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] , identifier[targetNode] operator[SEP] operator[SEP] Keyword[boolean] identifier[targetIsFirstChild] operator[=] identifier[parent] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[==] identifier[targetNode] operator[SEP] Keyword[if] operator[SEP] identifier[parent] operator[SEP] identifier[isDefaultValue] operator[SEP] operator[SEP] operator[||] identifier[parent] operator[SEP] identifier[isRest] operator[SEP] operator[SEP] operator[SEP] {
identifier[checkState] operator[SEP] identifier[targetIsFirstChild] , identifier[parent] operator[SEP] operator[SEP] identifier[targetNode] operator[=] identifier[parent] operator[SEP] identifier[parent] operator[=] identifier[checkNotNull] operator[SEP] identifier[targetNode] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[targetIsFirstChild] operator[=] identifier[targetNode] operator[==] identifier[parent] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[parent] operator[SEP] identifier[getToken] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[ARRAY_PATTERN] operator[:] Keyword[return] identifier[parent] operator[SEP] Keyword[case] identifier[OBJECT_PATTERN] operator[:] Keyword[return] identifier[parent] operator[SEP] Keyword[case] identifier[COMPUTED_PROP] operator[:] identifier[checkState] operator[SEP] operator[!] identifier[targetIsFirstChild] , identifier[parent] operator[SEP] operator[SEP] Keyword[case] identifier[STRING_KEY] operator[:] identifier[Node] identifier[grandparent] operator[=] identifier[checkNotNull] operator[SEP] identifier[parent] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] , identifier[parent] operator[SEP] operator[SEP] identifier[checkState] operator[SEP] identifier[grandparent] operator[SEP] identifier[isObjectPattern] operator[SEP] operator[SEP] , identifier[grandparent] operator[SEP] operator[SEP] Keyword[return] identifier[grandparent] operator[SEP] Keyword[case] identifier[PARAM_LIST] operator[:] Keyword[case] identifier[LET] operator[:] Keyword[case] identifier[CONST] operator[:] Keyword[case] identifier[VAR] operator[:] Keyword[return] Other[null] operator[SEP] Keyword[case] identifier[FUNCTION] operator[:] Keyword[case] identifier[CLASS] operator[:] identifier[checkState] operator[SEP] identifier[targetIsFirstChild] , identifier[targetNode] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[case] identifier[FOR_IN] operator[:] Keyword[case] identifier[FOR_OF] operator[:] Keyword[case] identifier[FOR_AWAIT_OF] operator[:] identifier[checkState] operator[SEP] identifier[targetIsFirstChild] , identifier[targetNode] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[case] identifier[DESTRUCTURING_LHS] operator[:] identifier[checkState] operator[SEP] identifier[targetIsFirstChild] , identifier[targetNode] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[case] identifier[IMPORT] operator[:] Keyword[return] Other[null] operator[SEP] Keyword[case] identifier[IMPORT_SPEC] operator[:] identifier[checkState] operator[SEP] operator[!] identifier[targetIsFirstChild] , identifier[parent] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[case] identifier[CATCH] operator[:] Keyword[return] Other[null] operator[SEP] Keyword[default] operator[:] identifier[checkState] operator[SEP] identifier[isAssignmentOp] operator[SEP] identifier[parent] operator[SEP] operator[&&] identifier[targetIsFirstChild] , identifier[parent] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BpsimPackage.GAMMA_DISTRIBUTION_TYPE__SCALE:
return getScale();
case BpsimPackage.GAMMA_DISTRIBUTION_TYPE__SHAPE:
return getShape();
}
return super.eGet(featureID, resolve, coreType);
} | class class_name[name] begin[{]
method[eGet, return_type[type[Object]], modifier[public], parameter[featureID, resolve, coreType]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=GAMMA_DISTRIBUTION_TYPE__SCALE, postfix_operators=[], prefix_operators=[], qualifier=BpsimPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getScale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=GAMMA_DISTRIBUTION_TYPE__SHAPE, postfix_operators=[], prefix_operators=[], qualifier=BpsimPackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getShape, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resolve, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=coreType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eGet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[eGet] operator[SEP] Keyword[int] identifier[featureID] , Keyword[boolean] identifier[resolve] , Keyword[boolean] identifier[coreType] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[BpsimPackage] operator[SEP] identifier[GAMMA_DISTRIBUTION_TYPE__SCALE] operator[:] Keyword[return] identifier[getScale] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[BpsimPackage] operator[SEP] identifier[GAMMA_DISTRIBUTION_TYPE__SHAPE] operator[:] Keyword[return] identifier[getShape] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eGet] operator[SEP] identifier[featureID] , identifier[resolve] , identifier[coreType] operator[SEP] operator[SEP]
}
|
public static String getNameOfMissingClassLoaderDependency(Throwable e) {
if (e instanceof NoClassDefFoundError) {
// NoClassDefFoundError sometimes includes CNFE as the cause. Since CNFE has a better formatted class name
// and may also include classloader info, we prefer CNFE's over NCDFE's message.
if (e.getCause() instanceof ClassNotFoundException) {
return getNameOfMissingClassLoaderDependency(e.getCause());
}
if (e.getMessage() != null) {
return e.getMessage().replace('/', '.');
}
}
if (e instanceof ClassNotFoundException) {
if (e.getMessage() != null) {
return e.getMessage();
}
}
if (e.getCause() != null) {
return getNameOfMissingClassLoaderDependency(e.getCause());
} else {
return "[unknown]";
}
} | class class_name[name] begin[{]
method[getNameOfMissingClassLoaderDependency, return_type[type[String]], modifier[public static], parameter[e]] begin[{]
if[binary_operation[member[.e], instanceof, type[NoClassDefFoundError]]] begin[{]
if[binary_operation[call[e.getCause, parameter[]], instanceof, type[ClassNotFoundException]]] begin[{]
return[call[.getNameOfMissingClassLoaderDependency, parameter[call[e.getCause, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[call[e.getMessage, parameter[]], !=, literal[null]]] begin[{]
return[call[e.getMessage, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.e], instanceof, type[ClassNotFoundException]]] begin[{]
if[binary_operation[call[e.getMessage, parameter[]], !=, literal[null]]] begin[{]
return[call[e.getMessage, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[e.getCause, parameter[]], !=, literal[null]]] begin[{]
return[call[.getNameOfMissingClassLoaderDependency, parameter[call[e.getCause, parameter[]]]]]
else begin[{]
return[literal["[unknown]"]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getNameOfMissingClassLoaderDependency] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] Keyword[instanceof] identifier[NoClassDefFoundError] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] Keyword[instanceof] identifier[ClassNotFoundException] operator[SEP] {
Keyword[return] identifier[getNameOfMissingClassLoaderDependency] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[e] Keyword[instanceof] identifier[ClassNotFoundException] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[getNameOfMissingClassLoaderDependency] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[String] operator[SEP]
}
}
|
@Nonnull
public FineUploader5Validation setMinSizeLimit (@Nonnegative final int nMinSizeLimit)
{
ValueEnforcer.isGE0 (nMinSizeLimit, "MinSizeLimit");
m_nValidationMinSizeLimit = nMinSizeLimit;
return this;
} | class class_name[name] begin[{]
method[setMinSizeLimit, return_type[type[FineUploader5Validation]], modifier[public], parameter[nMinSizeLimit]] begin[{]
call[ValueEnforcer.isGE0, parameter[member[.nMinSizeLimit], literal["MinSizeLimit"]]]
assign[member[.m_nValidationMinSizeLimit], member[.nMinSizeLimit]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] identifier[FineUploader5Validation] identifier[setMinSizeLimit] operator[SEP] annotation[@] identifier[Nonnegative] Keyword[final] Keyword[int] identifier[nMinSizeLimit] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[isGE0] operator[SEP] identifier[nMinSizeLimit] , literal[String] operator[SEP] operator[SEP] identifier[m_nValidationMinSizeLimit] operator[=] identifier[nMinSizeLimit] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private static String getJsonValueAsString(JsonValue value) {
return (value != null && value.getValueType() == ValueType.STRING) ? ((JsonString) value).getString() : null;
} | class class_name[name] begin[{]
method[getJsonValueAsString, return_type[type[String]], modifier[private static], parameter[value]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValueType, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), operandr=MemberReference(member=STRING, postfix_operators=[], prefix_operators=[], qualifier=ValueType, selectors=[]), operator===), operator=&&), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JsonString, sub_type=None)))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[getJsonValueAsString] operator[SEP] identifier[JsonValue] identifier[value] operator[SEP] {
Keyword[return] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] identifier[value] operator[SEP] identifier[getValueType] operator[SEP] operator[SEP] operator[==] identifier[ValueType] operator[SEP] identifier[STRING] operator[SEP] operator[?] operator[SEP] operator[SEP] identifier[JsonString] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[getString] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
public static String toHex(ModbusMessage msg) {
BytesOutputStream byteOutputStream = new BytesOutputStream(Modbus.MAX_MESSAGE_LENGTH);
String ret = "-1";
try {
msg.writeTo(byteOutputStream);
ret = toHex(byteOutputStream.getBuffer(), 0, byteOutputStream.size());
}
catch (IOException ex) {
logger.debug("Hex conversion error {}", ex);
}
return ret;
} | class class_name[name] begin[{]
method[toHex, return_type[type[String]], modifier[public static], parameter[msg]] begin[{]
local_variable[type[BytesOutputStream], byteOutputStream]
local_variable[type[String], ret]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=byteOutputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeTo, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBuffer, postfix_operators=[], prefix_operators=[], qualifier=byteOutputStream, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=byteOutputStream, selectors=[], type_arguments=None)], member=toHex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Hex conversion error {}"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=None)
return[member[.ret]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[toHex] operator[SEP] identifier[ModbusMessage] identifier[msg] operator[SEP] {
identifier[BytesOutputStream] identifier[byteOutputStream] operator[=] Keyword[new] identifier[BytesOutputStream] operator[SEP] identifier[Modbus] operator[SEP] identifier[MAX_MESSAGE_LENGTH] operator[SEP] operator[SEP] identifier[String] identifier[ret] operator[=] literal[String] operator[SEP] Keyword[try] {
identifier[msg] operator[SEP] identifier[writeTo] operator[SEP] identifier[byteOutputStream] operator[SEP] operator[SEP] identifier[ret] operator[=] identifier[toHex] operator[SEP] identifier[byteOutputStream] operator[SEP] identifier[getBuffer] operator[SEP] operator[SEP] , Other[0] , identifier[byteOutputStream] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
@Override
public void setDecomposition(int value) {
if (value < Collator.NO_DECOMPOSITION || value > Collator.FULL_DECOMPOSITION) {
throw new IllegalArgumentException();
}
decomposition = value;
} | class class_name[name] begin[{]
method[setDecomposition, return_type[void], modifier[public], parameter[value]] begin[{]
if[binary_operation[binary_operation[member[.value], <, member[Collator.NO_DECOMPOSITION]], ||, binary_operation[member[.value], >, member[Collator.FULL_DECOMPOSITION]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.decomposition], member[.value]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setDecomposition] operator[SEP] Keyword[int] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[<] identifier[Collator] operator[SEP] identifier[NO_DECOMPOSITION] operator[||] identifier[value] operator[>] identifier[Collator] operator[SEP] identifier[FULL_DECOMPOSITION] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[decomposition] operator[=] identifier[value] operator[SEP]
}
|
public static <DATATYPE extends Comparable <? super DATATYPE>> int compare (@Nullable final DATATYPE aObj1,
@Nullable final DATATYPE aObj2)
{
// Legacy behavior: null values come first
return compare (aObj1, aObj2, DEFAULT_NULL_VALUES_COME_FIRST);
} | class class_name[name] begin[{]
method[compare, return_type[type[int]], modifier[public static], parameter[aObj1, aObj2]] begin[{]
return[call[.compare, parameter[member[.aObj1], member[.aObj2], member[.DEFAULT_NULL_VALUES_COME_FIRST]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[DATATYPE] Keyword[extends] identifier[Comparable] operator[<] operator[?] Keyword[super] identifier[DATATYPE] operator[>] operator[>] Keyword[int] identifier[compare] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[DATATYPE] identifier[aObj1] , annotation[@] identifier[Nullable] Keyword[final] identifier[DATATYPE] identifier[aObj2] operator[SEP] {
Keyword[return] identifier[compare] operator[SEP] identifier[aObj1] , identifier[aObj2] , identifier[DEFAULT_NULL_VALUES_COME_FIRST] operator[SEP] operator[SEP]
}
|
public static <V> ListenableFutureTask<V> create(Callable<V> callable) {
return new ListenableFutureTask<V>(callable);
} | class class_name[name] begin[{]
method[create, return_type[type[ListenableFutureTask]], modifier[public static], parameter[callable]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=callable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=ListenableFutureTask, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[V] operator[>] identifier[ListenableFutureTask] operator[<] identifier[V] operator[>] identifier[create] operator[SEP] identifier[Callable] operator[<] identifier[V] operator[>] identifier[callable] operator[SEP] {
Keyword[return] Keyword[new] identifier[ListenableFutureTask] operator[<] identifier[V] operator[>] operator[SEP] identifier[callable] operator[SEP] operator[SEP]
}
|
protected void toStringFields(final StringBuffer buffer) {
buffer.append("<managedConnectionFactory=");
buffer.append(_managedConnectionFactory);
buffer.append("> <coreConnection=");
buffer.append(_coreConnection);
buffer.append("> <localTransaction=");
buffer.append(_localTransaction);
buffer.append("> <xaResource=");
buffer.append(_xaResource);
buffer.append("> <metaData=");
buffer.append(_metaData);
buffer.append("> <userDetails=");
buffer.append(_userDetails);
buffer.append("> <subject=");
buffer.append(subjectToString(_subject));
buffer.append("> <logWriter=");
buffer.append(_logWriter);
buffer.append("> <sessions=");
buffer.append(_sessions);
// Don't call toString on listeners as this will result in recursive calls under JBoss and a StackOverFlow
buffer.append("> <connectionListeners=[");
for (int i = 0; i < _connectionListeners.size(); i++) {
Object o = _connectionListeners.get(i);
if (i > 0)
buffer.append(",");
buffer.append(o.getClass().getName() + "@" + o.hashCode());
}
buffer.append("]>");
} | class class_name[name] begin[{]
method[toStringFields, return_type[void], modifier[protected], parameter[buffer]] begin[{]
call[buffer.append, parameter[literal["<managedConnectionFactory="]]]
call[buffer.append, parameter[member[._managedConnectionFactory]]]
call[buffer.append, parameter[literal["> <coreConnection="]]]
call[buffer.append, parameter[member[._coreConnection]]]
call[buffer.append, parameter[literal["> <localTransaction="]]]
call[buffer.append, parameter[member[._localTransaction]]]
call[buffer.append, parameter[literal["> <xaResource="]]]
call[buffer.append, parameter[member[._xaResource]]]
call[buffer.append, parameter[literal["> <metaData="]]]
call[buffer.append, parameter[member[._metaData]]]
call[buffer.append, parameter[literal["> <userDetails="]]]
call[buffer.append, parameter[member[._userDetails]]]
call[buffer.append, parameter[literal["> <subject="]]]
call[buffer.append, parameter[call[.subjectToString, parameter[member[._subject]]]]]
call[buffer.append, parameter[literal["> <logWriter="]]]
call[buffer.append, parameter[member[._logWriter]]]
call[buffer.append, parameter[literal["> <sessions="]]]
call[buffer.append, parameter[member[._sessions]]]
call[buffer.append, parameter[literal["> <connectionListeners=["]]]
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=_connectionListeners, selectors=[], type_arguments=None), name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=",")], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="@"), operator=+), operandr=MethodInvocation(arguments=[], member=hashCode, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[], type_arguments=None), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, 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=_connectionListeners, 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)
call[buffer.append, parameter[literal["]>"]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[toStringFields] operator[SEP] Keyword[final] identifier[StringBuffer] identifier[buffer] operator[SEP] {
identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[_managedConnectionFactory] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[_coreConnection] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[_localTransaction] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[_xaResource] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[_metaData] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[_userDetails] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[subjectToString] operator[SEP] identifier[_subject] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[_logWriter] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[_sessions] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[_connectionListeners] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Object] identifier[o] operator[=] identifier[_connectionListeners] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[append] operator[SEP] identifier[o] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[o] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
private void lockAllLocalizations(String key) throws CmsException {
for (Locale l : m_bundleFiles.keySet()) {
if ((null == l) || m_localizations.get(l).containsKey(key)) {
lockLocalization(l);
}
}
} | class class_name[name] begin[{]
method[lockAllLocalizations, return_type[void], modifier[private], parameter[key]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=MethodInvocation(arguments=[MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=m_localizations, selectors=[MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lockLocalization, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=m_bundleFiles, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=l)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Locale, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[lockAllLocalizations] operator[SEP] identifier[String] identifier[key] operator[SEP] Keyword[throws] identifier[CmsException] {
Keyword[for] operator[SEP] identifier[Locale] identifier[l] operator[:] identifier[m_bundleFiles] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] Other[null] operator[==] identifier[l] operator[SEP] operator[||] identifier[m_localizations] operator[SEP] identifier[get] operator[SEP] identifier[l] operator[SEP] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[lockLocalization] operator[SEP] identifier[l] operator[SEP] operator[SEP]
}
}
}
|
public void getWvWMatchStat(String[] ids, Callback<List<WvWMatchStat>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getWvWMatchStatUsingID(processIds(ids)).enqueue(callback);
} | class class_name[name] begin[{]
method[getWvWMatchStat, return_type[void], modifier[public], parameter[ids, callback]] begin[{]
call[.isParamValid, parameter[ClassCreator(arguments=[MemberReference(member=ids, 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=ParamChecker, sub_type=None))]]
call[gw2API.getWvWMatchStatUsingID, parameter[call[.processIds, parameter[member[.ids]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[getWvWMatchStat] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[ids] , identifier[Callback] operator[<] identifier[List] operator[<] identifier[WvWMatchStat] operator[>] operator[>] identifier[callback] operator[SEP] Keyword[throws] identifier[GuildWars2Exception] , identifier[NullPointerException] {
identifier[isParamValid] operator[SEP] Keyword[new] identifier[ParamChecker] operator[SEP] identifier[ids] operator[SEP] operator[SEP] operator[SEP] identifier[gw2API] operator[SEP] identifier[getWvWMatchStatUsingID] operator[SEP] identifier[processIds] operator[SEP] identifier[ids] operator[SEP] operator[SEP] operator[SEP] identifier[enqueue] operator[SEP] identifier[callback] operator[SEP] operator[SEP]
}
|
public <T> T getModel(Class<T> modelClass) {
return (T)Injector.injectModel(modelClass, request, false);
} | class class_name[name] begin[{]
method[getModel, return_type[type[T]], modifier[public], parameter[modelClass]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=modelClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=injectModel, postfix_operators=[], prefix_operators=[], qualifier=Injector, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[getModel] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[modelClass] operator[SEP] {
Keyword[return] operator[SEP] identifier[T] operator[SEP] identifier[Injector] operator[SEP] identifier[injectModel] operator[SEP] identifier[modelClass] , identifier[request] , literal[boolean] operator[SEP] operator[SEP]
}
|
public void marshall(KeyPhrasesDetectionJobFilter keyPhrasesDetectionJobFilter, ProtocolMarshaller protocolMarshaller) {
if (keyPhrasesDetectionJobFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(keyPhrasesDetectionJobFilter.getJobName(), JOBNAME_BINDING);
protocolMarshaller.marshall(keyPhrasesDetectionJobFilter.getJobStatus(), JOBSTATUS_BINDING);
protocolMarshaller.marshall(keyPhrasesDetectionJobFilter.getSubmitTimeBefore(), SUBMITTIMEBEFORE_BINDING);
protocolMarshaller.marshall(keyPhrasesDetectionJobFilter.getSubmitTimeAfter(), SUBMITTIMEAFTER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[keyPhrasesDetectionJobFilter, protocolMarshaller]] begin[{]
if[binary_operation[member[.keyPhrasesDetectionJobFilter], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getJobName, postfix_operators=[], prefix_operators=[], qualifier=keyPhrasesDetectionJobFilter, selectors=[], type_arguments=None), MemberReference(member=JOBNAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getJobStatus, postfix_operators=[], prefix_operators=[], qualifier=keyPhrasesDetectionJobFilter, selectors=[], type_arguments=None), MemberReference(member=JOBSTATUS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSubmitTimeBefore, postfix_operators=[], prefix_operators=[], qualifier=keyPhrasesDetectionJobFilter, selectors=[], type_arguments=None), MemberReference(member=SUBMITTIMEBEFORE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSubmitTimeAfter, postfix_operators=[], prefix_operators=[], qualifier=keyPhrasesDetectionJobFilter, selectors=[], type_arguments=None), MemberReference(member=SUBMITTIMEAFTER_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[KeyPhrasesDetectionJobFilter] identifier[keyPhrasesDetectionJobFilter] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[keyPhrasesDetectionJobFilter] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyPhrasesDetectionJobFilter] operator[SEP] identifier[getJobName] operator[SEP] operator[SEP] , identifier[JOBNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyPhrasesDetectionJobFilter] operator[SEP] identifier[getJobStatus] operator[SEP] operator[SEP] , identifier[JOBSTATUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyPhrasesDetectionJobFilter] operator[SEP] identifier[getSubmitTimeBefore] operator[SEP] operator[SEP] , identifier[SUBMITTIMEBEFORE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyPhrasesDetectionJobFilter] operator[SEP] identifier[getSubmitTimeAfter] operator[SEP] operator[SEP] , identifier[SUBMITTIMEAFTER_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public Observable<List<AnnotationInner>> createAsync(String resourceGroupName, String resourceName, AnnotationInner annotationProperties) {
return createWithServiceResponseAsync(resourceGroupName, resourceName, annotationProperties).map(new Func1<ServiceResponse<List<AnnotationInner>>, List<AnnotationInner>>() {
@Override
public List<AnnotationInner> call(ServiceResponse<List<AnnotationInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[createAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, resourceName, annotationProperties]] begin[{]
return[call[.createWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.resourceName], member[.annotationProperties]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[List] operator[<] identifier[AnnotationInner] operator[>] operator[>] identifier[createAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[resourceName] , identifier[AnnotationInner] identifier[annotationProperties] operator[SEP] {
Keyword[return] identifier[createWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[resourceName] , identifier[annotationProperties] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[AnnotationInner] operator[>] operator[>] , identifier[List] operator[<] identifier[AnnotationInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[AnnotationInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[AnnotationInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
private static String extractPassword(String password, ClientAuthScheme scheme) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance(ClientAuthScheme.getDigestScheme(scheme));
} catch (final NoSuchAlgorithmException e) {
hostLog.l7dlog(Level.FATAL, LogKeys.compiler_VoltCompiler_NoSuchAlgorithm.name(), e);
System.exit(-1);
}
final byte passwordHash[] = md.digest(password.getBytes(Charsets.UTF_8));
return Encoder.hexEncode(passwordHash);
} | class class_name[name] begin[{]
method[extractPassword, return_type[type[String]], modifier[private static], parameter[password, scheme]] begin[{]
local_variable[type[MessageDigest], md]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=md, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDigestScheme, postfix_operators=[], prefix_operators=[], qualifier=ClientAuthScheme, selectors=[], type_arguments=None)], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=MessageDigest, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FATAL, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=LogKeys.compiler_VoltCompiler_NoSuchAlgorithm, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=l7dlog, postfix_operators=[], prefix_operators=[], qualifier=hostLog, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchAlgorithmException']))], finally_block=None, label=None, resources=None)
local_variable[type[byte], passwordHash]
return[call[Encoder.hexEncode, parameter[member[.passwordHash]]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[extractPassword] operator[SEP] identifier[String] identifier[password] , identifier[ClientAuthScheme] identifier[scheme] operator[SEP] {
identifier[MessageDigest] identifier[md] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[md] operator[=] identifier[MessageDigest] operator[SEP] identifier[getInstance] operator[SEP] identifier[ClientAuthScheme] operator[SEP] identifier[getDigestScheme] operator[SEP] identifier[scheme] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[NoSuchAlgorithmException] identifier[e] operator[SEP] {
identifier[hostLog] operator[SEP] identifier[l7dlog] operator[SEP] identifier[Level] operator[SEP] identifier[FATAL] , identifier[LogKeys] operator[SEP] identifier[compiler_VoltCompiler_NoSuchAlgorithm] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[byte] identifier[passwordHash] operator[SEP] operator[SEP] operator[=] identifier[md] operator[SEP] identifier[digest] operator[SEP] identifier[password] operator[SEP] identifier[getBytes] operator[SEP] identifier[Charsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Encoder] operator[SEP] identifier[hexEncode] operator[SEP] identifier[passwordHash] operator[SEP] operator[SEP]
}
|
public JobUpdateHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new DateTimeRfc1123(lastModified);
}
return this;
} | class class_name[name] begin[{]
method[withLastModified, return_type[type[JobUpdateHeaders]], modifier[public], parameter[lastModified]] begin[{]
if[binary_operation[member[.lastModified], ==, literal[null]]] begin[{]
assign[THIS[member[None.lastModified]], literal[null]]
else begin[{]
assign[THIS[member[None.lastModified]], ClassCreator(arguments=[MemberReference(member=lastModified, 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=DateTimeRfc1123, sub_type=None))]
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[JobUpdateHeaders] identifier[withLastModified] operator[SEP] identifier[DateTime] identifier[lastModified] operator[SEP] {
Keyword[if] operator[SEP] identifier[lastModified] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[lastModified] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[lastModified] operator[=] Keyword[new] identifier[DateTimeRfc1123] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public void addAllowedOrigin(String origin) {
Constraint.ensureNotEmpty(origin, String.format("Invalid origin '%s'", origin));
allowedOrigins.add(origin);
} | class class_name[name] begin[{]
method[addAllowedOrigin, return_type[void], modifier[public], parameter[origin]] begin[{]
call[Constraint.ensureNotEmpty, parameter[member[.origin], call[String.format, parameter[literal["Invalid origin '%s'"], member[.origin]]]]]
call[allowedOrigins.add, parameter[member[.origin]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addAllowedOrigin] operator[SEP] identifier[String] identifier[origin] operator[SEP] {
identifier[Constraint] operator[SEP] identifier[ensureNotEmpty] operator[SEP] identifier[origin] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[origin] operator[SEP] operator[SEP] operator[SEP] identifier[allowedOrigins] operator[SEP] identifier[add] operator[SEP] identifier[origin] operator[SEP] operator[SEP]
}
|
private String handleFTMBizzareDateFormat(final String dateString) {
approximation = DateParser.Approximation.BETWEEN;
String string = stripPrefix(dateString, "(").trim();
string = stripSuffix(string, ")").trim();
if ("BIC".equals(string)) {
// BIC refers to LDS status "born in the covenant". Such a date can
// be treated as a plain string with no approximation semantics.
return "";
}
if (startsWithIgnoreCase(string, ABT)) {
string = stripPrefix(string, ABT).trim();
approximation = DateParser.Approximation.ABOUT;
}
if (startsWithIgnoreCase(string, AFT)) {
string = stripPrefix(string, AFT).trim();
approximation = DateParser.Approximation.AFTER;
}
if (startsWithIgnoreCase(string, BEF)) {
string = stripPrefix(string, BEF).trim();
approximation = DateParser.Approximation.BEFORE;
}
if (startsWithIgnoreCase(string, FROM)) {
string = stripPrefix(string, FROM).trim();
}
string = truncateAt(string, "-");
string = truncateAt(string, " TO ");
if (string.length() <= 2) {
// Probably like 10-11 Nov 2017
string = stripPrefix(dateString, "(").trim();
string = stripSuffix(string, ")").trim();
string = removeBeginningAt(string, "-");
string = removeBeginningAt(string, " TO ");
}
return string;
} | class class_name[name] begin[{]
method[handleFTMBizzareDateFormat, return_type[type[String]], modifier[private], parameter[dateString]] begin[{]
assign[member[.approximation], member[DateParser.Approximation.BETWEEN]]
local_variable[type[String], string]
assign[member[.string], call[.stripSuffix, parameter[member[.string], literal[")"]]]]
if[literal["BIC"]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
if[call[.startsWithIgnoreCase, parameter[member[.string], member[.ABT]]]] begin[{]
assign[member[.string], call[.stripPrefix, parameter[member[.string], member[.ABT]]]]
assign[member[.approximation], member[DateParser.Approximation.ABOUT]]
else begin[{]
None
end[}]
if[call[.startsWithIgnoreCase, parameter[member[.string], member[.AFT]]]] begin[{]
assign[member[.string], call[.stripPrefix, parameter[member[.string], member[.AFT]]]]
assign[member[.approximation], member[DateParser.Approximation.AFTER]]
else begin[{]
None
end[}]
if[call[.startsWithIgnoreCase, parameter[member[.string], member[.BEF]]]] begin[{]
assign[member[.string], call[.stripPrefix, parameter[member[.string], member[.BEF]]]]
assign[member[.approximation], member[DateParser.Approximation.BEFORE]]
else begin[{]
None
end[}]
if[call[.startsWithIgnoreCase, parameter[member[.string], member[.FROM]]]] begin[{]
assign[member[.string], call[.stripPrefix, parameter[member[.string], member[.FROM]]]]
else begin[{]
None
end[}]
assign[member[.string], call[.truncateAt, parameter[member[.string], literal["-"]]]]
assign[member[.string], call[.truncateAt, parameter[member[.string], literal[" TO "]]]]
if[binary_operation[call[string.length, parameter[]], <=, literal[2]]] begin[{]
assign[member[.string], call[.stripPrefix, parameter[member[.dateString], literal["("]]]]
assign[member[.string], call[.stripSuffix, parameter[member[.string], literal[")"]]]]
assign[member[.string], call[.removeBeginningAt, parameter[member[.string], literal["-"]]]]
assign[member[.string], call[.removeBeginningAt, parameter[member[.string], literal[" TO "]]]]
else begin[{]
None
end[}]
return[member[.string]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[handleFTMBizzareDateFormat] operator[SEP] Keyword[final] identifier[String] identifier[dateString] operator[SEP] {
identifier[approximation] operator[=] identifier[DateParser] operator[SEP] identifier[Approximation] operator[SEP] identifier[BETWEEN] operator[SEP] identifier[String] identifier[string] operator[=] identifier[stripPrefix] operator[SEP] identifier[dateString] , literal[String] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[string] operator[=] identifier[stripSuffix] operator[SEP] identifier[string] , literal[String] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[string] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[if] operator[SEP] identifier[startsWithIgnoreCase] operator[SEP] identifier[string] , identifier[ABT] operator[SEP] operator[SEP] {
identifier[string] operator[=] identifier[stripPrefix] operator[SEP] identifier[string] , identifier[ABT] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[approximation] operator[=] identifier[DateParser] operator[SEP] identifier[Approximation] operator[SEP] identifier[ABOUT] operator[SEP]
}
Keyword[if] operator[SEP] identifier[startsWithIgnoreCase] operator[SEP] identifier[string] , identifier[AFT] operator[SEP] operator[SEP] {
identifier[string] operator[=] identifier[stripPrefix] operator[SEP] identifier[string] , identifier[AFT] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[approximation] operator[=] identifier[DateParser] operator[SEP] identifier[Approximation] operator[SEP] identifier[AFTER] operator[SEP]
}
Keyword[if] operator[SEP] identifier[startsWithIgnoreCase] operator[SEP] identifier[string] , identifier[BEF] operator[SEP] operator[SEP] {
identifier[string] operator[=] identifier[stripPrefix] operator[SEP] identifier[string] , identifier[BEF] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[approximation] operator[=] identifier[DateParser] operator[SEP] identifier[Approximation] operator[SEP] identifier[BEFORE] operator[SEP]
}
Keyword[if] operator[SEP] identifier[startsWithIgnoreCase] operator[SEP] identifier[string] , identifier[FROM] operator[SEP] operator[SEP] {
identifier[string] operator[=] identifier[stripPrefix] operator[SEP] identifier[string] , identifier[FROM] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP]
}
identifier[string] operator[=] identifier[truncateAt] operator[SEP] identifier[string] , literal[String] operator[SEP] operator[SEP] identifier[string] operator[=] identifier[truncateAt] operator[SEP] identifier[string] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[string] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<=] Other[2] operator[SEP] {
identifier[string] operator[=] identifier[stripPrefix] operator[SEP] identifier[dateString] , literal[String] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[string] operator[=] identifier[stripSuffix] operator[SEP] identifier[string] , literal[String] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[string] operator[=] identifier[removeBeginningAt] operator[SEP] identifier[string] , literal[String] operator[SEP] operator[SEP] identifier[string] operator[=] identifier[removeBeginningAt] operator[SEP] identifier[string] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[string] operator[SEP]
}
|
public DfuServiceInitiator setScope(@DfuScope final int scope) {
if (!DfuBaseService.MIME_TYPE_ZIP.equals(mimeType))
throw new UnsupportedOperationException("Scope can be set only for a ZIP file");
if (scope == SCOPE_APPLICATION)
fileType = DfuBaseService.TYPE_APPLICATION;
else if (scope == SCOPE_SYSTEM_COMPONENTS)
fileType = DfuBaseService.TYPE_SOFT_DEVICE | DfuBaseService.TYPE_BOOTLOADER;
else if (scope == (SCOPE_APPLICATION | SCOPE_SYSTEM_COMPONENTS))
fileType = DfuBaseService.TYPE_AUTO;
else throw new UnsupportedOperationException("Unknown scope");
return this;
} | class class_name[name] begin[{]
method[setScope, return_type[type[DfuServiceInitiator]], modifier[public], parameter[scope]] begin[{]
if[call[DfuBaseService.MIME_TYPE_ZIP.equals, parameter[member[.mimeType]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Scope can be set only for a ZIP file")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.scope], ==, member[.SCOPE_APPLICATION]]] begin[{]
assign[member[.fileType], member[DfuBaseService.TYPE_APPLICATION]]
else begin[{]
if[binary_operation[member[.scope], ==, member[.SCOPE_SYSTEM_COMPONENTS]]] begin[{]
assign[member[.fileType], binary_operation[member[DfuBaseService.TYPE_SOFT_DEVICE], |, member[DfuBaseService.TYPE_BOOTLOADER]]]
else begin[{]
if[binary_operation[member[.scope], ==, binary_operation[member[.SCOPE_APPLICATION], |, member[.SCOPE_SYSTEM_COMPONENTS]]]] begin[{]
assign[member[.fileType], member[DfuBaseService.TYPE_AUTO]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown scope")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[DfuServiceInitiator] identifier[setScope] operator[SEP] annotation[@] identifier[DfuScope] Keyword[final] Keyword[int] identifier[scope] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[DfuBaseService] operator[SEP] identifier[MIME_TYPE_ZIP] operator[SEP] identifier[equals] operator[SEP] identifier[mimeType] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scope] operator[==] identifier[SCOPE_APPLICATION] operator[SEP] identifier[fileType] operator[=] identifier[DfuBaseService] operator[SEP] identifier[TYPE_APPLICATION] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[scope] operator[==] identifier[SCOPE_SYSTEM_COMPONENTS] operator[SEP] identifier[fileType] operator[=] identifier[DfuBaseService] operator[SEP] identifier[TYPE_SOFT_DEVICE] operator[|] identifier[DfuBaseService] operator[SEP] identifier[TYPE_BOOTLOADER] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[scope] operator[==] operator[SEP] identifier[SCOPE_APPLICATION] operator[|] identifier[SCOPE_SYSTEM_COMPONENTS] operator[SEP] operator[SEP] identifier[fileType] operator[=] identifier[DfuBaseService] operator[SEP] identifier[TYPE_AUTO] operator[SEP] Keyword[else] Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public JPanel getPanel() {
if (panel == null) {
panel = getComponentFactory().createPanel();
}
insertMissingSpecs();
fixColSpans();
fillInGaps();
fillPanel();
if( focusOrder != null ) {
installFocusOrder( focusOrder );
}
return panel;
} | class class_name[name] begin[{]
method[getPanel, return_type[type[JPanel]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.panel], ==, literal[null]]] begin[{]
assign[member[.panel], call[.getComponentFactory, parameter[]]]
else begin[{]
None
end[}]
call[.insertMissingSpecs, parameter[]]
call[.fixColSpans, parameter[]]
call[.fillInGaps, parameter[]]
call[.fillPanel, parameter[]]
if[binary_operation[member[.focusOrder], !=, literal[null]]] begin[{]
call[.installFocusOrder, parameter[member[.focusOrder]]]
else begin[{]
None
end[}]
return[member[.panel]]
end[}]
END[}] | Keyword[public] identifier[JPanel] identifier[getPanel] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[panel] operator[==] Other[null] operator[SEP] {
identifier[panel] operator[=] identifier[getComponentFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createPanel] operator[SEP] operator[SEP] operator[SEP]
}
identifier[insertMissingSpecs] operator[SEP] operator[SEP] operator[SEP] identifier[fixColSpans] operator[SEP] operator[SEP] operator[SEP] identifier[fillInGaps] operator[SEP] operator[SEP] operator[SEP] identifier[fillPanel] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[focusOrder] operator[!=] Other[null] operator[SEP] {
identifier[installFocusOrder] operator[SEP] identifier[focusOrder] operator[SEP] operator[SEP]
}
Keyword[return] identifier[panel] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
final ReentrantLock lock = this.lock;
lock.lock();
try {
final Object[] items = this.items;
final int count = this.count;
final int firstLeg = Math.min(items.length - takeIndex, count);
if (a.length < count) {
a = (T[]) Arrays.copyOfRange(items, takeIndex, takeIndex + count,
a.getClass());
} else {
System.arraycopy(items, takeIndex, a, 0, firstLeg);
if (a.length > count)
a[count] = null;
}
if (firstLeg < count)
System.arraycopy(items, 0, a, firstLeg, putIndex);
return a;
} finally {
lock.unlock();
}
} | class class_name[name] begin[{]
method[toArray, return_type[type[T]], modifier[public], parameter[a]] begin[{]
local_variable[type[ReentrantLock], lock]
call[lock.lock, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=items, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), name=items)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=count, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), name=count)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=items, selectors=[]), operandr=MemberReference(member=takeIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), name=firstLeg)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=takeIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=firstLeg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=arraycopy, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=takeIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=takeIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None)], member=copyOfRange, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=T, sub_type=None))), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=firstLeg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=firstLeg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=putIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=arraycopy, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)), ReturnStatement(expression=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] operator[<] identifier[T] operator[>] identifier[T] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[a] operator[SEP] {
Keyword[final] identifier[ReentrantLock] identifier[lock] operator[=] Keyword[this] operator[SEP] identifier[lock] operator[SEP] identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[items] operator[=] Keyword[this] operator[SEP] identifier[items] operator[SEP] Keyword[final] Keyword[int] identifier[count] operator[=] Keyword[this] operator[SEP] identifier[count] operator[SEP] Keyword[final] Keyword[int] identifier[firstLeg] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[items] operator[SEP] identifier[length] operator[-] identifier[takeIndex] , identifier[count] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[a] operator[SEP] identifier[length] operator[<] identifier[count] operator[SEP] {
identifier[a] operator[=] operator[SEP] identifier[T] operator[SEP] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[copyOfRange] operator[SEP] identifier[items] , identifier[takeIndex] , identifier[takeIndex] operator[+] identifier[count] , identifier[a] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[items] , identifier[takeIndex] , identifier[a] , Other[0] , identifier[firstLeg] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[a] operator[SEP] identifier[length] operator[>] identifier[count] operator[SEP] identifier[a] operator[SEP] identifier[count] operator[SEP] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[firstLeg] operator[<] identifier[count] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[items] , Other[0] , identifier[a] , identifier[firstLeg] , identifier[putIndex] operator[SEP] operator[SEP] Keyword[return] identifier[a] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public synchronized boolean removeInstance(T element) {
if (end == start) return false;
if (end == -1) {
for (int i = array.length - 1; i >= 0; --i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
if (end < start) {
for (int i = array.length - 1; i >= start; --i)
if (array[i] == element) {
removeAt(i);
return true;
}
for (int i = 0; i < end; ++i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
for (int i = start; i < end; ++i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
} | class class_name[name] begin[{]
method[removeInstance, return_type[type[boolean]], modifier[synchronized public], parameter[element]] begin[{]
if[binary_operation[member[.end], ==, member[.start]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.end], ==, literal[1]]] begin[{]
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=element, 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=removeAt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=array, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[])]), label=None)
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.end], <, member[.start]]] begin[{]
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=element, 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=removeAt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=array, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[])]), label=None)
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=element, 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=removeAt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=end, 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[literal[false]]
else begin[{]
None
end[}]
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=element, 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=removeAt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[boolean] identifier[removeInstance] operator[SEP] identifier[T] identifier[element] operator[SEP] {
Keyword[if] operator[SEP] identifier[end] operator[==] identifier[start] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[end] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[array] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] identifier[i] operator[>=] Other[0] operator[SEP] operator[--] identifier[i] operator[SEP] Keyword[if] operator[SEP] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[element] operator[SEP] {
identifier[removeAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[end] operator[<] identifier[start] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[array] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] identifier[i] operator[>=] identifier[start] operator[SEP] operator[--] identifier[i] operator[SEP] Keyword[if] operator[SEP] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[element] operator[SEP] {
identifier[removeAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[end] operator[SEP] operator[++] identifier[i] operator[SEP] Keyword[if] operator[SEP] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[element] operator[SEP] {
identifier[removeAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[start] operator[SEP] identifier[i] operator[<] identifier[end] operator[SEP] operator[++] identifier[i] operator[SEP] Keyword[if] operator[SEP] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[element] operator[SEP] {
identifier[removeAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.