code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public void setSSLPort() throws InstallationFailedException {
Element httpsConnector =
(Element) getDocument()
.selectSingleNode(HTTPS_CONNECTOR_XPATH);
if (options.getBooleanValue(InstallOptions.SSL_AVAILABLE, true)) {
if (httpsConnector == null) {
Element service =
(Element) getDocument()
.selectSingleNode("/Server/Service[@name='Catalina']");
httpsConnector = service.addElement("Connector");
httpsConnector.addAttribute("maxThreads", "150");
httpsConnector.addAttribute("minSpareThreads", "25");
httpsConnector.addAttribute("maxSpareThreads", "75");
httpsConnector.addAttribute("disableUploadTimeout", "true");
httpsConnector.addAttribute("acceptCount", "100");
httpsConnector.addAttribute("debug", "0");
httpsConnector.addAttribute("scheme", "https");
httpsConnector.addAttribute("secure", "true");
httpsConnector.addAttribute("clientAuth", "false");
httpsConnector.addAttribute("sslProtocol", "TLS");
}
httpsConnector.addAttribute("port", options
.getValue(InstallOptions.TOMCAT_SSL_PORT));
httpsConnector.addAttribute("enableLookups", "true"); // supports client dns/fqdn in xacml authz policies
String keystore = options.getValue(InstallOptions.KEYSTORE_FILE);
if (keystore.equals(InstallOptions.INCLUDED)) {
keystore = KEYSTORE_LOCATION;
}
addAttribute(httpsConnector,
"keystoreFile",
keystore,
InstallOptions.DEFAULT);
addAttribute(httpsConnector,
"keystorePass",
options.getValue(InstallOptions.KEYSTORE_PASSWORD),
KEYSTORE_PASSWORD_DEFAULT);
addAttribute(httpsConnector,
"keystoreType",
options.getValue(InstallOptions.KEYSTORE_TYPE),
KEYSTORE_TYPE_DEFAULT);
// The redirectPort for the non-SSL connector should match the port on
// the SSL connector, per:
// http://tomcat.apache.org/tomcat-5.0-doc/ssl-howto.html
Element httpConnector =
(Element) getDocument()
.selectSingleNode(HTTP_CONNECTOR_XPATH);
if (httpConnector != null) {
httpConnector.addAttribute("redirectPort", options
.getValue(InstallOptions.TOMCAT_SSL_PORT));
} else {
throw new InstallationFailedException("Unable to set server.xml SSL Port. XPath for Connector element failed.");
}
} else if (httpsConnector != null) {
httpsConnector.getParent().remove(httpsConnector);
}
}
|
class class_name[name] begin[{]
method[setSSLPort, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[Element], httpsConnector]
if[call[options.getBooleanValue, parameter[member[InstallOptions.SSL_AVAILABLE], literal[true]]]] begin[{]
if[binary_operation[member[.httpsConnector], ==, literal[null]]] begin[{]
local_variable[type[Element], service]
assign[member[.httpsConnector], call[service.addElement, parameter[literal["Connector"]]]]
call[httpsConnector.addAttribute, parameter[literal["maxThreads"], literal["150"]]]
call[httpsConnector.addAttribute, parameter[literal["minSpareThreads"], literal["25"]]]
call[httpsConnector.addAttribute, parameter[literal["maxSpareThreads"], literal["75"]]]
call[httpsConnector.addAttribute, parameter[literal["disableUploadTimeout"], literal["true"]]]
call[httpsConnector.addAttribute, parameter[literal["acceptCount"], literal["100"]]]
call[httpsConnector.addAttribute, parameter[literal["debug"], literal["0"]]]
call[httpsConnector.addAttribute, parameter[literal["scheme"], literal["https"]]]
call[httpsConnector.addAttribute, parameter[literal["secure"], literal["true"]]]
call[httpsConnector.addAttribute, parameter[literal["clientAuth"], literal["false"]]]
call[httpsConnector.addAttribute, parameter[literal["sslProtocol"], literal["TLS"]]]
else begin[{]
None
end[}]
call[httpsConnector.addAttribute, parameter[literal["port"], call[options.getValue, parameter[member[InstallOptions.TOMCAT_SSL_PORT]]]]]
call[httpsConnector.addAttribute, parameter[literal["enableLookups"], literal["true"]]]
local_variable[type[String], keystore]
if[call[keystore.equals, parameter[member[InstallOptions.INCLUDED]]]] begin[{]
assign[member[.keystore], member[.KEYSTORE_LOCATION]]
else begin[{]
None
end[}]
call[.addAttribute, parameter[member[.httpsConnector], literal["keystoreFile"], member[.keystore], member[InstallOptions.DEFAULT]]]
call[.addAttribute, parameter[member[.httpsConnector], literal["keystorePass"], call[options.getValue, parameter[member[InstallOptions.KEYSTORE_PASSWORD]]], member[.KEYSTORE_PASSWORD_DEFAULT]]]
call[.addAttribute, parameter[member[.httpsConnector], literal["keystoreType"], call[options.getValue, parameter[member[InstallOptions.KEYSTORE_TYPE]]], member[.KEYSTORE_TYPE_DEFAULT]]]
local_variable[type[Element], httpConnector]
if[binary_operation[member[.httpConnector], !=, literal[null]]] begin[{]
call[httpConnector.addAttribute, parameter[literal["redirectPort"], call[options.getValue, parameter[member[InstallOptions.TOMCAT_SSL_PORT]]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to set server.xml SSL Port. XPath for Connector element failed.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InstallationFailedException, sub_type=None)), label=None)
end[}]
else begin[{]
if[binary_operation[member[.httpsConnector], !=, literal[null]]] begin[{]
call[httpsConnector.getParent, parameter[]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setSSLPort] operator[SEP] operator[SEP] Keyword[throws] identifier[InstallationFailedException] {
identifier[Element] identifier[httpsConnector] operator[=] operator[SEP] identifier[Element] operator[SEP] identifier[getDocument] operator[SEP] operator[SEP] operator[SEP] identifier[selectSingleNode] operator[SEP] identifier[HTTPS_CONNECTOR_XPATH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[getBooleanValue] operator[SEP] identifier[InstallOptions] operator[SEP] identifier[SSL_AVAILABLE] , literal[boolean] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[httpsConnector] operator[==] Other[null] operator[SEP] {
identifier[Element] identifier[service] operator[=] operator[SEP] identifier[Element] operator[SEP] identifier[getDocument] operator[SEP] operator[SEP] operator[SEP] identifier[selectSingleNode] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[=] identifier[service] operator[SEP] identifier[addElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , identifier[options] operator[SEP] identifier[getValue] operator[SEP] identifier[InstallOptions] operator[SEP] identifier[TOMCAT_SSL_PORT] operator[SEP] operator[SEP] operator[SEP] identifier[httpsConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[keystore] operator[=] identifier[options] operator[SEP] identifier[getValue] operator[SEP] identifier[InstallOptions] operator[SEP] identifier[KEYSTORE_FILE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[keystore] operator[SEP] identifier[equals] operator[SEP] identifier[InstallOptions] operator[SEP] identifier[INCLUDED] operator[SEP] operator[SEP] {
identifier[keystore] operator[=] identifier[KEYSTORE_LOCATION] operator[SEP]
}
identifier[addAttribute] operator[SEP] identifier[httpsConnector] , literal[String] , identifier[keystore] , identifier[InstallOptions] operator[SEP] identifier[DEFAULT] operator[SEP] operator[SEP] identifier[addAttribute] operator[SEP] identifier[httpsConnector] , literal[String] , identifier[options] operator[SEP] identifier[getValue] operator[SEP] identifier[InstallOptions] operator[SEP] identifier[KEYSTORE_PASSWORD] operator[SEP] , identifier[KEYSTORE_PASSWORD_DEFAULT] operator[SEP] operator[SEP] identifier[addAttribute] operator[SEP] identifier[httpsConnector] , literal[String] , identifier[options] operator[SEP] identifier[getValue] operator[SEP] identifier[InstallOptions] operator[SEP] identifier[KEYSTORE_TYPE] operator[SEP] , identifier[KEYSTORE_TYPE_DEFAULT] operator[SEP] operator[SEP] identifier[Element] identifier[httpConnector] operator[=] operator[SEP] identifier[Element] operator[SEP] identifier[getDocument] operator[SEP] operator[SEP] operator[SEP] identifier[selectSingleNode] operator[SEP] identifier[HTTP_CONNECTOR_XPATH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[httpConnector] operator[!=] Other[null] operator[SEP] {
identifier[httpConnector] operator[SEP] identifier[addAttribute] operator[SEP] literal[String] , identifier[options] operator[SEP] identifier[getValue] operator[SEP] identifier[InstallOptions] operator[SEP] identifier[TOMCAT_SSL_PORT] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[InstallationFailedException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[httpsConnector] operator[!=] Other[null] operator[SEP] {
identifier[httpsConnector] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[httpsConnector] operator[SEP] operator[SEP]
}
}
|
public void writeUncommitted(SIMPMessage m)
throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writeUncommitted", new Object[] { m });
TickRange tr = null;
JsMessage jsMsg = m.getMessage();
long stamp = jsMsg.getGuaranteedValueValueTick();
long starts = jsMsg.getGuaranteedValueStartTick();
long ends = jsMsg.getGuaranteedValueEndTick();
long completedPrefix;
tr = TickRange.newUncommittedTick(stamp);
tr.startstamp = starts;
tr.endstamp = ends;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "writeUncommitted at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + streamID);
}
synchronized (this)
{
// write into stream
oststream.writeCombinedRange(tr);
completedPrefix = oststream.getCompletedPrefix();
sendSilence(starts, completedPrefix);
// SIB0105
// If this is the first uncommitted messages to be added to the stream, start off the
// blocked message health state timer. This will check back in the future to see if the
// message successfully sent.
if (blockedStreamAlarm == null)
{
blockedStreamAlarm = new BlockedStreamAlarm(this, getCompletedPrefix());
am.create(GDConfig.BLOCKED_STREAM_HEALTH_CHECK_INTERVAL, blockedStreamAlarm);
}
} // end synchronized
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writeUncommitted");
}
|
class class_name[name] begin[{]
method[writeUncommitted, return_type[void], modifier[public], parameter[m]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["writeUncommitted"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[TickRange], tr]
local_variable[type[JsMessage], jsMsg]
local_variable[type[long], stamp]
local_variable[type[long], starts]
local_variable[type[long], ends]
local_variable[type[long], completedPrefix]
assign[member[.tr], call[TickRange.newUncommittedTick, parameter[member[.stamp]]]]
assign[member[tr.startstamp], member[.starts]]
assign[member[tr.endstamp], member[.ends]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[SibTr.debug, parameter[member[.tc], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["writeUncommitted at: "], +, member[.stamp]], +, literal[" with Silence from: "]], +, member[.starts]], +, literal[" to "]], +, member[.ends]], +, literal[" on Stream "]], +, member[.streamID]]]]
else begin[{]
None
end[}]
SYNCHRONIZED[THIS[]] BEGIN[{]
call[oststream.writeCombinedRange, parameter[member[.tr]]]
assign[member[.completedPrefix], call[oststream.getCompletedPrefix, parameter[]]]
call[.sendSilence, parameter[member[.starts], member[.completedPrefix]]]
if[binary_operation[member[.blockedStreamAlarm], ==, literal[null]]] begin[{]
assign[member[.blockedStreamAlarm], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[], member=getCompletedPrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BlockedStreamAlarm, sub_type=None))]
call[am.create, parameter[member[GDConfig.BLOCKED_STREAM_HEALTH_CHECK_INTERVAL], member[.blockedStreamAlarm]]]
else begin[{]
None
end[}]
END[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["writeUncommitted"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[writeUncommitted] operator[SEP] identifier[SIMPMessage] identifier[m] operator[SEP] Keyword[throws] identifier[SIResourceException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[m]
} operator[SEP] operator[SEP] identifier[TickRange] identifier[tr] operator[=] Other[null] operator[SEP] identifier[JsMessage] identifier[jsMsg] operator[=] identifier[m] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[stamp] operator[=] identifier[jsMsg] operator[SEP] identifier[getGuaranteedValueValueTick] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[starts] operator[=] identifier[jsMsg] operator[SEP] identifier[getGuaranteedValueStartTick] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[ends] operator[=] identifier[jsMsg] operator[SEP] identifier[getGuaranteedValueEndTick] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[completedPrefix] operator[SEP] identifier[tr] operator[=] identifier[TickRange] operator[SEP] identifier[newUncommittedTick] operator[SEP] identifier[stamp] operator[SEP] operator[SEP] identifier[tr] operator[SEP] identifier[startstamp] operator[=] identifier[starts] operator[SEP] identifier[tr] operator[SEP] identifier[endstamp] operator[=] identifier[ends] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[stamp] operator[+] literal[String] operator[+] identifier[starts] operator[+] literal[String] operator[+] identifier[ends] operator[+] literal[String] operator[+] identifier[streamID] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
identifier[oststream] operator[SEP] identifier[writeCombinedRange] operator[SEP] identifier[tr] operator[SEP] operator[SEP] identifier[completedPrefix] operator[=] identifier[oststream] operator[SEP] identifier[getCompletedPrefix] operator[SEP] operator[SEP] operator[SEP] identifier[sendSilence] operator[SEP] identifier[starts] , identifier[completedPrefix] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[blockedStreamAlarm] operator[==] Other[null] operator[SEP] {
identifier[blockedStreamAlarm] operator[=] Keyword[new] identifier[BlockedStreamAlarm] operator[SEP] Keyword[this] , identifier[getCompletedPrefix] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[am] operator[SEP] identifier[create] operator[SEP] identifier[GDConfig] operator[SEP] identifier[BLOCKED_STREAM_HEALTH_CHECK_INTERVAL] , identifier[blockedStreamAlarm] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public String getPomFileContent() {
try (InputStream inputStream = new FileInputStream(pomFile)) {
return IOUtils.toString(inputStream, encoding);
} catch (UnsupportedCharsetException ex) {
throw new FailureException("Could not handle encoding: " + encoding, ex);
} catch (IOException ex) {
throw new FailureException("Could not read pom file: " + pomFile.getAbsolutePath(), ex);
}
}
|
class class_name[name] begin[{]
method[getPomFileContent, return_type[type[String]], modifier[public], parameter[]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=IOUtils, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not handle encoding: "), operandr=MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), 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=FailureException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['UnsupportedCharsetException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not read pom file: "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=pomFile, selectors=[], type_arguments=None), operator=+), 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=FailureException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=inputStream, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=pomFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None)))])
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getPomFileContent] operator[SEP] operator[SEP] {
Keyword[try] operator[SEP] identifier[InputStream] identifier[inputStream] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[pomFile] operator[SEP] operator[SEP] {
Keyword[return] identifier[IOUtils] operator[SEP] identifier[toString] operator[SEP] identifier[inputStream] , identifier[encoding] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedCharsetException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FailureException] operator[SEP] literal[String] operator[+] identifier[encoding] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FailureException] operator[SEP] literal[String] operator[+] identifier[pomFile] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
@GwtIncompatible("incompatible method")
public static void isInstanceOf(final Class<?> type, @Nullable final Object obj) {
Assert.isInstanceOf(type, obj, "");
}
|
class class_name[name] begin[{]
method[isInstanceOf, return_type[void], modifier[public static], parameter[type, obj]] begin[{]
call[Assert.isInstanceOf, parameter[member[.type], member[.obj], literal[""]]]
end[}]
END[}]
|
annotation[@] identifier[GwtIncompatible] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] Keyword[void] identifier[isInstanceOf] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[type] , annotation[@] identifier[Nullable] Keyword[final] identifier[Object] identifier[obj] operator[SEP] {
identifier[Assert] operator[SEP] identifier[isInstanceOf] operator[SEP] identifier[type] , identifier[obj] , literal[String] operator[SEP] operator[SEP]
}
|
@Pure
public static <K, V> LinkedHashMap<K, V> newLinkedHashMap() {
return new LinkedHashMap<K, V>();
}
|
class class_name[name] begin[{]
method[newLinkedHashMap, return_type[type[LinkedHashMap]], modifier[public static], parameter[]] begin[{]
return[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=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=LinkedHashMap, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Pure] Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[LinkedHashMap] operator[<] identifier[K] , identifier[V] operator[>] identifier[newLinkedHashMap] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
|
public synchronized void termin(TerminType type) {
// 构建termin信号
List<Long> processIds = new ArrayList<Long>(progress.keySet());
Collections.sort(processIds);// 做一下排序
for (Long processId : processIds) {
EtlEventData eventData = progress.get(processId).getData();
TerminEventData data = new TerminEventData();
data.setPipelineId(getPipelineId());
data.setType(type);
data.setCode("channel");
data.setDesc(type.toString());
data.setProcessId(processId);
if (eventData != null) {
data.setBatchId(eventData.getBatchId());
data.setCurrNid(eventData.getCurrNid());
data.setStartTime(eventData.getStartTime());
data.setEndTime(eventData.getEndTime());
data.setFirstTime(eventData.getFirstTime());
data.setNumber(eventData.getNumber());
data.setSize(eventData.getSize());
data.setExts(eventData.getExts());
}
offerTermin(data);
progress.remove(processId);
}
// 重新初始化一下select调度
initSelect();
}
|
class class_name[name] begin[{]
method[termin, return_type[void], modifier[synchronized public], parameter[type]] begin[{]
local_variable[type[List], processIds]
call[Collections.sort, parameter[member[.processIds]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=processId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=progress, selectors=[MethodInvocation(arguments=[], member=getData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=eventData)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EtlEventData, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TerminEventData, sub_type=None)), name=data)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TerminEventData, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPipelineId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setPipelineId, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setType, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="channel")], member=setCode, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None)], member=setDesc, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=processId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setProcessId, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=eventData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBatchId, postfix_operators=[], prefix_operators=[], qualifier=eventData, selectors=[], type_arguments=None)], member=setBatchId, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCurrNid, postfix_operators=[], prefix_operators=[], qualifier=eventData, selectors=[], type_arguments=None)], member=setCurrNid, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStartTime, postfix_operators=[], prefix_operators=[], qualifier=eventData, selectors=[], type_arguments=None)], member=setStartTime, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEndTime, postfix_operators=[], prefix_operators=[], qualifier=eventData, selectors=[], type_arguments=None)], member=setEndTime, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFirstTime, postfix_operators=[], prefix_operators=[], qualifier=eventData, selectors=[], type_arguments=None)], member=setFirstTime, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNumber, postfix_operators=[], prefix_operators=[], qualifier=eventData, selectors=[], type_arguments=None)], member=setNumber, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSize, postfix_operators=[], prefix_operators=[], qualifier=eventData, selectors=[], type_arguments=None)], member=setSize, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getExts, postfix_operators=[], prefix_operators=[], qualifier=eventData, selectors=[], type_arguments=None)], member=setExts, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=offerTermin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=processId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=progress, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=processIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=processId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))), label=None)
call[.initSelect, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[void] identifier[termin] operator[SEP] identifier[TerminType] identifier[type] operator[SEP] {
identifier[List] operator[<] identifier[Long] operator[>] identifier[processIds] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Long] operator[>] operator[SEP] identifier[progress] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[processIds] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Long] identifier[processId] operator[:] identifier[processIds] operator[SEP] {
identifier[EtlEventData] identifier[eventData] operator[=] identifier[progress] operator[SEP] identifier[get] operator[SEP] identifier[processId] operator[SEP] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[TerminEventData] identifier[data] operator[=] Keyword[new] identifier[TerminEventData] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setPipelineId] operator[SEP] identifier[getPipelineId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setType] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setCode] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setDesc] operator[SEP] identifier[type] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setProcessId] operator[SEP] identifier[processId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[eventData] operator[!=] Other[null] operator[SEP] {
identifier[data] operator[SEP] identifier[setBatchId] operator[SEP] identifier[eventData] operator[SEP] identifier[getBatchId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setCurrNid] operator[SEP] identifier[eventData] operator[SEP] identifier[getCurrNid] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setStartTime] operator[SEP] identifier[eventData] operator[SEP] identifier[getStartTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setEndTime] operator[SEP] identifier[eventData] operator[SEP] identifier[getEndTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setFirstTime] operator[SEP] identifier[eventData] operator[SEP] identifier[getFirstTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setNumber] operator[SEP] identifier[eventData] operator[SEP] identifier[getNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setSize] operator[SEP] identifier[eventData] operator[SEP] identifier[getSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[setExts] operator[SEP] identifier[eventData] operator[SEP] identifier[getExts] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[offerTermin] operator[SEP] identifier[data] operator[SEP] operator[SEP] identifier[progress] operator[SEP] identifier[remove] operator[SEP] identifier[processId] operator[SEP] operator[SEP]
}
identifier[initSelect] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public String[] getCacheInstanceNames() {
Map instances = ServerCache.getCacheInstances();
String names[] = new String[instances.size()];
Iterator it = instances.keySet().iterator();
int i = 0;
while (it.hasNext()) {
names[i] = (String) it.next();
i++;
}
return names;
}
|
class class_name[name] begin[{]
method[getCacheInstanceNames, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[Map], instances]
local_variable[type[String], names]
local_variable[type[Iterator], it]
local_variable[type[int], i]
while[call[it.hasNext, parameter[]]] begin[{]
assign[member[.names], Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]
member[.i]
end[}]
return[member[.names]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[String] operator[SEP] operator[SEP] identifier[getCacheInstanceNames] operator[SEP] operator[SEP] {
identifier[Map] identifier[instances] operator[=] identifier[ServerCache] operator[SEP] identifier[getCacheInstances] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[names] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[instances] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] identifier[it] operator[=] identifier[instances] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[names] operator[SEP] identifier[i] operator[SEP] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP]
}
Keyword[return] identifier[names] operator[SEP]
}
|
public OvhRefund refund_refundId_GET(String refundId) throws IOException {
String qPath = "/me/refund/{refundId}";
StringBuilder sb = path(qPath, refundId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRefund.class);
}
|
class class_name[name] begin[{]
method[refund_refundId_GET, return_type[type[OvhRefund]], modifier[public], parameter[refundId]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhRefund, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[OvhRefund] identifier[refund_refundId_GET] operator[SEP] identifier[String] identifier[refundId] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[refundId] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhRefund] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static TransientPropertyData createPropertyData(NodeData parent, InternalQName name, int type,
boolean multiValued)
{
QPath path = QPath.makeChildPath(parent.getQPath(), name);
TransientPropertyData propData =
new TransientPropertyData(path, IdGenerator.generate(), -1, type, parent.getIdentifier(), multiValued);
return propData;
}
|
class class_name[name] begin[{]
method[createPropertyData, return_type[type[TransientPropertyData]], modifier[public static], parameter[parent, name, type, multiValued]] begin[{]
local_variable[type[QPath], path]
local_variable[type[TransientPropertyData], propData]
return[member[.propData]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[TransientPropertyData] identifier[createPropertyData] operator[SEP] identifier[NodeData] identifier[parent] , identifier[InternalQName] identifier[name] , Keyword[int] identifier[type] , Keyword[boolean] identifier[multiValued] operator[SEP] {
identifier[QPath] identifier[path] operator[=] identifier[QPath] operator[SEP] identifier[makeChildPath] operator[SEP] identifier[parent] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] , identifier[name] operator[SEP] operator[SEP] identifier[TransientPropertyData] identifier[propData] operator[=] Keyword[new] identifier[TransientPropertyData] operator[SEP] identifier[path] , identifier[IdGenerator] operator[SEP] identifier[generate] operator[SEP] operator[SEP] , operator[-] Other[1] , identifier[type] , identifier[parent] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] , identifier[multiValued] operator[SEP] operator[SEP] Keyword[return] identifier[propData] operator[SEP]
}
|
protected void initLocaleEncodingList(XmlParser.Node node)
{
Iterator iter=node.iterator("locale-encoding-mapping");
while(iter.hasNext())
{
XmlParser.Node mapping=(XmlParser.Node)iter.next();
String locale=mapping.getString("locale",false,true);
String encoding=mapping.getString("encoding",false,true);
getWebApplicationContext().addLocaleEncoding(locale,encoding);
}
}
|
class class_name[name] begin[{]
method[initLocaleEncodingList, return_type[void], modifier[protected], parameter[node]] begin[{]
local_variable[type[Iterator], iter]
while[call[iter.hasNext, parameter[]]] begin[{]
local_variable[type[XmlParser], mapping]
local_variable[type[String], locale]
local_variable[type[String], encoding]
call[.getWebApplicationContext, parameter[]]
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[initLocaleEncodingList] operator[SEP] identifier[XmlParser] operator[SEP] identifier[Node] identifier[node] operator[SEP] {
identifier[Iterator] identifier[iter] operator[=] identifier[node] operator[SEP] identifier[iterator] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[XmlParser] operator[SEP] identifier[Node] identifier[mapping] operator[=] operator[SEP] identifier[XmlParser] operator[SEP] identifier[Node] operator[SEP] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[locale] operator[=] identifier[mapping] operator[SEP] identifier[getString] operator[SEP] literal[String] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] identifier[String] identifier[encoding] operator[=] identifier[mapping] operator[SEP] identifier[getString] operator[SEP] literal[String] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] identifier[getWebApplicationContext] operator[SEP] operator[SEP] operator[SEP] identifier[addLocaleEncoding] operator[SEP] identifier[locale] , identifier[encoding] operator[SEP] operator[SEP]
}
}
|
@Override
protected void doExecute() {
Predicate<MailMessage> condition = createMessagePredicate();
List<MailMessage> messages = mailService.findMessages(accountReservationKey, condition, getExpectedMessagesCount());
validateMessages(messages);
}
|
class class_name[name] begin[{]
method[doExecute, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[Predicate], condition]
local_variable[type[List], messages]
call[.validateMessages, parameter[member[.messages]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[doExecute] operator[SEP] operator[SEP] {
identifier[Predicate] operator[<] identifier[MailMessage] operator[>] identifier[condition] operator[=] identifier[createMessagePredicate] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[MailMessage] operator[>] identifier[messages] operator[=] identifier[mailService] operator[SEP] identifier[findMessages] operator[SEP] identifier[accountReservationKey] , identifier[condition] , identifier[getExpectedMessagesCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[validateMessages] operator[SEP] identifier[messages] operator[SEP] operator[SEP]
}
|
@Override
public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in) {
final InputStreamReader inputStream = new InputStreamReader( new ByteArrayInputStream( in ) );
if (LOG.isDebugEnabled()) {
LOG.debug("deserialize the stream");
}
try {
return deserializer.deserializeInto(inputStream, new ConcurrentHashMap<String, Object>());
} catch( final RuntimeException e) {
LOG.warn("Caught Exception deserializing JSON "+e);
throw new TranscoderDeserializationException(e);
}
}
|
class class_name[name] begin[{]
method[deserializeAttributes, return_type[type[ConcurrentMap]], modifier[public], parameter[in]] begin[{]
local_variable[type[InputStreamReader], inputStream]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[literal["deserialize the stream"]]]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=ConcurrentHashMap, sub_type=None))], member=deserializeInto, postfix_operators=[], prefix_operators=[], qualifier=deserializer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Caught Exception deserializing JSON "), operandr=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TranscoderDeserializationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RuntimeException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ConcurrentMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[deserializeAttributes] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[in] operator[SEP] {
Keyword[final] identifier[InputStreamReader] identifier[inputStream] operator[=] Keyword[new] identifier[InputStreamReader] operator[SEP] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[in] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[deserializer] operator[SEP] identifier[deserializeInto] operator[SEP] identifier[inputStream] , Keyword[new] identifier[ConcurrentHashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[RuntimeException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[TranscoderDeserializationException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
private void init(AnnotatedElement element) {
Annotation[] declaredAnnotations = element.getDeclaredAnnotations();
this.declaredAnnotationMap = new HashMap<>();
parseDeclared(declaredAnnotations);
Annotation[] annotations = element.getAnnotations();
if(declaredAnnotations == annotations) {
this.annotationMap = this.declaredAnnotationMap;
}else {
this.annotationMap = new HashMap<>();
parse(annotations);
}
}
|
class class_name[name] begin[{]
method[init, return_type[void], modifier[private], parameter[element]] begin[{]
local_variable[type[Annotation], declaredAnnotations]
assign[THIS[member[None.declaredAnnotationMap]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashMap, sub_type=None))]
call[.parseDeclared, parameter[member[.declaredAnnotations]]]
local_variable[type[Annotation], annotations]
if[binary_operation[member[.declaredAnnotations], ==, member[.annotations]]] begin[{]
assign[THIS[member[None.annotationMap]], THIS[member[None.declaredAnnotationMap]]]
else begin[{]
assign[THIS[member[None.annotationMap]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashMap, sub_type=None))]
call[.parse, parameter[member[.annotations]]]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[init] operator[SEP] identifier[AnnotatedElement] identifier[element] operator[SEP] {
identifier[Annotation] operator[SEP] operator[SEP] identifier[declaredAnnotations] operator[=] identifier[element] operator[SEP] identifier[getDeclaredAnnotations] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[declaredAnnotationMap] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[parseDeclared] operator[SEP] identifier[declaredAnnotations] operator[SEP] operator[SEP] identifier[Annotation] operator[SEP] operator[SEP] identifier[annotations] operator[=] identifier[element] operator[SEP] identifier[getAnnotations] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[declaredAnnotations] operator[==] identifier[annotations] operator[SEP] {
Keyword[this] operator[SEP] identifier[annotationMap] operator[=] Keyword[this] operator[SEP] identifier[declaredAnnotationMap] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[annotationMap] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[parse] operator[SEP] identifier[annotations] operator[SEP] operator[SEP]
}
}
|
public void setNotebookInstanceLifecycleConfigs(java.util.Collection<NotebookInstanceLifecycleConfigSummary> notebookInstanceLifecycleConfigs) {
if (notebookInstanceLifecycleConfigs == null) {
this.notebookInstanceLifecycleConfigs = null;
return;
}
this.notebookInstanceLifecycleConfigs = new java.util.ArrayList<NotebookInstanceLifecycleConfigSummary>(notebookInstanceLifecycleConfigs);
}
|
class class_name[name] begin[{]
method[setNotebookInstanceLifecycleConfigs, return_type[void], modifier[public], parameter[notebookInstanceLifecycleConfigs]] begin[{]
if[binary_operation[member[.notebookInstanceLifecycleConfigs], ==, literal[null]]] begin[{]
assign[THIS[member[None.notebookInstanceLifecycleConfigs]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.notebookInstanceLifecycleConfigs]], ClassCreator(arguments=[MemberReference(member=notebookInstanceLifecycleConfigs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NotebookInstanceLifecycleConfigSummary, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setNotebookInstanceLifecycleConfigs] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[NotebookInstanceLifecycleConfigSummary] operator[>] identifier[notebookInstanceLifecycleConfigs] operator[SEP] {
Keyword[if] operator[SEP] identifier[notebookInstanceLifecycleConfigs] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[notebookInstanceLifecycleConfigs] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[notebookInstanceLifecycleConfigs] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[NotebookInstanceLifecycleConfigSummary] operator[>] operator[SEP] identifier[notebookInstanceLifecycleConfigs] operator[SEP] operator[SEP]
}
|
@Override
public CPFriendlyURLEntry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
}
|
class class_name[name] begin[{]
method[fetchByUUID_G, return_type[type[CPFriendlyURLEntry]], modifier[public], parameter[uuid, groupId]] begin[{]
return[call[.fetchByUUID_G, parameter[member[.uuid], member[.groupId], literal[true]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[CPFriendlyURLEntry] identifier[fetchByUUID_G] operator[SEP] identifier[String] identifier[uuid] , Keyword[long] identifier[groupId] operator[SEP] {
Keyword[return] identifier[fetchByUUID_G] operator[SEP] identifier[uuid] , identifier[groupId] , literal[boolean] operator[SEP] operator[SEP]
}
|
public static EndSpanOptions getEndSpanOptions(@Nullable Integer statusCode) {
// Always sample the span, but optionally export it.
EndSpanOptions.Builder builder = EndSpanOptions.builder();
if (statusCode == null) {
builder.setStatus(Status.UNKNOWN);
} else if (!HttpStatusCodes.isSuccess(statusCode)) {
switch (statusCode) {
case HttpStatusCodes.STATUS_CODE_BAD_REQUEST:
builder.setStatus(Status.INVALID_ARGUMENT);
break;
case HttpStatusCodes.STATUS_CODE_UNAUTHORIZED:
builder.setStatus(Status.UNAUTHENTICATED);
break;
case HttpStatusCodes.STATUS_CODE_FORBIDDEN:
builder.setStatus(Status.PERMISSION_DENIED);
break;
case HttpStatusCodes.STATUS_CODE_NOT_FOUND:
builder.setStatus(Status.NOT_FOUND);
break;
case HttpStatusCodes.STATUS_CODE_PRECONDITION_FAILED:
builder.setStatus(Status.FAILED_PRECONDITION);
break;
case HttpStatusCodes.STATUS_CODE_SERVER_ERROR:
builder.setStatus(Status.UNAVAILABLE);
break;
default:
builder.setStatus(Status.UNKNOWN);
}
} else {
builder.setStatus(Status.OK);
}
return builder.build();
}
|
class class_name[name] begin[{]
method[getEndSpanOptions, return_type[type[EndSpanOptions]], modifier[public static], parameter[statusCode]] begin[{]
local_variable[type[EndSpanOptions], builder]
if[binary_operation[member[.statusCode], ==, literal[null]]] begin[{]
call[builder.setStatus, parameter[member[Status.UNKNOWN]]]
else begin[{]
if[call[HttpStatusCodes.isSuccess, parameter[member[.statusCode]]]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=STATUS_CODE_BAD_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=HttpStatusCodes, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=INVALID_ARGUMENT, postfix_operators=[], prefix_operators=[], qualifier=Status, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=STATUS_CODE_UNAUTHORIZED, postfix_operators=[], prefix_operators=[], qualifier=HttpStatusCodes, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=UNAUTHENTICATED, postfix_operators=[], prefix_operators=[], qualifier=Status, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=STATUS_CODE_FORBIDDEN, postfix_operators=[], prefix_operators=[], qualifier=HttpStatusCodes, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PERMISSION_DENIED, postfix_operators=[], prefix_operators=[], qualifier=Status, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=STATUS_CODE_NOT_FOUND, postfix_operators=[], prefix_operators=[], qualifier=HttpStatusCodes, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=NOT_FOUND, postfix_operators=[], prefix_operators=[], qualifier=Status, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=STATUS_CODE_PRECONDITION_FAILED, postfix_operators=[], prefix_operators=[], qualifier=HttpStatusCodes, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FAILED_PRECONDITION, postfix_operators=[], prefix_operators=[], qualifier=Status, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=STATUS_CODE_SERVER_ERROR, postfix_operators=[], prefix_operators=[], qualifier=HttpStatusCodes, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=UNAVAILABLE, postfix_operators=[], prefix_operators=[], qualifier=Status, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=UNKNOWN, postfix_operators=[], prefix_operators=[], qualifier=Status, selectors=[])], member=setStatus, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
else begin[{]
call[builder.setStatus, parameter[member[Status.OK]]]
end[}]
end[}]
return[call[builder.build, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[EndSpanOptions] identifier[getEndSpanOptions] operator[SEP] annotation[@] identifier[Nullable] identifier[Integer] identifier[statusCode] operator[SEP] {
identifier[EndSpanOptions] operator[SEP] identifier[Builder] identifier[builder] operator[=] identifier[EndSpanOptions] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[statusCode] operator[==] Other[null] operator[SEP] {
identifier[builder] operator[SEP] identifier[setStatus] operator[SEP] identifier[Status] operator[SEP] identifier[UNKNOWN] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[HttpStatusCodes] operator[SEP] identifier[isSuccess] operator[SEP] identifier[statusCode] operator[SEP] operator[SEP] {
Keyword[switch] operator[SEP] identifier[statusCode] operator[SEP] {
Keyword[case] identifier[HttpStatusCodes] operator[SEP] identifier[STATUS_CODE_BAD_REQUEST] operator[:] identifier[builder] operator[SEP] identifier[setStatus] operator[SEP] identifier[Status] operator[SEP] identifier[INVALID_ARGUMENT] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[HttpStatusCodes] operator[SEP] identifier[STATUS_CODE_UNAUTHORIZED] operator[:] identifier[builder] operator[SEP] identifier[setStatus] operator[SEP] identifier[Status] operator[SEP] identifier[UNAUTHENTICATED] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[HttpStatusCodes] operator[SEP] identifier[STATUS_CODE_FORBIDDEN] operator[:] identifier[builder] operator[SEP] identifier[setStatus] operator[SEP] identifier[Status] operator[SEP] identifier[PERMISSION_DENIED] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[HttpStatusCodes] operator[SEP] identifier[STATUS_CODE_NOT_FOUND] operator[:] identifier[builder] operator[SEP] identifier[setStatus] operator[SEP] identifier[Status] operator[SEP] identifier[NOT_FOUND] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[HttpStatusCodes] operator[SEP] identifier[STATUS_CODE_PRECONDITION_FAILED] operator[:] identifier[builder] operator[SEP] identifier[setStatus] operator[SEP] identifier[Status] operator[SEP] identifier[FAILED_PRECONDITION] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[HttpStatusCodes] operator[SEP] identifier[STATUS_CODE_SERVER_ERROR] operator[:] identifier[builder] operator[SEP] identifier[setStatus] operator[SEP] identifier[Status] operator[SEP] identifier[UNAVAILABLE] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[builder] operator[SEP] identifier[setStatus] operator[SEP] identifier[Status] operator[SEP] identifier[UNKNOWN] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[builder] operator[SEP] identifier[setStatus] operator[SEP] identifier[Status] operator[SEP] identifier[OK] operator[SEP] operator[SEP]
}
Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String getFormattedMessage(Class<?> aClass, ResourceBundle bundle, String bundleName,
String key, Object[] args, String defaultString,
Locale locale,
boolean quiet) {
return TraceNLSResolver.getInstance().getMessage(aClass,
bundle,
bundleName,
key,
args,
defaultString,
true,
locale,
quiet);
}
|
class class_name[name] begin[{]
method[getFormattedMessage, return_type[type[String]], modifier[public static], parameter[aClass, bundle, bundleName, key, args, defaultString, locale, quiet]] begin[{]
return[call[TraceNLSResolver.getInstance, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getFormattedMessage] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[aClass] , identifier[ResourceBundle] identifier[bundle] , identifier[String] identifier[bundleName] , identifier[String] identifier[key] , identifier[Object] operator[SEP] operator[SEP] identifier[args] , identifier[String] identifier[defaultString] , identifier[Locale] identifier[locale] , Keyword[boolean] identifier[quiet] operator[SEP] {
Keyword[return] identifier[TraceNLSResolver] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] identifier[aClass] , identifier[bundle] , identifier[bundleName] , identifier[key] , identifier[args] , identifier[defaultString] , literal[boolean] , identifier[locale] , identifier[quiet] operator[SEP] operator[SEP]
}
|
public <T, V> void addColumn(String name, Class<? extends V> type,
Function<T, V> getter)
{
addColumn(name, type, getter, null);
}
|
class class_name[name] begin[{]
method[addColumn, return_type[void], modifier[public], parameter[name, type, getter]] begin[{]
call[.addColumn, parameter[member[.name], member[.type], member[.getter], literal[null]]]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T] , identifier[V] operator[>] Keyword[void] identifier[addColumn] operator[SEP] identifier[String] identifier[name] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[V] operator[>] identifier[type] , identifier[Function] operator[<] identifier[T] , identifier[V] operator[>] identifier[getter] operator[SEP] {
identifier[addColumn] operator[SEP] identifier[name] , identifier[type] , identifier[getter] , Other[null] operator[SEP] operator[SEP]
}
|
private static Object decodeObject(String text) {
Object result = null;
if (text.startsWith("[]"))
result = HexString.hexToBin(text, 2);
else
result = URLDecode(text);
return result;
}
|
class class_name[name] begin[{]
method[decodeObject, return_type[type[Object]], modifier[private static], parameter[text]] begin[{]
local_variable[type[Object], result]
if[call[text.startsWith, parameter[literal["[]"]]]] begin[{]
assign[member[.result], call[HexString.hexToBin, parameter[member[.text], literal[2]]]]
else begin[{]
assign[member[.result], call[.URLDecode, parameter[member[.text]]]]
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Object] identifier[decodeObject] operator[SEP] identifier[String] identifier[text] operator[SEP] {
identifier[Object] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[text] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[HexString] operator[SEP] identifier[hexToBin] operator[SEP] identifier[text] , Other[2] operator[SEP] operator[SEP] Keyword[else] identifier[result] operator[=] identifier[URLDecode] operator[SEP] identifier[text] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public void close() throws IOException
{
if(this.in != null && this.inStream != null){
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"close", "close called->"+this);
}
this.in.close();
}
else{
super.close();
}
}
|
class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[THIS[member[None.in]], !=, literal[null]], &&, binary_operation[THIS[member[None.inStream]], !=, literal[null]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[logger.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[logger.logp, parameter[member[Level.FINE], member[.CLASS_NAME], literal["close"], binary_operation[literal["close called->"], +, THIS[]]]]
else begin[{]
None
end[}]
THIS[member[None.in]call[None.close, parameter[]]]
else begin[{]
SuperMethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[in] operator[!=] Other[null] operator[&&] Keyword[this] operator[SEP] identifier[inStream] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[+] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[in] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[super] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Implementation
protected static void createSystemAssetsInZygoteLocked() {
_AssetManager28_ _assetManagerStatic_ = reflector(_AssetManager28_.class);
AssetManager sSystem = _assetManagerStatic_.getSystem();
if (sSystem != null) {
return;
}
if (systemCppAssetManager2 == null) {
// first time! let the framework create a CppAssetManager2 and an AssetManager, which we'll
// hang on to.
directlyOn(AssetManager.class, "createSystemAssetsInZygoteLocked");
cachedSystemApkAssets = _assetManagerStatic_.getSystemApkAssets();
cachedSystemApkAssetsSet = _assetManagerStatic_.getSystemApkAssetsSet();
} else {
// reuse the shared system CppAssetManager2; create a new AssetManager around it.
_assetManagerStatic_.setSystemApkAssets(cachedSystemApkAssets);
_assetManagerStatic_.setSystemApkAssetsSet(cachedSystemApkAssetsSet);
sSystem = ReflectionHelpers.callConstructor(AssetManager.class,
ClassParameter.from(boolean.class, true /*sentinel*/));
sSystem.setApkAssets(cachedSystemApkAssets, false /*invalidateCaches*/);
ReflectionHelpers.setStaticField(AssetManager.class, "sSystem", sSystem);
}
}
|
class class_name[name] begin[{]
method[createSystemAssetsInZygoteLocked, return_type[void], modifier[static protected], parameter[]] begin[{]
local_variable[type[_AssetManager28_], _assetManagerStatic_]
local_variable[type[AssetManager], sSystem]
if[binary_operation[member[.sSystem], !=, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.systemCppAssetManager2], ==, literal[null]]] begin[{]
call[.directlyOn, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AssetManager, sub_type=None)), literal["createSystemAssetsInZygoteLocked"]]]
assign[member[.cachedSystemApkAssets], call[_assetManagerStatic_.getSystemApkAssets, parameter[]]]
assign[member[.cachedSystemApkAssetsSet], call[_assetManagerStatic_.getSystemApkAssetsSet, parameter[]]]
else begin[{]
call[_assetManagerStatic_.setSystemApkAssets, parameter[member[.cachedSystemApkAssets]]]
call[_assetManagerStatic_.setSystemApkAssetsSet, parameter[member[.cachedSystemApkAssetsSet]]]
assign[member[.sSystem], call[ReflectionHelpers.callConstructor, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AssetManager, sub_type=None)), call[ClassParameter.from, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=boolean)), literal[true]]]]]]
call[sSystem.setApkAssets, parameter[member[.cachedSystemApkAssets], literal[false]]]
call[ReflectionHelpers.setStaticField, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AssetManager, sub_type=None)), literal["sSystem"], member[.sSystem]]]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Implementation] Keyword[protected] Keyword[static] Keyword[void] identifier[createSystemAssetsInZygoteLocked] operator[SEP] operator[SEP] {
identifier[_AssetManager28_] identifier[_assetManagerStatic_] operator[=] identifier[reflector] operator[SEP] identifier[_AssetManager28_] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[AssetManager] identifier[sSystem] operator[=] identifier[_assetManagerStatic_] operator[SEP] identifier[getSystem] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sSystem] operator[!=] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[systemCppAssetManager2] operator[==] Other[null] operator[SEP] {
identifier[directlyOn] operator[SEP] identifier[AssetManager] operator[SEP] Keyword[class] , literal[String] operator[SEP] operator[SEP] identifier[cachedSystemApkAssets] operator[=] identifier[_assetManagerStatic_] operator[SEP] identifier[getSystemApkAssets] operator[SEP] operator[SEP] operator[SEP] identifier[cachedSystemApkAssetsSet] operator[=] identifier[_assetManagerStatic_] operator[SEP] identifier[getSystemApkAssetsSet] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[_assetManagerStatic_] operator[SEP] identifier[setSystemApkAssets] operator[SEP] identifier[cachedSystemApkAssets] operator[SEP] operator[SEP] identifier[_assetManagerStatic_] operator[SEP] identifier[setSystemApkAssetsSet] operator[SEP] identifier[cachedSystemApkAssetsSet] operator[SEP] operator[SEP] identifier[sSystem] operator[=] identifier[ReflectionHelpers] operator[SEP] identifier[callConstructor] operator[SEP] identifier[AssetManager] operator[SEP] Keyword[class] , identifier[ClassParameter] operator[SEP] identifier[from] operator[SEP] Keyword[boolean] operator[SEP] Keyword[class] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[sSystem] operator[SEP] identifier[setApkAssets] operator[SEP] identifier[cachedSystemApkAssets] , literal[boolean] operator[SEP] operator[SEP] identifier[ReflectionHelpers] operator[SEP] identifier[setStaticField] operator[SEP] identifier[AssetManager] operator[SEP] Keyword[class] , literal[String] , identifier[sSystem] operator[SEP] operator[SEP]
}
}
|
public WebSocket sendFrame(WebSocketFrame frame)
{
if (frame == null)
{
return this;
}
synchronized (mStateManager)
{
WebSocketState state = mStateManager.getState();
if (state != OPEN && state != CLOSING)
{
return this;
}
}
// The current state is either OPEN or CLOSING. Or, CLOSED.
// Get the reference to the writing thread.
WritingThread wt = mWritingThread;
// Some applications call sendFrame() without waiting for the
// notification of WebSocketListener.onConnected() (Issue #23),
// and/or even after the connection is closed. That is, there
// are chances that sendFrame() is called when mWritingThread
// is null. So, it should be checked whether an instance of
// WritingThread is available or not before calling queueFrame().
if (wt == null)
{
// An instance of WritingThread is not available.
return this;
}
// Split the frame into multiple frames if necessary.
List<WebSocketFrame> frames = splitIfNecessary(frame);
// Queue the frame or the frames. Even if the current state is
// CLOSED, queueing won't be a big issue.
// If the frame was not split.
if (frames == null)
{
// Queue the frame.
wt.queueFrame(frame);
}
else
{
for (WebSocketFrame f : frames)
{
// Queue the frame.
wt.queueFrame(f);
}
}
return this;
}
|
class class_name[name] begin[{]
method[sendFrame, return_type[type[WebSocket]], modifier[public], parameter[frame]] begin[{]
if[binary_operation[member[.frame], ==, literal[null]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
SYNCHRONIZED[member[.mStateManager]] BEGIN[{]
local_variable[type[WebSocketState], state]
if[binary_operation[binary_operation[member[.state], !=, member[.OPEN]], &&, binary_operation[member[.state], !=, member[.CLOSING]]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
END[}]
local_variable[type[WritingThread], wt]
if[binary_operation[member[.wt], ==, literal[null]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
local_variable[type[List], frames]
if[binary_operation[member[.frames], ==, literal[null]]] begin[{]
call[wt.queueFrame, parameter[member[.frame]]]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=queueFrame, postfix_operators=[], prefix_operators=[], qualifier=wt, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=frames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WebSocketFrame, sub_type=None))), label=None)
end[}]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[WebSocket] identifier[sendFrame] operator[SEP] identifier[WebSocketFrame] identifier[frame] operator[SEP] {
Keyword[if] operator[SEP] identifier[frame] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[mStateManager] operator[SEP] {
identifier[WebSocketState] identifier[state] operator[=] identifier[mStateManager] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[!=] identifier[OPEN] operator[&&] identifier[state] operator[!=] identifier[CLOSING] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
}
identifier[WritingThread] identifier[wt] operator[=] identifier[mWritingThread] operator[SEP] Keyword[if] operator[SEP] identifier[wt] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
identifier[List] operator[<] identifier[WebSocketFrame] operator[>] identifier[frames] operator[=] identifier[splitIfNecessary] operator[SEP] identifier[frame] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[frames] operator[==] Other[null] operator[SEP] {
identifier[wt] operator[SEP] identifier[queueFrame] operator[SEP] identifier[frame] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[WebSocketFrame] identifier[f] operator[:] identifier[frames] operator[SEP] {
identifier[wt] operator[SEP] identifier[queueFrame] operator[SEP] identifier[f] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static DeprecationWarnings getDeprecationWarnings(
int deprecationLevel, boolean failOnWarn) {
if (deprecationLevel < 0) {
return DeprecationWarnings.OFF;
} else {
return failOnWarn ? DeprecationWarnings.FATAL
: DeprecationWarnings.ON;
}
}
|
class class_name[name] begin[{]
method[getDeprecationWarnings, return_type[type[DeprecationWarnings]], modifier[public static], parameter[deprecationLevel, failOnWarn]] begin[{]
if[binary_operation[member[.deprecationLevel], <, literal[0]]] begin[{]
return[member[DeprecationWarnings.OFF]]
else begin[{]
return[TernaryExpression(condition=MemberReference(member=failOnWarn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=ON, postfix_operators=[], prefix_operators=[], qualifier=DeprecationWarnings, selectors=[]), if_true=MemberReference(member=FATAL, postfix_operators=[], prefix_operators=[], qualifier=DeprecationWarnings, selectors=[]))]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DeprecationWarnings] identifier[getDeprecationWarnings] operator[SEP] Keyword[int] identifier[deprecationLevel] , Keyword[boolean] identifier[failOnWarn] operator[SEP] {
Keyword[if] operator[SEP] identifier[deprecationLevel] operator[<] Other[0] operator[SEP] {
Keyword[return] identifier[DeprecationWarnings] operator[SEP] identifier[OFF] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[failOnWarn] operator[?] identifier[DeprecationWarnings] operator[SEP] identifier[FATAL] operator[:] identifier[DeprecationWarnings] operator[SEP] identifier[ON] operator[SEP]
}
}
|
@Nonnull
public PathMatchingResult matchesParts (@Nonnull final List <String> aPathParts)
{
ValueEnforcer.notNull (aPathParts, "PathParts");
final int nPartCount = m_aPathParts.size ();
if (aPathParts.size () != nPartCount)
{
// Size must match
return PathMatchingResult.NO_MATCH;
}
final ICommonsOrderedMap <String, String> aVariableValues = new CommonsLinkedHashMap <> ();
for (int i = 0; i < nPartCount; ++i)
{
final PathDescriptorPart aPart = m_aPathParts.get (i);
final String sPathPart = aPathParts.get (i);
if (!aPart.matches (sPathPart))
{
// Current part does not match - full error
return PathMatchingResult.NO_MATCH;
}
// Matching variable part?
if (aPart.isVariable ())
aVariableValues.put (aPart.getName (), sPathPart);
}
// We've got it!
return PathMatchingResult.createSuccess (aVariableValues);
}
|
class class_name[name] begin[{]
method[matchesParts, return_type[type[PathMatchingResult]], modifier[public], parameter[aPathParts]] begin[{]
call[ValueEnforcer.notNull, parameter[member[.aPathParts], literal["PathParts"]]]
local_variable[type[int], nPartCount]
if[binary_operation[call[aPathParts.size, parameter[]], !=, member[.nPartCount]]] begin[{]
return[member[PathMatchingResult.NO_MATCH]]
else begin[{]
None
end[}]
local_variable[type[ICommonsOrderedMap], aVariableValues]
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=m_aPathParts, selectors=[], type_arguments=None), name=aPart)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=PathDescriptorPart, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=aPathParts, selectors=[], type_arguments=None), name=sPathPart)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=sPathPart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=matches, postfix_operators=[], prefix_operators=['!'], qualifier=aPart, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=NO_MATCH, postfix_operators=[], prefix_operators=[], qualifier=PathMatchingResult, selectors=[]), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=isVariable, postfix_operators=[], prefix_operators=[], qualifier=aPart, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=aPart, selectors=[], type_arguments=None), MemberReference(member=sPathPart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=aVariableValues, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nPartCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[call[PathMatchingResult.createSuccess, parameter[member[.aVariableValues]]]]
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] identifier[PathMatchingResult] identifier[matchesParts] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[aPathParts] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[aPathParts] , literal[String] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[nPartCount] operator[=] identifier[m_aPathParts] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[aPathParts] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] identifier[nPartCount] operator[SEP] {
Keyword[return] identifier[PathMatchingResult] operator[SEP] identifier[NO_MATCH] operator[SEP]
}
Keyword[final] identifier[ICommonsOrderedMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[aVariableValues] operator[=] Keyword[new] identifier[CommonsLinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[nPartCount] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[final] identifier[PathDescriptorPart] identifier[aPart] operator[=] identifier[m_aPathParts] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[sPathPart] operator[=] identifier[aPathParts] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[aPart] operator[SEP] identifier[matches] operator[SEP] identifier[sPathPart] operator[SEP] operator[SEP] {
Keyword[return] identifier[PathMatchingResult] operator[SEP] identifier[NO_MATCH] operator[SEP]
}
Keyword[if] operator[SEP] identifier[aPart] operator[SEP] identifier[isVariable] operator[SEP] operator[SEP] operator[SEP] identifier[aVariableValues] operator[SEP] identifier[put] operator[SEP] identifier[aPart] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[sPathPart] operator[SEP] operator[SEP]
}
Keyword[return] identifier[PathMatchingResult] operator[SEP] identifier[createSuccess] operator[SEP] identifier[aVariableValues] operator[SEP] operator[SEP]
}
|
public static protocoludp_stats get(nitro_service service) throws Exception{
protocoludp_stats obj = new protocoludp_stats();
protocoludp_stats[] response = (protocoludp_stats[])obj.stat_resources(service);
return response[0];
}
|
class class_name[name] begin[{]
method[get, return_type[type[protocoludp_stats]], modifier[public static], parameter[service]] begin[{]
local_variable[type[protocoludp_stats], obj]
local_variable[type[protocoludp_stats], response]
return[member[.response]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[protocoludp_stats] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[protocoludp_stats] identifier[obj] operator[=] Keyword[new] identifier[protocoludp_stats] operator[SEP] operator[SEP] operator[SEP] identifier[protocoludp_stats] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[protocoludp_stats] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[stat_resources] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public static <E> E takeUninterruptibly(BlockingQueue<E> queue) {
boolean interrupted = false;
try {
while (true) {
try {
return queue.take();
} catch (InterruptedException e) {
interrupted = true;
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
}
|
class class_name[name] begin[{]
method[takeUninterruptibly, return_type[type[E]], modifier[public static], parameter[queue]] begin[{]
local_variable[type[boolean], interrupted]
TryStatement(block=[WhileStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=take, postfix_operators=[], prefix_operators=[], qualifier=queue, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=interrupted, 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=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=None, finally_block=[IfStatement(condition=MemberReference(member=interrupted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[], member=interrupt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[E] operator[>] identifier[E] identifier[takeUninterruptibly] operator[SEP] identifier[BlockingQueue] operator[<] identifier[E] operator[>] identifier[queue] operator[SEP] {
Keyword[boolean] identifier[interrupted] operator[=] literal[boolean] operator[SEP] Keyword[try] {
Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[queue] operator[SEP] identifier[take] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
identifier[interrupted] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[interrupted] operator[SEP] {
identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static ByteSource concatOpenable(Iterable<ByteSource> possibleBrokenSources) {
//noinspection StaticPseudoFunctionalStyleMethod
return ByteSource.concat(Iterables.transform(possibleBrokenSources, ByteSources::orEmpty));
}
|
class class_name[name] begin[{]
method[concatOpenable, return_type[type[ByteSource]], modifier[public static], parameter[possibleBrokenSources]] begin[{]
return[call[ByteSource.concat, parameter[call[Iterables.transform, parameter[member[.possibleBrokenSources], MethodReference(expression=MemberReference(member=ByteSources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=orEmpty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ByteSource] identifier[concatOpenable] operator[SEP] identifier[Iterable] operator[<] identifier[ByteSource] operator[>] identifier[possibleBrokenSources] operator[SEP] {
Keyword[return] identifier[ByteSource] operator[SEP] identifier[concat] operator[SEP] identifier[Iterables] operator[SEP] identifier[transform] operator[SEP] identifier[possibleBrokenSources] , identifier[ByteSources] operator[::] identifier[orEmpty] operator[SEP] operator[SEP] operator[SEP]
}
|
public Future<T> executeAsync() {
return client.submit(new Callable<T>() {
@Override
public T call() throws Exception {
return execute();
}
});
}
|
class class_name[name] begin[{]
method[executeAsync, return_type[type[Future]], modifier[public], parameter[]] begin[{]
return[call[client.submit, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=execute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None), throws=['Exception'], 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=T, sub_type=None))], dimensions=None, name=Callable, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[Future] operator[<] identifier[T] operator[>] identifier[executeAsync] operator[SEP] operator[SEP] {
Keyword[return] identifier[client] operator[SEP] identifier[submit] operator[SEP] Keyword[new] identifier[Callable] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[T] identifier[call] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[return] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public T[] simplify(T[] points,
double tolerance,
boolean highestQuality) {
if (points == null || points.length <= 2) {
return points;
}
double sqTolerance = tolerance * tolerance;
if (!highestQuality) {
points = simplifyRadialDistance(points, sqTolerance);
}
points = simplifyDouglasPeucker(points, sqTolerance);
return points;
}
|
class class_name[name] begin[{]
method[simplify, return_type[type[T]], modifier[public], parameter[points, tolerance, highestQuality]] begin[{]
if[binary_operation[binary_operation[member[.points], ==, literal[null]], ||, binary_operation[member[points.length], <=, literal[2]]]] begin[{]
return[member[.points]]
else begin[{]
None
end[}]
local_variable[type[double], sqTolerance]
if[member[.highestQuality]] begin[{]
assign[member[.points], call[.simplifyRadialDistance, parameter[member[.points], member[.sqTolerance]]]]
else begin[{]
None
end[}]
assign[member[.points], call[.simplifyDouglasPeucker, parameter[member[.points], member[.sqTolerance]]]]
return[member[.points]]
end[}]
END[}]
|
Keyword[public] identifier[T] operator[SEP] operator[SEP] identifier[simplify] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[points] , Keyword[double] identifier[tolerance] , Keyword[boolean] identifier[highestQuality] operator[SEP] {
Keyword[if] operator[SEP] identifier[points] operator[==] Other[null] operator[||] identifier[points] operator[SEP] identifier[length] operator[<=] Other[2] operator[SEP] {
Keyword[return] identifier[points] operator[SEP]
}
Keyword[double] identifier[sqTolerance] operator[=] identifier[tolerance] operator[*] identifier[tolerance] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[highestQuality] operator[SEP] {
identifier[points] operator[=] identifier[simplifyRadialDistance] operator[SEP] identifier[points] , identifier[sqTolerance] operator[SEP] operator[SEP]
}
identifier[points] operator[=] identifier[simplifyDouglasPeucker] operator[SEP] identifier[points] , identifier[sqTolerance] operator[SEP] operator[SEP] Keyword[return] identifier[points] operator[SEP]
}
|
@Override
public DeleteVoiceChannelResult deleteVoiceChannel(DeleteVoiceChannelRequest request) {
request = beforeClientExecution(request);
return executeDeleteVoiceChannel(request);
}
|
class class_name[name] begin[{]
method[deleteVoiceChannel, return_type[type[DeleteVoiceChannelResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDeleteVoiceChannel, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[DeleteVoiceChannelResult] identifier[deleteVoiceChannel] operator[SEP] identifier[DeleteVoiceChannelRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDeleteVoiceChannel] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public void initialize(Subject newSubject, CallbackHandler newCallbackHandler,
Map<String, ?> sharedState, Map<String, ?> options) {
log.trace("Initializing HTTP OATH OTP LoginModule");
this.subject = newSubject;
this.callbackHandler = newCallbackHandler;
this.protectedUrl = options.get(OPTION_HTTPOATHOTP_PROTECTED_URL).toString();
if (options.get(OPTION_HTTPOATHOTP_EXPECTED_OUTPUT) != null) {
this.expectedOutput = options.get(OPTION_HTTPOATHOTP_EXPECTED_OUTPUT).toString();
}
if (options.get(OPTION_HTTPOATHOTP_MIN_LENGTH) != null) {
this.minLength = Integer.parseInt(options.get(OPTION_HTTPOATHOTP_MIN_LENGTH).toString());
}
if (options.get(OPTION_HTTPOATHOTP_MAX_LENGTH) != null) {
this.maxLength = Integer.parseInt(options.get(OPTION_HTTPOATHOTP_MAX_LENGTH).toString());
}
if (options.get(OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS) != null) {
String s = options.get(OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS).toString();
if (s.equals("true")) {
this.requireAllDigits = true;
} else if (s.equals("false")) {
this.requireAllDigits = false;
} else {
log.error("Bad value for option {}", OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS);
}
}
/* Realm of principals added after authentication */
if (options.get(OPTION_HTTPOATHOTP_ID_REALM) != null) {
this.idRealm = options.get(OPTION_HTTPOATHOTP_ID_REALM).toString();
}
}
|
class class_name[name] begin[{]
method[initialize, return_type[void], modifier[public], parameter[newSubject, newCallbackHandler, sharedState, options]] begin[{]
call[log.trace, parameter[literal["Initializing HTTP OATH OTP LoginModule"]]]
assign[THIS[member[None.subject]], member[.newSubject]]
assign[THIS[member[None.callbackHandler]], member[.newCallbackHandler]]
assign[THIS[member[None.protectedUrl]], call[options.get, parameter[member[.OPTION_HTTPOATHOTP_PROTECTED_URL]]]]
if[binary_operation[call[options.get, parameter[member[.OPTION_HTTPOATHOTP_EXPECTED_OUTPUT]]], !=, literal[null]]] begin[{]
assign[THIS[member[None.expectedOutput]], call[options.get, parameter[member[.OPTION_HTTPOATHOTP_EXPECTED_OUTPUT]]]]
else begin[{]
None
end[}]
if[binary_operation[call[options.get, parameter[member[.OPTION_HTTPOATHOTP_MIN_LENGTH]]], !=, literal[null]]] begin[{]
assign[THIS[member[None.minLength]], call[Integer.parseInt, parameter[call[options.get, parameter[member[.OPTION_HTTPOATHOTP_MIN_LENGTH]]]]]]
else begin[{]
None
end[}]
if[binary_operation[call[options.get, parameter[member[.OPTION_HTTPOATHOTP_MAX_LENGTH]]], !=, literal[null]]] begin[{]
assign[THIS[member[None.maxLength]], call[Integer.parseInt, parameter[call[options.get, parameter[member[.OPTION_HTTPOATHOTP_MAX_LENGTH]]]]]]
else begin[{]
None
end[}]
if[binary_operation[call[options.get, parameter[member[.OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS]]], !=, literal[null]]] begin[{]
local_variable[type[String], s]
if[call[s.equals, parameter[literal["true"]]]] begin[{]
assign[THIS[member[None.requireAllDigits]], literal[true]]
else begin[{]
if[call[s.equals, parameter[literal["false"]]]] begin[{]
assign[THIS[member[None.requireAllDigits]], literal[false]]
else begin[{]
call[log.error, parameter[literal["Bad value for option {}"], member[.OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS]]]
end[}]
end[}]
else begin[{]
None
end[}]
if[binary_operation[call[options.get, parameter[member[.OPTION_HTTPOATHOTP_ID_REALM]]], !=, literal[null]]] begin[{]
assign[THIS[member[None.idRealm]], call[options.get, parameter[member[.OPTION_HTTPOATHOTP_ID_REALM]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[initialize] operator[SEP] identifier[Subject] identifier[newSubject] , identifier[CallbackHandler] identifier[newCallbackHandler] , identifier[Map] operator[<] identifier[String] , operator[?] operator[>] identifier[sharedState] , identifier[Map] operator[<] identifier[String] , operator[?] operator[>] identifier[options] operator[SEP] {
identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[subject] operator[=] identifier[newSubject] operator[SEP] Keyword[this] operator[SEP] identifier[callbackHandler] operator[=] identifier[newCallbackHandler] operator[SEP] Keyword[this] operator[SEP] identifier[protectedUrl] operator[=] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_PROTECTED_URL] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_EXPECTED_OUTPUT] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[expectedOutput] operator[=] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_EXPECTED_OUTPUT] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_MIN_LENGTH] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[minLength] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_MIN_LENGTH] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_MAX_LENGTH] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[maxLength] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_MAX_LENGTH] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[s] operator[=] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[requireAllDigits] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[requireAllDigits] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[OPTION_HTTPOATHOTP_REQUIRE_ALL_DIGITS] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_ID_REALM] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[idRealm] operator[=] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[OPTION_HTTPOATHOTP_ID_REALM] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public synchronized CommsServerByteBuffer allocate() {
if (tc.isEntryEnabled())
SibTr.entry(this, tc, "allocate");
CommsServerByteBuffer buff = (CommsServerByteBuffer) super.allocate();
if (tc.isEntryEnabled())
SibTr.exit(this, tc, "allocate", buff);
return buff;
}
|
class class_name[name] begin[{]
method[allocate, return_type[type[CommsServerByteBuffer]], modifier[synchronized public], parameter[]] begin[{]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["allocate"]]]
else begin[{]
None
end[}]
local_variable[type[CommsServerByteBuffer], buff]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["allocate"], member[.buff]]]
else begin[{]
None
end[}]
return[member[.buff]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] identifier[CommsServerByteBuffer] identifier[allocate] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[CommsServerByteBuffer] identifier[buff] operator[=] operator[SEP] identifier[CommsServerByteBuffer] operator[SEP] Keyword[super] operator[SEP] identifier[allocate] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[buff] operator[SEP] operator[SEP] Keyword[return] identifier[buff] operator[SEP]
}
|
@NonNull
public static <T> T nonNull(@Nullable T obj) {
if (obj == null) {
throw new IllegalArgumentException("encountered illegal null value");
}
return obj;
}
|
class class_name[name] begin[{]
method[nonNull, return_type[type[T]], modifier[public static], parameter[obj]] begin[{]
if[binary_operation[member[.obj], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="encountered illegal null value")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.obj]]
end[}]
END[}]
|
annotation[@] identifier[NonNull] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[nonNull] operator[SEP] annotation[@] identifier[Nullable] identifier[T] identifier[obj] operator[SEP] {
Keyword[if] operator[SEP] identifier[obj] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[obj] operator[SEP]
}
|
public String getDepLabel() {
if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_depLabel == null)
jcasType.jcas.throwFeatMissing("depLabel", "edu.cmu.lti.oaqa.type.nlp.Token");
return jcasType.ll_cas.ll_getStringValue(addr, ((Token_Type)jcasType).casFeatCode_depLabel);}
|
class class_name[name] begin[{]
method[getDepLabel, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[Token_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Token_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["depLabel"], literal["edu.cmu.lti.oaqa.type.nlp.Token"]]]
else begin[{]
None
end[}]
return[call[jcasType.ll_cas.ll_getStringValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Token_Type, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getDepLabel] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[Token_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[Token_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_depLabel] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_getStringValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[Token_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_depLabel] operator[SEP] operator[SEP]
}
|
public static boolean isAm(Date date) {
String time = getTime(date);
return time.toLowerCase().contains(AM);
}
|
class class_name[name] begin[{]
method[isAm, return_type[type[boolean]], modifier[public static], parameter[date]] begin[{]
local_variable[type[String], time]
return[call[time.toLowerCase, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[isAm] operator[SEP] identifier[Date] identifier[date] operator[SEP] {
identifier[String] identifier[time] operator[=] identifier[getTime] operator[SEP] identifier[date] operator[SEP] operator[SEP] Keyword[return] identifier[time] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[AM] operator[SEP] operator[SEP]
}
|
public long getNumberOfCompletedRequests()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getNumberOfCompletedRequests");
long completedRequests =
getNumberOfRequestsReceived() - getNumberOfCurrentRequests();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getNumberOfCompletedRequests", new Long(completedRequests));
return completedRequests;
}
|
class class_name[name] begin[{]
method[getNumberOfCompletedRequests, return_type[type[long]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["getNumberOfCompletedRequests"]]]
else begin[{]
None
end[}]
local_variable[type[long], completedRequests]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["getNumberOfCompletedRequests"], ClassCreator(arguments=[MemberReference(member=completedRequests, 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=Long, sub_type=None))]]
else begin[{]
None
end[}]
return[member[.completedRequests]]
end[}]
END[}]
|
Keyword[public] Keyword[long] identifier[getNumberOfCompletedRequests] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[completedRequests] operator[=] identifier[getNumberOfRequestsReceived] operator[SEP] operator[SEP] operator[-] identifier[getNumberOfCurrentRequests] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Long] operator[SEP] identifier[completedRequests] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[completedRequests] operator[SEP]
}
|
public static List<CPOptionValue> findByCPOptionId(long CPOptionId,
int start, int end, OrderByComparator<CPOptionValue> orderByComparator) {
return getPersistence()
.findByCPOptionId(CPOptionId, start, end, orderByComparator);
}
|
class class_name[name] begin[{]
method[findByCPOptionId, return_type[type[List]], modifier[public static], parameter[CPOptionId, start, end, orderByComparator]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[CPOptionValue] operator[>] identifier[findByCPOptionId] operator[SEP] Keyword[long] identifier[CPOptionId] , Keyword[int] identifier[start] , Keyword[int] identifier[end] , identifier[OrderByComparator] operator[<] identifier[CPOptionValue] operator[>] identifier[orderByComparator] operator[SEP] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[findByCPOptionId] operator[SEP] identifier[CPOptionId] , identifier[start] , identifier[end] , identifier[orderByComparator] operator[SEP] operator[SEP]
}
|
public void setDomainCacheFullUrl(String domain, boolean setting) {
SetDomainCacheFullUrlRequest request = new SetDomainCacheFullUrlRequest()
.withDomain(domain);
request.setCacheFullUrl(setting);
setDomainCacheFullUrl(request);
}
|
class class_name[name] begin[{]
method[setDomainCacheFullUrl, return_type[void], modifier[public], parameter[domain, setting]] begin[{]
local_variable[type[SetDomainCacheFullUrlRequest], request]
call[request.setCacheFullUrl, parameter[member[.setting]]]
call[.setDomainCacheFullUrl, parameter[member[.request]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setDomainCacheFullUrl] operator[SEP] identifier[String] identifier[domain] , Keyword[boolean] identifier[setting] operator[SEP] {
identifier[SetDomainCacheFullUrlRequest] identifier[request] operator[=] Keyword[new] identifier[SetDomainCacheFullUrlRequest] operator[SEP] operator[SEP] operator[SEP] identifier[withDomain] operator[SEP] identifier[domain] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setCacheFullUrl] operator[SEP] identifier[setting] operator[SEP] operator[SEP] identifier[setDomainCacheFullUrl] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
static String replaceCheckDigit(final String iban, final String checkDigit) {
return getCountryCode(iban) + checkDigit + getBban(iban);
}
|
class class_name[name] begin[{]
method[replaceCheckDigit, return_type[type[String]], modifier[static], parameter[iban, checkDigit]] begin[{]
return[binary_operation[binary_operation[call[.getCountryCode, parameter[member[.iban]]], +, member[.checkDigit]], +, call[.getBban, parameter[member[.iban]]]]]
end[}]
END[}]
|
Keyword[static] identifier[String] identifier[replaceCheckDigit] operator[SEP] Keyword[final] identifier[String] identifier[iban] , Keyword[final] identifier[String] identifier[checkDigit] operator[SEP] {
Keyword[return] identifier[getCountryCode] operator[SEP] identifier[iban] operator[SEP] operator[+] identifier[checkDigit] operator[+] identifier[getBban] operator[SEP] identifier[iban] operator[SEP] operator[SEP]
}
|
public void removeProject(String projectName) {
// It should only be in list once (usually in slot 0) but check entire
// list...
Iterator<String> it = recentProjectsList.iterator();
while (it.hasNext()) {
// LinkedList, so remove() via iterator is faster than
// remove(index).
if (projectName.equals(it.next())) {
it.remove();
}
}
}
|
class class_name[name] begin[{]
method[removeProject, return_type[void], modifier[public], parameter[projectName]] begin[{]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
if[call[projectName.equals, parameter[call[it.next, parameter[]]]]] begin[{]
call[it.remove, parameter[]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[removeProject] operator[SEP] identifier[String] identifier[projectName] operator[SEP] {
identifier[Iterator] operator[<] identifier[String] operator[>] identifier[it] operator[=] identifier[recentProjectsList] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[projectName] operator[SEP] identifier[equals] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[it] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
boolean recoverLease(String src, boolean discardLastBlock) throws IOException {
checkOpen();
// We remove the file from local lease checker. Usually it is already been
// removed by the client but we want to be extra safe.
leasechecker.remove(src);
if (this.namenodeProtocolProxy == null) {
return versionBasedRecoverLease(src);
}
return methodBasedRecoverLease(src, discardLastBlock);
}
|
class class_name[name] begin[{]
method[recoverLease, return_type[type[boolean]], modifier[default], parameter[src, discardLastBlock]] begin[{]
call[.checkOpen, parameter[]]
call[leasechecker.remove, parameter[member[.src]]]
if[binary_operation[THIS[member[None.namenodeProtocolProxy]], ==, literal[null]]] begin[{]
return[call[.versionBasedRecoverLease, parameter[member[.src]]]]
else begin[{]
None
end[}]
return[call[.methodBasedRecoverLease, parameter[member[.src], member[.discardLastBlock]]]]
end[}]
END[}]
|
Keyword[boolean] identifier[recoverLease] operator[SEP] identifier[String] identifier[src] , Keyword[boolean] identifier[discardLastBlock] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[checkOpen] operator[SEP] operator[SEP] operator[SEP] identifier[leasechecker] operator[SEP] identifier[remove] operator[SEP] identifier[src] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[namenodeProtocolProxy] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[versionBasedRecoverLease] operator[SEP] identifier[src] operator[SEP] operator[SEP]
}
Keyword[return] identifier[methodBasedRecoverLease] operator[SEP] identifier[src] , identifier[discardLastBlock] operator[SEP] operator[SEP]
}
|
protected void addModulePackagesIndexContents(String text,
String tableSummary, Content body, ModuleElement mdle) {
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
? HtmlTree.NAV()
: new HtmlTree(HtmlTag.DIV);
htmlTree.addStyle(HtmlStyle.indexNav);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
addAllClassesLink(ul);
addAllPackagesLink(ul);
addAllModulesLink(ul);
htmlTree.addContent(ul);
body.addContent(htmlTree);
addModulePackagesList(modules, text, tableSummary, body, mdle);
}
|
class class_name[name] begin[{]
method[addModulePackagesIndexContents, return_type[void], modifier[protected], parameter[text, tableSummary, body, mdle]] begin[{]
local_variable[type[HtmlTree], htmlTree]
call[htmlTree.addStyle, parameter[member[HtmlStyle.indexNav]]]
local_variable[type[HtmlTree], ul]
call[.addAllClassesLink, parameter[member[.ul]]]
call[.addAllPackagesLink, parameter[member[.ul]]]
call[.addAllModulesLink, parameter[member[.ul]]]
call[htmlTree.addContent, parameter[member[.ul]]]
call[body.addContent, parameter[member[.htmlTree]]]
call[.addModulePackagesList, parameter[member[.modules], member[.text], member[.tableSummary], member[.body], member[.mdle]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[addModulePackagesIndexContents] operator[SEP] identifier[String] identifier[text] , identifier[String] identifier[tableSummary] , identifier[Content] identifier[body] , identifier[ModuleElement] identifier[mdle] operator[SEP] {
identifier[HtmlTree] identifier[htmlTree] operator[=] operator[SEP] identifier[configuration] operator[SEP] identifier[allowTag] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[NAV] operator[SEP] operator[SEP] operator[?] identifier[HtmlTree] operator[SEP] identifier[NAV] operator[SEP] operator[SEP] operator[:] Keyword[new] identifier[HtmlTree] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[DIV] operator[SEP] operator[SEP] identifier[htmlTree] operator[SEP] identifier[addStyle] operator[SEP] identifier[HtmlStyle] operator[SEP] identifier[indexNav] operator[SEP] operator[SEP] identifier[HtmlTree] identifier[ul] operator[=] Keyword[new] identifier[HtmlTree] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[UL] operator[SEP] operator[SEP] identifier[addAllClassesLink] operator[SEP] identifier[ul] operator[SEP] operator[SEP] identifier[addAllPackagesLink] operator[SEP] identifier[ul] operator[SEP] operator[SEP] identifier[addAllModulesLink] operator[SEP] identifier[ul] operator[SEP] operator[SEP] identifier[htmlTree] operator[SEP] identifier[addContent] operator[SEP] identifier[ul] operator[SEP] operator[SEP] identifier[body] operator[SEP] identifier[addContent] operator[SEP] identifier[htmlTree] operator[SEP] operator[SEP] identifier[addModulePackagesList] operator[SEP] identifier[modules] , identifier[text] , identifier[tableSummary] , identifier[body] , identifier[mdle] operator[SEP] operator[SEP]
}
|
public final void mELEMENTS() throws RecognitionException {
try {
int _type = ELEMENTS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// hql.g:21:10: ( 'elements' )
// hql.g:21:12: 'elements'
{
match("elements"); if (state.failed) return;
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
}
|
class class_name[name] begin[{]
method[mELEMENTS, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=ELEMENTS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_type)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=DEFAULT_TOKEN_CHANNEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_channel)], modifiers=set(), type=BasicType(dimensions=[], name=int)), BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="elements")], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None))]), StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=None, finally_block=[], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[mELEMENTS] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[try] {
Keyword[int] identifier[_type] operator[=] identifier[ELEMENTS] operator[SEP] Keyword[int] identifier[_channel] operator[=] identifier[DEFAULT_TOKEN_CHANNEL] operator[SEP] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
identifier[state] operator[SEP] identifier[type] operator[=] identifier[_type] operator[SEP] identifier[state] operator[SEP] identifier[channel] operator[=] identifier[_channel] operator[SEP]
}
Keyword[finally] {
}
}
|
public void start(String resourceGroupName, String clusterName) {
startWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().last().body();
}
|
class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[resourceGroupName, clusterName]] begin[{]
call[.startWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.clusterName]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[start] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[clusterName] operator[SEP] {
identifier[startWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[clusterName] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[last] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public int getAndIncrement (K key, int defaultValue, int increment) {
int hashCode = key.hashCode();
int index = hashCode & mask;
if (!key.equals(keyTable[index])) {
index = hash2(hashCode);
if (!key.equals(keyTable[index])) {
index = hash3(hashCode);
if (!key.equals(keyTable[index])) return getAndIncrementStash(key, defaultValue, increment);
}
}
int value = valueTable[index];
valueTable[index] = value + increment;
return value;
}
|
class class_name[name] begin[{]
method[getAndIncrement, return_type[type[int]], modifier[public], parameter[key, defaultValue, increment]] begin[{]
local_variable[type[int], hashCode]
local_variable[type[int], index]
if[call[key.equals, parameter[member[.keyTable]]]] begin[{]
assign[member[.index], call[.hash2, parameter[member[.hashCode]]]]
if[call[key.equals, parameter[member[.keyTable]]]] begin[{]
assign[member[.index], call[.hash3, parameter[member[.hashCode]]]]
if[call[key.equals, parameter[member[.keyTable]]]] begin[{]
return[call[.getAndIncrementStash, parameter[member[.key], member[.defaultValue], member[.increment]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[int], value]
assign[member[.valueTable], binary_operation[member[.value], +, member[.increment]]]
return[member[.value]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[getAndIncrement] operator[SEP] identifier[K] identifier[key] , Keyword[int] identifier[defaultValue] , Keyword[int] identifier[increment] operator[SEP] {
Keyword[int] identifier[hashCode] operator[=] identifier[key] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[hashCode] operator[&] identifier[mask] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[key] operator[SEP] identifier[equals] operator[SEP] identifier[keyTable] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] {
identifier[index] operator[=] identifier[hash2] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[key] operator[SEP] identifier[equals] operator[SEP] identifier[keyTable] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] {
identifier[index] operator[=] identifier[hash3] operator[SEP] identifier[hashCode] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[key] operator[SEP] identifier[equals] operator[SEP] identifier[keyTable] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getAndIncrementStash] operator[SEP] identifier[key] , identifier[defaultValue] , identifier[increment] operator[SEP] operator[SEP]
}
}
Keyword[int] identifier[value] operator[=] identifier[valueTable] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[valueTable] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[value] operator[+] identifier[increment] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
|
public static void addRowMapping(Class returnTypeClass, Class<? extends RowMapper> rowMapperClass) {
_rowMappings.put(returnTypeClass, rowMapperClass);
}
|
class class_name[name] begin[{]
method[addRowMapping, return_type[void], modifier[public static], parameter[returnTypeClass, rowMapperClass]] begin[{]
call[_rowMappings.put, parameter[member[.returnTypeClass], member[.rowMapperClass]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[addRowMapping] operator[SEP] identifier[Class] identifier[returnTypeClass] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[RowMapper] operator[>] identifier[rowMapperClass] operator[SEP] {
identifier[_rowMappings] operator[SEP] identifier[put] operator[SEP] identifier[returnTypeClass] , identifier[rowMapperClass] operator[SEP] operator[SEP]
}
|
public PlaceInfo getInfoByUrl(String url) throws JinxException {
JinxUtils.validateParams(url);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.places.getInfoByUrl");
params.put("url", url);
return jinx.flickrGet(params, PlaceInfo.class, false);
}
|
class class_name[name] begin[{]
method[getInfoByUrl, return_type[type[PlaceInfo]], modifier[public], parameter[url]] begin[{]
call[JinxUtils.validateParams, parameter[member[.url]]]
local_variable[type[Map], params]
call[params.put, parameter[literal["method"], literal["flickr.places.getInfoByUrl"]]]
call[params.put, parameter[literal["url"], member[.url]]]
return[call[jinx.flickrGet, parameter[member[.params], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PlaceInfo, sub_type=None)), literal[false]]]]
end[}]
END[}]
|
Keyword[public] identifier[PlaceInfo] identifier[getInfoByUrl] operator[SEP] identifier[String] identifier[url] operator[SEP] Keyword[throws] identifier[JinxException] {
identifier[JinxUtils] operator[SEP] identifier[validateParams] operator[SEP] identifier[url] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[=] Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[url] operator[SEP] operator[SEP] Keyword[return] identifier[jinx] operator[SEP] identifier[flickrGet] operator[SEP] identifier[params] , identifier[PlaceInfo] operator[SEP] Keyword[class] , literal[boolean] operator[SEP] operator[SEP]
}
|
public ClusterHealthStatus ensureGreen(final String... indices) {
final ClusterHealthResponse actionGet = client().admin().cluster().health(
Requests.clusterHealthRequest(indices).waitForGreenStatus().waitForEvents(Priority.LANGUID).waitForNoRelocatingShards(true))
.actionGet();
if (actionGet.isTimedOut()) {
onFailure("ensureGreen timed out, cluster state:\n" + client().admin().cluster().prepareState().get().getState() + "\n"
+ client().admin().cluster().preparePendingClusterTasks().get(), actionGet);
}
return actionGet.getStatus();
}
|
class class_name[name] begin[{]
method[ensureGreen, return_type[type[ClusterHealthStatus]], modifier[public], parameter[indices]] begin[{]
local_variable[type[ClusterHealthResponse], actionGet]
if[call[actionGet.isTimedOut, parameter[]]] begin[{]
call[.onFailure, parameter[binary_operation[binary_operation[binary_operation[literal["ensureGreen timed out, cluster state:\n"], +, call[.client, parameter[]]], +, literal["\n"]], +, call[.client, parameter[]]], member[.actionGet]]]
else begin[{]
None
end[}]
return[call[actionGet.getStatus, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[ClusterHealthStatus] identifier[ensureGreen] operator[SEP] Keyword[final] identifier[String] operator[...] identifier[indices] operator[SEP] {
Keyword[final] identifier[ClusterHealthResponse] identifier[actionGet] operator[=] identifier[client] operator[SEP] operator[SEP] operator[SEP] identifier[admin] operator[SEP] operator[SEP] operator[SEP] identifier[cluster] operator[SEP] operator[SEP] operator[SEP] identifier[health] operator[SEP] identifier[Requests] operator[SEP] identifier[clusterHealthRequest] operator[SEP] identifier[indices] operator[SEP] operator[SEP] identifier[waitForGreenStatus] operator[SEP] operator[SEP] operator[SEP] identifier[waitForEvents] operator[SEP] identifier[Priority] operator[SEP] identifier[LANGUID] operator[SEP] operator[SEP] identifier[waitForNoRelocatingShards] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[actionGet] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[actionGet] operator[SEP] identifier[isTimedOut] operator[SEP] operator[SEP] operator[SEP] {
identifier[onFailure] operator[SEP] literal[String] operator[+] identifier[client] operator[SEP] operator[SEP] operator[SEP] identifier[admin] operator[SEP] operator[SEP] operator[SEP] identifier[cluster] operator[SEP] operator[SEP] operator[SEP] identifier[prepareState] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[client] operator[SEP] operator[SEP] operator[SEP] identifier[admin] operator[SEP] operator[SEP] operator[SEP] identifier[cluster] operator[SEP] operator[SEP] operator[SEP] identifier[preparePendingClusterTasks] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] , identifier[actionGet] operator[SEP] operator[SEP]
}
Keyword[return] identifier[actionGet] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP]
}
|
private boolean hasConstantField(PackageElement pkg) {
SortedSet<TypeElement> classes = !pkg.isUnnamed()
? utils.getAllClasses(pkg)
: configuration.typeElementCatalog.allUnnamedClasses();
boolean found = false;
for (TypeElement te : classes) {
if (utils.isIncluded(te) && hasConstantField(te)) {
found = true;
}
}
return found;
}
|
class class_name[name] begin[{]
method[hasConstantField, return_type[type[boolean]], modifier[private], parameter[pkg]] begin[{]
local_variable[type[SortedSet], classes]
local_variable[type[boolean], found]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=te, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isIncluded, postfix_operators=[], prefix_operators=[], qualifier=utils, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=te, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasConstantField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=found, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=classes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=te)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeElement, sub_type=None))), label=None)
return[member[.found]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[hasConstantField] operator[SEP] identifier[PackageElement] identifier[pkg] operator[SEP] {
identifier[SortedSet] operator[<] identifier[TypeElement] operator[>] identifier[classes] operator[=] operator[!] identifier[pkg] operator[SEP] identifier[isUnnamed] operator[SEP] operator[SEP] operator[?] identifier[utils] operator[SEP] identifier[getAllClasses] operator[SEP] identifier[pkg] operator[SEP] operator[:] identifier[configuration] operator[SEP] identifier[typeElementCatalog] operator[SEP] identifier[allUnnamedClasses] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[found] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[TypeElement] identifier[te] operator[:] identifier[classes] operator[SEP] {
Keyword[if] operator[SEP] identifier[utils] operator[SEP] identifier[isIncluded] operator[SEP] identifier[te] operator[SEP] operator[&&] identifier[hasConstantField] operator[SEP] identifier[te] operator[SEP] operator[SEP] {
identifier[found] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[return] identifier[found] operator[SEP]
}
|
@Override
public void handle(String chargingStationId, JsonObject commandObject, IdentityContext identityContext) throws UserIdentityUnauthorizedException {
ChargingStationId csId = new ChargingStationId(chargingStationId);
if (!commandAuthorizationService.isAuthorized(csId, identityContext.getUserIdentity(), RequestDataTransferCommand.class)) {
throw new UserIdentityUnauthorizedException(chargingStationId, identityContext.getUserIdentity(), RequestDataTransferCommand.class);
}
try {
ChargingStation chargingStation = repository.findOne(chargingStationId);
if (chargingStation != null && chargingStation.communicationAllowed()) {
DataTransferMessage dataTransferMessage = gson.fromJson(commandObject, DataTransferMessage.class);
commandGateway.send(new RequestDataTransferCommand(csId, dataTransferMessage, identityContext), new CorrelationToken());
}
} catch (JsonSyntaxException ex) {
throw new IllegalArgumentException("Data transfer command not able to parse the payload, is your json correctly formatted?", ex);
}
}
|
class class_name[name] begin[{]
method[handle, return_type[void], modifier[public], parameter[chargingStationId, commandObject, identityContext]] begin[{]
local_variable[type[ChargingStationId], csId]
if[call[commandAuthorizationService.isAuthorized, parameter[member[.csId], call[identityContext.getUserIdentity, parameter[]], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RequestDataTransferCommand, sub_type=None))]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=chargingStationId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getUserIdentity, postfix_operators=[], prefix_operators=[], qualifier=identityContext, selectors=[], type_arguments=None), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RequestDataTransferCommand, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UserIdentityUnauthorizedException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=chargingStationId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findOne, postfix_operators=[], prefix_operators=[], qualifier=repository, selectors=[], type_arguments=None), name=chargingStation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChargingStation, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=chargingStation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=communicationAllowed, postfix_operators=[], prefix_operators=[], qualifier=chargingStation, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=commandObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DataTransferMessage, sub_type=None))], member=fromJson, postfix_operators=[], prefix_operators=[], qualifier=gson, selectors=[], type_arguments=None), name=dataTransferMessage)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DataTransferMessage, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=csId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataTransferMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=identityContext, 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=RequestDataTransferCommand, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CorrelationToken, sub_type=None))], member=send, postfix_operators=[], prefix_operators=[], qualifier=commandGateway, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Data transfer command not able to parse the payload, is your json correctly formatted?"), 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=['JsonSyntaxException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handle] operator[SEP] identifier[String] identifier[chargingStationId] , identifier[JsonObject] identifier[commandObject] , identifier[IdentityContext] identifier[identityContext] operator[SEP] Keyword[throws] identifier[UserIdentityUnauthorizedException] {
identifier[ChargingStationId] identifier[csId] operator[=] Keyword[new] identifier[ChargingStationId] operator[SEP] identifier[chargingStationId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[commandAuthorizationService] operator[SEP] identifier[isAuthorized] operator[SEP] identifier[csId] , identifier[identityContext] operator[SEP] identifier[getUserIdentity] operator[SEP] operator[SEP] , identifier[RequestDataTransferCommand] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UserIdentityUnauthorizedException] operator[SEP] identifier[chargingStationId] , identifier[identityContext] operator[SEP] identifier[getUserIdentity] operator[SEP] operator[SEP] , identifier[RequestDataTransferCommand] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[ChargingStation] identifier[chargingStation] operator[=] identifier[repository] operator[SEP] identifier[findOne] operator[SEP] identifier[chargingStationId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[chargingStation] operator[!=] Other[null] operator[&&] identifier[chargingStation] operator[SEP] identifier[communicationAllowed] operator[SEP] operator[SEP] operator[SEP] {
identifier[DataTransferMessage] identifier[dataTransferMessage] operator[=] identifier[gson] operator[SEP] identifier[fromJson] operator[SEP] identifier[commandObject] , identifier[DataTransferMessage] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[commandGateway] operator[SEP] identifier[send] operator[SEP] Keyword[new] identifier[RequestDataTransferCommand] operator[SEP] identifier[csId] , identifier[dataTransferMessage] , identifier[identityContext] operator[SEP] , Keyword[new] identifier[CorrelationToken] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[JsonSyntaxException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case TypesPackage.JVM_TYPE_CONSTRAINT__TYPE_REFERENCE:
return typeReference != null;
case TypesPackage.JVM_TYPE_CONSTRAINT__OWNER:
return getOwner() != null;
}
return super.eIsSet(featureID);
}
|
class class_name[name] begin[{]
method[eIsSet, return_type[type[boolean]], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=JVM_TYPE_CONSTRAINT__TYPE_REFERENCE, postfix_operators=[], prefix_operators=[], qualifier=TypesPackage, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=typeReference, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None)]), SwitchStatementCase(case=[MemberReference(member=JVM_TYPE_CONSTRAINT__OWNER, postfix_operators=[], prefix_operators=[], qualifier=TypesPackage, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getOwner, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eIsSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[eIsSet] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[TypesPackage] operator[SEP] identifier[JVM_TYPE_CONSTRAINT__TYPE_REFERENCE] operator[:] Keyword[return] identifier[typeReference] operator[!=] Other[null] operator[SEP] Keyword[case] identifier[TypesPackage] operator[SEP] identifier[JVM_TYPE_CONSTRAINT__OWNER] operator[:] Keyword[return] identifier[getOwner] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eIsSet] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public UpdateConfigurationTemplateRequest withOptionsToRemove(OptionSpecification... optionsToRemove) {
if (this.optionsToRemove == null) {
setOptionsToRemove(new com.amazonaws.internal.SdkInternalList<OptionSpecification>(optionsToRemove.length));
}
for (OptionSpecification ele : optionsToRemove) {
this.optionsToRemove.add(ele);
}
return this;
}
|
class class_name[name] begin[{]
method[withOptionsToRemove, return_type[type[UpdateConfigurationTemplateRequest]], modifier[public], parameter[optionsToRemove]] begin[{]
if[binary_operation[THIS[member[None.optionsToRemove]], ==, literal[null]]] begin[{]
call[.setOptionsToRemove, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=optionsToRemove, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=OptionSpecification, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=optionsToRemove, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=optionsToRemove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OptionSpecification, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[UpdateConfigurationTemplateRequest] identifier[withOptionsToRemove] operator[SEP] identifier[OptionSpecification] operator[...] identifier[optionsToRemove] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[optionsToRemove] operator[==] Other[null] operator[SEP] {
identifier[setOptionsToRemove] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[OptionSpecification] operator[>] operator[SEP] identifier[optionsToRemove] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[OptionSpecification] identifier[ele] operator[:] identifier[optionsToRemove] operator[SEP] {
Keyword[this] operator[SEP] identifier[optionsToRemove] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
final protected void eventPrecommitAdd(MessageItem msg, final TransactionCommon transaction) throws SIDiscriminatorSyntaxException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "eventPrecommitAdd", new Object[] { msg, transaction });
if (!(_destination.isToBeDeleted()))
{
if (msg.isTransacted() && (!(msg.isToBeStoredAtSendTime())))
{
// LockR the destination to prevent reallocation from occurring on the chosen localisation
LockManager reallocationLock = _destination.getReallocationLockManager();
reallocationLock.lock();
try
{
// If we fixed the ME it'll be in the routing address in the message
SIBUuid8 fixedME = null;
JsDestinationAddress routingAddr = msg.getMessage().getRoutingDestination();
if (routingAddr != null)
fixedME = routingAddr.getME();
// If the sender prefers any local ME over others then we'll give it a go
SIBUuid8 preferredME = null;
if (msg.preferLocal())
{
if (_destination.hasLocal())
preferredME = _messageProcessor.getMessagingEngineUuid();
}
// 176658.3.5
OutputHandler handler = _destination.choosePtoPOutputHandler(fixedME,
preferredME,
!msg.isFromRemoteME(),
msg.isForcePut(),
null);
if (handler == null)
{
// We can't find a suitable localisation.
// Although a queue must have at least one localisation this is
// possible if the sender restricted the potential localisations
// using a fixed ME or a scoping alias (to an out-of-date set of
// localisation)
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "No suitable OutputHandler found for " + _destination.getName() + " (" + fixedME + ")");
}
//Put the message to the exception destination.
handleUndeliverableMessage(_destination
, null // null LinkHandler
, msg
, SIRCConstants.SIRC0026_NO_LOCALISATIONS_FOUND_ERROR
, new String[] { _destination.getName() }
, transaction);
}
else
{
//Indicate in the message if this was a guess
msg.setStreamIsGuess(handler.isWLMGuess());
// put the message to the output handler
handler.put(msg, transaction, null, true);
}
} finally
{
// unlock the reallocation lock
reallocationLock.unlock();
}
}
}
else
{
//The destination has been deleted. Put the message to the exception destination#
ExceptionDestinationHandlerImpl exceptionDestinationHandlerImpl =
(ExceptionDestinationHandlerImpl) _messageProcessor.createExceptionDestinationHandler(null);
//Set indicator to send the message to the exception destination immediately,
//rather than registering it for pre-prepare of the transaction, as this is
//pre-prepare of the transaction!
msg.setStoreAtSendTime(true);
String destName = _destination.getName();
if (_destination.isLink())
destName = ((LinkHandler) _destination).getBusName();
final UndeliverableReturnCode rc =
exceptionDestinationHandlerImpl.handleUndeliverableMessage(msg
, transaction
, SIRCConstants.SIRC0032_DESTINATION_DELETED_ERROR
, new String[] { destName,
_messageProcessor.getMessagingEngineName() });
if (rc != UndeliverableReturnCode.OK)
{
if (rc == UndeliverableReturnCode.DISCARD)
{
//The message is to be discarded. Do nothing and it will disappear.
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "eventPrecommitAdd", "WsRuntimeException");
//We cannot put the message to the exception destination. All we can
//do in this case is rollback the users transaction. This is done by
//throwing an exception that is caught by the transaction manager.
throw new WsRuntimeException(
nls.getFormattedMessage(
"DESTINATION_DELETED_ERROR_CWSIP0247",
new Object[] { _destination.getName(),
rc },
null));
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "eventPrecommitAdd");
}
|
class class_name[name] begin[{]
method[eventPrecommitAdd, return_type[void], modifier[final protected], parameter[msg, transaction]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["eventPrecommitAdd"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=transaction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
if[call[_destination.isToBeDeleted, parameter[]]] begin[{]
if[binary_operation[call[msg.isTransacted, parameter[]], &&, call[msg.isToBeStoredAtSendTime, parameter[]]]] begin[{]
local_variable[type[LockManager], reallocationLock]
call[reallocationLock.lock, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=fixedME)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SIBUuid8, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[MethodInvocation(arguments=[], member=getRoutingDestination, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=routingAddr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsDestinationAddress, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=routingAddr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=fixedME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getME, postfix_operators=[], prefix_operators=[], qualifier=routingAddr, selectors=[], type_arguments=None)), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=preferredME)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SIBUuid8, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=preferLocal, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=hasLocal, postfix_operators=[], prefix_operators=[], qualifier=_destination, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=preferredME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getMessagingEngineUuid, postfix_operators=[], prefix_operators=[], qualifier=_messageProcessor, selectors=[], type_arguments=None)), label=None))])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fixedME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=preferredME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=isFromRemoteME, postfix_operators=[], prefix_operators=['!'], qualifier=msg, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=isForcePut, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=choosePtoPOutputHandler, postfix_operators=[], prefix_operators=[], qualifier=_destination, selectors=[], type_arguments=None), name=handler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OutputHandler, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=isWLMGuess, postfix_operators=[], prefix_operators=[], qualifier=handler, selectors=[], type_arguments=None)], member=setStreamIsGuess, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=transaction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=put, postfix_operators=[], prefix_operators=[], qualifier=handler, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No suitable OutputHandler found for "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=_destination, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ("), operator=+), operandr=MemberReference(member=fixedME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=_destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=SIRC0026_NO_LOCALISATIONS_FOUND_ERROR, postfix_operators=[], prefix_operators=[], qualifier=SIRCConstants, selectors=[]), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=_destination, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), MemberReference(member=transaction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleUndeliverableMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=reallocationLock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
else begin[{]
local_variable[type[ExceptionDestinationHandlerImpl], exceptionDestinationHandlerImpl]
call[msg.setStoreAtSendTime, parameter[literal[true]]]
local_variable[type[String], destName]
if[call[_destination.isLink, parameter[]]] begin[{]
assign[member[.destName], Cast(expression=MemberReference(member=_destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LinkHandler, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[UndeliverableReturnCode], rc]
if[binary_operation[member[.rc], !=, member[UndeliverableReturnCode.OK]]] begin[{]
if[binary_operation[member[.rc], ==, member[UndeliverableReturnCode.DISCARD]]] begin[{]
else begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["eventPrecommitAdd"], literal["WsRuntimeException"]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DESTINATION_DELETED_ERROR_CWSIP0247"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=_destination, selectors=[], type_arguments=None), MemberReference(member=rc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=nls, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WsRuntimeException, sub_type=None)), label=None)
end[}]
else begin[{]
None
end[}]
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["eventPrecommitAdd"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[final] Keyword[protected] Keyword[void] identifier[eventPrecommitAdd] operator[SEP] identifier[MessageItem] identifier[msg] , Keyword[final] identifier[TransactionCommon] identifier[transaction] operator[SEP] Keyword[throws] identifier[SIDiscriminatorSyntaxException] , identifier[SIResourceException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[msg] , identifier[transaction]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[_destination] operator[SEP] identifier[isToBeDeleted] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[msg] operator[SEP] identifier[isTransacted] operator[SEP] operator[SEP] operator[&&] operator[SEP] operator[!] operator[SEP] identifier[msg] operator[SEP] identifier[isToBeStoredAtSendTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[LockManager] identifier[reallocationLock] operator[=] identifier[_destination] operator[SEP] identifier[getReallocationLockManager] operator[SEP] operator[SEP] operator[SEP] identifier[reallocationLock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[SIBUuid8] identifier[fixedME] operator[=] Other[null] operator[SEP] identifier[JsDestinationAddress] identifier[routingAddr] operator[=] identifier[msg] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] identifier[getRoutingDestination] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[routingAddr] operator[!=] Other[null] operator[SEP] identifier[fixedME] operator[=] identifier[routingAddr] operator[SEP] identifier[getME] operator[SEP] operator[SEP] operator[SEP] identifier[SIBUuid8] identifier[preferredME] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[msg] operator[SEP] identifier[preferLocal] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[_destination] operator[SEP] identifier[hasLocal] operator[SEP] operator[SEP] operator[SEP] identifier[preferredME] operator[=] identifier[_messageProcessor] operator[SEP] identifier[getMessagingEngineUuid] operator[SEP] operator[SEP] operator[SEP]
}
identifier[OutputHandler] identifier[handler] operator[=] identifier[_destination] operator[SEP] identifier[choosePtoPOutputHandler] operator[SEP] identifier[fixedME] , identifier[preferredME] , operator[!] identifier[msg] operator[SEP] identifier[isFromRemoteME] operator[SEP] operator[SEP] , identifier[msg] operator[SEP] identifier[isForcePut] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[handler] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[_destination] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[fixedME] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[handleUndeliverableMessage] operator[SEP] identifier[_destination] , Other[null] , identifier[msg] , identifier[SIRCConstants] operator[SEP] identifier[SIRC0026_NO_LOCALISATIONS_FOUND_ERROR] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[_destination] operator[SEP] identifier[getName] operator[SEP] operator[SEP]
} , identifier[transaction] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[msg] operator[SEP] identifier[setStreamIsGuess] operator[SEP] identifier[handler] operator[SEP] identifier[isWLMGuess] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[handler] operator[SEP] identifier[put] operator[SEP] identifier[msg] , identifier[transaction] , Other[null] , literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[reallocationLock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[ExceptionDestinationHandlerImpl] identifier[exceptionDestinationHandlerImpl] operator[=] operator[SEP] identifier[ExceptionDestinationHandlerImpl] operator[SEP] identifier[_messageProcessor] operator[SEP] identifier[createExceptionDestinationHandler] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[setStoreAtSendTime] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[String] identifier[destName] operator[=] identifier[_destination] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_destination] operator[SEP] identifier[isLink] operator[SEP] operator[SEP] operator[SEP] identifier[destName] operator[=] operator[SEP] operator[SEP] identifier[LinkHandler] operator[SEP] identifier[_destination] operator[SEP] operator[SEP] identifier[getBusName] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[UndeliverableReturnCode] identifier[rc] operator[=] identifier[exceptionDestinationHandlerImpl] operator[SEP] identifier[handleUndeliverableMessage] operator[SEP] identifier[msg] , identifier[transaction] , identifier[SIRCConstants] operator[SEP] identifier[SIRC0032_DESTINATION_DELETED_ERROR] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[destName] , identifier[_messageProcessor] operator[SEP] identifier[getMessagingEngineName] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rc] operator[!=] identifier[UndeliverableReturnCode] operator[SEP] identifier[OK] operator[SEP] {
Keyword[if] operator[SEP] identifier[rc] operator[==] identifier[UndeliverableReturnCode] operator[SEP] identifier[DISCARD] operator[SEP] {
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[WsRuntimeException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[_destination] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[rc]
} , Other[null] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public Observable<SummarizeResultsInner> summarizeForPolicySetDefinitionAsync(String subscriptionId, String policySetDefinitionName, QueryOptions queryOptions) {
return summarizeForPolicySetDefinitionWithServiceResponseAsync(subscriptionId, policySetDefinitionName, queryOptions).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() {
@Override
public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[summarizeForPolicySetDefinitionAsync, return_type[type[Observable]], modifier[public], parameter[subscriptionId, policySetDefinitionName, queryOptions]] begin[{]
return[call[.summarizeForPolicySetDefinitionWithServiceResponseAsync, parameter[member[.subscriptionId], member[.policySetDefinitionName], member[.queryOptions]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[SummarizeResultsInner] operator[>] identifier[summarizeForPolicySetDefinitionAsync] operator[SEP] identifier[String] identifier[subscriptionId] , identifier[String] identifier[policySetDefinitionName] , identifier[QueryOptions] identifier[queryOptions] operator[SEP] {
Keyword[return] identifier[summarizeForPolicySetDefinitionWithServiceResponseAsync] operator[SEP] identifier[subscriptionId] , identifier[policySetDefinitionName] , identifier[queryOptions] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[SummarizeResultsInner] operator[>] , identifier[SummarizeResultsInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[SummarizeResultsInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[SummarizeResultsInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Override
public final Object retrieve(int handle) throws DataStoreException
{
if (SAFE_MODE) checkHandle(handle);
// Compute total size
int totalSize = computeSize(handle);
// Retrieve all blocks
byte[] data = new byte[totalSize];
int offset = 0;
int current = handle;
while (current != -1)
{
int blockLen = allocatedSize[current];
// Read block from map file
readDataBlock(data,offset,blockLen,current);
offset += blockLen;
if ((flags[current] & FLAG_END_BLOCK) > 0)
break;
current = nextBlock[current];
}
if (current == -1)
throw new DataStoreException("Can't find end block for "+handle);
return data;
}
|
class class_name[name] begin[{]
method[retrieve, return_type[type[Object]], modifier[final public], parameter[handle]] begin[{]
if[member[.SAFE_MODE]] begin[{]
call[.checkHandle, parameter[member[.handle]]]
else begin[{]
None
end[}]
local_variable[type[int], totalSize]
local_variable[type[byte], data]
local_variable[type[int], offset]
local_variable[type[int], current]
while[binary_operation[member[.current], !=, literal[1]]] begin[{]
local_variable[type[int], blockLen]
call[.readDataBlock, parameter[member[.data], member[.offset], member[.blockLen], member[.current]]]
assign[member[.offset], member[.blockLen]]
if[binary_operation[binary_operation[member[.flags], &, member[.FLAG_END_BLOCK]], >, literal[0]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.current], member[.nextBlock]]
end[}]
if[binary_operation[member[.current], ==, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can't find end block for "), operandr=MemberReference(member=handle, 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=DataStoreException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.data]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[final] identifier[Object] identifier[retrieve] operator[SEP] Keyword[int] identifier[handle] operator[SEP] Keyword[throws] identifier[DataStoreException] {
Keyword[if] operator[SEP] identifier[SAFE_MODE] operator[SEP] identifier[checkHandle] operator[SEP] identifier[handle] operator[SEP] operator[SEP] Keyword[int] identifier[totalSize] operator[=] identifier[computeSize] operator[SEP] identifier[handle] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[totalSize] operator[SEP] operator[SEP] Keyword[int] identifier[offset] operator[=] Other[0] operator[SEP] Keyword[int] identifier[current] operator[=] identifier[handle] operator[SEP] Keyword[while] operator[SEP] identifier[current] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[int] identifier[blockLen] operator[=] identifier[allocatedSize] operator[SEP] identifier[current] operator[SEP] operator[SEP] identifier[readDataBlock] operator[SEP] identifier[data] , identifier[offset] , identifier[blockLen] , identifier[current] operator[SEP] operator[SEP] identifier[offset] operator[+=] identifier[blockLen] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[SEP] identifier[current] operator[SEP] operator[&] identifier[FLAG_END_BLOCK] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[break] operator[SEP] identifier[current] operator[=] identifier[nextBlock] operator[SEP] identifier[current] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[current] operator[==] operator[-] Other[1] operator[SEP] Keyword[throw] Keyword[new] identifier[DataStoreException] operator[SEP] literal[String] operator[+] identifier[handle] operator[SEP] operator[SEP] Keyword[return] identifier[data] operator[SEP]
}
|
private static boolean includeTypeParameterInformation(final Class<?> containerClass,
final Integer typeArgumentIndex) {
if (containerClass == null || typeArgumentIndex == null) {
return false;
}
// if (containerClass.getTypeParameters().length < 2) {
// return false;
// }
// return !(Map.class.isAssignableFrom(containerClass) && typeArgumentIndex == 1);
throw new UnsupportedOperationException("GWT does not support getTypeArgumentIndex().");
}
|
class class_name[name] begin[{]
method[includeTypeParameterInformation, return_type[type[boolean]], modifier[private static], parameter[containerClass, typeArgumentIndex]] begin[{]
if[binary_operation[binary_operation[member[.containerClass], ==, literal[null]], ||, binary_operation[member[.typeArgumentIndex], ==, literal[null]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="GWT does not support getTypeArgumentIndex().")], 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[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[includeTypeParameterInformation] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[containerClass] , Keyword[final] identifier[Integer] identifier[typeArgumentIndex] operator[SEP] {
Keyword[if] operator[SEP] identifier[containerClass] operator[==] Other[null] operator[||] identifier[typeArgumentIndex] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@Override
public void messageReceived(NextFilter nextFilter, IoSession session,
Object message) throws Exception {
LOGGER.debug("Processing a MESSAGE_RECEIVED for session {}", session.getId());
if (!(message instanceof IoBuffer)) {
nextFilter.messageReceived(session, message);
return;
}
IoBuffer in = (IoBuffer) message;
ProtocolDecoder decoder = getDecoder(session);
ProtocolDecoderOutput decoderOut = getDecoderOut(session, nextFilter);
IoSessionEx sessionEx = (IoSessionEx)session;
Thread ioThread = sessionEx.getIoThread();
// Loop until we don't have anymore byte in the buffer,
// or until the decoder throws an unrecoverable exception or
// can't decoder a message, because there are not enough
// data in the buffer
// Note: break out to let old I/O thread unwind after deregistering
while (in.hasRemaining()) {
// If the session is realigned, let the new thread deal with the decoding
if (sessionEx.getIoThread() != ioThread) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(format("Decoding for session=%s will be continued by new thread=%s old thread=%s",
session, sessionEx.getIoThread(), ioThread));
}
break;
}
int oldPos = in.position();
try {
synchronized (decoderOut) {
// Call the decoder with the read bytes
decoder.decode(session, in, decoderOut);
// Finish decoding if no exception was thrown.
decoderOut.flush(nextFilter, session);
}
} catch (Throwable t) {
ProtocolDecoderException pde;
if (t instanceof ProtocolDecoderException) {
pde = (ProtocolDecoderException) t;
} else {
pde = new ProtocolDecoderException(t);
}
if (pde.getHexdump() == null) {
// Generate a message hex dump
int curPos = in.position();
in.position(oldPos);
pde.setHexdump(in.getHexDump());
in.position(curPos);
}
// Fire the exceptionCaught event.
synchronized (decoderOut) {
decoderOut.flush(nextFilter, session);
}
nextFilter.exceptionCaught(session, pde);
// Retry only if the type of the caught exception is
// recoverable and the buffer position has changed.
// We check buffer position additionally to prevent an
// infinite loop.
if (!(t instanceof RecoverableProtocolDecoderException) ||
(in.position() == oldPos)) {
break;
}
}
}
}
|
class class_name[name] begin[{]
method[messageReceived, return_type[void], modifier[public], parameter[nextFilter, session, message]] begin[{]
call[LOGGER.debug, parameter[literal["Processing a MESSAGE_RECEIVED for session {}"], call[session.getId, parameter[]]]]
if[binary_operation[member[.message], instanceof, type[IoBuffer]]] begin[{]
call[nextFilter.messageReceived, parameter[member[.session], member[.message]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[IoBuffer], in]
local_variable[type[ProtocolDecoder], decoder]
local_variable[type[ProtocolDecoderOutput], decoderOut]
local_variable[type[IoSessionEx], sessionEx]
local_variable[type[Thread], ioThread]
while[call[in.hasRemaining, parameter[]]] begin[{]
if[binary_operation[call[sessionEx.getIoThread, parameter[]], !=, member[.ioThread]]] begin[{]
if[call[LOGGER.isTraceEnabled, parameter[]]] begin[{]
call[LOGGER.trace, parameter[call[.format, parameter[literal["Decoding for session=%s will be continued by new thread=%s old thread=%s"], member[.session], call[sessionEx.getIoThread, parameter[]], member[.ioThread]]]]]
else begin[{]
None
end[}]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[int], oldPos]
TryStatement(block=[SynchronizedStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=decoderOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=decoder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=nextFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=flush, postfix_operators=[], prefix_operators=[], qualifier=decoderOut, selectors=[], type_arguments=None), label=None)], label=None, lock=MemberReference(member=decoderOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=pde)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ProtocolDecoderException, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ProtocolDecoderException, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=pde, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=t, 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=ProtocolDecoderException, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=pde, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ProtocolDecoderException, sub_type=None))), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getHexdump, postfix_operators=[], prefix_operators=[], qualifier=pde, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=position, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), name=curPos)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=oldPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=position, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getHexDump, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None)], member=setHexdump, postfix_operators=[], prefix_operators=[], qualifier=pde, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=curPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=position, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), label=None)])), SynchronizedStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=nextFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=flush, postfix_operators=[], prefix_operators=[], qualifier=decoderOut, selectors=[], type_arguments=None), label=None)], label=None, lock=MemberReference(member=decoderOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=session, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pde, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exceptionCaught, postfix_operators=[], prefix_operators=[], qualifier=nextFilter, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=RecoverableProtocolDecoderException, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=position, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), operandr=MemberReference(member=oldPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[messageReceived] operator[SEP] identifier[NextFilter] identifier[nextFilter] , identifier[IoSession] identifier[session] , identifier[Object] identifier[message] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[session] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[message] Keyword[instanceof] identifier[IoBuffer] operator[SEP] operator[SEP] {
identifier[nextFilter] operator[SEP] identifier[messageReceived] operator[SEP] identifier[session] , identifier[message] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[IoBuffer] identifier[in] operator[=] operator[SEP] identifier[IoBuffer] operator[SEP] identifier[message] operator[SEP] identifier[ProtocolDecoder] identifier[decoder] operator[=] identifier[getDecoder] operator[SEP] identifier[session] operator[SEP] operator[SEP] identifier[ProtocolDecoderOutput] identifier[decoderOut] operator[=] identifier[getDecoderOut] operator[SEP] identifier[session] , identifier[nextFilter] operator[SEP] operator[SEP] identifier[IoSessionEx] identifier[sessionEx] operator[=] operator[SEP] identifier[IoSessionEx] operator[SEP] identifier[session] operator[SEP] identifier[Thread] identifier[ioThread] operator[=] identifier[sessionEx] operator[SEP] identifier[getIoThread] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[in] operator[SEP] identifier[hasRemaining] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[sessionEx] operator[SEP] identifier[getIoThread] operator[SEP] operator[SEP] operator[!=] identifier[ioThread] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOGGER] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[session] , identifier[sessionEx] operator[SEP] identifier[getIoThread] operator[SEP] operator[SEP] , identifier[ioThread] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[int] identifier[oldPos] operator[=] identifier[in] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[synchronized] operator[SEP] identifier[decoderOut] operator[SEP] {
identifier[decoder] operator[SEP] identifier[decode] operator[SEP] identifier[session] , identifier[in] , identifier[decoderOut] operator[SEP] operator[SEP] identifier[decoderOut] operator[SEP] identifier[flush] operator[SEP] identifier[nextFilter] , identifier[session] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[ProtocolDecoderException] identifier[pde] operator[SEP] Keyword[if] operator[SEP] identifier[t] Keyword[instanceof] identifier[ProtocolDecoderException] operator[SEP] {
identifier[pde] operator[=] operator[SEP] identifier[ProtocolDecoderException] operator[SEP] identifier[t] operator[SEP]
}
Keyword[else] {
identifier[pde] operator[=] Keyword[new] identifier[ProtocolDecoderException] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[pde] operator[SEP] identifier[getHexdump] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[int] identifier[curPos] operator[=] identifier[in] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] identifier[in] operator[SEP] identifier[position] operator[SEP] identifier[oldPos] operator[SEP] operator[SEP] identifier[pde] operator[SEP] identifier[setHexdump] operator[SEP] identifier[in] operator[SEP] identifier[getHexDump] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[in] operator[SEP] identifier[position] operator[SEP] identifier[curPos] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[decoderOut] operator[SEP] {
identifier[decoderOut] operator[SEP] identifier[flush] operator[SEP] identifier[nextFilter] , identifier[session] operator[SEP] operator[SEP]
}
identifier[nextFilter] operator[SEP] identifier[exceptionCaught] operator[SEP] identifier[session] , identifier[pde] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[t] Keyword[instanceof] identifier[RecoverableProtocolDecoderException] operator[SEP] operator[||] operator[SEP] identifier[in] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[==] identifier[oldPos] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
}
}
}
|
public void promptPresent(double seconds) {
try {
double timeTook = popup(seconds);
checkPromptPresent(seconds, timeTook);
} catch (TimeoutException e) {
checkPromptPresent(seconds, seconds);
}
}
|
class class_name[name] begin[{]
method[promptPresent, return_type[void], modifier[public], parameter[seconds]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=seconds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=popup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=timeTook)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=seconds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeTook, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkPromptPresent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=seconds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seconds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkPromptPresent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TimeoutException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[promptPresent] operator[SEP] Keyword[double] identifier[seconds] operator[SEP] {
Keyword[try] {
Keyword[double] identifier[timeTook] operator[=] identifier[popup] operator[SEP] identifier[seconds] operator[SEP] operator[SEP] identifier[checkPromptPresent] operator[SEP] identifier[seconds] , identifier[timeTook] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TimeoutException] identifier[e] operator[SEP] {
identifier[checkPromptPresent] operator[SEP] identifier[seconds] , identifier[seconds] operator[SEP] operator[SEP]
}
}
|
static Cookie getLTPACookie(final Subject subject) throws Exception {
Cookie ltpaCookie = null;
SingleSignonToken ssoToken = null;
Set<SingleSignonToken> ssoTokens = subject.getPrivateCredentials(SingleSignonToken.class);
Iterator<SingleSignonToken> ssoTokensIterator = ssoTokens.iterator();
if (ssoTokensIterator.hasNext()) {
ssoToken = ssoTokensIterator.next();
if (ssoTokensIterator.hasNext()) {
throw new WSSecurityException("More than one ssotoken found in subject");
}
}
if (ssoToken != null) {
ltpaCookie = constructLTPACookieObj(ssoToken);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No ssotoken found for this subject");
}
}
return ltpaCookie;
}
|
class class_name[name] begin[{]
method[getLTPACookie, return_type[type[Cookie]], modifier[static], parameter[subject]] begin[{]
local_variable[type[Cookie], ltpaCookie]
local_variable[type[SingleSignonToken], ssoToken]
local_variable[type[Set], ssoTokens]
local_variable[type[Iterator], ssoTokensIterator]
if[call[ssoTokensIterator.hasNext, parameter[]]] begin[{]
assign[member[.ssoToken], call[ssoTokensIterator.next, parameter[]]]
if[call[ssoTokensIterator.hasNext, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="More than one ssotoken found in subject")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WSSecurityException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.ssoToken], !=, literal[null]]] begin[{]
assign[member[.ltpaCookie], call[.constructLTPACookieObj, parameter[member[.ssoToken]]]]
else begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["No ssotoken found for this subject"]]]
else begin[{]
None
end[}]
end[}]
return[member[.ltpaCookie]]
end[}]
END[}]
|
Keyword[static] identifier[Cookie] identifier[getLTPACookie] operator[SEP] Keyword[final] identifier[Subject] identifier[subject] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Cookie] identifier[ltpaCookie] operator[=] Other[null] operator[SEP] identifier[SingleSignonToken] identifier[ssoToken] operator[=] Other[null] operator[SEP] identifier[Set] operator[<] identifier[SingleSignonToken] operator[>] identifier[ssoTokens] operator[=] identifier[subject] operator[SEP] identifier[getPrivateCredentials] operator[SEP] identifier[SingleSignonToken] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[SingleSignonToken] operator[>] identifier[ssoTokensIterator] operator[=] identifier[ssoTokens] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ssoTokensIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[ssoToken] operator[=] identifier[ssoTokensIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ssoTokensIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WSSecurityException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[ssoToken] operator[!=] Other[null] operator[SEP] {
identifier[ltpaCookie] operator[=] identifier[constructLTPACookieObj] operator[SEP] identifier[ssoToken] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[ltpaCookie] operator[SEP]
}
|
public static MD5Hash digest(byte[] data, int start, int len) {
byte[] digest;
MessageDigest digester = DIGESTER_FACTORY.get();
digester.update(data, start, len);
digest = digester.digest();
return new MD5Hash(digest);
}
|
class class_name[name] begin[{]
method[digest, return_type[type[MD5Hash]], modifier[public static], parameter[data, start, len]] begin[{]
local_variable[type[byte], digest]
local_variable[type[MessageDigest], digester]
call[digester.update, parameter[member[.data], member[.start], member[.len]]]
assign[member[.digest], call[digester.digest, parameter[]]]
return[ClassCreator(arguments=[MemberReference(member=digest, 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=MD5Hash, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[MD5Hash] identifier[digest] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] , Keyword[int] identifier[start] , Keyword[int] identifier[len] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[digest] operator[SEP] identifier[MessageDigest] identifier[digester] operator[=] identifier[DIGESTER_FACTORY] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[digester] operator[SEP] identifier[update] operator[SEP] identifier[data] , identifier[start] , identifier[len] operator[SEP] operator[SEP] identifier[digest] operator[=] identifier[digester] operator[SEP] identifier[digest] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[MD5Hash] operator[SEP] identifier[digest] operator[SEP] operator[SEP]
}
|
protected JRDesignGroup getParent(JRDesignGroup group) {
int index = realGroups.indexOf(group);
return (index > 0) ? (JRDesignGroup) realGroups.get(index - 1) : group;
}
|
class class_name[name] begin[{]
method[getParent, return_type[type[JRDesignGroup]], modifier[protected], parameter[group]] begin[{]
local_variable[type[int], index]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), if_false=MemberReference(member=group, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Cast(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=get, postfix_operators=[], prefix_operators=[], qualifier=realGroups, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=JRDesignGroup, sub_type=None)))]
end[}]
END[}]
|
Keyword[protected] identifier[JRDesignGroup] identifier[getParent] operator[SEP] identifier[JRDesignGroup] identifier[group] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[realGroups] operator[SEP] identifier[indexOf] operator[SEP] identifier[group] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[index] operator[>] Other[0] operator[SEP] operator[?] operator[SEP] identifier[JRDesignGroup] operator[SEP] identifier[realGroups] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[-] Other[1] operator[SEP] operator[:] identifier[group] operator[SEP]
}
|
public static String getCanonicalDirectoryName(String path) {
String realPath = getCanonicalPath(path);
if (realPath == null) {
return null;
}
String separator = System.getProperty("file.separator", "/");
// backslashes must be escaped for split(). kthxbai
separator = Pattern.quote(separator);
String[] pathElements = realPath.split(separator);
return pathElements.length > 0 ? pathElements[pathElements.length - 1] : realPath;
}
|
class class_name[name] begin[{]
method[getCanonicalDirectoryName, return_type[type[String]], modifier[public static], parameter[path]] begin[{]
local_variable[type[String], realPath]
if[binary_operation[member[.realPath], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], separator]
assign[member[.separator], call[Pattern.quote, parameter[member[.separator]]]]
local_variable[type[String], pathElements]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pathElements, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), if_false=MemberReference(member=realPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=pathElements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pathElements, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getCanonicalDirectoryName] operator[SEP] identifier[String] identifier[path] operator[SEP] {
identifier[String] identifier[realPath] operator[=] identifier[getCanonicalPath] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[realPath] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[separator] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[separator] operator[=] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] identifier[separator] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[pathElements] operator[=] identifier[realPath] operator[SEP] identifier[split] operator[SEP] identifier[separator] operator[SEP] operator[SEP] Keyword[return] identifier[pathElements] operator[SEP] identifier[length] operator[>] Other[0] operator[?] identifier[pathElements] operator[SEP] identifier[pathElements] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[:] identifier[realPath] operator[SEP]
}
|
public void finish() throws IOException {
writer.append("--" + boundary + "--").append(LINE_BREAK);
writer.flush();
writer.close();
outputStream.flush();
outputStream.close();
}
|
class class_name[name] begin[{]
method[finish, return_type[void], modifier[public], parameter[]] begin[{]
call[writer.append, parameter[binary_operation[binary_operation[literal["--"], +, member[.boundary]], +, literal["--"]]]]
call[writer.flush, parameter[]]
call[writer.close, parameter[]]
call[outputStream.flush, parameter[]]
call[outputStream.close, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[finish] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[writer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[boundary] operator[+] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[LINE_BREAK] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[outputStream] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[outputStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
|
private void fireMappingDeleted(URI srcuri, String mapping_id) {
for (OBDAMappingListener listener : mappingListeners) {
listener.mappingDeleted(srcuri);
}
}
|
class class_name[name] begin[{]
method[fireMappingDeleted, return_type[void], modifier[private], parameter[srcuri, mapping_id]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcuri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mappingDeleted, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=mappingListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OBDAMappingListener, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[fireMappingDeleted] operator[SEP] identifier[URI] identifier[srcuri] , identifier[String] identifier[mapping_id] operator[SEP] {
Keyword[for] operator[SEP] identifier[OBDAMappingListener] identifier[listener] operator[:] identifier[mappingListeners] operator[SEP] {
identifier[listener] operator[SEP] identifier[mappingDeleted] operator[SEP] identifier[srcuri] operator[SEP] operator[SEP]
}
}
|
private ACLProvider getDefaultAclProvider() {
return new ACLProvider() {
@Override
public List<ACL> getDefaultAcl() {
return ZooDefs.Ids.CREATOR_ALL_ACL;
}
@Override
public List<ACL> getAclForPath(String path) {
return ZooDefs.Ids.CREATOR_ALL_ACL;
}
};
}
|
class class_name[name] begin[{]
method[getDefaultAclProvider, return_type[type[ACLProvider]], modifier[private], parameter[]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=CREATOR_ALL_ACL, postfix_operators=[], prefix_operators=[], qualifier=ZooDefs.Ids, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getDefaultAcl, parameters=[], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ACL, sub_type=None))], dimensions=[], name=List, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=CREATOR_ALL_ACL, postfix_operators=[], prefix_operators=[], qualifier=ZooDefs.Ids, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getAclForPath, parameters=[FormalParameter(annotations=[], modifiers=set(), name=path, 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=ACL, sub_type=None))], dimensions=[], name=List, 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=ACLProvider, sub_type=None))]
end[}]
END[}]
|
Keyword[private] identifier[ACLProvider] identifier[getDefaultAclProvider] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[ACLProvider] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[ACL] operator[>] identifier[getDefaultAcl] operator[SEP] operator[SEP] {
Keyword[return] identifier[ZooDefs] operator[SEP] identifier[Ids] operator[SEP] identifier[CREATOR_ALL_ACL] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[ACL] operator[>] identifier[getAclForPath] operator[SEP] identifier[String] identifier[path] operator[SEP] {
Keyword[return] identifier[ZooDefs] operator[SEP] identifier[Ids] operator[SEP] identifier[CREATOR_ALL_ACL] operator[SEP]
}
} operator[SEP]
}
|
@GET
public ReplyObject getAccumulators(){
try{
return ReplyObject.success("accumulators", getAccumulatorAPI().getAccumulatorDefinitions() );
}catch(APIException e){
return ReplyObject.error(e);
}
}
|
class class_name[name] begin[{]
method[getAccumulators, return_type[type[ReplyObject]], modifier[public], parameter[]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="accumulators"), MethodInvocation(arguments=[], member=getAccumulatorAPI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getAccumulatorDefinitions, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=success, postfix_operators=[], prefix_operators=[], qualifier=ReplyObject, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=ReplyObject, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['APIException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[GET] Keyword[public] identifier[ReplyObject] identifier[getAccumulators] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[ReplyObject] operator[SEP] identifier[success] operator[SEP] literal[String] , identifier[getAccumulatorAPI] operator[SEP] operator[SEP] operator[SEP] identifier[getAccumulatorDefinitions] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[APIException] identifier[e] operator[SEP] {
Keyword[return] identifier[ReplyObject] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static String getEnumName(Enum[] e, int value) {
if (e != null) {
int toCompareValue;
for (Enum en : e) {
if (en instanceof EnumReadable) {
toCompareValue = ((EnumReadable) en).value();
} else {
toCompareValue = en.ordinal();
}
if (value == toCompareValue) {
return en.name();
}
}
}
return "";
}
|
class class_name[name] begin[{]
method[getEnumName, return_type[type[String]], modifier[public static], parameter[e, value]] begin[{]
if[binary_operation[member[.e], !=, literal[null]]] begin[{]
local_variable[type[int], toCompareValue]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=en, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=EnumReadable, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=toCompareValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=ordinal, postfix_operators=[], prefix_operators=[], qualifier=en, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=toCompareValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=en, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=EnumReadable, sub_type=None))), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=toCompareValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=en, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=en)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Enum, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[literal[""]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getEnumName] operator[SEP] identifier[Enum] operator[SEP] operator[SEP] identifier[e] , Keyword[int] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[toCompareValue] operator[SEP] Keyword[for] operator[SEP] identifier[Enum] identifier[en] operator[:] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[en] Keyword[instanceof] identifier[EnumReadable] operator[SEP] {
identifier[toCompareValue] operator[=] operator[SEP] operator[SEP] identifier[EnumReadable] operator[SEP] identifier[en] operator[SEP] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[toCompareValue] operator[=] identifier[en] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[value] operator[==] identifier[toCompareValue] operator[SEP] {
Keyword[return] identifier[en] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] literal[String] operator[SEP]
}
|
public String getModuleExtension()
{
if (value >= moduleExtensions.length)
return Integer.toString(value);
return moduleExtensions[value];
}
|
class class_name[name] begin[{]
method[getModuleExtension, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.value], >=, member[moduleExtensions.length]]] begin[{]
return[call[Integer.toString, parameter[member[.value]]]]
else begin[{]
None
end[}]
return[member[.moduleExtensions]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getModuleExtension] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[>=] identifier[moduleExtensions] operator[SEP] identifier[length] operator[SEP] Keyword[return] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[moduleExtensions] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
|
public static LocationModel getLocationByCoordinates(Double latitude, Double longitude ){
try {
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(QuickUtils.getContext());
addresses = geocoder.getFromLocation(latitude, longitude, 1);
LocationModel locationModel = new LocationModel();
locationModel.latitude = latitude;
locationModel.longitude = longitude;
try{
locationModel.address = addresses.get(0).getAddressLine(0);
}catch(Exception ex){
QuickUtils.log.e("empty address");
}
try{
locationModel.city = addresses.get(0).getAddressLine(1);
}catch(Exception ex){
QuickUtils.log.e("empty city");
}
try{
locationModel.country = addresses.get(0).getAddressLine(2);
}catch(Exception ex){
QuickUtils.log.e("empty country");
}
return locationModel;
} catch (IOException e) {
QuickUtils.log.e("empty location");
return new LocationModel();
}
}
|
class class_name[name] begin[{]
method[getLocationByCoordinates, return_type[type[LocationModel]], modifier[public static], parameter[latitude, longitude]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=geocoder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Geocoder, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=addresses)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Address, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=geocoder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getContext, postfix_operators=[], prefix_operators=[], qualifier=QuickUtils, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Geocoder, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=addresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=latitude, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=longitude, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=getFromLocation, postfix_operators=[], prefix_operators=[], qualifier=geocoder, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocationModel, sub_type=None)), name=locationModel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LocationModel, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=latitude, postfix_operators=[], prefix_operators=[], qualifier=locationModel, selectors=[]), type==, value=MemberReference(member=latitude, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=longitude, postfix_operators=[], prefix_operators=[], qualifier=locationModel, selectors=[]), type==, value=MemberReference(member=longitude, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=locationModel, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=addresses, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=getAddressLine, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="empty address")], member=e, postfix_operators=[], prefix_operators=[], qualifier=QuickUtils.log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=city, postfix_operators=[], prefix_operators=[], qualifier=locationModel, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=addresses, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=getAddressLine, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="empty city")], member=e, postfix_operators=[], prefix_operators=[], qualifier=QuickUtils.log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=country, postfix_operators=[], prefix_operators=[], qualifier=locationModel, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=addresses, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=getAddressLine, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="empty country")], member=e, postfix_operators=[], prefix_operators=[], qualifier=QuickUtils.log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None), ReturnStatement(expression=MemberReference(member=locationModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="empty location")], member=e, postfix_operators=[], prefix_operators=[], qualifier=QuickUtils.log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocationModel, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[LocationModel] identifier[getLocationByCoordinates] operator[SEP] identifier[Double] identifier[latitude] , identifier[Double] identifier[longitude] operator[SEP] {
Keyword[try] {
identifier[Geocoder] identifier[geocoder] operator[SEP] identifier[List] operator[<] identifier[Address] operator[>] identifier[addresses] operator[SEP] identifier[geocoder] operator[=] Keyword[new] identifier[Geocoder] operator[SEP] identifier[QuickUtils] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[addresses] operator[=] identifier[geocoder] operator[SEP] identifier[getFromLocation] operator[SEP] identifier[latitude] , identifier[longitude] , Other[1] operator[SEP] operator[SEP] identifier[LocationModel] identifier[locationModel] operator[=] Keyword[new] identifier[LocationModel] operator[SEP] operator[SEP] operator[SEP] identifier[locationModel] operator[SEP] identifier[latitude] operator[=] identifier[latitude] operator[SEP] identifier[locationModel] operator[SEP] identifier[longitude] operator[=] identifier[longitude] operator[SEP] Keyword[try] {
identifier[locationModel] operator[SEP] identifier[address] operator[=] identifier[addresses] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getAddressLine] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[QuickUtils] operator[SEP] identifier[log] operator[SEP] identifier[e] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[locationModel] operator[SEP] identifier[city] operator[=] identifier[addresses] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getAddressLine] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[QuickUtils] operator[SEP] identifier[log] operator[SEP] identifier[e] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[locationModel] operator[SEP] identifier[country] operator[=] identifier[addresses] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getAddressLine] operator[SEP] Other[2] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[QuickUtils] operator[SEP] identifier[log] operator[SEP] identifier[e] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[locationModel] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[QuickUtils] operator[SEP] identifier[log] operator[SEP] identifier[e] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[LocationModel] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void updateBestSolution(long time, double value, SolutionType newBestSolution){
times.add(time);
values.add(value);
bestSolution = newBestSolution;
}
|
class class_name[name] begin[{]
method[updateBestSolution, return_type[void], modifier[public], parameter[time, value, newBestSolution]] begin[{]
call[times.add, parameter[member[.time]]]
call[values.add, parameter[member[.value]]]
assign[member[.bestSolution], member[.newBestSolution]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[updateBestSolution] operator[SEP] Keyword[long] identifier[time] , Keyword[double] identifier[value] , identifier[SolutionType] identifier[newBestSolution] operator[SEP] {
identifier[times] operator[SEP] identifier[add] operator[SEP] identifier[time] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[bestSolution] operator[=] identifier[newBestSolution] operator[SEP]
}
|
public ReliableTopicConfig findReliableTopicConfig(String name) {
name = getBaseName(name);
ReliableTopicConfig config = lookupByPattern(configPatternMatcher, reliableTopicConfigs, name);
if (config != null) {
return config.getAsReadOnly();
}
return getReliableTopicConfig("default").getAsReadOnly();
}
|
class class_name[name] begin[{]
method[findReliableTopicConfig, return_type[type[ReliableTopicConfig]], modifier[public], parameter[name]] begin[{]
assign[member[.name], call[.getBaseName, parameter[member[.name]]]]
local_variable[type[ReliableTopicConfig], config]
if[binary_operation[member[.config], !=, literal[null]]] begin[{]
return[call[config.getAsReadOnly, parameter[]]]
else begin[{]
None
end[}]
return[call[.getReliableTopicConfig, parameter[literal["default"]]]]
end[}]
END[}]
|
Keyword[public] identifier[ReliableTopicConfig] identifier[findReliableTopicConfig] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[name] operator[=] identifier[getBaseName] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[ReliableTopicConfig] identifier[config] operator[=] identifier[lookupByPattern] operator[SEP] identifier[configPatternMatcher] , identifier[reliableTopicConfigs] , identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[config] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[config] operator[SEP] identifier[getAsReadOnly] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getReliableTopicConfig] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getAsReadOnly] operator[SEP] operator[SEP] operator[SEP]
}
|
public ColumnFamily adapt(HColumnDescriptor columnDescriptor) {
throwIfRequestingUnknownFeatures(columnDescriptor);
throwIfRequestingUnsupportedFeatures(columnDescriptor);
ColumnFamily.Builder resultBuilder = ColumnFamily.newBuilder();
GCRule gcRule = buildGarbageCollectionRule(columnDescriptor);
if (gcRule != null) {
resultBuilder.setGcRule(gcRule.toProto());
}
return resultBuilder.build();
}
|
class class_name[name] begin[{]
method[adapt, return_type[type[ColumnFamily]], modifier[public], parameter[columnDescriptor]] begin[{]
call[.throwIfRequestingUnknownFeatures, parameter[member[.columnDescriptor]]]
call[.throwIfRequestingUnsupportedFeatures, parameter[member[.columnDescriptor]]]
local_variable[type[ColumnFamily], resultBuilder]
local_variable[type[GCRule], gcRule]
if[binary_operation[member[.gcRule], !=, literal[null]]] begin[{]
call[resultBuilder.setGcRule, parameter[call[gcRule.toProto, parameter[]]]]
else begin[{]
None
end[}]
return[call[resultBuilder.build, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[ColumnFamily] identifier[adapt] operator[SEP] identifier[HColumnDescriptor] identifier[columnDescriptor] operator[SEP] {
identifier[throwIfRequestingUnknownFeatures] operator[SEP] identifier[columnDescriptor] operator[SEP] operator[SEP] identifier[throwIfRequestingUnsupportedFeatures] operator[SEP] identifier[columnDescriptor] operator[SEP] operator[SEP] identifier[ColumnFamily] operator[SEP] identifier[Builder] identifier[resultBuilder] operator[=] identifier[ColumnFamily] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[GCRule] identifier[gcRule] operator[=] identifier[buildGarbageCollectionRule] operator[SEP] identifier[columnDescriptor] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[gcRule] operator[!=] Other[null] operator[SEP] {
identifier[resultBuilder] operator[SEP] identifier[setGcRule] operator[SEP] identifier[gcRule] operator[SEP] identifier[toProto] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[resultBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean handleExecutionOutcome(
FlowExecutionOutcome outcome, ActionRequest request, ActionResponse response) {
if (this.redirectOnEnds != null && this.redirectOnEnds.containsKey(outcome.getId())) {
final String redirectPath =
request.getContextPath() + this.redirectOnEnds.get(outcome.getId());
try {
response.sendRedirect(redirectPath);
return true;
} catch (IOException e) {
this.logger.warn("Failed to send flow-end redirect to '" + redirectPath + "'");
}
}
return false;
}
|
class class_name[name] begin[{]
method[handleExecutionOutcome, return_type[type[boolean]], modifier[public], parameter[outcome, request, response]] begin[{]
if[binary_operation[binary_operation[THIS[member[None.redirectOnEnds]], !=, literal[null]], &&, THIS[member[None.redirectOnEnds]call[None.containsKey, parameter[call[outcome.getId, parameter[]]]]]]] begin[{]
local_variable[type[String], redirectPath]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=redirectPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendRedirect, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=logger, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to send flow-end redirect to '"), operandr=MemberReference(member=redirectPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], member=warn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[handleExecutionOutcome] operator[SEP] identifier[FlowExecutionOutcome] identifier[outcome] , identifier[ActionRequest] identifier[request] , identifier[ActionResponse] identifier[response] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[redirectOnEnds] operator[!=] Other[null] operator[&&] Keyword[this] operator[SEP] identifier[redirectOnEnds] operator[SEP] identifier[containsKey] operator[SEP] identifier[outcome] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[redirectPath] operator[=] identifier[request] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] operator[+] Keyword[this] operator[SEP] identifier[redirectOnEnds] operator[SEP] identifier[get] operator[SEP] identifier[outcome] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[response] operator[SEP] identifier[sendRedirect] operator[SEP] identifier[redirectPath] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[this] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[redirectPath] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static String formatDuration(final long durationMillis, final String format, final boolean padWithZeros) {
Validate.inclusiveBetween(0, Long.MAX_VALUE, durationMillis, "durationMillis must not be negative");
final Token[] tokens = lexx(format);
long days = 0;
long hours = 0;
long minutes = 0;
long seconds = 0;
long milliseconds = durationMillis;
if (Token.containsTokenWithValue(tokens, d) ) {
days = milliseconds / DateUtils.MILLIS_PER_DAY;
milliseconds = milliseconds - (days * DateUtils.MILLIS_PER_DAY);
}
if (Token.containsTokenWithValue(tokens, H) ) {
hours = milliseconds / DateUtils.MILLIS_PER_HOUR;
milliseconds = milliseconds - (hours * DateUtils.MILLIS_PER_HOUR);
}
if (Token.containsTokenWithValue(tokens, m) ) {
minutes = milliseconds / DateUtils.MILLIS_PER_MINUTE;
milliseconds = milliseconds - (minutes * DateUtils.MILLIS_PER_MINUTE);
}
if (Token.containsTokenWithValue(tokens, s) ) {
seconds = milliseconds / DateUtils.MILLIS_PER_SECOND;
milliseconds = milliseconds - (seconds * DateUtils.MILLIS_PER_SECOND);
}
return format(tokens, 0, 0, days, hours, minutes, seconds, milliseconds, padWithZeros);
}
|
class class_name[name] begin[{]
method[formatDuration, return_type[type[String]], modifier[public static], parameter[durationMillis, format, padWithZeros]] begin[{]
call[Validate.inclusiveBetween, parameter[literal[0], member[Long.MAX_VALUE], member[.durationMillis], literal["durationMillis must not be negative"]]]
local_variable[type[Token], tokens]
local_variable[type[long], days]
local_variable[type[long], hours]
local_variable[type[long], minutes]
local_variable[type[long], seconds]
local_variable[type[long], milliseconds]
if[call[Token.containsTokenWithValue, parameter[member[.tokens], member[.d]]]] begin[{]
assign[member[.days], binary_operation[member[.milliseconds], /, member[DateUtils.MILLIS_PER_DAY]]]
assign[member[.milliseconds], binary_operation[member[.milliseconds], -, binary_operation[member[.days], *, member[DateUtils.MILLIS_PER_DAY]]]]
else begin[{]
None
end[}]
if[call[Token.containsTokenWithValue, parameter[member[.tokens], member[.H]]]] begin[{]
assign[member[.hours], binary_operation[member[.milliseconds], /, member[DateUtils.MILLIS_PER_HOUR]]]
assign[member[.milliseconds], binary_operation[member[.milliseconds], -, binary_operation[member[.hours], *, member[DateUtils.MILLIS_PER_HOUR]]]]
else begin[{]
None
end[}]
if[call[Token.containsTokenWithValue, parameter[member[.tokens], member[.m]]]] begin[{]
assign[member[.minutes], binary_operation[member[.milliseconds], /, member[DateUtils.MILLIS_PER_MINUTE]]]
assign[member[.milliseconds], binary_operation[member[.milliseconds], -, binary_operation[member[.minutes], *, member[DateUtils.MILLIS_PER_MINUTE]]]]
else begin[{]
None
end[}]
if[call[Token.containsTokenWithValue, parameter[member[.tokens], member[.s]]]] begin[{]
assign[member[.seconds], binary_operation[member[.milliseconds], /, member[DateUtils.MILLIS_PER_SECOND]]]
assign[member[.milliseconds], binary_operation[member[.milliseconds], -, binary_operation[member[.seconds], *, member[DateUtils.MILLIS_PER_SECOND]]]]
else begin[{]
None
end[}]
return[call[.format, parameter[member[.tokens], literal[0], literal[0], member[.days], member[.hours], member[.minutes], member[.seconds], member[.milliseconds], member[.padWithZeros]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[formatDuration] operator[SEP] Keyword[final] Keyword[long] identifier[durationMillis] , Keyword[final] identifier[String] identifier[format] , Keyword[final] Keyword[boolean] identifier[padWithZeros] operator[SEP] {
identifier[Validate] operator[SEP] identifier[inclusiveBetween] operator[SEP] Other[0] , identifier[Long] operator[SEP] identifier[MAX_VALUE] , identifier[durationMillis] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Token] operator[SEP] operator[SEP] identifier[tokens] operator[=] identifier[lexx] operator[SEP] identifier[format] operator[SEP] operator[SEP] Keyword[long] identifier[days] operator[=] Other[0] operator[SEP] Keyword[long] identifier[hours] operator[=] Other[0] operator[SEP] Keyword[long] identifier[minutes] operator[=] Other[0] operator[SEP] Keyword[long] identifier[seconds] operator[=] Other[0] operator[SEP] Keyword[long] identifier[milliseconds] operator[=] identifier[durationMillis] operator[SEP] Keyword[if] operator[SEP] identifier[Token] operator[SEP] identifier[containsTokenWithValue] operator[SEP] identifier[tokens] , identifier[d] operator[SEP] operator[SEP] {
identifier[days] operator[=] identifier[milliseconds] operator[/] identifier[DateUtils] operator[SEP] identifier[MILLIS_PER_DAY] operator[SEP] identifier[milliseconds] operator[=] identifier[milliseconds] operator[-] operator[SEP] identifier[days] operator[*] identifier[DateUtils] operator[SEP] identifier[MILLIS_PER_DAY] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Token] operator[SEP] identifier[containsTokenWithValue] operator[SEP] identifier[tokens] , identifier[H] operator[SEP] operator[SEP] {
identifier[hours] operator[=] identifier[milliseconds] operator[/] identifier[DateUtils] operator[SEP] identifier[MILLIS_PER_HOUR] operator[SEP] identifier[milliseconds] operator[=] identifier[milliseconds] operator[-] operator[SEP] identifier[hours] operator[*] identifier[DateUtils] operator[SEP] identifier[MILLIS_PER_HOUR] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Token] operator[SEP] identifier[containsTokenWithValue] operator[SEP] identifier[tokens] , identifier[m] operator[SEP] operator[SEP] {
identifier[minutes] operator[=] identifier[milliseconds] operator[/] identifier[DateUtils] operator[SEP] identifier[MILLIS_PER_MINUTE] operator[SEP] identifier[milliseconds] operator[=] identifier[milliseconds] operator[-] operator[SEP] identifier[minutes] operator[*] identifier[DateUtils] operator[SEP] identifier[MILLIS_PER_MINUTE] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Token] operator[SEP] identifier[containsTokenWithValue] operator[SEP] identifier[tokens] , identifier[s] operator[SEP] operator[SEP] {
identifier[seconds] operator[=] identifier[milliseconds] operator[/] identifier[DateUtils] operator[SEP] identifier[MILLIS_PER_SECOND] operator[SEP] identifier[milliseconds] operator[=] identifier[milliseconds] operator[-] operator[SEP] identifier[seconds] operator[*] identifier[DateUtils] operator[SEP] identifier[MILLIS_PER_SECOND] operator[SEP] operator[SEP]
}
Keyword[return] identifier[format] operator[SEP] identifier[tokens] , Other[0] , Other[0] , identifier[days] , identifier[hours] , identifier[minutes] , identifier[seconds] , identifier[milliseconds] , identifier[padWithZeros] operator[SEP] operator[SEP]
}
|
public <T extends Client> int getSize(T client) {
Cipher encryption;
if (client == null || (encryption = client.getEncryption()) == null) {
return queue.stream().mapToInt(array -> array.length).sum();
}
int blockSize = encryption.getBlockSize();
return queue.stream().mapToInt(array -> Utility.roundUpToNextMultiple(array.length, blockSize)).sum();
}
|
class class_name[name] begin[{]
method[getSize, return_type[type[int]], modifier[public], parameter[client]] begin[{]
local_variable[type[Cipher], encryption]
if[binary_operation[binary_operation[member[.client], ==, literal[null]], ||, binary_operation[assign[member[.encryption], call[client.getEncryption, parameter[]]], ==, literal[null]]]] begin[{]
return[call[queue.stream, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[int], blockSize]
return[call[queue.stream, parameter[]]]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[Client] operator[>] Keyword[int] identifier[getSize] operator[SEP] identifier[T] identifier[client] operator[SEP] {
identifier[Cipher] identifier[encryption] operator[SEP] Keyword[if] operator[SEP] identifier[client] operator[==] Other[null] operator[||] operator[SEP] identifier[encryption] operator[=] identifier[client] operator[SEP] identifier[getEncryption] operator[SEP] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[queue] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[mapToInt] operator[SEP] identifier[array] operator[->] identifier[array] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[sum] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[blockSize] operator[=] identifier[encryption] operator[SEP] identifier[getBlockSize] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[queue] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[mapToInt] operator[SEP] identifier[array] operator[->] identifier[Utility] operator[SEP] identifier[roundUpToNextMultiple] operator[SEP] identifier[array] operator[SEP] identifier[length] , identifier[blockSize] operator[SEP] operator[SEP] operator[SEP] identifier[sum] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<GriddedTile> getGriddedTile() {
List<GriddedTile> griddedTile = null;
try {
if (griddedTileDao.isTableExists()) {
griddedTile = griddedTileDao
.query(tileMatrixSet.getTableName());
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to get Gridded Tile for table name: "
+ tileMatrixSet.getTableName(), e);
}
return griddedTile;
}
|
class class_name[name] begin[{]
method[getGriddedTile, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], griddedTile]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isTableExists, postfix_operators=[], prefix_operators=[], qualifier=griddedTileDao, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=griddedTile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=tileMatrixSet, selectors=[], type_arguments=None)], member=query, postfix_operators=[], prefix_operators=[], qualifier=griddedTileDao, selectors=[], type_arguments=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to get Gridded Tile for table name: "), operandr=MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=tileMatrixSet, 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=GeoPackageException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
return[member[.griddedTile]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[GriddedTile] operator[>] identifier[getGriddedTile] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[GriddedTile] operator[>] identifier[griddedTile] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[griddedTileDao] operator[SEP] identifier[isTableExists] operator[SEP] operator[SEP] operator[SEP] {
identifier[griddedTile] operator[=] identifier[griddedTileDao] operator[SEP] identifier[query] operator[SEP] identifier[tileMatrixSet] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[GeoPackageException] operator[SEP] literal[String] operator[+] identifier[tileMatrixSet] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[griddedTile] operator[SEP]
}
|
private void newlineAndIndent(){
if (isWriting()){
if (isClosed){
write(Indentation.tabs(depth)); // \n\t\t\t\...
} else {
depth++;
write(Indentation.closedTabs(depth)); // >\n\t\t\t\...
isClosed = true;
}
}
}
|
class class_name[name] begin[{]
method[newlineAndIndent, return_type[void], modifier[private], parameter[]] begin[{]
if[call[.isWriting, parameter[]]] begin[{]
if[member[.isClosed]] begin[{]
call[.write, parameter[call[Indentation.tabs, parameter[member[.depth]]]]]
else begin[{]
member[.depth]
call[.write, parameter[call[Indentation.closedTabs, parameter[member[.depth]]]]]
assign[member[.isClosed], literal[true]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[newlineAndIndent] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isWriting] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isClosed] operator[SEP] {
identifier[write] operator[SEP] identifier[Indentation] operator[SEP] identifier[tabs] operator[SEP] identifier[depth] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[depth] operator[++] operator[SEP] identifier[write] operator[SEP] identifier[Indentation] operator[SEP] identifier[closedTabs] operator[SEP] identifier[depth] operator[SEP] operator[SEP] operator[SEP] identifier[isClosed] operator[=] literal[boolean] operator[SEP]
}
}
}
|
public float[] readData(RandomAccessFile raf) throws IOException {
Grib2Gds gds = getGDS();
Grib2DataReader reader = new Grib2DataReader(drss.getDataTemplate(), gdss.getNumberPoints(), drss.getDataPoints(),
getScanMode(), gds.getNxRaw(), dataSection.getStartingPosition(), dataSection.getMsgLength());
Grib2Drs gdrs = drss.getDrs(raf);
float[] data = reader.getData(raf, bms, gdrs);
if (gds.isThin())
data = QuasiRegular.convertQuasiGrid(data, gds.getNptsInLine(), gds.getNxRaw(), gds.getNyRaw(), GribData.getInterpolationMethod());
lastRecordRead = this;
return data;
}
|
class class_name[name] begin[{]
method[readData, return_type[type[float]], modifier[public], parameter[raf]] begin[{]
local_variable[type[Grib2Gds], gds]
local_variable[type[Grib2DataReader], reader]
local_variable[type[Grib2Drs], gdrs]
local_variable[type[float], data]
if[call[gds.isThin, parameter[]]] begin[{]
assign[member[.data], call[QuasiRegular.convertQuasiGrid, parameter[member[.data], call[gds.getNptsInLine, parameter[]], call[gds.getNxRaw, parameter[]], call[gds.getNyRaw, parameter[]], call[GribData.getInterpolationMethod, parameter[]]]]]
else begin[{]
None
end[}]
assign[member[.lastRecordRead], THIS[]]
return[member[.data]]
end[}]
END[}]
|
Keyword[public] Keyword[float] operator[SEP] operator[SEP] identifier[readData] operator[SEP] identifier[RandomAccessFile] identifier[raf] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Grib2Gds] identifier[gds] operator[=] identifier[getGDS] operator[SEP] operator[SEP] operator[SEP] identifier[Grib2DataReader] identifier[reader] operator[=] Keyword[new] identifier[Grib2DataReader] operator[SEP] identifier[drss] operator[SEP] identifier[getDataTemplate] operator[SEP] operator[SEP] , identifier[gdss] operator[SEP] identifier[getNumberPoints] operator[SEP] operator[SEP] , identifier[drss] operator[SEP] identifier[getDataPoints] operator[SEP] operator[SEP] , identifier[getScanMode] operator[SEP] operator[SEP] , identifier[gds] operator[SEP] identifier[getNxRaw] operator[SEP] operator[SEP] , identifier[dataSection] operator[SEP] identifier[getStartingPosition] operator[SEP] operator[SEP] , identifier[dataSection] operator[SEP] identifier[getMsgLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Grib2Drs] identifier[gdrs] operator[=] identifier[drss] operator[SEP] identifier[getDrs] operator[SEP] identifier[raf] operator[SEP] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[reader] operator[SEP] identifier[getData] operator[SEP] identifier[raf] , identifier[bms] , identifier[gdrs] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[gds] operator[SEP] identifier[isThin] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[QuasiRegular] operator[SEP] identifier[convertQuasiGrid] operator[SEP] identifier[data] , identifier[gds] operator[SEP] identifier[getNptsInLine] operator[SEP] operator[SEP] , identifier[gds] operator[SEP] identifier[getNxRaw] operator[SEP] operator[SEP] , identifier[gds] operator[SEP] identifier[getNyRaw] operator[SEP] operator[SEP] , identifier[GribData] operator[SEP] identifier[getInterpolationMethod] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[lastRecordRead] operator[=] Keyword[this] operator[SEP] Keyword[return] identifier[data] operator[SEP]
}
|
public ClosableIterator<Tuple> callStoredProcedure(EmbeddedCacheManager embeddedCacheManager, String storedProcedureName, ProcedureQueryParameters queryParameters, ClassLoaderService classLoaderService ) {
validate( queryParameters );
Cache<String, String> cache = embeddedCacheManager.getCache( STORED_PROCEDURES_CACHE_NAME, true );
String className = cache.getOrDefault( storedProcedureName, storedProcedureName );
Callable<?> callable = instantiate( storedProcedureName, className, classLoaderService );
setParams( storedProcedureName, queryParameters, callable );
Object res = execute( storedProcedureName, embeddedCacheManager, callable );
return extractResultSet( storedProcedureName, res );
}
|
class class_name[name] begin[{]
method[callStoredProcedure, return_type[type[ClosableIterator]], modifier[public], parameter[embeddedCacheManager, storedProcedureName, queryParameters, classLoaderService]] begin[{]
call[.validate, parameter[member[.queryParameters]]]
local_variable[type[Cache], cache]
local_variable[type[String], className]
local_variable[type[Callable], callable]
call[.setParams, parameter[member[.storedProcedureName], member[.queryParameters], member[.callable]]]
local_variable[type[Object], res]
return[call[.extractResultSet, parameter[member[.storedProcedureName], member[.res]]]]
end[}]
END[}]
|
Keyword[public] identifier[ClosableIterator] operator[<] identifier[Tuple] operator[>] identifier[callStoredProcedure] operator[SEP] identifier[EmbeddedCacheManager] identifier[embeddedCacheManager] , identifier[String] identifier[storedProcedureName] , identifier[ProcedureQueryParameters] identifier[queryParameters] , identifier[ClassLoaderService] identifier[classLoaderService] operator[SEP] {
identifier[validate] operator[SEP] identifier[queryParameters] operator[SEP] operator[SEP] identifier[Cache] operator[<] identifier[String] , identifier[String] operator[>] identifier[cache] operator[=] identifier[embeddedCacheManager] operator[SEP] identifier[getCache] operator[SEP] identifier[STORED_PROCEDURES_CACHE_NAME] , literal[boolean] operator[SEP] operator[SEP] identifier[String] identifier[className] operator[=] identifier[cache] operator[SEP] identifier[getOrDefault] operator[SEP] identifier[storedProcedureName] , identifier[storedProcedureName] operator[SEP] operator[SEP] identifier[Callable] operator[<] operator[?] operator[>] identifier[callable] operator[=] identifier[instantiate] operator[SEP] identifier[storedProcedureName] , identifier[className] , identifier[classLoaderService] operator[SEP] operator[SEP] identifier[setParams] operator[SEP] identifier[storedProcedureName] , identifier[queryParameters] , identifier[callable] operator[SEP] operator[SEP] identifier[Object] identifier[res] operator[=] identifier[execute] operator[SEP] identifier[storedProcedureName] , identifier[embeddedCacheManager] , identifier[callable] operator[SEP] operator[SEP] Keyword[return] identifier[extractResultSet] operator[SEP] identifier[storedProcedureName] , identifier[res] operator[SEP] operator[SEP]
}
|
public static <T extends Enum<T>> PropertiesManager<T> newManager(File file,
File defaultFile,
Class<T> keyType,
final Retriever... retrievers) throws IOException
{
return newManager(file, defaultFile, keyType, createExecutor(), retrievers);
}
|
class class_name[name] begin[{]
method[newManager, return_type[type[PropertiesManager]], modifier[public static], parameter[file, defaultFile, keyType, retrievers]] begin[{]
return[call[.newManager, parameter[member[.file], member[.defaultFile], member[.keyType], call[.createExecutor, parameter[]], member[.retrievers]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Enum] operator[<] identifier[T] operator[>] operator[>] identifier[PropertiesManager] operator[<] identifier[T] operator[>] identifier[newManager] operator[SEP] identifier[File] identifier[file] , identifier[File] identifier[defaultFile] , identifier[Class] operator[<] identifier[T] operator[>] identifier[keyType] , Keyword[final] identifier[Retriever] operator[...] identifier[retrievers] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[newManager] operator[SEP] identifier[file] , identifier[defaultFile] , identifier[keyType] , identifier[createExecutor] operator[SEP] operator[SEP] , identifier[retrievers] operator[SEP] operator[SEP]
}
|
static protected String getQueryResult(JsonNode inProgressResponse,
String previousGetResultPath,
StmtInput stmtInput)
throws SFException, SnowflakeSQLException
{
String getResultPath = null;
// get result url better not be empty
if (inProgressResponse == null ||
inProgressResponse.path("data").path("getResultUrl").isMissingNode())
{
if (previousGetResultPath == null)
{
throw new SFException(ErrorCode.INTERNAL_ERROR,
"No query response or missing get result URL");
}
else
{
logger.debug("No query response or missing get result URL, " +
"use previous get result URL: {}", previousGetResultPath);
getResultPath = previousGetResultPath;
}
}
else
{
getResultPath = inProgressResponse.path("data").path("getResultUrl").
asText();
}
return getQueryResult(
getResultPath,
stmtInput
);
}
|
class class_name[name] begin[{]
method[getQueryResult, return_type[type[String]], modifier[protected static], parameter[inProgressResponse, previousGetResultPath, stmtInput]] begin[{]
local_variable[type[String], getResultPath]
if[binary_operation[binary_operation[member[.inProgressResponse], ==, literal[null]], ||, call[inProgressResponse.path, parameter[literal["data"]]]]] begin[{]
if[binary_operation[member[.previousGetResultPath], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=INTERNAL_ERROR, postfix_operators=[], prefix_operators=[], qualifier=ErrorCode, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No query response or missing get result URL")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SFException, sub_type=None)), label=None)
else begin[{]
call[logger.debug, parameter[binary_operation[literal["No query response or missing get result URL, "], +, literal["use previous get result URL: {}"]], member[.previousGetResultPath]]]
assign[member[.getResultPath], member[.previousGetResultPath]]
end[}]
else begin[{]
assign[member[.getResultPath], call[inProgressResponse.path, parameter[literal["data"]]]]
end[}]
return[call[.getQueryResult, parameter[member[.getResultPath], member[.stmtInput]]]]
end[}]
END[}]
|
Keyword[static] Keyword[protected] identifier[String] identifier[getQueryResult] operator[SEP] identifier[JsonNode] identifier[inProgressResponse] , identifier[String] identifier[previousGetResultPath] , identifier[StmtInput] identifier[stmtInput] operator[SEP] Keyword[throws] identifier[SFException] , identifier[SnowflakeSQLException] {
identifier[String] identifier[getResultPath] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[inProgressResponse] operator[==] Other[null] operator[||] identifier[inProgressResponse] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isMissingNode] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[previousGetResultPath] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SFException] operator[SEP] identifier[ErrorCode] operator[SEP] identifier[INTERNAL_ERROR] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] literal[String] , identifier[previousGetResultPath] operator[SEP] operator[SEP] identifier[getResultPath] operator[=] identifier[previousGetResultPath] operator[SEP]
}
}
Keyword[else] {
identifier[getResultPath] operator[=] identifier[inProgressResponse] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getQueryResult] operator[SEP] identifier[getResultPath] , identifier[stmtInput] operator[SEP] operator[SEP]
}
|
public static <R> StandaloneMetaProperty<R> of(String propertyName, MetaBean metaBean, Class<R> clazz) {
return new StandaloneMetaProperty<>(propertyName, metaBean, clazz, clazz);
}
|
class class_name[name] begin[{]
method[of, return_type[type[StandaloneMetaProperty]], modifier[public static], parameter[propertyName, metaBean, clazz]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=metaBean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=StandaloneMetaProperty, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[R] operator[>] identifier[StandaloneMetaProperty] operator[<] identifier[R] operator[>] identifier[of] operator[SEP] identifier[String] identifier[propertyName] , identifier[MetaBean] identifier[metaBean] , identifier[Class] operator[<] identifier[R] operator[>] identifier[clazz] operator[SEP] {
Keyword[return] Keyword[new] identifier[StandaloneMetaProperty] operator[<] operator[>] operator[SEP] identifier[propertyName] , identifier[metaBean] , identifier[clazz] , identifier[clazz] operator[SEP] operator[SEP]
}
|
protected <T> WrapperGenericList<T> processWrapper(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
String webpage = httpTools.getRequest(url);
try {
// Due to type erasure, this doesn't work
// TypeReference<WrapperGenericList<T>> typeRef = new TypeReference<WrapperGenericList<T>>() {};
return MAPPER.readValue(webpage, typeRef);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get " + errorMessageSuffix, url, ex);
}
}
|
class class_name[name] begin[{]
method[processWrapper, return_type[type[WrapperGenericList]], modifier[protected], parameter[typeRef, url, errorMessageSuffix]] begin[{]
local_variable[type[String], webpage]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=webpage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=typeRef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readValue, postfix_operators=[], prefix_operators=[], qualifier=MAPPER, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=MAPPING_FAILED, postfix_operators=[], prefix_operators=[], qualifier=ApiExceptionType, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to get "), operandr=MemberReference(member=errorMessageSuffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=MovieDbException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] operator[<] identifier[T] operator[>] identifier[WrapperGenericList] operator[<] identifier[T] operator[>] identifier[processWrapper] operator[SEP] identifier[TypeReference] identifier[typeRef] , identifier[URL] identifier[url] , identifier[String] identifier[errorMessageSuffix] operator[SEP] Keyword[throws] identifier[MovieDbException] {
identifier[String] identifier[webpage] operator[=] identifier[httpTools] operator[SEP] identifier[getRequest] operator[SEP] identifier[url] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[MAPPER] operator[SEP] identifier[readValue] operator[SEP] identifier[webpage] , identifier[typeRef] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MovieDbException] operator[SEP] identifier[ApiExceptionType] operator[SEP] identifier[MAPPING_FAILED] , literal[String] operator[+] identifier[errorMessageSuffix] , identifier[url] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
private Record setDefault(Record record) {
int size = record.size();
for (int i = 0; i < size; i++)
if (record.get(i) == null) {
@SuppressWarnings("unchecked")
Field<Object> field = (Field<Object>) record.field(i);
if (!field.getDataType().nullable() && !field.getDataType().identity())
record.set(field, DSL.defaultValue());
}
return record;
}
|
class class_name[name] begin[{]
method[setDefault, return_type[type[Record]], modifier[private], parameter[record]] begin[{]
local_variable[type[int], size]
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unchecked"), name=SuppressWarnings)], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=field, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Field, sub_type=None)), name=field)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Field, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getDataType, postfix_operators=[], prefix_operators=['!'], qualifier=field, selectors=[MethodInvocation(arguments=[], member=nullable, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getDataType, postfix_operators=[], prefix_operators=['!'], qualifier=field, selectors=[MethodInvocation(arguments=[], member=identity, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=defaultValue, postfix_operators=[], prefix_operators=[], qualifier=DSL, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[], type_arguments=None), label=None))])), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.record]]
end[}]
END[}]
|
Keyword[private] identifier[Record] identifier[setDefault] operator[SEP] identifier[Record] identifier[record] operator[SEP] {
Keyword[int] identifier[size] operator[=] identifier[record] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[size] operator[SEP] identifier[i] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[record] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[==] Other[null] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Field] operator[<] identifier[Object] operator[>] identifier[field] operator[=] operator[SEP] identifier[Field] operator[<] identifier[Object] operator[>] operator[SEP] identifier[record] operator[SEP] identifier[field] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[field] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP] identifier[nullable] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[field] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP] identifier[identity] operator[SEP] operator[SEP] operator[SEP] identifier[record] operator[SEP] identifier[set] operator[SEP] identifier[field] , identifier[DSL] operator[SEP] identifier[defaultValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[record] operator[SEP]
}
|
private static List<Method> findStaticMethods(Class<?> type) {
return filter(asList(type.getDeclaredMethods()), STATIC_METHOD_PREDICATE);
}
|
class class_name[name] begin[{]
method[findStaticMethods, return_type[type[List]], modifier[private static], parameter[type]] begin[{]
return[call[.filter, parameter[call[.asList, parameter[call[type.getDeclaredMethods, parameter[]]]], member[.STATIC_METHOD_PREDICATE]]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[List] operator[<] identifier[Method] operator[>] identifier[findStaticMethods] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[SEP] {
Keyword[return] identifier[filter] operator[SEP] identifier[asList] operator[SEP] identifier[type] operator[SEP] identifier[getDeclaredMethods] operator[SEP] operator[SEP] operator[SEP] , identifier[STATIC_METHOD_PREDICATE] operator[SEP] operator[SEP]
}
|
public static char[] toChars(int codePoint) {
if (isBmpCodePoint(codePoint)) {
return new char[] { (char) codePoint };
} else if (isValidCodePoint(codePoint)) {
char[] result = new char[2];
toSurrogates(codePoint, result, 0);
return result;
} else {
throw new IllegalArgumentException();
}
}
|
class class_name[name] begin[{]
method[toChars, return_type[type[char]], modifier[public static], parameter[codePoint]] begin[{]
if[call[.isBmpCodePoint, parameter[member[.codePoint]]]] begin[{]
return[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Cast(expression=MemberReference(member=codePoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=char))]
else begin[{]
if[call[.isValidCodePoint, parameter[member[.codePoint]]]] begin[{]
local_variable[type[char], result]
call[.toSurrogates, parameter[member[.codePoint], member[.result], literal[0]]]
return[member[.result]]
else 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)
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[char] operator[SEP] operator[SEP] identifier[toChars] operator[SEP] Keyword[int] identifier[codePoint] operator[SEP] {
Keyword[if] operator[SEP] identifier[isBmpCodePoint] operator[SEP] identifier[codePoint] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] Keyword[char] operator[SEP] operator[SEP] {
operator[SEP] Keyword[char] operator[SEP] identifier[codePoint]
} operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isValidCodePoint] operator[SEP] identifier[codePoint] operator[SEP] operator[SEP] {
Keyword[char] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] Keyword[char] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[toSurrogates] operator[SEP] identifier[codePoint] , identifier[result] , Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static String getServiceURL(KubernetesClient client, String serviceName, String serviceNamespace, String serviceProtocol, boolean serviceExternal) {
Service srv = null;
String serviceHost = serviceToHostOrBlank(serviceName);
String servicePort = serviceToPortOrBlank(serviceName);
String serviceProto = serviceProtocol != null ? serviceProtocol : serviceToProtocol(serviceName, servicePort);
//Use specified or fallback namespace.
String actualNamespace = StringUtils.isNotBlank(serviceNamespace) ? serviceNamespace : client.getNamespace();
//1. Inside Kubernetes: Services as ENV vars
if (!serviceExternal && StringUtils.isNotBlank(serviceHost) && StringUtils.isNotBlank(servicePort) && StringUtils.isNotBlank(serviceProtocol)) {
return serviceProtocol + "://" + serviceHost + ":" + servicePort;
//2. Anywhere: When namespace is passed System / Env var. Mostly needed for integration tests.
} else if (StringUtils.isNotBlank(actualNamespace)) {
srv = client.services().inNamespace(actualNamespace).withName(serviceName).get();
}
if (srv == null) {
// lets try use environment variables
String hostAndPort = getServiceHostAndPort(serviceName, "", "");
if (!hostAndPort.startsWith(":")) {
return serviceProto + "://" + hostAndPort;
}
}
if (srv == null) {
throw new IllegalArgumentException("No kubernetes service could be found for name: " + serviceName + " in namespace: " + actualNamespace);
}
String answer = KubernetesHelper.getOrCreateAnnotations(srv).get(Fabric8Annotations.SERVICE_EXPOSE_URL.toString());
if (StringUtils.isNotBlank(answer)) {
return answer;
}
if (OpenshiftHelper.isOpenShift(client)) {
OpenShiftClient openShiftClient = client.adapt(OpenShiftClient.class);
Route route = openShiftClient.routes().inNamespace(actualNamespace).withName(serviceName).get();
if (route != null) {
return (serviceProto + "://" + route.getSpec().getHost()).toLowerCase();
}
}
ServicePort port = findServicePortByName(srv, null);
if (port == null) {
throw new RuntimeException("Couldn't find port: " + null + " for service:" + serviceName);
}
String clusterIP = srv.getSpec().getClusterIP();
if ("None".equals(clusterIP)) {
throw new IllegalStateException("Service: " + serviceName + " in namespace:" + serviceNamespace + "is head-less. Search for endpoints instead.");
}
Integer portNumber = port.getPort();
if (StringUtils.isBlank(clusterIP)) {
IngressList ingresses = client.extensions().ingresses().inNamespace(serviceNamespace).list();
if (ingresses != null) {
List<Ingress> items = ingresses.getItems();
if (items != null) {
for (Ingress item : items) {
String ns = KubernetesHelper.getNamespace(item);
if (Objects.equal(serviceNamespace, ns)) {
IngressSpec spec = item.getSpec();
if (spec != null) {
List<IngressRule> rules = spec.getRules();
List<IngressTLS> tls = spec.getTls();
if (rules != null) {
for (IngressRule rule : rules) {
HTTPIngressRuleValue http = rule.getHttp();
if (http != null) {
List<HTTPIngressPath> paths = http.getPaths();
if (paths != null) {
for (HTTPIngressPath path : paths) {
IngressBackend backend = path.getBackend();
if (backend != null) {
String backendServiceName = backend.getServiceName();
if (serviceName.equals(backendServiceName) && portsMatch(port, backend.getServicePort())) {
String pathPostfix = path.getPath();
if (tls != null) {
for (IngressTLS tlsHost : tls) {
List<String> hosts = tlsHost.getHosts();
if (hosts != null) {
for (String host : hosts) {
if (StringUtils.isNotBlank(host)) {
return String.format("https://%s/%s", host, preparePath(pathPostfix));
}
}
}
}
}
answer = rule.getHost();
if (StringUtils.isNotBlank(answer)) {
return String.format("http://%s/%s",answer, preparePath(pathPostfix));
}
}
}
}
}
}
}
}
}
}
}
}
}
// lets try use the status on GKE
ServiceStatus status = srv.getStatus();
if (status != null) {
LoadBalancerStatus loadBalancerStatus = status.getLoadBalancer();
if (loadBalancerStatus != null) {
List<LoadBalancerIngress> loadBalancerIngresses = loadBalancerStatus.getIngress();
if (loadBalancerIngresses != null) {
for (LoadBalancerIngress loadBalancerIngress : loadBalancerIngresses) {
String ip = loadBalancerIngress.getIp();
if (StringUtils.isNotBlank(ip)) {
clusterIP = ip;
break;
}
}
}
}
}
}
if (StringUtils.isBlank(clusterIP)) {
// on vanilla kubernetes we can use nodePort to access things externally
boolean found = false;
Integer nodePort = port.getNodePort();
if (nodePort != null) {
NodeList nodeList = client.nodes().list();
if (nodeList != null) {
List<Node> items = nodeList.getItems();
if (items != null) {
for (Node item : items) {
NodeStatus status = item.getStatus();
if (!found && status != null) {
List<NodeAddress> addresses = status.getAddresses();
if (addresses != null) {
for (NodeAddress address : addresses) {
String ip = address.getAddress();
if (StringUtils.isNotBlank(ip)) {
clusterIP = ip;
portNumber = nodePort;
found = true;
break;
}
}
}
}
if (!found) {
NodeSpec spec = item.getSpec();
if (spec != null) {
clusterIP = spec.getExternalID();
if (StringUtils.isNotBlank(clusterIP)) {
portNumber = nodePort;
break;
}
}
}
}
}
}
}
}
return (serviceProto + "://" + clusterIP + ":" + portNumber).toLowerCase();
}
|
class class_name[name] begin[{]
method[getServiceURL, return_type[type[String]], modifier[public static], parameter[client, serviceName, serviceNamespace, serviceProtocol, serviceExternal]] begin[{]
local_variable[type[Service], srv]
local_variable[type[String], serviceHost]
local_variable[type[String], servicePort]
local_variable[type[String], serviceProto]
local_variable[type[String], actualNamespace]
if[binary_operation[binary_operation[binary_operation[member[.serviceExternal], &&, call[StringUtils.isNotBlank, parameter[member[.serviceHost]]]], &&, call[StringUtils.isNotBlank, parameter[member[.servicePort]]]], &&, call[StringUtils.isNotBlank, parameter[member[.serviceProtocol]]]]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[member[.serviceProtocol], +, literal["://"]], +, member[.serviceHost]], +, literal[":"]], +, member[.servicePort]]]
else begin[{]
if[call[StringUtils.isNotBlank, parameter[member[.actualNamespace]]]] begin[{]
assign[member[.srv], call[client.services, parameter[]]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.srv], ==, literal[null]]] begin[{]
local_variable[type[String], hostAndPort]
if[call[hostAndPort.startsWith, parameter[literal[":"]]]] begin[{]
return[binary_operation[binary_operation[member[.serviceProto], +, literal["://"]], +, member[.hostAndPort]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.srv], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No kubernetes service could be found for name: "), operandr=MemberReference(member=serviceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" in namespace: "), operator=+), operandr=MemberReference(member=actualNamespace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], answer]
if[call[StringUtils.isNotBlank, parameter[member[.answer]]]] begin[{]
return[member[.answer]]
else begin[{]
None
end[}]
if[call[OpenshiftHelper.isOpenShift, parameter[member[.client]]]] begin[{]
local_variable[type[OpenShiftClient], openShiftClient]
local_variable[type[Route], route]
if[binary_operation[member[.route], !=, literal[null]]] begin[{]
return[binary_operation[binary_operation[member[.serviceProto], +, literal["://"]], +, call[route.getSpec, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[ServicePort], port]
if[binary_operation[member[.port], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Couldn't find port: "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" for service:"), operator=+), operandr=MemberReference(member=serviceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], clusterIP]
if[literal["None"]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Service: "), operandr=MemberReference(member=serviceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" in namespace:"), operator=+), operandr=MemberReference(member=serviceNamespace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="is head-less. Search for endpoints instead."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Integer], portNumber]
if[call[StringUtils.isBlank, parameter[member[.clusterIP]]]] begin[{]
local_variable[type[IngressList], ingresses]
if[binary_operation[member[.ingresses], !=, literal[null]]] begin[{]
local_variable[type[List], items]
if[binary_operation[member[.items], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNamespace, postfix_operators=[], prefix_operators=[], qualifier=KubernetesHelper, selectors=[], type_arguments=None), name=ns)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=serviceNamespace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equal, postfix_operators=[], prefix_operators=[], qualifier=Objects, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSpec, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=spec)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IngressSpec, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=spec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRules, postfix_operators=[], prefix_operators=[], qualifier=spec, selectors=[], type_arguments=None), name=rules)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IngressRule, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTls, postfix_operators=[], prefix_operators=[], qualifier=spec, selectors=[], type_arguments=None), name=tls)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IngressTLS, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rules, 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=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getHttp, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None), name=http)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HTTPIngressRuleValue, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=http, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPaths, postfix_operators=[], prefix_operators=[], qualifier=http, selectors=[], type_arguments=None), name=paths)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=HTTPIngressPath, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=paths, 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=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBackend, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), name=backend)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IngressBackend, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getServiceName, postfix_operators=[], prefix_operators=[], qualifier=backend, selectors=[], type_arguments=None), name=backendServiceName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=backendServiceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=serviceName, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getServicePort, postfix_operators=[], prefix_operators=[], qualifier=backend, selectors=[], type_arguments=None)], member=portsMatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), name=pathPostfix)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tls, 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=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getHosts, postfix_operators=[], prefix_operators=[], qualifier=tlsHost, selectors=[], type_arguments=None), name=hosts)], 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=MemberReference(member=hosts, 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=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotBlank, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="https://%s/%s"), MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=pathPostfix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=preparePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=hosts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=host)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=tls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tlsHost)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IngressTLS, sub_type=None))), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=answer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getHost, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=answer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotBlank, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="http://%s/%s"), MemberReference(member=answer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=pathPostfix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=preparePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), label=None)]))]))]))]), control=EnhancedForControl(iterable=MemberReference(member=paths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HTTPIngressPath, sub_type=None))), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=rules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=rule)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IngressRule, sub_type=None))), label=None)]))]))]))]), control=EnhancedForControl(iterable=MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Ingress, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[ServiceStatus], status]
if[binary_operation[member[.status], !=, literal[null]]] begin[{]
local_variable[type[LoadBalancerStatus], loadBalancerStatus]
if[binary_operation[member[.loadBalancerStatus], !=, literal[null]]] begin[{]
local_variable[type[List], loadBalancerIngresses]
if[binary_operation[member[.loadBalancerIngresses], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getIp, postfix_operators=[], prefix_operators=[], qualifier=loadBalancerIngress, selectors=[], type_arguments=None), name=ip)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotBlank, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=clusterIP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=loadBalancerIngresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=loadBalancerIngress)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LoadBalancerIngress, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[call[StringUtils.isBlank, parameter[member[.clusterIP]]]] begin[{]
local_variable[type[boolean], found]
local_variable[type[Integer], nodePort]
if[binary_operation[member[.nodePort], !=, literal[null]]] begin[{]
local_variable[type[NodeList], nodeList]
if[binary_operation[member[.nodeList], !=, literal[null]]] begin[{]
local_variable[type[List], items]
if[binary_operation[member[.items], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getStatus, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=status)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeStatus, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=found, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getAddresses, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None), name=addresses)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NodeAddress, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=addresses, 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=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getAddress, postfix_operators=[], prefix_operators=[], qualifier=address, selectors=[], type_arguments=None), name=ip)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotBlank, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=clusterIP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=portNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=nodePort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=found, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=addresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=address)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeAddress, sub_type=None))), label=None)]))])), IfStatement(condition=MemberReference(member=found, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSpec, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=spec)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeSpec, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=spec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=clusterIP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getExternalID, postfix_operators=[], prefix_operators=[], qualifier=spec, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=clusterIP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotBlank, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=portNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=nodePort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]))]))]))]), control=EnhancedForControl(iterable=MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[binary_operation[binary_operation[binary_operation[binary_operation[member[.serviceProto], +, literal["://"]], +, member[.clusterIP]], +, literal[":"]], +, member[.portNumber]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getServiceURL] operator[SEP] identifier[KubernetesClient] identifier[client] , identifier[String] identifier[serviceName] , identifier[String] identifier[serviceNamespace] , identifier[String] identifier[serviceProtocol] , Keyword[boolean] identifier[serviceExternal] operator[SEP] {
identifier[Service] identifier[srv] operator[=] Other[null] operator[SEP] identifier[String] identifier[serviceHost] operator[=] identifier[serviceToHostOrBlank] operator[SEP] identifier[serviceName] operator[SEP] operator[SEP] identifier[String] identifier[servicePort] operator[=] identifier[serviceToPortOrBlank] operator[SEP] identifier[serviceName] operator[SEP] operator[SEP] identifier[String] identifier[serviceProto] operator[=] identifier[serviceProtocol] operator[!=] Other[null] operator[?] identifier[serviceProtocol] operator[:] identifier[serviceToProtocol] operator[SEP] identifier[serviceName] , identifier[servicePort] operator[SEP] operator[SEP] identifier[String] identifier[actualNamespace] operator[=] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[serviceNamespace] operator[SEP] operator[?] identifier[serviceNamespace] operator[:] identifier[client] operator[SEP] identifier[getNamespace] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[serviceExternal] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[serviceHost] operator[SEP] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[servicePort] operator[SEP] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[serviceProtocol] operator[SEP] operator[SEP] {
Keyword[return] identifier[serviceProtocol] operator[+] literal[String] operator[+] identifier[serviceHost] operator[+] literal[String] operator[+] identifier[servicePort] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[actualNamespace] operator[SEP] operator[SEP] {
identifier[srv] operator[=] identifier[client] operator[SEP] identifier[services] operator[SEP] operator[SEP] operator[SEP] identifier[inNamespace] operator[SEP] identifier[actualNamespace] operator[SEP] operator[SEP] identifier[withName] operator[SEP] identifier[serviceName] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[srv] operator[==] Other[null] operator[SEP] {
identifier[String] identifier[hostAndPort] operator[=] identifier[getServiceHostAndPort] operator[SEP] identifier[serviceName] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[hostAndPort] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[serviceProto] operator[+] literal[String] operator[+] identifier[hostAndPort] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[srv] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[serviceName] operator[+] literal[String] operator[+] identifier[actualNamespace] operator[SEP] operator[SEP]
}
identifier[String] identifier[answer] operator[=] identifier[KubernetesHelper] operator[SEP] identifier[getOrCreateAnnotations] operator[SEP] identifier[srv] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[Fabric8Annotations] operator[SEP] identifier[SERVICE_EXPOSE_URL] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[answer] operator[SEP] operator[SEP] {
Keyword[return] identifier[answer] operator[SEP]
}
Keyword[if] operator[SEP] identifier[OpenshiftHelper] operator[SEP] identifier[isOpenShift] operator[SEP] identifier[client] operator[SEP] operator[SEP] {
identifier[OpenShiftClient] identifier[openShiftClient] operator[=] identifier[client] operator[SEP] identifier[adapt] operator[SEP] identifier[OpenShiftClient] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Route] identifier[route] operator[=] identifier[openShiftClient] operator[SEP] identifier[routes] operator[SEP] operator[SEP] operator[SEP] identifier[inNamespace] operator[SEP] identifier[actualNamespace] operator[SEP] operator[SEP] identifier[withName] operator[SEP] identifier[serviceName] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[route] operator[!=] Other[null] operator[SEP] {
Keyword[return] operator[SEP] identifier[serviceProto] operator[+] literal[String] operator[+] identifier[route] operator[SEP] identifier[getSpec] operator[SEP] operator[SEP] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[ServicePort] identifier[port] operator[=] identifier[findServicePortByName] operator[SEP] identifier[srv] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[port] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] Other[null] operator[+] literal[String] operator[+] identifier[serviceName] operator[SEP] operator[SEP]
}
identifier[String] identifier[clusterIP] operator[=] identifier[srv] operator[SEP] identifier[getSpec] operator[SEP] operator[SEP] operator[SEP] identifier[getClusterIP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[clusterIP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[serviceName] operator[+] literal[String] operator[+] identifier[serviceNamespace] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[Integer] identifier[portNumber] operator[=] identifier[port] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[clusterIP] operator[SEP] operator[SEP] {
identifier[IngressList] identifier[ingresses] operator[=] identifier[client] operator[SEP] identifier[extensions] operator[SEP] operator[SEP] operator[SEP] identifier[ingresses] operator[SEP] operator[SEP] operator[SEP] identifier[inNamespace] operator[SEP] identifier[serviceNamespace] operator[SEP] operator[SEP] identifier[list] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ingresses] operator[!=] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[Ingress] operator[>] identifier[items] operator[=] identifier[ingresses] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[items] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Ingress] identifier[item] operator[:] identifier[items] operator[SEP] {
identifier[String] identifier[ns] operator[=] identifier[KubernetesHelper] operator[SEP] identifier[getNamespace] operator[SEP] identifier[item] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Objects] operator[SEP] identifier[equal] operator[SEP] identifier[serviceNamespace] , identifier[ns] operator[SEP] operator[SEP] {
identifier[IngressSpec] identifier[spec] operator[=] identifier[item] operator[SEP] identifier[getSpec] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[spec] operator[!=] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[IngressRule] operator[>] identifier[rules] operator[=] identifier[spec] operator[SEP] identifier[getRules] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[IngressTLS] operator[>] identifier[tls] operator[=] identifier[spec] operator[SEP] identifier[getTls] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rules] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[IngressRule] identifier[rule] operator[:] identifier[rules] operator[SEP] {
identifier[HTTPIngressRuleValue] identifier[http] operator[=] identifier[rule] operator[SEP] identifier[getHttp] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[http] operator[!=] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[HTTPIngressPath] operator[>] identifier[paths] operator[=] identifier[http] operator[SEP] identifier[getPaths] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[paths] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[HTTPIngressPath] identifier[path] operator[:] identifier[paths] operator[SEP] {
identifier[IngressBackend] identifier[backend] operator[=] identifier[path] operator[SEP] identifier[getBackend] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[backend] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[backendServiceName] operator[=] identifier[backend] operator[SEP] identifier[getServiceName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[serviceName] operator[SEP] identifier[equals] operator[SEP] identifier[backendServiceName] operator[SEP] operator[&&] identifier[portsMatch] operator[SEP] identifier[port] , identifier[backend] operator[SEP] identifier[getServicePort] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[pathPostfix] operator[=] identifier[path] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tls] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[IngressTLS] identifier[tlsHost] operator[:] identifier[tls] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[hosts] operator[=] identifier[tlsHost] operator[SEP] identifier[getHosts] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hosts] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[host] operator[:] identifier[hosts] operator[SEP] {
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[host] operator[SEP] operator[SEP] {
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[host] , identifier[preparePath] operator[SEP] identifier[pathPostfix] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
identifier[answer] operator[=] identifier[rule] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[answer] operator[SEP] operator[SEP] {
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[answer] , identifier[preparePath] operator[SEP] identifier[pathPostfix] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
}
}
}
}
}
}
}
}
identifier[ServiceStatus] identifier[status] operator[=] identifier[srv] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[!=] Other[null] operator[SEP] {
identifier[LoadBalancerStatus] identifier[loadBalancerStatus] operator[=] identifier[status] operator[SEP] identifier[getLoadBalancer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[loadBalancerStatus] operator[!=] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[LoadBalancerIngress] operator[>] identifier[loadBalancerIngresses] operator[=] identifier[loadBalancerStatus] operator[SEP] identifier[getIngress] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[loadBalancerIngresses] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[LoadBalancerIngress] identifier[loadBalancerIngress] operator[:] identifier[loadBalancerIngresses] operator[SEP] {
identifier[String] identifier[ip] operator[=] identifier[loadBalancerIngress] operator[SEP] identifier[getIp] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[ip] operator[SEP] operator[SEP] {
identifier[clusterIP] operator[=] identifier[ip] operator[SEP] Keyword[break] operator[SEP]
}
}
}
}
}
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[clusterIP] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[found] operator[=] literal[boolean] operator[SEP] identifier[Integer] identifier[nodePort] operator[=] identifier[port] operator[SEP] identifier[getNodePort] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodePort] operator[!=] Other[null] operator[SEP] {
identifier[NodeList] identifier[nodeList] operator[=] identifier[client] operator[SEP] identifier[nodes] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodeList] operator[!=] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[items] operator[=] identifier[nodeList] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[items] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Node] identifier[item] operator[:] identifier[items] operator[SEP] {
identifier[NodeStatus] identifier[status] operator[=] identifier[item] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[found] operator[&&] identifier[status] operator[!=] Other[null] operator[SEP] {
identifier[List] operator[<] identifier[NodeAddress] operator[>] identifier[addresses] operator[=] identifier[status] operator[SEP] identifier[getAddresses] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[addresses] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[NodeAddress] identifier[address] operator[:] identifier[addresses] operator[SEP] {
identifier[String] identifier[ip] operator[=] identifier[address] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[ip] operator[SEP] operator[SEP] {
identifier[clusterIP] operator[=] identifier[ip] operator[SEP] identifier[portNumber] operator[=] identifier[nodePort] operator[SEP] identifier[found] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] operator[!] identifier[found] operator[SEP] {
identifier[NodeSpec] identifier[spec] operator[=] identifier[item] operator[SEP] identifier[getSpec] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[spec] operator[!=] Other[null] operator[SEP] {
identifier[clusterIP] operator[=] identifier[spec] operator[SEP] identifier[getExternalID] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[clusterIP] operator[SEP] operator[SEP] {
identifier[portNumber] operator[=] identifier[nodePort] operator[SEP] Keyword[break] operator[SEP]
}
}
}
}
}
}
}
}
Keyword[return] operator[SEP] identifier[serviceProto] operator[+] literal[String] operator[+] identifier[clusterIP] operator[+] literal[String] operator[+] identifier[portNumber] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP]
}
|
public PathMatcher.PathMatch<T> match(String path){
if (!exactPathMatches.isEmpty()) {
T match = getExactPath(path);
if (match != null) {
UndertowLogger.REQUEST_LOGGER.debugf("Matched exact path %s", path);
return new PathMatcher.PathMatch<>(path, "", match);
}
}
int length = path.length();
final int[] lengths = this.lengths;
for (int i = 0; i < lengths.length; ++i) {
int pathLength = lengths[i];
if (pathLength == length) {
SubstringMap.SubstringMatch<T> next = paths.get(path, length);
if (next != null) {
UndertowLogger.REQUEST_LOGGER.debugf("Matched prefix path %s for path %s", next.getKey(), path);
return new PathMatcher.PathMatch<>(path, "", next.getValue());
}
} else if (pathLength < length) {
char c = path.charAt(pathLength);
if (c == '/') {
//String part = path.substring(0, pathLength);
SubstringMap.SubstringMatch<T> next = paths.get(path, pathLength);
if (next != null) {
UndertowLogger.REQUEST_LOGGER.debugf("Matched prefix path %s for path %s", next.getKey(), path);
return new PathMatcher.PathMatch<>(next.getKey(), path.substring(pathLength), next.getValue());
}
}
}
}
UndertowLogger.REQUEST_LOGGER.debugf("Matched default handler path %s", path);
return new PathMatcher.PathMatch<>("", path, defaultHandler);
}
|
class class_name[name] begin[{]
method[match, return_type[type[PathMatcher]], modifier[public], parameter[path]] begin[{]
if[call[exactPathMatches.isEmpty, parameter[]]] begin[{]
local_variable[type[T], match]
if[binary_operation[member[.match], !=, literal[null]]] begin[{]
call[UndertowLogger.REQUEST_LOGGER.debugf, parameter[literal["Matched exact path %s"], member[.path]]]
return[ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=match, 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=PathMatcher, sub_type=ReferenceType(arguments=[], dimensions=None, name=PathMatch, sub_type=None)))]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[int], length]
local_variable[type[int], lengths]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=lengths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=pathLength)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pathLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pathLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=pathLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pathLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=paths, selectors=[], type_arguments=None), name=next)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SubstringMap, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=SubstringMatch, sub_type=None))), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=next, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Matched prefix path %s for path %s"), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=next, selectors=[], type_arguments=None), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debugf, postfix_operators=[], prefix_operators=[], qualifier=UndertowLogger.REQUEST_LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=next, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=pathLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=next, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PathMatcher, sub_type=ReferenceType(arguments=[], dimensions=None, name=PathMatch, sub_type=None))), label=None)]))]))])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=paths, selectors=[], type_arguments=None), name=next)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SubstringMap, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=SubstringMatch, sub_type=None))), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=next, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Matched prefix path %s for path %s"), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=next, selectors=[], type_arguments=None), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debugf, postfix_operators=[], prefix_operators=[], qualifier=UndertowLogger.REQUEST_LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=next, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PathMatcher, sub_type=ReferenceType(arguments=[], dimensions=None, name=PathMatch, sub_type=None))), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=lengths, 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[UndertowLogger.REQUEST_LOGGER.debugf, parameter[literal["Matched default handler path %s"], member[.path]]]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=defaultHandler, 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=PathMatcher, sub_type=ReferenceType(arguments=[], dimensions=None, name=PathMatch, sub_type=None)))]
end[}]
END[}]
|
Keyword[public] identifier[PathMatcher] operator[SEP] identifier[PathMatch] operator[<] identifier[T] operator[>] identifier[match] operator[SEP] identifier[String] identifier[path] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[exactPathMatches] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[T] identifier[match] operator[=] identifier[getExactPath] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[match] operator[!=] Other[null] operator[SEP] {
identifier[UndertowLogger] operator[SEP] identifier[REQUEST_LOGGER] operator[SEP] identifier[debugf] operator[SEP] literal[String] , identifier[path] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PathMatcher] operator[SEP] identifier[PathMatch] operator[<] operator[>] operator[SEP] identifier[path] , literal[String] , identifier[match] operator[SEP] operator[SEP]
}
}
Keyword[int] identifier[length] operator[=] identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] operator[SEP] operator[SEP] identifier[lengths] operator[=] Keyword[this] operator[SEP] identifier[lengths] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[lengths] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[int] identifier[pathLength] operator[=] identifier[lengths] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pathLength] operator[==] identifier[length] operator[SEP] {
identifier[SubstringMap] operator[SEP] identifier[SubstringMatch] operator[<] identifier[T] operator[>] identifier[next] operator[=] identifier[paths] operator[SEP] identifier[get] operator[SEP] identifier[path] , identifier[length] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[next] operator[!=] Other[null] operator[SEP] {
identifier[UndertowLogger] operator[SEP] identifier[REQUEST_LOGGER] operator[SEP] identifier[debugf] operator[SEP] literal[String] , identifier[next] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[path] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PathMatcher] operator[SEP] identifier[PathMatch] operator[<] operator[>] operator[SEP] identifier[path] , literal[String] , identifier[next] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[pathLength] operator[<] identifier[length] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[path] operator[SEP] identifier[charAt] operator[SEP] identifier[pathLength] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[SubstringMap] operator[SEP] identifier[SubstringMatch] operator[<] identifier[T] operator[>] identifier[next] operator[=] identifier[paths] operator[SEP] identifier[get] operator[SEP] identifier[path] , identifier[pathLength] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[next] operator[!=] Other[null] operator[SEP] {
identifier[UndertowLogger] operator[SEP] identifier[REQUEST_LOGGER] operator[SEP] identifier[debugf] operator[SEP] literal[String] , identifier[next] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[path] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PathMatcher] operator[SEP] identifier[PathMatch] operator[<] operator[>] operator[SEP] identifier[next] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[path] operator[SEP] identifier[substring] operator[SEP] identifier[pathLength] operator[SEP] , identifier[next] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
identifier[UndertowLogger] operator[SEP] identifier[REQUEST_LOGGER] operator[SEP] identifier[debugf] operator[SEP] literal[String] , identifier[path] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PathMatcher] operator[SEP] identifier[PathMatch] operator[<] operator[>] operator[SEP] literal[String] , identifier[path] , identifier[defaultHandler] operator[SEP] operator[SEP]
}
|
public int getIndexOfConverterToPass(boolean bSetData)
{
Converter field = this.getTargetField(null);
if (m_converterNext == field)
return -1; // -1 is the code for the base field.
int iIndex = 0;
for ( ; ; iIndex++)
{ // Is this one already on my list?
Converter converter = this.getConverterToPass(iIndex);
if (converter == null)
break; // End of list
if (converter == field)
return iIndex; // Found
}
if (field == null)
return -1; // Never
this.addConverterToPass(field); // Add it, and
return iIndex; // Return the index to the new converter.
}
|
class class_name[name] begin[{]
method[getIndexOfConverterToPass, return_type[type[int]], modifier[public], parameter[bSetData]] begin[{]
local_variable[type[Converter], field]
if[binary_operation[member[.m_converterNext], ==, member[.field]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
local_variable[type[int], iIndex]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=iIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getConverterToPass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=converter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Converter, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=converter, 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=BreakStatement(goto=None, label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=converter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=iIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=ForControl(condition=None, init=None, update=[MemberReference(member=iIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[member[.field], ==, literal[null]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
THIS[call[None.addConverterToPass, parameter[member[.field]]]]
return[member[.iIndex]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[getIndexOfConverterToPass] operator[SEP] Keyword[boolean] identifier[bSetData] operator[SEP] {
identifier[Converter] identifier[field] operator[=] Keyword[this] operator[SEP] identifier[getTargetField] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_converterNext] operator[==] identifier[field] operator[SEP] Keyword[return] operator[-] Other[1] operator[SEP] Keyword[int] identifier[iIndex] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] operator[SEP] operator[SEP] identifier[iIndex] operator[++] operator[SEP] {
identifier[Converter] identifier[converter] operator[=] Keyword[this] operator[SEP] identifier[getConverterToPass] operator[SEP] identifier[iIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[converter] operator[==] Other[null] operator[SEP] Keyword[break] operator[SEP] Keyword[if] operator[SEP] identifier[converter] operator[==] identifier[field] operator[SEP] Keyword[return] identifier[iIndex] operator[SEP]
}
Keyword[if] operator[SEP] identifier[field] operator[==] Other[null] operator[SEP] Keyword[return] operator[-] Other[1] operator[SEP] Keyword[this] operator[SEP] identifier[addConverterToPass] operator[SEP] identifier[field] operator[SEP] operator[SEP] Keyword[return] identifier[iIndex] operator[SEP]
}
|
public static SecretKey getSecretKey(File keystore, String entryName,
String keyStorePassword) throws KeyStoreException,
NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, UnrecoverableEntryException {
KeyStore keyStore = KeyStore.getInstance("JCEKS");
FileInputStream fis = null;
if (keystore == null || !keystore.exists()
|| FileUtils.sizeOf(keystore) == 0) {
throw new FileNotFoundException();
}
if (StringUtils.isEmpty(keyStorePassword)) {
throw new KeyStoreException("No Keystore password provided.");
}
if (StringUtils.isEmpty(entryName)) {
throw new KeyStoreException("No Keystore entry name provided.");
}
fis = new FileInputStream(keystore);
return getSecretKey(fis, entryName, keyStorePassword);
}
|
class class_name[name] begin[{]
method[getSecretKey, return_type[type[SecretKey]], modifier[public static], parameter[keystore, entryName, keyStorePassword]] begin[{]
local_variable[type[KeyStore], keyStore]
local_variable[type[FileInputStream], fis]
if[binary_operation[binary_operation[binary_operation[member[.keystore], ==, literal[null]], ||, call[keystore.exists, parameter[]]], ||, binary_operation[call[FileUtils.sizeOf, parameter[member[.keystore]]], ==, literal[0]]]] 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=FileNotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[StringUtils.isEmpty, parameter[member[.keyStorePassword]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No Keystore password provided.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KeyStoreException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[StringUtils.isEmpty, parameter[member[.entryName]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No Keystore entry name provided.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KeyStoreException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.fis], ClassCreator(arguments=[MemberReference(member=keystore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None))]
return[call[.getSecretKey, parameter[member[.fis], member[.entryName], member[.keyStorePassword]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[SecretKey] identifier[getSecretKey] operator[SEP] identifier[File] identifier[keystore] , identifier[String] identifier[entryName] , identifier[String] identifier[keyStorePassword] operator[SEP] Keyword[throws] identifier[KeyStoreException] , identifier[NoSuchAlgorithmException] , identifier[CertificateException] , identifier[FileNotFoundException] , identifier[IOException] , identifier[UnrecoverableEntryException] {
identifier[KeyStore] identifier[keyStore] operator[=] identifier[KeyStore] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[FileInputStream] identifier[fis] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[keystore] operator[==] Other[null] operator[||] operator[!] identifier[keystore] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[||] identifier[FileUtils] operator[SEP] identifier[sizeOf] operator[SEP] identifier[keystore] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FileNotFoundException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[keyStorePassword] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[KeyStoreException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[entryName] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[KeyStoreException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[fis] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[keystore] operator[SEP] operator[SEP] Keyword[return] identifier[getSecretKey] operator[SEP] identifier[fis] , identifier[entryName] , identifier[keyStorePassword] operator[SEP] operator[SEP]
}
|
private void generateDataValue() {
if (m_image == null) {
m_imagePanel.removeFromParent();
} else {
m_imagePanel.addStyleName(m_image);
}
m_table.insertRow(0);
int i = 0;
for (String parameter : m_parameters) {
if (i > 0) {
boolean rtl = false;
if (parameter.startsWith("rtl:")) {
parameter = parameter.substring(4);
m_parameters[i] = parameter;
rtl = true;
}
if (parameter.startsWith("hide:")) {
m_parameters[i] = parameter.substring(5);
} else {
Label label = rtl ? new CmsLabelLeftTruncating(parameter) : new Label(parameter);
label.setStyleName(m_style.parameter());
label.addStyleName(m_style.rtl());
label.setTitle(parameter);
m_table.setWidget(0, i - 1, label);
}
} else {
m_label.setText(parameter);
m_label.setTitle(parameter);
}
i++;
}
}
|
class class_name[name] begin[{]
method[generateDataValue, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.m_image], ==, literal[null]]] begin[{]
call[m_imagePanel.removeFromParent, parameter[]]
else begin[{]
call[m_imagePanel.addStyleName, parameter[member[.m_image]]]
end[}]
call[m_table.insertRow, parameter[literal[0]]]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setText, postfix_operators=[], prefix_operators=[], qualifier=m_label, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTitle, postfix_operators=[], prefix_operators=[], qualifier=m_label, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=rtl)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="rtl:")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=parameter, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=parameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=parameter, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=parameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rtl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)])), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="hide:")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=parameter, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MemberReference(member=rtl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=ClassCreator(arguments=[MemberReference(member=parameter, 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=Label, sub_type=None)), if_true=ClassCreator(arguments=[MemberReference(member=parameter, 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=CmsLabelLeftTruncating, sub_type=None))), name=label)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Label, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=parameter, postfix_operators=[], prefix_operators=[], qualifier=m_style, selectors=[], type_arguments=None)], member=setStyleName, postfix_operators=[], prefix_operators=[], qualifier=label, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=rtl, postfix_operators=[], prefix_operators=[], qualifier=m_style, selectors=[], type_arguments=None)], member=addStyleName, postfix_operators=[], prefix_operators=[], qualifier=label, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parameter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTitle, postfix_operators=[], prefix_operators=[], qualifier=label, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), MemberReference(member=label, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setWidget, postfix_operators=[], prefix_operators=[], qualifier=m_table, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=parameter, selectors=[], type_arguments=None)), label=None)]))])), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=m_parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=parameter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[generateDataValue] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_image] operator[==] Other[null] operator[SEP] {
identifier[m_imagePanel] operator[SEP] identifier[removeFromParent] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[m_imagePanel] operator[SEP] identifier[addStyleName] operator[SEP] identifier[m_image] operator[SEP] operator[SEP]
}
identifier[m_table] operator[SEP] identifier[insertRow] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[parameter] operator[:] identifier[m_parameters] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] {
Keyword[boolean] identifier[rtl] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[parameter] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[parameter] operator[=] identifier[parameter] operator[SEP] identifier[substring] operator[SEP] Other[4] operator[SEP] operator[SEP] identifier[m_parameters] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[parameter] operator[SEP] identifier[rtl] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[parameter] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[m_parameters] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[parameter] operator[SEP] identifier[substring] operator[SEP] Other[5] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Label] identifier[label] operator[=] identifier[rtl] operator[?] Keyword[new] identifier[CmsLabelLeftTruncating] operator[SEP] identifier[parameter] operator[SEP] operator[:] Keyword[new] identifier[Label] operator[SEP] identifier[parameter] operator[SEP] operator[SEP] identifier[label] operator[SEP] identifier[setStyleName] operator[SEP] identifier[m_style] operator[SEP] identifier[parameter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[label] operator[SEP] identifier[addStyleName] operator[SEP] identifier[m_style] operator[SEP] identifier[rtl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[label] operator[SEP] identifier[setTitle] operator[SEP] identifier[parameter] operator[SEP] operator[SEP] identifier[m_table] operator[SEP] identifier[setWidget] operator[SEP] Other[0] , identifier[i] operator[-] Other[1] , identifier[label] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[m_label] operator[SEP] identifier[setText] operator[SEP] identifier[parameter] operator[SEP] operator[SEP] identifier[m_label] operator[SEP] identifier[setTitle] operator[SEP] identifier[parameter] operator[SEP] operator[SEP]
}
identifier[i] operator[++] operator[SEP]
}
}
|
public static void head(String url, HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) {
addResource(Methods.HEAD, url, endpoint, mediaTypes);
}
|
class class_name[name] begin[{]
method[head, return_type[void], modifier[public static], parameter[url, endpoint, mediaTypes]] begin[{]
call[.addResource, parameter[member[Methods.HEAD], member[.url], member[.endpoint], member[.mediaTypes]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[head] operator[SEP] identifier[String] identifier[url] , identifier[HttpConsumer] operator[<] identifier[HttpExchange] operator[>] identifier[endpoint] , identifier[MediaTypes] operator[...] identifier[mediaTypes] operator[SEP] {
identifier[addResource] operator[SEP] identifier[Methods] operator[SEP] identifier[HEAD] , identifier[url] , identifier[endpoint] , identifier[mediaTypes] operator[SEP] operator[SEP]
}
|
public void setResourceShareInvitationArns(java.util.Collection<String> resourceShareInvitationArns) {
if (resourceShareInvitationArns == null) {
this.resourceShareInvitationArns = null;
return;
}
this.resourceShareInvitationArns = new java.util.ArrayList<String>(resourceShareInvitationArns);
}
|
class class_name[name] begin[{]
method[setResourceShareInvitationArns, return_type[void], modifier[public], parameter[resourceShareInvitationArns]] begin[{]
if[binary_operation[member[.resourceShareInvitationArns], ==, literal[null]]] begin[{]
assign[THIS[member[None.resourceShareInvitationArns]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.resourceShareInvitationArns]], ClassCreator(arguments=[MemberReference(member=resourceShareInvitationArns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setResourceShareInvitationArns] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[resourceShareInvitationArns] operator[SEP] {
Keyword[if] operator[SEP] identifier[resourceShareInvitationArns] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[resourceShareInvitationArns] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[resourceShareInvitationArns] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[resourceShareInvitationArns] operator[SEP] operator[SEP]
}
|
public String getString()
{
int len=getInt();
if (len==0xFFFF)
return null;
try
{
String s=new String(_buf,_pos,len,StringUtil.__ISO_8859_1);
_pos+=len+1;
return s;
}
catch (IndexOutOfBoundsException e)
{
// Bad request!!!
LogSupport.ignore(log,e);
return null;
}
catch (UnsupportedEncodingException e)
{
log.fatal(e);
System.exit(1);
return null;
}
}
|
class class_name[name] begin[{]
method[getString, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[int], len]
if[binary_operation[member[.len], ==, literal[0xFFFF]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=_buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=_pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=__ISO_8859_1, postfix_operators=[], prefix_operators=[], qualifier=StringUtil, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=_pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), ReturnStatement(expression=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ignore, postfix_operators=[], prefix_operators=[], qualifier=LogSupport, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IndexOutOfBoundsException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fatal, postfix_operators=[], prefix_operators=[], qualifier=log, 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), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getString] operator[SEP] operator[SEP] {
Keyword[int] identifier[len] operator[=] identifier[getInt] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[len] operator[==] literal[Integer] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[try] {
identifier[String] identifier[s] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[_buf] , identifier[_pos] , identifier[len] , identifier[StringUtil] operator[SEP] identifier[__ISO_8859_1] operator[SEP] operator[SEP] identifier[_pos] operator[+=] identifier[len] operator[+] Other[1] operator[SEP] Keyword[return] identifier[s] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IndexOutOfBoundsException] identifier[e] operator[SEP] {
identifier[LogSupport] operator[SEP] identifier[ignore] operator[SEP] identifier[log] , identifier[e] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[fatal] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
@Override
public void clear(Principal p, StringBuilder report) {
for(Lur lur : lurs) {
lur.clear(p, report);
}
}
|
class class_name[name] begin[{]
method[clear, return_type[void], modifier[public], parameter[p, report]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=report, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=clear, postfix_operators=[], prefix_operators=[], qualifier=lur, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=lurs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=lur)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Lur, sub_type=None))), label=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[clear] operator[SEP] identifier[Principal] identifier[p] , identifier[StringBuilder] identifier[report] operator[SEP] {
Keyword[for] operator[SEP] identifier[Lur] identifier[lur] operator[:] identifier[lurs] operator[SEP] {
identifier[lur] operator[SEP] identifier[clear] operator[SEP] identifier[p] , identifier[report] operator[SEP] operator[SEP]
}
}
|
@VisibleForTesting
synchronized int sweep() {
long startTime = System.nanoTime();
int swept = 0;
for (Map.Entry<String, Deque<AcknowledgableWatermark>> entry : _watermarksMap.entrySet()) {
Deque<AcknowledgableWatermark> watermarks = entry.getValue();
/**
* Keep popping acked elements from the front as long as their next element is also acked.
* So: Acked_A -> Acked_B -> Not-Acked_C -> ... becomes
* Acked_B -> Not-Acked_C -> ...
*
* We keep the acked element around because that represents the highest contiguous acked watermark.
*/
boolean continueIteration = true;
while (continueIteration) {
Iterator<AcknowledgableWatermark> iter = watermarks.iterator();
if (!iter.hasNext()) { // null
continueIteration = false;
continue;
}
AcknowledgableWatermark first = iter.next();
if (first.isAcked()) {
if (!iter.hasNext()) { // Acked_A -> null
continueIteration = false;
continue;
}
AcknowledgableWatermark second = iter.next();
if ((second != null) && second.isAcked()) { // Acked_A -> Acked_B -> ...
watermarks.pop();
swept++;
} else { // Acked_A -> Not_Acked_B
continueIteration = false;
}
} else { // Not_Acked_A -> ..
continueIteration = false;
}
}
}
long duration = (System.nanoTime() - startTime)/ MILLIS_TO_NANOS;
log.debug("Swept {} watermarks in {} millis", swept, duration);
_watermarksSwept.mark(swept);
return swept;
}
|
class class_name[name] begin[{]
method[sweep, return_type[type[int]], modifier[synchronized], parameter[]] begin[{]
local_variable[type[long], startTime]
local_variable[type[int], swept]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=watermarks)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AcknowledgableWatermark, sub_type=None))], dimensions=[], name=Deque, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=continueIteration)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=watermarks, selectors=[], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AcknowledgableWatermark, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=['!'], qualifier=iter, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=continueIteration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), name=first)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AcknowledgableWatermark, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isAcked, postfix_operators=[], prefix_operators=[], qualifier=first, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=continueIteration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=['!'], qualifier=iter, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=continueIteration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), name=second)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AcknowledgableWatermark, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isAcked, postfix_operators=[], prefix_operators=[], qualifier=second, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=continueIteration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=pop, postfix_operators=[], prefix_operators=[], qualifier=watermarks, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=swept, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]))]), condition=MemberReference(member=continueIteration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=_watermarksMap, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AcknowledgableWatermark, sub_type=None))], dimensions=[], name=Deque, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
local_variable[type[long], duration]
call[log.debug, parameter[literal["Swept {} watermarks in {} millis"], member[.swept], member[.duration]]]
call[_watermarksSwept.mark, parameter[member[.swept]]]
return[member[.swept]]
end[}]
END[}]
|
annotation[@] identifier[VisibleForTesting] Keyword[synchronized] Keyword[int] identifier[sweep] operator[SEP] operator[SEP] {
Keyword[long] identifier[startTime] operator[=] identifier[System] operator[SEP] identifier[nanoTime] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[swept] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Deque] operator[<] identifier[AcknowledgableWatermark] operator[>] operator[>] identifier[entry] operator[:] identifier[_watermarksMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Deque] operator[<] identifier[AcknowledgableWatermark] operator[>] identifier[watermarks] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[continueIteration] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] identifier[continueIteration] operator[SEP] {
identifier[Iterator] operator[<] identifier[AcknowledgableWatermark] operator[>] identifier[iter] operator[=] identifier[watermarks] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[continueIteration] operator[=] literal[boolean] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[AcknowledgableWatermark] identifier[first] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[first] operator[SEP] identifier[isAcked] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[continueIteration] operator[=] literal[boolean] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[AcknowledgableWatermark] identifier[second] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[second] operator[!=] Other[null] operator[SEP] operator[&&] identifier[second] operator[SEP] identifier[isAcked] operator[SEP] operator[SEP] operator[SEP] {
identifier[watermarks] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP] identifier[swept] operator[++] operator[SEP]
}
Keyword[else] {
identifier[continueIteration] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] {
identifier[continueIteration] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[long] identifier[duration] operator[=] operator[SEP] identifier[System] operator[SEP] identifier[nanoTime] operator[SEP] operator[SEP] operator[-] identifier[startTime] operator[SEP] operator[/] identifier[MILLIS_TO_NANOS] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[swept] , identifier[duration] operator[SEP] operator[SEP] identifier[_watermarksSwept] operator[SEP] identifier[mark] operator[SEP] identifier[swept] operator[SEP] operator[SEP] Keyword[return] identifier[swept] operator[SEP]
}
|
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static boolean hasBarometerSensorFeature(Context context) {
return hasBarometerSensorFeature(context.getPackageManager());
}
|
class class_name[name] begin[{]
method[hasBarometerSensorFeature, return_type[type[boolean]], modifier[public static], parameter[context]] begin[{]
return[call[.hasBarometerSensorFeature, parameter[call[context.getPackageManager, parameter[]]]]]
end[}]
END[}]
|
annotation[@] identifier[TargetApi] operator[SEP] identifier[Build] operator[SEP] identifier[VERSION_CODES] operator[SEP] identifier[GINGERBREAD] operator[SEP] Keyword[public] Keyword[static] Keyword[boolean] identifier[hasBarometerSensorFeature] operator[SEP] identifier[Context] identifier[context] operator[SEP] {
Keyword[return] identifier[hasBarometerSensorFeature] operator[SEP] identifier[context] operator[SEP] identifier[getPackageManager] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<QueryControllerGroup> getGroups() {
List<QueryControllerGroup> groups = new ArrayList<QueryControllerGroup>();
for (QueryControllerEntity element : entities) {
if (element instanceof QueryControllerGroup) {
groups.add((QueryControllerGroup) element);
}
}
return groups;
}
|
class class_name[name] begin[{]
method[getGroups, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], groups]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=QueryControllerGroup, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=QueryControllerGroup, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=groups, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=entities, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=element)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=QueryControllerEntity, sub_type=None))), label=None)
return[member[.groups]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[QueryControllerGroup] operator[>] identifier[getGroups] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[QueryControllerGroup] operator[>] identifier[groups] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[QueryControllerGroup] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[QueryControllerEntity] identifier[element] operator[:] identifier[entities] operator[SEP] {
Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[QueryControllerGroup] operator[SEP] {
identifier[groups] operator[SEP] identifier[add] operator[SEP] operator[SEP] identifier[QueryControllerGroup] operator[SEP] identifier[element] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[groups] operator[SEP]
}
|
private static Type findGenericInterface(Class<?> sourceClass, Class<?> targetBaseInterface) {
for (int i = 0; i < sourceClass.getInterfaces().length; i++) {
Class<?> inter = sourceClass.getInterfaces()[i];
if (inter == targetBaseInterface) {
return sourceClass.getGenericInterfaces()[0];
} else {
Type deeper = findGenericInterface(inter, targetBaseInterface);
if (deeper != null) {
return deeper;
}
}
}
return null;
}
|
class class_name[name] begin[{]
method[findGenericInterface, return_type[type[Type]], modifier[private static], parameter[sourceClass, targetBaseInterface]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInterfaces, postfix_operators=[], prefix_operators=[], qualifier=sourceClass, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], type_arguments=None), name=inter)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=inter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=targetBaseInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=inter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=targetBaseInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findGenericInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=deeper)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Type, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=deeper, 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=[ReturnStatement(expression=MemberReference(member=deeper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getGenericInterfaces, postfix_operators=[], prefix_operators=[], qualifier=sourceClass, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getInterfaces, postfix_operators=[], prefix_operators=[], qualifier=sourceClass, selectors=[MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Type] identifier[findGenericInterface] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[sourceClass] , identifier[Class] operator[<] operator[?] operator[>] identifier[targetBaseInterface] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[sourceClass] operator[SEP] identifier[getInterfaces] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[inter] operator[=] identifier[sourceClass] operator[SEP] identifier[getInterfaces] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[inter] operator[==] identifier[targetBaseInterface] operator[SEP] {
Keyword[return] identifier[sourceClass] operator[SEP] identifier[getGenericInterfaces] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Type] identifier[deeper] operator[=] identifier[findGenericInterface] operator[SEP] identifier[inter] , identifier[targetBaseInterface] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[deeper] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[deeper] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
private void parse(byte[] timestampTokenInfo) throws IOException {
DerValue tstInfo = new DerValue(timestampTokenInfo);
if (tstInfo.tag != DerValue.tag_Sequence) {
throw new IOException("Bad encoding for timestamp token info");
}
// Parse version
version = tstInfo.data.getInteger();
// Parse policy
policy = tstInfo.data.getOID();
// Parse messageImprint
DerValue messageImprint = tstInfo.data.getDerValue();
hashAlgorithm = AlgorithmId.parse(messageImprint.data.getDerValue());
hashedMessage = messageImprint.data.getOctetString();
// Parse serialNumber
serialNumber = tstInfo.data.getBigInteger();
// Parse genTime
genTime = tstInfo.data.getGeneralizedTime();
// Parse optional elements, if present
while (tstInfo.data.available() > 0) {
DerValue d = tstInfo.data.getDerValue();
if (d.tag == DerValue.tag_Integer) { // must be the nonce
nonce = d.getBigInteger();
break;
}
// Additional fields:
// Parse accuracy
// Parse ordering
// Parse tsa
// Parse extensions
}
}
|
class class_name[name] begin[{]
method[parse, return_type[void], modifier[private], parameter[timestampTokenInfo]] begin[{]
local_variable[type[DerValue], tstInfo]
if[binary_operation[member[tstInfo.tag], !=, member[DerValue.tag_Sequence]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Bad encoding for timestamp token info")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.version], call[tstInfo.data.getInteger, parameter[]]]
assign[member[.policy], call[tstInfo.data.getOID, parameter[]]]
local_variable[type[DerValue], messageImprint]
assign[member[.hashAlgorithm], call[AlgorithmId.parse, parameter[call[messageImprint.data.getDerValue, parameter[]]]]]
assign[member[.hashedMessage], call[messageImprint.data.getOctetString, parameter[]]]
assign[member[.serialNumber], call[tstInfo.data.getBigInteger, parameter[]]]
assign[member[.genTime], call[tstInfo.data.getGeneralizedTime, parameter[]]]
while[binary_operation[call[tstInfo.data.available, parameter[]], >, literal[0]]] begin[{]
local_variable[type[DerValue], d]
if[binary_operation[member[d.tag], ==, member[DerValue.tag_Integer]]] begin[{]
assign[member[.nonce], call[d.getBigInteger, parameter[]]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[parse] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[timestampTokenInfo] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[DerValue] identifier[tstInfo] operator[=] Keyword[new] identifier[DerValue] operator[SEP] identifier[timestampTokenInfo] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tstInfo] operator[SEP] identifier[tag] operator[!=] identifier[DerValue] operator[SEP] identifier[tag_Sequence] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[version] operator[=] identifier[tstInfo] operator[SEP] identifier[data] operator[SEP] identifier[getInteger] operator[SEP] operator[SEP] operator[SEP] identifier[policy] operator[=] identifier[tstInfo] operator[SEP] identifier[data] operator[SEP] identifier[getOID] operator[SEP] operator[SEP] operator[SEP] identifier[DerValue] identifier[messageImprint] operator[=] identifier[tstInfo] operator[SEP] identifier[data] operator[SEP] identifier[getDerValue] operator[SEP] operator[SEP] operator[SEP] identifier[hashAlgorithm] operator[=] identifier[AlgorithmId] operator[SEP] identifier[parse] operator[SEP] identifier[messageImprint] operator[SEP] identifier[data] operator[SEP] identifier[getDerValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[hashedMessage] operator[=] identifier[messageImprint] operator[SEP] identifier[data] operator[SEP] identifier[getOctetString] operator[SEP] operator[SEP] operator[SEP] identifier[serialNumber] operator[=] identifier[tstInfo] operator[SEP] identifier[data] operator[SEP] identifier[getBigInteger] operator[SEP] operator[SEP] operator[SEP] identifier[genTime] operator[=] identifier[tstInfo] operator[SEP] identifier[data] operator[SEP] identifier[getGeneralizedTime] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[tstInfo] operator[SEP] identifier[data] operator[SEP] identifier[available] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[DerValue] identifier[d] operator[=] identifier[tstInfo] operator[SEP] identifier[data] operator[SEP] identifier[getDerValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[d] operator[SEP] identifier[tag] operator[==] identifier[DerValue] operator[SEP] identifier[tag_Integer] operator[SEP] {
identifier[nonce] operator[=] identifier[d] operator[SEP] identifier[getBigInteger] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.