code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public AnycastInputHandler getAnycastInputHandler()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getAnycastInputHandler");
SibTr.exit(tc, "getAnycastInputHandler", _parent);
}
return _parent;
} | class class_name[name] begin[{]
method[getAnycastInputHandler, return_type[type[AnycastInputHandler]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["getAnycastInputHandler"]]]
call[SibTr.exit, parameter[member[.tc], literal["getAnycastInputHandler"], member[._parent]]]
else begin[{]
None
end[}]
return[member[._parent]]
end[}]
END[}] | Keyword[public] identifier[AnycastInputHandler] identifier[getAnycastInputHandler] 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] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[_parent] operator[SEP] operator[SEP]
}
Keyword[return] identifier[_parent] operator[SEP]
}
|
public static <S extends Subject<S, T>, T> SimpleSubjectBuilder<S, T> assertAbout(
Subject.Factory<S, T> factory) {
return assert_().about(factory);
} | class class_name[name] begin[{]
method[assertAbout, return_type[type[SimpleSubjectBuilder]], modifier[public static], parameter[factory]] begin[{]
return[call[.assert_, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[S] Keyword[extends] identifier[Subject] operator[<] identifier[S] , identifier[T] operator[>] , identifier[T] operator[>] identifier[SimpleSubjectBuilder] operator[<] identifier[S] , identifier[T] operator[>] identifier[assertAbout] operator[SEP] identifier[Subject] operator[SEP] identifier[Factory] operator[<] identifier[S] , identifier[T] operator[>] identifier[factory] operator[SEP] {
Keyword[return] identifier[assert_] operator[SEP] operator[SEP] operator[SEP] identifier[about] operator[SEP] identifier[factory] operator[SEP] operator[SEP]
}
|
public static final ScopeInfo extractScopeFirst(final String str, final String beginMark, final String endMark) {
final List<ScopeInfo> scopeList = doExtractScopeList(str, beginMark, endMark, true);
if (scopeList == null || scopeList.isEmpty()) {
return null;
}
if (scopeList.size() > 1) {
String msg = "This method should extract only one scope: " + scopeList;
throw new IllegalStateException(msg);
}
return scopeList.get(0);
} | class class_name[name] begin[{]
method[extractScopeFirst, return_type[type[ScopeInfo]], modifier[final public static], parameter[str, beginMark, endMark]] begin[{]
local_variable[type[List], scopeList]
if[binary_operation[binary_operation[member[.scopeList], ==, literal[null]], ||, call[scopeList.isEmpty, parameter[]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[call[scopeList.size, parameter[]], >, literal[1]]] begin[{]
local_variable[type[String], msg]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[scopeList.get, parameter[literal[0]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[ScopeInfo] identifier[extractScopeFirst] operator[SEP] Keyword[final] identifier[String] identifier[str] , Keyword[final] identifier[String] identifier[beginMark] , Keyword[final] identifier[String] identifier[endMark] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[ScopeInfo] operator[>] identifier[scopeList] operator[=] identifier[doExtractScopeList] operator[SEP] identifier[str] , identifier[beginMark] , identifier[endMark] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scopeList] operator[==] Other[null] operator[||] identifier[scopeList] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[scopeList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[scopeList] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
Keyword[return] identifier[scopeList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public static FileChannel open(FileDescriptor fd, String path,
boolean readable, boolean writable,
Object parent)
{
return new FileChannelImpl(fd, path, readable, writable, false, parent);
} | class class_name[name] begin[{]
method[open, return_type[type[FileChannel]], modifier[public static], parameter[fd, path, readable, writable, parent]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=fd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=readable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=writable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=parent, 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=FileChannelImpl, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FileChannel] identifier[open] operator[SEP] identifier[FileDescriptor] identifier[fd] , identifier[String] identifier[path] , Keyword[boolean] identifier[readable] , Keyword[boolean] identifier[writable] , identifier[Object] identifier[parent] operator[SEP] {
Keyword[return] Keyword[new] identifier[FileChannelImpl] operator[SEP] identifier[fd] , identifier[path] , identifier[readable] , identifier[writable] , literal[boolean] , identifier[parent] operator[SEP] operator[SEP]
}
|
private static void attachToContent(Activity activity, MenuDrawer menuDrawer) {
/**
* Do not call mActivity#setContentView.
* E.g. if using with a ListActivity, Activity#setContentView is overridden and dispatched to
* MenuDrawer#setContentView, which then again would call Activity#setContentView.
*/
ViewGroup content = (ViewGroup) activity.findViewById(android.R.id.content);
content.removeAllViews();
content.addView(menuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
} | class class_name[name] begin[{]
method[attachToContent, return_type[void], modifier[private static], parameter[activity, menuDrawer]] begin[{]
local_variable[type[ViewGroup], content]
call[content.removeAllViews, parameter[]]
call[content.addView, parameter[member[.menuDrawer], member[LayoutParams.MATCH_PARENT], member[LayoutParams.MATCH_PARENT]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[attachToContent] operator[SEP] identifier[Activity] identifier[activity] , identifier[MenuDrawer] identifier[menuDrawer] operator[SEP] {
identifier[ViewGroup] identifier[content] operator[=] operator[SEP] identifier[ViewGroup] operator[SEP] identifier[activity] operator[SEP] identifier[findViewById] operator[SEP] identifier[android] operator[SEP] identifier[R] operator[SEP] identifier[id] operator[SEP] identifier[content] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[removeAllViews] operator[SEP] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[addView] operator[SEP] identifier[menuDrawer] , identifier[LayoutParams] operator[SEP] identifier[MATCH_PARENT] , identifier[LayoutParams] operator[SEP] identifier[MATCH_PARENT] operator[SEP] operator[SEP]
}
|
public static synchronized GeoLocationManager getInstanceFor(XMPPConnection connection) {
GeoLocationManager geoLocationManager = INSTANCES.get(connection);
if (geoLocationManager == null) {
geoLocationManager = new GeoLocationManager(connection);
INSTANCES.put(connection, geoLocationManager);
}
return geoLocationManager;
} | class class_name[name] begin[{]
method[getInstanceFor, return_type[type[GeoLocationManager]], modifier[synchronized public static], parameter[connection]] begin[{]
local_variable[type[GeoLocationManager], geoLocationManager]
if[binary_operation[member[.geoLocationManager], ==, literal[null]]] begin[{]
assign[member[.geoLocationManager], ClassCreator(arguments=[MemberReference(member=connection, 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=GeoLocationManager, sub_type=None))]
call[INSTANCES.put, parameter[member[.connection], member[.geoLocationManager]]]
else begin[{]
None
end[}]
return[member[.geoLocationManager]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[synchronized] identifier[GeoLocationManager] identifier[getInstanceFor] operator[SEP] identifier[XMPPConnection] identifier[connection] operator[SEP] {
identifier[GeoLocationManager] identifier[geoLocationManager] operator[=] identifier[INSTANCES] operator[SEP] identifier[get] operator[SEP] identifier[connection] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[geoLocationManager] operator[==] Other[null] operator[SEP] {
identifier[geoLocationManager] operator[=] Keyword[new] identifier[GeoLocationManager] operator[SEP] identifier[connection] operator[SEP] operator[SEP] identifier[INSTANCES] operator[SEP] identifier[put] operator[SEP] identifier[connection] , identifier[geoLocationManager] operator[SEP] operator[SEP]
}
Keyword[return] identifier[geoLocationManager] operator[SEP]
}
|
public String digestHex(String data, String charset) {
return HexUtil.encodeHexStr(digest(data, charset));
} | class class_name[name] begin[{]
method[digestHex, return_type[type[String]], modifier[public], parameter[data, charset]] begin[{]
return[call[HexUtil.encodeHexStr, parameter[call[.digest, parameter[member[.data], member[.charset]]]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[digestHex] operator[SEP] identifier[String] identifier[data] , identifier[String] identifier[charset] operator[SEP] {
Keyword[return] identifier[HexUtil] operator[SEP] identifier[encodeHexStr] operator[SEP] identifier[digest] operator[SEP] identifier[data] , identifier[charset] operator[SEP] operator[SEP] operator[SEP]
}
|
public byte[] getTelemetryBytes(Beacon beacon) {
if (beacon.getExtraDataFields().size() >= 5) {
Beacon telemetryBeacon = new Beacon.Builder()
.setDataFields(beacon.getExtraDataFields())
.build();
BeaconParser telemetryParser = new BeaconParser()
.setBeaconLayout(BeaconParser.EDDYSTONE_TLM_LAYOUT);
byte[] telemetryBytes = telemetryParser.getBeaconAdvertisementData(telemetryBeacon);
Log.d(TAG, "Rehydrated telemetry bytes are :" + byteArrayToString(telemetryBytes));
return telemetryBytes;
}
else {
return null;
}
} | class class_name[name] begin[{]
method[getTelemetryBytes, return_type[type[byte]], modifier[public], parameter[beacon]] begin[{]
if[binary_operation[call[beacon.getExtraDataFields, parameter[]], >=, literal[5]]] begin[{]
local_variable[type[Beacon], telemetryBeacon]
local_variable[type[BeaconParser], telemetryParser]
local_variable[type[byte], telemetryBytes]
call[Log.d, parameter[member[.TAG], binary_operation[literal["Rehydrated telemetry bytes are :"], +, call[.byteArrayToString, parameter[member[.telemetryBytes]]]]]]
return[member[.telemetryBytes]]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[getTelemetryBytes] operator[SEP] identifier[Beacon] identifier[beacon] operator[SEP] {
Keyword[if] operator[SEP] identifier[beacon] operator[SEP] identifier[getExtraDataFields] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>=] Other[5] operator[SEP] {
identifier[Beacon] identifier[telemetryBeacon] operator[=] Keyword[new] identifier[Beacon] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[setDataFields] operator[SEP] identifier[beacon] operator[SEP] identifier[getExtraDataFields] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[BeaconParser] identifier[telemetryParser] operator[=] Keyword[new] identifier[BeaconParser] operator[SEP] operator[SEP] operator[SEP] identifier[setBeaconLayout] operator[SEP] identifier[BeaconParser] operator[SEP] identifier[EDDYSTONE_TLM_LAYOUT] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[telemetryBytes] operator[=] identifier[telemetryParser] operator[SEP] identifier[getBeaconAdvertisementData] operator[SEP] identifier[telemetryBeacon] operator[SEP] operator[SEP] identifier[Log] operator[SEP] identifier[d] operator[SEP] identifier[TAG] , literal[String] operator[+] identifier[byteArrayToString] operator[SEP] identifier[telemetryBytes] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[telemetryBytes] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public int scrollToPage(int pageNumber) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "scrollToPage pageNumber = %d mPageCount = %d",
pageNumber, mPageCount);
if (mSupportScrollByPage &&
(mScrollOver || (pageNumber >= 0 && pageNumber <= mPageCount - 1))) {
scrollToItem(getFirstItemIndexOnPage(pageNumber));
} else {
Log.w(TAG, "Pagination is not enabled!");
}
return mCurrentItemIndex;
} | class class_name[name] begin[{]
method[scrollToPage, return_type[type[int]], modifier[public], parameter[pageNumber]] begin[{]
call[Log.d, parameter[member[Log.SUBSYSTEM.LAYOUT], member[.TAG], literal["scrollToPage pageNumber = %d mPageCount = %d"], member[.pageNumber], member[.mPageCount]]]
if[binary_operation[member[.mSupportScrollByPage], &&, binary_operation[member[.mScrollOver], ||, binary_operation[binary_operation[member[.pageNumber], >=, literal[0]], &&, binary_operation[member[.pageNumber], <=, binary_operation[member[.mPageCount], -, literal[1]]]]]]] begin[{]
call[.scrollToItem, parameter[call[.getFirstItemIndexOnPage, parameter[member[.pageNumber]]]]]
else begin[{]
call[Log.w, parameter[member[.TAG], literal["Pagination is not enabled!"]]]
end[}]
return[member[.mCurrentItemIndex]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[scrollToPage] operator[SEP] Keyword[int] identifier[pageNumber] operator[SEP] {
identifier[Log] operator[SEP] identifier[d] operator[SEP] identifier[Log] operator[SEP] identifier[SUBSYSTEM] operator[SEP] identifier[LAYOUT] , identifier[TAG] , literal[String] , identifier[pageNumber] , identifier[mPageCount] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mSupportScrollByPage] operator[&&] operator[SEP] identifier[mScrollOver] operator[||] operator[SEP] identifier[pageNumber] operator[>=] Other[0] operator[&&] identifier[pageNumber] operator[<=] identifier[mPageCount] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
identifier[scrollToItem] operator[SEP] identifier[getFirstItemIndexOnPage] operator[SEP] identifier[pageNumber] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Log] operator[SEP] identifier[w] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[mCurrentItemIndex] operator[SEP]
}
|
public static Object evaluate(final ActionContext actionContext, final GraphObject entity, final String input, final String methodName) throws FrameworkException, UnlicensedScriptException {
final String expression = input.trim();
boolean isJavascript = expression.startsWith("${{") && expression.endsWith("}}");
final int prefixOffset = isJavascript ? 1 : 0;
String source = expression.substring(2 + prefixOffset, expression.length() - (1 + prefixOffset));
if (source.length() <= 0) {
return null;
}
String engine = "";
boolean isScriptEngine = false;
if (!isJavascript) {
final Matcher matcher = ScriptEngineExpression.matcher(expression);
if (matcher.matches()) {
engine = matcher.group(1);
source = matcher.group(2);
logger.debug("Scripting engine {} requested.", engine);
isJavascript = StringUtils.isBlank(engine) || "JavaScript".equals(engine);
isScriptEngine = !isJavascript && StringUtils.isNotBlank(engine);
}
}
actionContext.setJavaScriptContext(isJavascript);
// temporarily disable notifications for scripted actions
boolean enableTransactionNotifactions = false;
final SecurityContext securityContext = actionContext.getSecurityContext();
if (securityContext != null) {
enableTransactionNotifactions = securityContext.doTransactionNotifications();
securityContext.setDoTransactionNotifications(false);
}
if (isScriptEngine) {
return evaluateScript(actionContext, entity, engine, source);
} else if (isJavascript) {
final Object result = evaluateJavascript(actionContext, entity, new Snippet(methodName, source));
if (enableTransactionNotifactions && securityContext != null) {
securityContext.setDoTransactionNotifications(true);
}
return result;
} else {
Object extractedValue = Functions.evaluate(actionContext, entity, source);
final String value = extractedValue != null ? extractedValue.toString() : "";
final String output = actionContext.getOutput();
if (StringUtils.isEmpty(value) && output != null && !output.isEmpty()) {
extractedValue = output;
}
if (enableTransactionNotifactions && securityContext != null) {
securityContext.setDoTransactionNotifications(true);
}
return extractedValue;
}
} | class class_name[name] begin[{]
method[evaluate, return_type[type[Object]], modifier[public static], parameter[actionContext, entity, input, methodName]] begin[{]
local_variable[type[String], expression]
local_variable[type[boolean], isJavascript]
local_variable[type[int], prefixOffset]
local_variable[type[String], source]
if[binary_operation[call[source.length, parameter[]], <=, literal[0]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], engine]
local_variable[type[boolean], isScriptEngine]
if[member[.isJavascript]] begin[{]
local_variable[type[Matcher], matcher]
if[call[matcher.matches, parameter[]]] begin[{]
assign[member[.engine], call[matcher.group, parameter[literal[1]]]]
assign[member[.source], call[matcher.group, parameter[literal[2]]]]
call[logger.debug, parameter[literal["Scripting engine {} requested."], member[.engine]]]
assign[member[.isJavascript], binary_operation[call[StringUtils.isBlank, parameter[member[.engine]]], ||, literal["JavaScript"]]]
assign[member[.isScriptEngine], binary_operation[member[.isJavascript], &&, call[StringUtils.isNotBlank, parameter[member[.engine]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[actionContext.setJavaScriptContext, parameter[member[.isJavascript]]]
local_variable[type[boolean], enableTransactionNotifactions]
local_variable[type[SecurityContext], securityContext]
if[binary_operation[member[.securityContext], !=, literal[null]]] begin[{]
assign[member[.enableTransactionNotifactions], call[securityContext.doTransactionNotifications, parameter[]]]
call[securityContext.setDoTransactionNotifications, parameter[literal[false]]]
else begin[{]
None
end[}]
if[member[.isScriptEngine]] begin[{]
return[call[.evaluateScript, parameter[member[.actionContext], member[.entity], member[.engine], member[.source]]]]
else begin[{]
if[member[.isJavascript]] begin[{]
local_variable[type[Object], result]
if[binary_operation[member[.enableTransactionNotifactions], &&, binary_operation[member[.securityContext], !=, literal[null]]]] begin[{]
call[securityContext.setDoTransactionNotifications, parameter[literal[true]]]
else begin[{]
None
end[}]
return[member[.result]]
else begin[{]
local_variable[type[Object], extractedValue]
local_variable[type[String], value]
local_variable[type[String], output]
if[binary_operation[binary_operation[call[StringUtils.isEmpty, parameter[member[.value]]], &&, binary_operation[member[.output], !=, literal[null]]], &&, call[output.isEmpty, parameter[]]]] begin[{]
assign[member[.extractedValue], member[.output]]
else begin[{]
None
end[}]
if[binary_operation[member[.enableTransactionNotifactions], &&, binary_operation[member[.securityContext], !=, literal[null]]]] begin[{]
call[securityContext.setDoTransactionNotifications, parameter[literal[true]]]
else begin[{]
None
end[}]
return[member[.extractedValue]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[evaluate] operator[SEP] Keyword[final] identifier[ActionContext] identifier[actionContext] , Keyword[final] identifier[GraphObject] identifier[entity] , Keyword[final] identifier[String] identifier[input] , Keyword[final] identifier[String] identifier[methodName] operator[SEP] Keyword[throws] identifier[FrameworkException] , identifier[UnlicensedScriptException] {
Keyword[final] identifier[String] identifier[expression] operator[=] identifier[input] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isJavascript] operator[=] identifier[expression] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[expression] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[prefixOffset] operator[=] identifier[isJavascript] operator[?] Other[1] operator[:] Other[0] operator[SEP] identifier[String] identifier[source] operator[=] identifier[expression] operator[SEP] identifier[substring] operator[SEP] Other[2] operator[+] identifier[prefixOffset] , identifier[expression] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] operator[SEP] Other[1] operator[+] identifier[prefixOffset] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<=] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[engine] operator[=] literal[String] operator[SEP] Keyword[boolean] identifier[isScriptEngine] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isJavascript] operator[SEP] {
Keyword[final] identifier[Matcher] identifier[matcher] operator[=] identifier[ScriptEngineExpression] operator[SEP] identifier[matcher] operator[SEP] identifier[expression] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[matcher] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[engine] operator[=] identifier[matcher] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[source] operator[=] identifier[matcher] operator[SEP] identifier[group] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[engine] operator[SEP] operator[SEP] identifier[isJavascript] operator[=] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[engine] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[engine] operator[SEP] operator[SEP] identifier[isScriptEngine] operator[=] operator[!] identifier[isJavascript] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[engine] operator[SEP] operator[SEP]
}
}
identifier[actionContext] operator[SEP] identifier[setJavaScriptContext] operator[SEP] identifier[isJavascript] operator[SEP] operator[SEP] Keyword[boolean] identifier[enableTransactionNotifactions] operator[=] literal[boolean] operator[SEP] Keyword[final] identifier[SecurityContext] identifier[securityContext] operator[=] identifier[actionContext] operator[SEP] identifier[getSecurityContext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[securityContext] operator[!=] Other[null] operator[SEP] {
identifier[enableTransactionNotifactions] operator[=] identifier[securityContext] operator[SEP] identifier[doTransactionNotifications] operator[SEP] operator[SEP] operator[SEP] identifier[securityContext] operator[SEP] identifier[setDoTransactionNotifications] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isScriptEngine] operator[SEP] {
Keyword[return] identifier[evaluateScript] operator[SEP] identifier[actionContext] , identifier[entity] , identifier[engine] , identifier[source] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isJavascript] operator[SEP] {
Keyword[final] identifier[Object] identifier[result] operator[=] identifier[evaluateJavascript] operator[SEP] identifier[actionContext] , identifier[entity] , Keyword[new] identifier[Snippet] operator[SEP] identifier[methodName] , identifier[source] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[enableTransactionNotifactions] operator[&&] identifier[securityContext] operator[!=] Other[null] operator[SEP] {
identifier[securityContext] operator[SEP] identifier[setDoTransactionNotifications] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
Keyword[else] {
identifier[Object] identifier[extractedValue] operator[=] identifier[Functions] operator[SEP] identifier[evaluate] operator[SEP] identifier[actionContext] , identifier[entity] , identifier[source] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[value] operator[=] identifier[extractedValue] operator[!=] Other[null] operator[?] identifier[extractedValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] Keyword[final] identifier[String] identifier[output] operator[=] identifier[actionContext] operator[SEP] identifier[getOutput] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[value] operator[SEP] operator[&&] identifier[output] operator[!=] Other[null] operator[&&] operator[!] identifier[output] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[extractedValue] operator[=] identifier[output] operator[SEP]
}
Keyword[if] operator[SEP] identifier[enableTransactionNotifactions] operator[&&] identifier[securityContext] operator[!=] Other[null] operator[SEP] {
identifier[securityContext] operator[SEP] identifier[setDoTransactionNotifications] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] identifier[extractedValue] operator[SEP]
}
}
|
@Override
public void create(SchemaMigrationMetadata metadata) {
session.execute(
insertInto(METADATA_TABLE)
.ifNotExists()
.value(ID_COL, metadata.getId())
.value(INDEX_COL, metadata.getIndex())
.value(TOKEN_COL, metadata.getToken())
.value(STATUS_COL, metadata.getStatus().name())
.value(FINGERPRINT_COL, metadata.getFingerprint()));
} | class class_name[name] begin[{]
method[create, return_type[void], modifier[public], parameter[metadata]] begin[{]
call[session.execute, parameter[call[.insertInto, parameter[member[.METADATA_TABLE]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[create] operator[SEP] identifier[SchemaMigrationMetadata] identifier[metadata] operator[SEP] {
identifier[session] operator[SEP] identifier[execute] operator[SEP] identifier[insertInto] operator[SEP] identifier[METADATA_TABLE] operator[SEP] operator[SEP] identifier[ifNotExists] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[SEP] identifier[ID_COL] , identifier[metadata] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[SEP] identifier[INDEX_COL] , identifier[metadata] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[SEP] identifier[TOKEN_COL] , identifier[metadata] operator[SEP] identifier[getToken] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[SEP] identifier[STATUS_COL] , identifier[metadata] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[SEP] identifier[FINGERPRINT_COL] , identifier[metadata] operator[SEP] identifier[getFingerprint] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public DataBuffer relocateConstantSpace(DataBuffer dataBuffer) {
// we always assume that data is sync, and valid on host side
Integer deviceId = AtomicAllocator.getInstance().getDeviceId();
ensureMaps(deviceId);
if (dataBuffer instanceof CudaIntDataBuffer) {
int[] data = dataBuffer.asInt();
return getConstantBuffer(data);
} else if (dataBuffer instanceof CudaFloatDataBuffer) {
float[] data = dataBuffer.asFloat();
return getConstantBuffer(data);
} else if (dataBuffer instanceof CudaDoubleDataBuffer) {
double[] data = dataBuffer.asDouble();
return getConstantBuffer(data);
} else if (dataBuffer instanceof CudaHalfDataBuffer) {
float[] data = dataBuffer.asFloat();
return getConstantBuffer(data);
} else if (dataBuffer instanceof CudaLongDataBuffer) {
long[] data = dataBuffer.asLong();
return getConstantBuffer(data);
}
throw new IllegalStateException("Unknown CudaDataBuffer opType");
} | class class_name[name] begin[{]
method[relocateConstantSpace, return_type[type[DataBuffer]], modifier[public], parameter[dataBuffer]] begin[{]
local_variable[type[Integer], deviceId]
call[.ensureMaps, parameter[member[.deviceId]]]
if[binary_operation[member[.dataBuffer], instanceof, type[CudaIntDataBuffer]]] begin[{]
local_variable[type[int], data]
return[call[.getConstantBuffer, parameter[member[.data]]]]
else begin[{]
if[binary_operation[member[.dataBuffer], instanceof, type[CudaFloatDataBuffer]]] begin[{]
local_variable[type[float], data]
return[call[.getConstantBuffer, parameter[member[.data]]]]
else begin[{]
if[binary_operation[member[.dataBuffer], instanceof, type[CudaDoubleDataBuffer]]] begin[{]
local_variable[type[double], data]
return[call[.getConstantBuffer, parameter[member[.data]]]]
else begin[{]
if[binary_operation[member[.dataBuffer], instanceof, type[CudaHalfDataBuffer]]] begin[{]
local_variable[type[float], data]
return[call[.getConstantBuffer, parameter[member[.data]]]]
else begin[{]
if[binary_operation[member[.dataBuffer], instanceof, type[CudaLongDataBuffer]]] begin[{]
local_variable[type[long], data]
return[call[.getConstantBuffer, parameter[member[.data]]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown CudaDataBuffer opType")], 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)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DataBuffer] identifier[relocateConstantSpace] operator[SEP] identifier[DataBuffer] identifier[dataBuffer] operator[SEP] {
identifier[Integer] identifier[deviceId] operator[=] identifier[AtomicAllocator] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getDeviceId] operator[SEP] operator[SEP] operator[SEP] identifier[ensureMaps] operator[SEP] identifier[deviceId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataBuffer] Keyword[instanceof] identifier[CudaIntDataBuffer] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[dataBuffer] operator[SEP] identifier[asInt] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getConstantBuffer] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[dataBuffer] Keyword[instanceof] identifier[CudaFloatDataBuffer] operator[SEP] {
Keyword[float] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[dataBuffer] operator[SEP] identifier[asFloat] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getConstantBuffer] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[dataBuffer] Keyword[instanceof] identifier[CudaDoubleDataBuffer] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[dataBuffer] operator[SEP] identifier[asDouble] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getConstantBuffer] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[dataBuffer] Keyword[instanceof] identifier[CudaHalfDataBuffer] operator[SEP] {
Keyword[float] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[dataBuffer] operator[SEP] identifier[asFloat] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getConstantBuffer] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[dataBuffer] Keyword[instanceof] identifier[CudaLongDataBuffer] operator[SEP] {
Keyword[long] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[dataBuffer] operator[SEP] identifier[asLong] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getConstantBuffer] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public void setParentProject(String groupId, String artifactId, String version) {
groupIdCombo.setText(groupId);
versionCombo.setText(version);
validate();
} | class class_name[name] begin[{]
method[setParentProject, return_type[void], modifier[public], parameter[groupId, artifactId, version]] begin[{]
call[groupIdCombo.setText, parameter[member[.groupId]]]
call[versionCombo.setText, parameter[member[.version]]]
call[.validate, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setParentProject] operator[SEP] identifier[String] identifier[groupId] , identifier[String] identifier[artifactId] , identifier[String] identifier[version] operator[SEP] {
identifier[groupIdCombo] operator[SEP] identifier[setText] operator[SEP] identifier[groupId] operator[SEP] operator[SEP] identifier[versionCombo] operator[SEP] identifier[setText] operator[SEP] identifier[version] operator[SEP] operator[SEP] identifier[validate] operator[SEP] operator[SEP] operator[SEP]
}
|
public Project.Layouts.Layout.Bars.BarGroup createProjectLayoutsLayoutBarsBarGroup()
{
return new Project.Layouts.Layout.Bars.BarGroup();
} | class class_name[name] begin[{]
method[createProjectLayoutsLayoutBarsBarGroup, return_type[type[Project]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Project, sub_type=ReferenceType(arguments=None, dimensions=None, name=Layouts, sub_type=ReferenceType(arguments=None, dimensions=None, name=Layout, sub_type=ReferenceType(arguments=None, dimensions=None, name=Bars, sub_type=ReferenceType(arguments=None, dimensions=None, name=BarGroup, sub_type=None))))))]
end[}]
END[}] | Keyword[public] identifier[Project] operator[SEP] identifier[Layouts] operator[SEP] identifier[Layout] operator[SEP] identifier[Bars] operator[SEP] identifier[BarGroup] identifier[createProjectLayoutsLayoutBarsBarGroup] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[Project] operator[SEP] identifier[Layouts] operator[SEP] identifier[Layout] operator[SEP] identifier[Bars] operator[SEP] identifier[BarGroup] operator[SEP] operator[SEP] operator[SEP]
}
|
private void appendAttribute(Tag tag, String text) {
if (tag.getTagName().equals("IMG")) {
appendText(text);
} else {
String current = m_attributeMap.get(tag);
if (current != null) {
text = current + text;
}
m_attributeMap.put(tag, text);
}
} | class class_name[name] begin[{]
method[appendAttribute, return_type[void], modifier[private], parameter[tag, text]] begin[{]
if[call[tag.getTagName, parameter[]]] begin[{]
call[.appendText, parameter[member[.text]]]
else begin[{]
local_variable[type[String], current]
if[binary_operation[member[.current], !=, literal[null]]] begin[{]
assign[member[.text], binary_operation[member[.current], +, member[.text]]]
else begin[{]
None
end[}]
call[m_attributeMap.put, parameter[member[.tag], member[.text]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[appendAttribute] operator[SEP] identifier[Tag] identifier[tag] , identifier[String] identifier[text] operator[SEP] {
Keyword[if] operator[SEP] identifier[tag] operator[SEP] identifier[getTagName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[appendText] operator[SEP] identifier[text] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[current] operator[=] identifier[m_attributeMap] operator[SEP] identifier[get] operator[SEP] identifier[tag] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[current] operator[!=] Other[null] operator[SEP] {
identifier[text] operator[=] identifier[current] operator[+] identifier[text] operator[SEP]
}
identifier[m_attributeMap] operator[SEP] identifier[put] operator[SEP] identifier[tag] , identifier[text] operator[SEP] operator[SEP]
}
}
|
protected boolean initialize(Session session, boolean restrictHosts,
boolean getForwardHeader)
throws IOException, RequestException {
String queryText = INIT_QUERY;
if (getForwardHeader) {
StringBuilder buf = new StringBuilder();
buf.append(HEADER_QUERY).append(";\n").append(queryText);
queryText = buf.toString();
}
AdhocQuery query = session.newAdhocQuery(queryText);
RequestOptions options = new RequestOptions();
options.setDefaultXQueryVersion("1.0-ml");
query.setOptions(options);
ResultSequence result = null;
if (LOG.isDebugEnabled()) {
LOG.debug("init query: \n" + query.getQuery());
}
result = session.submitRequest(query);
ResultItem item = result.next();
boolean forwardHeaderExists = false;
if (getForwardHeader) {
forwardHeaderExists = item.asString().equals("true");
item = result.next();
if (forwardHeaderExists) {
restrictHosts = true;
conf.setBoolean(OUTPUT_RESTRICT_HOSTS, true);
if (LOG.isDebugEnabled()) {
LOG.debug("HTTP compliant mode enabled since x-forwarded-for exists");
}
} else {
// check if input needs to be in HTTP compliant mode
String inputRestrictHost = conf.getTrimmed(INPUT_RESTRICT_HOSTS);
if (inputRestrictHost == null ||
inputRestrictHost.equalsIgnoreCase("false")) {
HttpChannel.setUseHTTP(false);
if (LOG.isDebugEnabled()) {
LOG.debug("HTTP compliant mode disabled since x-forwarded-for doesn't exist");
}
}
}
}
initHostName = item.asString();
item = result.next();
am.setEffectiveVersion(((XSInteger)item.getItem()).asLong());
item = result.next();
failover = !restrictHosts && item.asString().equals("true");
if (result.hasNext()) {
item = result.next();
String policyStr = item.asString();
conf.set(ASSIGNMENT_POLICY, policyStr);
policy = AssignmentPolicy.Kind.forName(policyStr);
item = result.next();
allowFastLoad = Boolean.parseBoolean(item.asString());
if ((policy == AssignmentPolicy.Kind.STATISTICAL
|| policy == AssignmentPolicy.Kind.RANGE
|| policy == AssignmentPolicy.Kind.QUERY)
&& !allowFastLoad && conf.getBoolean(OUTPUT_FAST_LOAD, false)) {
throw new IOException(
"Fastload can't be used: rebalancer is on and "
+ "forests are imbalanced in a database with "
+ "statistics-based assignment policy");
}
} else {
policy = AssignmentPolicy.Kind.LEGACY;
legacy = true;
}
// initialize fastload mode
if (conf.get(OUTPUT_FAST_LOAD) == null) {
// fastload not set
if (conf.get(OUTPUT_DIRECTORY) != null) {
// output_dir is set, attempt to do fastload
if(conf.get(OUTPUT_PARTITION) == null &&
(policy == AssignmentPolicy.Kind.RANGE ||
policy == AssignmentPolicy.Kind.QUERY)) {
fastLoad = false;
} else if (policy == AssignmentPolicy.Kind.RANGE ||
policy == AssignmentPolicy.Kind.QUERY ||
policy == AssignmentPolicy.Kind.STATISTICAL) {
fastLoad = allowFastLoad;
} else {
fastLoad = true;
}
} else {
//neither fastload nor output_dir is set
fastLoad = false;
}
} else {
fastLoad = conf.getBoolean(OUTPUT_FAST_LOAD, false);
if (fastLoad && conf.get(OUTPUT_PARTITION) == null
&& (policy == AssignmentPolicy.Kind.RANGE ||
policy == AssignmentPolicy.Kind.QUERY)) {
throw new IllegalArgumentException(
"output_partition is required for fastload mode.");
}
}
conf.setBoolean(OUTPUT_FAST_LOAD, fastLoad);
return restrictHosts;
} | class class_name[name] begin[{]
method[initialize, return_type[type[boolean]], modifier[protected], parameter[session, restrictHosts, getForwardHeader]] begin[{]
local_variable[type[String], queryText]
if[member[.getForwardHeader]] begin[{]
local_variable[type[StringBuilder], buf]
call[buf.append, parameter[member[.HEADER_QUERY]]]
assign[member[.queryText], call[buf.toString, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[AdhocQuery], query]
local_variable[type[RequestOptions], options]
call[options.setDefaultXQueryVersion, parameter[literal["1.0-ml"]]]
call[query.setOptions, parameter[member[.options]]]
local_variable[type[ResultSequence], result]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[binary_operation[literal["init query: \n"], +, call[query.getQuery, parameter[]]]]]
else begin[{]
None
end[}]
assign[member[.result], call[session.submitRequest, parameter[member[.query]]]]
local_variable[type[ResultItem], item]
local_variable[type[boolean], forwardHeaderExists]
if[member[.getForwardHeader]] begin[{]
assign[member[.forwardHeaderExists], call[item.asString, parameter[]]]
assign[member[.item], call[result.next, parameter[]]]
if[member[.forwardHeaderExists]] begin[{]
assign[member[.restrictHosts], literal[true]]
call[conf.setBoolean, parameter[member[.OUTPUT_RESTRICT_HOSTS], literal[true]]]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[literal["HTTP compliant mode enabled since x-forwarded-for exists"]]]
else begin[{]
None
end[}]
else begin[{]
local_variable[type[String], inputRestrictHost]
if[binary_operation[binary_operation[member[.inputRestrictHost], ==, literal[null]], ||, call[inputRestrictHost.equalsIgnoreCase, parameter[literal["false"]]]]] begin[{]
call[HttpChannel.setUseHTTP, parameter[literal[false]]]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[literal["HTTP compliant mode disabled since x-forwarded-for doesn't exist"]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
assign[member[.initHostName], call[item.asString, parameter[]]]
assign[member[.item], call[result.next, parameter[]]]
call[am.setEffectiveVersion, parameter[Cast(expression=MethodInvocation(arguments=[], member=getItem, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=XSInteger, sub_type=None))]]
assign[member[.item], call[result.next, parameter[]]]
assign[member[.failover], binary_operation[member[.restrictHosts], &&, call[item.asString, parameter[]]]]
if[call[result.hasNext, parameter[]]] begin[{]
assign[member[.item], call[result.next, parameter[]]]
local_variable[type[String], policyStr]
call[conf.set, parameter[member[.ASSIGNMENT_POLICY], member[.policyStr]]]
assign[member[.policy], call[AssignmentPolicy.Kind.forName, parameter[member[.policyStr]]]]
assign[member[.item], call[result.next, parameter[]]]
assign[member[.allowFastLoad], call[Boolean.parseBoolean, parameter[call[item.asString, parameter[]]]]]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.STATISTICAL]], ||, binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.RANGE]]], ||, binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.QUERY]]], &&, member[.allowFastLoad]], &&, call[conf.getBoolean, parameter[member[.OUTPUT_FAST_LOAD], literal[false]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Fastload can't be used: rebalancer is on and "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="forests are imbalanced in a database with "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="statistics-based assignment policy"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
assign[member[.policy], member[AssignmentPolicy.Kind.LEGACY]]
assign[member[.legacy], literal[true]]
end[}]
if[binary_operation[call[conf.get, parameter[member[.OUTPUT_FAST_LOAD]]], ==, literal[null]]] begin[{]
if[binary_operation[call[conf.get, parameter[member[.OUTPUT_DIRECTORY]]], !=, literal[null]]] begin[{]
if[binary_operation[binary_operation[call[conf.get, parameter[member[.OUTPUT_PARTITION]]], ==, literal[null]], &&, binary_operation[binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.RANGE]], ||, binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.QUERY]]]]] begin[{]
assign[member[.fastLoad], literal[false]]
else begin[{]
if[binary_operation[binary_operation[binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.RANGE]], ||, binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.QUERY]]], ||, binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.STATISTICAL]]]] begin[{]
assign[member[.fastLoad], member[.allowFastLoad]]
else begin[{]
assign[member[.fastLoad], literal[true]]
end[}]
end[}]
else begin[{]
assign[member[.fastLoad], literal[false]]
end[}]
else begin[{]
assign[member[.fastLoad], call[conf.getBoolean, parameter[member[.OUTPUT_FAST_LOAD], literal[false]]]]
if[binary_operation[binary_operation[member[.fastLoad], &&, binary_operation[call[conf.get, parameter[member[.OUTPUT_PARTITION]]], ==, literal[null]]], &&, binary_operation[binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.RANGE]], ||, binary_operation[member[.policy], ==, member[AssignmentPolicy.Kind.QUERY]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="output_partition is required for fastload mode.")], 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[}]
end[}]
call[conf.setBoolean, parameter[member[.OUTPUT_FAST_LOAD], member[.fastLoad]]]
return[member[.restrictHosts]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[initialize] operator[SEP] identifier[Session] identifier[session] , Keyword[boolean] identifier[restrictHosts] , Keyword[boolean] identifier[getForwardHeader] operator[SEP] Keyword[throws] identifier[IOException] , identifier[RequestException] {
identifier[String] identifier[queryText] operator[=] identifier[INIT_QUERY] operator[SEP] Keyword[if] operator[SEP] identifier[getForwardHeader] operator[SEP] {
identifier[StringBuilder] identifier[buf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[HEADER_QUERY] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[queryText] operator[SEP] operator[SEP] identifier[queryText] operator[=] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
identifier[AdhocQuery] identifier[query] operator[=] identifier[session] operator[SEP] identifier[newAdhocQuery] operator[SEP] identifier[queryText] operator[SEP] operator[SEP] identifier[RequestOptions] identifier[options] operator[=] Keyword[new] identifier[RequestOptions] operator[SEP] operator[SEP] operator[SEP] identifier[options] operator[SEP] identifier[setDefaultXQueryVersion] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[setOptions] operator[SEP] identifier[options] operator[SEP] operator[SEP] identifier[ResultSequence] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[query] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[result] operator[=] identifier[session] operator[SEP] identifier[submitRequest] operator[SEP] identifier[query] operator[SEP] operator[SEP] identifier[ResultItem] identifier[item] operator[=] identifier[result] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[forwardHeaderExists] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[getForwardHeader] operator[SEP] {
identifier[forwardHeaderExists] operator[=] identifier[item] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[item] operator[=] identifier[result] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[forwardHeaderExists] operator[SEP] {
identifier[restrictHosts] operator[=] literal[boolean] operator[SEP] identifier[conf] operator[SEP] identifier[setBoolean] operator[SEP] identifier[OUTPUT_RESTRICT_HOSTS] , literal[boolean] 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[else] {
identifier[String] identifier[inputRestrictHost] operator[=] identifier[conf] operator[SEP] identifier[getTrimmed] operator[SEP] identifier[INPUT_RESTRICT_HOSTS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[inputRestrictHost] operator[==] Other[null] operator[||] identifier[inputRestrictHost] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[HttpChannel] operator[SEP] identifier[setUseHTTP] operator[SEP] literal[boolean] 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]
}
}
}
}
identifier[initHostName] operator[=] identifier[item] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] identifier[item] operator[=] identifier[result] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[am] operator[SEP] identifier[setEffectiveVersion] operator[SEP] operator[SEP] operator[SEP] identifier[XSInteger] operator[SEP] identifier[item] operator[SEP] identifier[getItem] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[asLong] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[item] operator[=] identifier[result] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[failover] operator[=] operator[!] identifier[restrictHosts] operator[&&] identifier[item] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[item] operator[=] identifier[result] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[policyStr] operator[=] identifier[item] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] identifier[conf] operator[SEP] identifier[set] operator[SEP] identifier[ASSIGNMENT_POLICY] , identifier[policyStr] operator[SEP] operator[SEP] identifier[policy] operator[=] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[forName] operator[SEP] identifier[policyStr] operator[SEP] operator[SEP] identifier[item] operator[=] identifier[result] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[allowFastLoad] operator[=] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[item] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[STATISTICAL] operator[||] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[RANGE] operator[||] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[QUERY] operator[SEP] operator[&&] operator[!] identifier[allowFastLoad] operator[&&] identifier[conf] operator[SEP] identifier[getBoolean] operator[SEP] identifier[OUTPUT_FAST_LOAD] , literal[boolean] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[policy] operator[=] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[LEGACY] operator[SEP] identifier[legacy] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[conf] operator[SEP] identifier[get] operator[SEP] identifier[OUTPUT_FAST_LOAD] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[conf] operator[SEP] identifier[get] operator[SEP] identifier[OUTPUT_DIRECTORY] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[conf] operator[SEP] identifier[get] operator[SEP] identifier[OUTPUT_PARTITION] operator[SEP] operator[==] Other[null] operator[&&] operator[SEP] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[RANGE] operator[||] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[QUERY] operator[SEP] operator[SEP] {
identifier[fastLoad] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[RANGE] operator[||] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[QUERY] operator[||] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[STATISTICAL] operator[SEP] {
identifier[fastLoad] operator[=] identifier[allowFastLoad] operator[SEP]
}
Keyword[else] {
identifier[fastLoad] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] {
identifier[fastLoad] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] {
identifier[fastLoad] operator[=] identifier[conf] operator[SEP] identifier[getBoolean] operator[SEP] identifier[OUTPUT_FAST_LOAD] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fastLoad] operator[&&] identifier[conf] operator[SEP] identifier[get] operator[SEP] identifier[OUTPUT_PARTITION] operator[SEP] operator[==] Other[null] operator[&&] operator[SEP] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[RANGE] operator[||] identifier[policy] operator[==] identifier[AssignmentPolicy] operator[SEP] identifier[Kind] operator[SEP] identifier[QUERY] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[conf] operator[SEP] identifier[setBoolean] operator[SEP] identifier[OUTPUT_FAST_LOAD] , identifier[fastLoad] operator[SEP] operator[SEP] Keyword[return] identifier[restrictHosts] operator[SEP]
}
|
public AtomicCounter newCounter(
final int typeId,
final DirectBuffer keyBuffer,
final int keyOffset,
final int keyLength,
final DirectBuffer labelBuffer,
final int labelOffset,
final int labelLength)
{
return new AtomicCounter(
valuesBuffer,
allocate(typeId, keyBuffer, keyOffset, keyLength, labelBuffer, labelOffset, labelLength),
this);
} | class class_name[name] begin[{]
method[newCounter, return_type[type[AtomicCounter]], modifier[public], parameter[typeId, keyBuffer, keyOffset, keyLength, labelBuffer, labelOffset, labelLength]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=valuesBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=typeId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keyBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keyOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keyLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=labelBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=labelOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=labelLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=allocate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AtomicCounter, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[AtomicCounter] identifier[newCounter] operator[SEP] Keyword[final] Keyword[int] identifier[typeId] , Keyword[final] identifier[DirectBuffer] identifier[keyBuffer] , Keyword[final] Keyword[int] identifier[keyOffset] , Keyword[final] Keyword[int] identifier[keyLength] , Keyword[final] identifier[DirectBuffer] identifier[labelBuffer] , Keyword[final] Keyword[int] identifier[labelOffset] , Keyword[final] Keyword[int] identifier[labelLength] operator[SEP] {
Keyword[return] Keyword[new] identifier[AtomicCounter] operator[SEP] identifier[valuesBuffer] , identifier[allocate] operator[SEP] identifier[typeId] , identifier[keyBuffer] , identifier[keyOffset] , identifier[keyLength] , identifier[labelBuffer] , identifier[labelOffset] , identifier[labelLength] operator[SEP] , Keyword[this] operator[SEP] operator[SEP]
}
|
public static FSImageCompression readCompressionHeader(
Configuration conf,
DataInputStream dis) throws IOException
{
boolean isCompressed = dis.readBoolean();
if (!isCompressed) {
return createNoopCompression();
} else {
String codecClassName = Text.readString(dis);
return createCompression(conf, codecClassName);
}
} | class class_name[name] begin[{]
method[readCompressionHeader, return_type[type[FSImageCompression]], modifier[public static], parameter[conf, dis]] begin[{]
local_variable[type[boolean], isCompressed]
if[member[.isCompressed]] begin[{]
return[call[.createNoopCompression, parameter[]]]
else begin[{]
local_variable[type[String], codecClassName]
return[call[.createCompression, parameter[member[.conf], member[.codecClassName]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FSImageCompression] identifier[readCompressionHeader] operator[SEP] identifier[Configuration] identifier[conf] , identifier[DataInputStream] identifier[dis] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[boolean] identifier[isCompressed] operator[=] identifier[dis] operator[SEP] identifier[readBoolean] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isCompressed] operator[SEP] {
Keyword[return] identifier[createNoopCompression] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[codecClassName] operator[=] identifier[Text] operator[SEP] identifier[readString] operator[SEP] identifier[dis] operator[SEP] operator[SEP] Keyword[return] identifier[createCompression] operator[SEP] identifier[conf] , identifier[codecClassName] operator[SEP] operator[SEP]
}
}
|
private String htmlStart(CmsWorkplace wp) {
StringBuffer html = new StringBuffer(1024);
html.append("<table border='0' cellspacing='0' cellpadding='0' width='100%' class='navOpened' id='");
html.append(getId());
html.append("'>\n");
html.append("\t<tr>\n");
html.append("\t\t<td class='titleBorder'>\n");
html.append(
"\t\t\t<table border='0' cellspacing='0' cellpadding='0' width='100%' class='navTitle' onMouseOver='mouseGroupEvent(this, true);' onMouseOut='mouseGroupEvent(this, false);' onClick=\"return openGroup('");
html.append(getId());
html.append("');\" >\n");
html.append("\t\t\t\t<tr>\n");
html.append("\t\t\t\t\t<td class='titleText' width='100%'>");
html.append(CmsToolMacroResolver.resolveMacros(getName(), wp));
html.append("</td>\n");
html.append("\t\t\t\t</tr>\n");
html.append("\t\t\t</table>\n");
html.append("\t\t</td>\n");
html.append("\t</tr><tr>\n");
html.append("\t\t<td class='treeBorder'>\n");
html.append("\t\t\t<div class='tree'>\n");
html.append("\t\t\t\t<table border='0' cellspacing='0' cellpadding='0' width='100%'>\n");
html.append("\t\t\t\t\t<tr>\n");
html.append("\t\t\t\t\t\t<td>\n");
return html.toString();
} | class class_name[name] begin[{]
method[htmlStart, return_type[type[String]], modifier[private], parameter[wp]] begin[{]
local_variable[type[StringBuffer], html]
call[html.append, parameter[literal["<table border='0' cellspacing='0' cellpadding='0' width='100%' class='navOpened' id='"]]]
call[html.append, parameter[call[.getId, parameter[]]]]
call[html.append, parameter[literal["'>\n"]]]
call[html.append, parameter[literal["\t<tr>\n"]]]
call[html.append, parameter[literal["\t\t<td class='titleBorder'>\n"]]]
call[html.append, parameter[literal["\t\t\t<table border='0' cellspacing='0' cellpadding='0' width='100%' class='navTitle' onMouseOver='mouseGroupEvent(this, true);' onMouseOut='mouseGroupEvent(this, false);' onClick=\"return openGroup('"]]]
call[html.append, parameter[call[.getId, parameter[]]]]
call[html.append, parameter[literal["');\" >\n"]]]
call[html.append, parameter[literal["\t\t\t\t<tr>\n"]]]
call[html.append, parameter[literal["\t\t\t\t\t<td class='titleText' width='100%'>"]]]
call[html.append, parameter[call[CmsToolMacroResolver.resolveMacros, parameter[call[.getName, parameter[]], member[.wp]]]]]
call[html.append, parameter[literal["</td>\n"]]]
call[html.append, parameter[literal["\t\t\t\t</tr>\n"]]]
call[html.append, parameter[literal["\t\t\t</table>\n"]]]
call[html.append, parameter[literal["\t\t</td>\n"]]]
call[html.append, parameter[literal["\t</tr><tr>\n"]]]
call[html.append, parameter[literal["\t\t<td class='treeBorder'>\n"]]]
call[html.append, parameter[literal["\t\t\t<div class='tree'>\n"]]]
call[html.append, parameter[literal["\t\t\t\t<table border='0' cellspacing='0' cellpadding='0' width='100%'>\n"]]]
call[html.append, parameter[literal["\t\t\t\t\t<tr>\n"]]]
call[html.append, parameter[literal["\t\t\t\t\t\t<td>\n"]]]
return[call[html.toString, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[htmlStart] operator[SEP] identifier[CmsWorkplace] identifier[wp] operator[SEP] {
identifier[StringBuffer] identifier[html] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] Other[1024] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] identifier[CmsToolMacroResolver] operator[SEP] identifier[resolveMacros] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[wp] operator[SEP] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[html] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean isUseFormBasedAuth() {
String useFormBasedAuth = getModelAttribute("useFormBasedAuth");
return useFormBasedAuth != null ? Boolean.parseBoolean(useFormBasedAuth) : false;
} | class class_name[name] begin[{]
method[isUseFormBasedAuth, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[String], useFormBasedAuth]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=useFormBasedAuth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), if_true=MethodInvocation(arguments=[MemberReference(member=useFormBasedAuth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseBoolean, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isUseFormBasedAuth] operator[SEP] operator[SEP] {
identifier[String] identifier[useFormBasedAuth] operator[=] identifier[getModelAttribute] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[useFormBasedAuth] operator[!=] Other[null] operator[?] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[useFormBasedAuth] operator[SEP] operator[:] literal[boolean] operator[SEP]
}
|
public List<File> getClasspathFiles() {
if (closed.get()) {
throw new IllegalArgumentException("Cannot use a ScanResult after it has been closed");
}
final List<File> classpathElementOrderFiles = new ArrayList<>();
for (final ClasspathElement classpathElement : classpathOrder) {
final File file = classpathElement.getFile();
if (file != null) {
classpathElementOrderFiles.add(file);
}
}
return classpathElementOrderFiles;
} | class class_name[name] begin[{]
method[getClasspathFiles, return_type[type[List]], modifier[public], parameter[]] begin[{]
if[call[closed.get, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot use a ScanResult after it has been closed")], 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[List], classpathElementOrderFiles]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getFile, postfix_operators=[], prefix_operators=[], qualifier=classpathElement, selectors=[], type_arguments=None), name=file)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=classpathElementOrderFiles, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=classpathOrder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=classpathElement)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ClasspathElement, sub_type=None))), label=None)
return[member[.classpathElementOrderFiles]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[File] operator[>] identifier[getClasspathFiles] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[closed] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[File] operator[>] identifier[classpathElementOrderFiles] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[ClasspathElement] identifier[classpathElement] operator[:] identifier[classpathOrder] operator[SEP] {
Keyword[final] identifier[File] identifier[file] operator[=] identifier[classpathElement] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[file] operator[!=] Other[null] operator[SEP] {
identifier[classpathElementOrderFiles] operator[SEP] identifier[add] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[classpathElementOrderFiles] operator[SEP]
}
|
public synchronized File createUniqueFile(String prefix, String suffix) {
if (suffix == null) suffix = ".tmp";
Random random = new Random(System.currentTimeMillis());
File result = new File(getRootDirectory(), prefix + Integer.toString(random.nextInt()) + suffix);
while (result.exists())
result = new File(getRootDirectory(), prefix + Integer.toString(random.nextInt()) + suffix);
return result;
} | class class_name[name] begin[{]
method[createUniqueFile, return_type[type[File]], modifier[synchronized public], parameter[prefix, suffix]] begin[{]
if[binary_operation[member[.suffix], ==, literal[null]]] begin[{]
assign[member[.suffix], literal[".tmp"]]
else begin[{]
None
end[}]
local_variable[type[Random], random]
local_variable[type[File], result]
while[call[result.exists, parameter[]]] begin[{]
assign[member[.result], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getRootDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=random, selectors=[], type_arguments=None)], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), operator=+), operandr=MemberReference(member=suffix, 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=File, sub_type=None))]
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[File] identifier[createUniqueFile] operator[SEP] identifier[String] identifier[prefix] , identifier[String] identifier[suffix] operator[SEP] {
Keyword[if] operator[SEP] identifier[suffix] operator[==] Other[null] operator[SEP] identifier[suffix] operator[=] literal[String] operator[SEP] identifier[Random] identifier[random] operator[=] Keyword[new] identifier[Random] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[result] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[getRootDirectory] operator[SEP] operator[SEP] , identifier[prefix] operator[+] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[random] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[SEP] operator[+] identifier[suffix] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[result] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[getRootDirectory] operator[SEP] operator[SEP] , identifier[prefix] operator[+] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[random] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[SEP] operator[+] identifier[suffix] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private static double dot(int[] x, double[] w) {
double dot = w[w.length - 1];
for (int i : x) {
dot += w[i];
}
return dot;
} | class class_name[name] begin[{]
method[dot, return_type[type[double]], modifier[private static], parameter[x, w]] begin[{]
local_variable[type[double], dot]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=dot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None)
return[member[.dot]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[double] identifier[dot] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[x] , Keyword[double] operator[SEP] operator[SEP] identifier[w] operator[SEP] {
Keyword[double] identifier[dot] operator[=] identifier[w] operator[SEP] identifier[w] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[:] identifier[x] operator[SEP] {
identifier[dot] operator[+=] identifier[w] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] identifier[dot] operator[SEP]
}
|
public synchronized UUID nextUUID() {
byte[] rawUUID = new byte[UUID_BYTE_LENGTH];
long time = 0;
short clockSq = 0;
Node node = manager.currentNode();
while (time < 1) {
try {
manager.lockNode(node);
time = node.getUUIDTime();
clockSq = node.getClockSequence();
System.arraycopy(node.getNodeIdentifier(), 0, rawUUID, NODE_ID_BYTE10, NODE_ID_BYTE_LENGTH);
manager.releaseNode(node);
} catch (OverClockedException e) {
node = manager.nextAvailableNode();
} finally {
manager.releaseNode(node);
}
}
byte[] timeBytes = Bytes.toBytes(time);
//Copy time low
System.arraycopy(timeBytes, TIME_LOW_TS_POS, rawUUID, TIME_LOW_START_POS, TIME_LOW_BYTE_LEN);
//Copy time mid
System.arraycopy(timeBytes, TIME_MID_TS_POS, rawUUID, TIME_MID_START_POS, TIME_MID_BYTE_LEN);
//Copy time hi
System.arraycopy(timeBytes, TIME_HI_TS_POS, rawUUID, TIME_HI_START_POS, TIME_HI_BYTE_LEN);
//Set version
rawUUID[6] |= 0x10; // 0001 0000
//Set clock sequence
rawUUID[CLOCK_HI_VARIANT_BYTE8] = (byte) ((clockSq & 0x3F00) >>> 8);
rawUUID[CLOCK_HI_VARIANT_BYTE8] |= 0x80;
rawUUID[CLOCK_LOW_BYTE9] = (byte) (clockSq & 0xFF);
return new UUID(rawUUID);
} | class class_name[name] begin[{]
method[nextUUID, return_type[type[UUID]], modifier[synchronized public], parameter[]] begin[{]
local_variable[type[byte], rawUUID]
local_variable[type[long], time]
local_variable[type[short], clockSq]
local_variable[type[Node], node]
while[binary_operation[member[.time], <, literal[1]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lockNode, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getUUIDTime, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=clockSq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getClockSequence, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNodeIdentifier, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=rawUUID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NODE_ID_BYTE10, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NODE_ID_BYTE_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=arraycopy, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=releaseNode, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=nextAvailableNode, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['OverClockedException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=releaseNode, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
local_variable[type[byte], timeBytes]
call[System.arraycopy, parameter[member[.timeBytes], member[.TIME_LOW_TS_POS], member[.rawUUID], member[.TIME_LOW_START_POS], member[.TIME_LOW_BYTE_LEN]]]
call[System.arraycopy, parameter[member[.timeBytes], member[.TIME_MID_TS_POS], member[.rawUUID], member[.TIME_MID_START_POS], member[.TIME_MID_BYTE_LEN]]]
call[System.arraycopy, parameter[member[.timeBytes], member[.TIME_HI_TS_POS], member[.rawUUID], member[.TIME_HI_START_POS], member[.TIME_HI_BYTE_LEN]]]
assign[member[.rawUUID], literal[0x10]]
assign[member[.rawUUID], Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=clockSq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x3F00), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>>), type=BasicType(dimensions=[], name=byte))]
assign[member[.rawUUID], literal[0x80]]
assign[member[.rawUUID], Cast(expression=BinaryOperation(operandl=MemberReference(member=clockSq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), type=BasicType(dimensions=[], name=byte))]
return[ClassCreator(arguments=[MemberReference(member=rawUUID, 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=UUID, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[synchronized] identifier[UUID] identifier[nextUUID] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[rawUUID] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[UUID_BYTE_LENGTH] operator[SEP] operator[SEP] Keyword[long] identifier[time] operator[=] Other[0] operator[SEP] Keyword[short] identifier[clockSq] operator[=] Other[0] operator[SEP] identifier[Node] identifier[node] operator[=] identifier[manager] operator[SEP] identifier[currentNode] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[time] operator[<] Other[1] operator[SEP] {
Keyword[try] {
identifier[manager] operator[SEP] identifier[lockNode] operator[SEP] identifier[node] operator[SEP] operator[SEP] identifier[time] operator[=] identifier[node] operator[SEP] identifier[getUUIDTime] operator[SEP] operator[SEP] operator[SEP] identifier[clockSq] operator[=] identifier[node] operator[SEP] identifier[getClockSequence] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[node] operator[SEP] identifier[getNodeIdentifier] operator[SEP] operator[SEP] , Other[0] , identifier[rawUUID] , identifier[NODE_ID_BYTE10] , identifier[NODE_ID_BYTE_LENGTH] operator[SEP] operator[SEP] identifier[manager] operator[SEP] identifier[releaseNode] operator[SEP] identifier[node] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[OverClockedException] identifier[e] operator[SEP] {
identifier[node] operator[=] identifier[manager] operator[SEP] identifier[nextAvailableNode] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[manager] operator[SEP] identifier[releaseNode] operator[SEP] identifier[node] operator[SEP] operator[SEP]
}
}
Keyword[byte] operator[SEP] operator[SEP] identifier[timeBytes] operator[=] identifier[Bytes] operator[SEP] identifier[toBytes] operator[SEP] identifier[time] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[timeBytes] , identifier[TIME_LOW_TS_POS] , identifier[rawUUID] , identifier[TIME_LOW_START_POS] , identifier[TIME_LOW_BYTE_LEN] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[timeBytes] , identifier[TIME_MID_TS_POS] , identifier[rawUUID] , identifier[TIME_MID_START_POS] , identifier[TIME_MID_BYTE_LEN] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[timeBytes] , identifier[TIME_HI_TS_POS] , identifier[rawUUID] , identifier[TIME_HI_START_POS] , identifier[TIME_HI_BYTE_LEN] operator[SEP] operator[SEP] identifier[rawUUID] operator[SEP] Other[6] operator[SEP] operator[|=] literal[Integer] operator[SEP] identifier[rawUUID] operator[SEP] identifier[CLOCK_HI_VARIANT_BYTE8] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[clockSq] operator[&] literal[Integer] operator[SEP] operator[>] operator[>] operator[>] Other[8] operator[SEP] operator[SEP] identifier[rawUUID] operator[SEP] identifier[CLOCK_HI_VARIANT_BYTE8] operator[SEP] operator[|=] literal[Integer] operator[SEP] identifier[rawUUID] operator[SEP] identifier[CLOCK_LOW_BYTE9] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[clockSq] operator[&] literal[Integer] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[UUID] operator[SEP] identifier[rawUUID] operator[SEP] operator[SEP]
}
|
public void createCheckpoint() {
if (logger.isLoggable(Level.INFO))
logger.info("Start creating checkpoint");
if (MY_METHOD == METHOD_MONITOR) {
if (VanillaDb.txMgr().getNextTxNum() - lastTxNum > TX_COUNT_TO_CHECKPOINT) {
Transaction tx = VanillaDb.txMgr().newTransaction(
Connection.TRANSACTION_SERIALIZABLE, false);
VanillaDb.txMgr().createCheckpoint(tx);
tx.commit();
lastTxNum = VanillaDb.txMgr().getNextTxNum();
}
} else if (MY_METHOD == METHOD_PERIODIC) {
Transaction tx = VanillaDb.txMgr().newTransaction(
Connection.TRANSACTION_SERIALIZABLE, false);
VanillaDb.txMgr().createCheckpoint(tx);
tx.commit();
}
if (logger.isLoggable(Level.INFO))
logger.info("A checkpoint created");
} | class class_name[name] begin[{]
method[createCheckpoint, return_type[void], modifier[public], parameter[]] begin[{]
if[call[logger.isLoggable, parameter[member[Level.INFO]]]] begin[{]
call[logger.info, parameter[literal["Start creating checkpoint"]]]
else begin[{]
None
end[}]
if[binary_operation[member[.MY_METHOD], ==, member[.METHOD_MONITOR]]] begin[{]
if[binary_operation[binary_operation[call[VanillaDb.txMgr, parameter[]], -, member[.lastTxNum]], >, member[.TX_COUNT_TO_CHECKPOINT]]] begin[{]
local_variable[type[Transaction], tx]
call[VanillaDb.txMgr, parameter[]]
call[tx.commit, parameter[]]
assign[member[.lastTxNum], call[VanillaDb.txMgr, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.MY_METHOD], ==, member[.METHOD_PERIODIC]]] begin[{]
local_variable[type[Transaction], tx]
call[VanillaDb.txMgr, parameter[]]
call[tx.commit, parameter[]]
else begin[{]
None
end[}]
end[}]
if[call[logger.isLoggable, parameter[member[Level.INFO]]]] begin[{]
call[logger.info, parameter[literal["A checkpoint created"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[createCheckpoint] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[INFO] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[MY_METHOD] operator[==] identifier[METHOD_MONITOR] operator[SEP] {
Keyword[if] operator[SEP] identifier[VanillaDb] operator[SEP] identifier[txMgr] operator[SEP] operator[SEP] operator[SEP] identifier[getNextTxNum] operator[SEP] operator[SEP] operator[-] identifier[lastTxNum] operator[>] identifier[TX_COUNT_TO_CHECKPOINT] operator[SEP] {
identifier[Transaction] identifier[tx] operator[=] identifier[VanillaDb] operator[SEP] identifier[txMgr] operator[SEP] operator[SEP] operator[SEP] identifier[newTransaction] operator[SEP] identifier[Connection] operator[SEP] identifier[TRANSACTION_SERIALIZABLE] , literal[boolean] operator[SEP] operator[SEP] identifier[VanillaDb] operator[SEP] identifier[txMgr] operator[SEP] operator[SEP] operator[SEP] identifier[createCheckpoint] operator[SEP] identifier[tx] operator[SEP] operator[SEP] identifier[tx] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP] identifier[lastTxNum] operator[=] identifier[VanillaDb] operator[SEP] identifier[txMgr] operator[SEP] operator[SEP] operator[SEP] identifier[getNextTxNum] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[MY_METHOD] operator[==] identifier[METHOD_PERIODIC] operator[SEP] {
identifier[Transaction] identifier[tx] operator[=] identifier[VanillaDb] operator[SEP] identifier[txMgr] operator[SEP] operator[SEP] operator[SEP] identifier[newTransaction] operator[SEP] identifier[Connection] operator[SEP] identifier[TRANSACTION_SERIALIZABLE] , literal[boolean] operator[SEP] operator[SEP] identifier[VanillaDb] operator[SEP] identifier[txMgr] operator[SEP] operator[SEP] operator[SEP] identifier[createCheckpoint] operator[SEP] identifier[tx] operator[SEP] operator[SEP] identifier[tx] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[INFO] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
protected HierarchicalProperty supportedLock()
{
HierarchicalProperty supportedLock = new HierarchicalProperty(new QName("DAV:", "supportedlock"));
HierarchicalProperty lockEntry = new HierarchicalProperty(new QName("DAV:", "lockentry"));
supportedLock.addChild(lockEntry);
HierarchicalProperty lockScope = new HierarchicalProperty(new QName("DAV:", "lockscope"));
lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive")));
lockEntry.addChild(lockScope);
HierarchicalProperty lockType = new HierarchicalProperty(new QName("DAV:", "locktype"));
lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write")));
lockEntry.addChild(lockType);
return supportedLock;
} | class class_name[name] begin[{]
method[supportedLock, return_type[type[HierarchicalProperty]], modifier[protected], parameter[]] begin[{]
local_variable[type[HierarchicalProperty], supportedLock]
local_variable[type[HierarchicalProperty], lockEntry]
call[supportedLock.addChild, parameter[member[.lockEntry]]]
local_variable[type[HierarchicalProperty], lockScope]
call[lockScope.addChild, parameter[ClassCreator(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DAV:"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="exclusive")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=QName, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HierarchicalProperty, sub_type=None))]]
call[lockEntry.addChild, parameter[member[.lockScope]]]
local_variable[type[HierarchicalProperty], lockType]
call[lockType.addChild, parameter[ClassCreator(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DAV:"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="write")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=QName, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HierarchicalProperty, sub_type=None))]]
call[lockEntry.addChild, parameter[member[.lockType]]]
return[member[.supportedLock]]
end[}]
END[}] | Keyword[protected] identifier[HierarchicalProperty] identifier[supportedLock] operator[SEP] operator[SEP] {
identifier[HierarchicalProperty] identifier[supportedLock] operator[=] Keyword[new] identifier[HierarchicalProperty] operator[SEP] Keyword[new] identifier[QName] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[HierarchicalProperty] identifier[lockEntry] operator[=] Keyword[new] identifier[HierarchicalProperty] operator[SEP] Keyword[new] identifier[QName] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[supportedLock] operator[SEP] identifier[addChild] operator[SEP] identifier[lockEntry] operator[SEP] operator[SEP] identifier[HierarchicalProperty] identifier[lockScope] operator[=] Keyword[new] identifier[HierarchicalProperty] operator[SEP] Keyword[new] identifier[QName] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[lockScope] operator[SEP] identifier[addChild] operator[SEP] Keyword[new] identifier[HierarchicalProperty] operator[SEP] Keyword[new] identifier[QName] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[lockEntry] operator[SEP] identifier[addChild] operator[SEP] identifier[lockScope] operator[SEP] operator[SEP] identifier[HierarchicalProperty] identifier[lockType] operator[=] Keyword[new] identifier[HierarchicalProperty] operator[SEP] Keyword[new] identifier[QName] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[lockType] operator[SEP] identifier[addChild] operator[SEP] Keyword[new] identifier[HierarchicalProperty] operator[SEP] Keyword[new] identifier[QName] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[lockEntry] operator[SEP] identifier[addChild] operator[SEP] identifier[lockType] operator[SEP] operator[SEP] Keyword[return] identifier[supportedLock] operator[SEP]
}
|
protected Object convertValueToRequiredType(Object value, Class requiredType) {
if (String.class.equals(this.requiredType)) {
return value.toString();
} else if (Number.class.isAssignableFrom(this.requiredType)) {
if (value instanceof Number) {
// Convert original Number to target Number class.
return NumberUtils.convertNumberToTargetClass(((Number) value), this.requiredType);
} else {
// Convert stringified value to target Number class.
return NumberUtils.parseNumber(value.toString(), this.requiredType);
}
} else {
throw new IllegalArgumentException(
"Value [" + value + "] is of type [" + value.getClass().getName() +
"] and cannot be converted to required type [" + this.requiredType.getName() + "]");
}
} | class class_name[name] begin[{]
method[convertValueToRequiredType, return_type[type[Object]], modifier[protected], parameter[value, requiredType]] begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=requiredType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))] begin[{]
return[call[value.toString, parameter[]]]
else begin[{]
if[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=requiredType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Number, sub_type=None))] begin[{]
if[binary_operation[member[.value], instanceof, type[Number]]] begin[{]
return[call[NumberUtils.convertNumberToTargetClass, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None)), THIS[member[None.requiredType]]]]]
else begin[{]
return[call[NumberUtils.parseNumber, parameter[call[value.toString, parameter[]], THIS[member[None.requiredType]]]]]
end[}]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Value ["), operandr=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] is of type ["), operator=+), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] and cannot be converted to required type ["), operator=+), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=requiredType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
END[}] | Keyword[protected] identifier[Object] identifier[convertValueToRequiredType] operator[SEP] identifier[Object] identifier[value] , identifier[Class] identifier[requiredType] operator[SEP] {
Keyword[if] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] Keyword[this] operator[SEP] identifier[requiredType] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[Number] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] Keyword[this] operator[SEP] identifier[requiredType] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Number] operator[SEP] {
Keyword[return] identifier[NumberUtils] operator[SEP] identifier[convertNumberToTargetClass] operator[SEP] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[value] operator[SEP] , Keyword[this] operator[SEP] identifier[requiredType] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[NumberUtils] operator[SEP] identifier[parseNumber] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[requiredType] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[value] operator[+] literal[String] operator[+] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[requiredType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
private Token parseQuotedChars(char quote) {
StringBuilder buf = new StringBuilder();
buf.append(quote);
while (hasNextChar()) {
char ch = nextChar();
if (ch == '\\') {
ch = nextChar();
if (ch == '\\' || ch == quote) {
buf.append(ch);
}
// else error!
} else if (ch == quote) {
buf.append(ch);
break;
} else {
buf.append(ch);
}
}
return new QuotedString(buf.toString());
} | class class_name[name] begin[{]
method[parseQuotedChars, return_type[type[Token]], modifier[private], parameter[quote]] begin[{]
local_variable[type[StringBuilder], buf]
call[buf.append, parameter[member[.quote]]]
while[call[.hasNextChar, parameter[]]] begin[{]
local_variable[type[char], ch]
if[binary_operation[member[.ch], ==, literal['\\']]] begin[{]
assign[member[.ch], call[.nextChar, parameter[]]]
if[binary_operation[binary_operation[member[.ch], ==, literal['\\']], ||, binary_operation[member[.ch], ==, member[.quote]]]] begin[{]
call[buf.append, parameter[member[.ch]]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.ch], ==, member[.quote]]] begin[{]
call[buf.append, parameter[member[.ch]]]
BreakStatement(goto=None, label=None)
else begin[{]
call[buf.append, parameter[member[.ch]]]
end[}]
end[}]
end[}]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=QuotedString, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[Token] identifier[parseQuotedChars] operator[SEP] Keyword[char] identifier[quote] operator[SEP] {
identifier[StringBuilder] identifier[buf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[quote] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[hasNextChar] operator[SEP] operator[SEP] operator[SEP] {
Keyword[char] identifier[ch] operator[=] identifier[nextChar] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ch] operator[==] literal[String] operator[SEP] {
identifier[ch] operator[=] identifier[nextChar] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ch] operator[==] literal[String] operator[||] identifier[ch] operator[==] identifier[quote] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[ch] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[ch] operator[==] identifier[quote] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[ch] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[else] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[ch] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[QuotedString] operator[SEP] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private boolean raSupportsCCILocalTran(ManagedConnectionFactory mcf) throws ResourceException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
ConnectionFactory cf;
ResourceAdapterMetaData raMetaData;
boolean cciLocalTranSupported = false;
if (isTraceOn
&& tc.isEntryEnabled())
Tr.entry(this, tc, "raSupportsCCILocalTran");
if (gConfigProps.transactionSupport == TransactionSupportLevel.XATransaction
|| gConfigProps.transactionSupport == TransactionSupportLevel.LocalTransaction) {
cf = (ConnectionFactory) mcf.createConnectionFactory(this);
raMetaData = cf.getMetaData();
if (raMetaData != null)
cciLocalTranSupported = raMetaData.supportsLocalTransactionDemarcation();
}
if (isTraceOn
&& tc.isEntryEnabled())
Tr.exit(this, tc, "raSupportsCCILocalTran " + cciLocalTranSupported);
return cciLocalTranSupported;
} | class class_name[name] begin[{]
method[raSupportsCCILocalTran, return_type[type[boolean]], modifier[private], parameter[mcf]] begin[{]
local_variable[type[boolean], isTraceOn]
local_variable[type[ConnectionFactory], cf]
local_variable[type[ResourceAdapterMetaData], raMetaData]
local_variable[type[boolean], cciLocalTranSupported]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[THIS[], member[.tc], literal["raSupportsCCILocalTran"]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[gConfigProps.transactionSupport], ==, member[TransactionSupportLevel.XATransaction]], ||, binary_operation[member[gConfigProps.transactionSupport], ==, member[TransactionSupportLevel.LocalTransaction]]]] begin[{]
assign[member[.cf], Cast(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=createConnectionFactory, postfix_operators=[], prefix_operators=[], qualifier=mcf, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ConnectionFactory, sub_type=None))]
assign[member[.raMetaData], call[cf.getMetaData, parameter[]]]
if[binary_operation[member[.raMetaData], !=, literal[null]]] begin[{]
assign[member[.cciLocalTranSupported], call[raMetaData.supportsLocalTransactionDemarcation, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[THIS[], member[.tc], binary_operation[literal["raSupportsCCILocalTran "], +, member[.cciLocalTranSupported]]]]
else begin[{]
None
end[}]
return[member[.cciLocalTranSupported]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[raSupportsCCILocalTran] operator[SEP] identifier[ManagedConnectionFactory] identifier[mcf] operator[SEP] Keyword[throws] identifier[ResourceException] {
Keyword[final] Keyword[boolean] identifier[isTraceOn] operator[=] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[ConnectionFactory] identifier[cf] operator[SEP] identifier[ResourceAdapterMetaData] identifier[raMetaData] operator[SEP] Keyword[boolean] identifier[cciLocalTranSupported] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[gConfigProps] operator[SEP] identifier[transactionSupport] operator[==] identifier[TransactionSupportLevel] operator[SEP] identifier[XATransaction] operator[||] identifier[gConfigProps] operator[SEP] identifier[transactionSupport] operator[==] identifier[TransactionSupportLevel] operator[SEP] identifier[LocalTransaction] operator[SEP] {
identifier[cf] operator[=] operator[SEP] identifier[ConnectionFactory] operator[SEP] identifier[mcf] operator[SEP] identifier[createConnectionFactory] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[raMetaData] operator[=] identifier[cf] operator[SEP] identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[raMetaData] operator[!=] Other[null] operator[SEP] identifier[cciLocalTranSupported] operator[=] identifier[raMetaData] operator[SEP] identifier[supportsLocalTransactionDemarcation] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[+] identifier[cciLocalTranSupported] operator[SEP] operator[SEP] Keyword[return] identifier[cciLocalTranSupported] operator[SEP]
}
|
public ArrayDouble.D3 getCoordinateArray(int timeIndex) throws IOException, InvalidRangeException {
Array etaArray = readArray(etaVar, timeIndex);
Array sArray = readArray(sVar, timeIndex);
Array depthArray = readArray(depthVar, timeIndex);
if (null == c) {
double a = aVar.readScalarDouble();
double b = bVar.readScalarDouble();
depth_c = depthCVar.readScalarDouble();
c = makeC(sArray, a, b);
}
return makeHeight(etaArray, sArray, depthArray, c, depth_c);
} | class class_name[name] begin[{]
method[getCoordinateArray, return_type[type[ArrayDouble]], modifier[public], parameter[timeIndex]] begin[{]
local_variable[type[Array], etaArray]
local_variable[type[Array], sArray]
local_variable[type[Array], depthArray]
if[binary_operation[literal[null], ==, member[.c]]] begin[{]
local_variable[type[double], a]
local_variable[type[double], b]
assign[member[.depth_c], call[depthCVar.readScalarDouble, parameter[]]]
assign[member[.c], call[.makeC, parameter[member[.sArray], member[.a], member[.b]]]]
else begin[{]
None
end[}]
return[call[.makeHeight, parameter[member[.etaArray], member[.sArray], member[.depthArray], member[.c], member[.depth_c]]]]
end[}]
END[}] | Keyword[public] identifier[ArrayDouble] operator[SEP] identifier[D3] identifier[getCoordinateArray] operator[SEP] Keyword[int] identifier[timeIndex] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InvalidRangeException] {
identifier[Array] identifier[etaArray] operator[=] identifier[readArray] operator[SEP] identifier[etaVar] , identifier[timeIndex] operator[SEP] operator[SEP] identifier[Array] identifier[sArray] operator[=] identifier[readArray] operator[SEP] identifier[sVar] , identifier[timeIndex] operator[SEP] operator[SEP] identifier[Array] identifier[depthArray] operator[=] identifier[readArray] operator[SEP] identifier[depthVar] , identifier[timeIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[c] operator[SEP] {
Keyword[double] identifier[a] operator[=] identifier[aVar] operator[SEP] identifier[readScalarDouble] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[b] operator[=] identifier[bVar] operator[SEP] identifier[readScalarDouble] operator[SEP] operator[SEP] operator[SEP] identifier[depth_c] operator[=] identifier[depthCVar] operator[SEP] identifier[readScalarDouble] operator[SEP] operator[SEP] operator[SEP] identifier[c] operator[=] identifier[makeC] operator[SEP] identifier[sArray] , identifier[a] , identifier[b] operator[SEP] operator[SEP]
}
Keyword[return] identifier[makeHeight] operator[SEP] identifier[etaArray] , identifier[sArray] , identifier[depthArray] , identifier[c] , identifier[depth_c] operator[SEP] operator[SEP]
}
|
public B camundaInSourceTarget(String source, String target) {
CamundaIn param = modelInstance.newInstance(CamundaIn.class);
param.setCamundaSource(source);
param.setCamundaTarget(target);
addExtensionElement(param);
return myself;
} | class class_name[name] begin[{]
method[camundaInSourceTarget, return_type[type[B]], modifier[public], parameter[source, target]] begin[{]
local_variable[type[CamundaIn], param]
call[param.setCamundaSource, parameter[member[.source]]]
call[param.setCamundaTarget, parameter[member[.target]]]
call[.addExtensionElement, parameter[member[.param]]]
return[member[.myself]]
end[}]
END[}] | Keyword[public] identifier[B] identifier[camundaInSourceTarget] operator[SEP] identifier[String] identifier[source] , identifier[String] identifier[target] operator[SEP] {
identifier[CamundaIn] identifier[param] operator[=] identifier[modelInstance] operator[SEP] identifier[newInstance] operator[SEP] identifier[CamundaIn] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[param] operator[SEP] identifier[setCamundaSource] operator[SEP] identifier[source] operator[SEP] operator[SEP] identifier[param] operator[SEP] identifier[setCamundaTarget] operator[SEP] identifier[target] operator[SEP] operator[SEP] identifier[addExtensionElement] operator[SEP] identifier[param] operator[SEP] operator[SEP] Keyword[return] identifier[myself] operator[SEP]
}
|
public final int weakOffer(final E e) {
if (null == e) {
throw new NullPointerException("Null is not a valid element");
}
final int mask = this.mask;
final long capacity = mask + 1;
final long currentTail = lvProducerIndex(); // LoadLoad
final long consumerIndexCache = lvConsumerIndexCache(); // LoadLoad
final long wrapPoint = currentTail - capacity;
if (consumerIndexCache <= wrapPoint) {
long currHead = lvConsumerIndex(); // LoadLoad
if (currHead <= wrapPoint) {
return 1; // FULL :(
} else {
svConsumerIndexCache(currHead); // StoreLoad
}
}
// look Ma, no loop!
if (!casProducerIndex(currentTail, currentTail + 1)) {
return -1; // CAS FAIL :(
}
// Won CAS, move on to storing
final int offset = calcElementOffset(currentTail, mask);
soElement(offset, e);
return 0; // AWESOME :)
} | class class_name[name] begin[{]
method[weakOffer, return_type[type[int]], modifier[final public], parameter[e]] begin[{]
if[binary_operation[literal[null], ==, member[.e]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Null is not a valid element")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], mask]
local_variable[type[long], capacity]
local_variable[type[long], currentTail]
local_variable[type[long], consumerIndexCache]
local_variable[type[long], wrapPoint]
if[binary_operation[member[.consumerIndexCache], <=, member[.wrapPoint]]] begin[{]
local_variable[type[long], currHead]
if[binary_operation[member[.currHead], <=, member[.wrapPoint]]] begin[{]
return[literal[1]]
else begin[{]
call[.svConsumerIndexCache, parameter[member[.currHead]]]
end[}]
else begin[{]
None
end[}]
if[call[.casProducerIndex, parameter[member[.currentTail], binary_operation[member[.currentTail], +, literal[1]]]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
local_variable[type[int], offset]
call[.soElement, parameter[member[.offset], member[.e]]]
return[literal[0]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[int] identifier[weakOffer] operator[SEP] Keyword[final] identifier[E] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[mask] operator[=] Keyword[this] operator[SEP] identifier[mask] operator[SEP] Keyword[final] Keyword[long] identifier[capacity] operator[=] identifier[mask] operator[+] Other[1] operator[SEP] Keyword[final] Keyword[long] identifier[currentTail] operator[=] identifier[lvProducerIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[consumerIndexCache] operator[=] identifier[lvConsumerIndexCache] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[wrapPoint] operator[=] identifier[currentTail] operator[-] identifier[capacity] operator[SEP] Keyword[if] operator[SEP] identifier[consumerIndexCache] operator[<=] identifier[wrapPoint] operator[SEP] {
Keyword[long] identifier[currHead] operator[=] identifier[lvConsumerIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currHead] operator[<=] identifier[wrapPoint] operator[SEP] {
Keyword[return] Other[1] operator[SEP]
}
Keyword[else] {
identifier[svConsumerIndexCache] operator[SEP] identifier[currHead] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[casProducerIndex] operator[SEP] identifier[currentTail] , identifier[currentTail] operator[+] Other[1] operator[SEP] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[final] Keyword[int] identifier[offset] operator[=] identifier[calcElementOffset] operator[SEP] identifier[currentTail] , identifier[mask] operator[SEP] operator[SEP] identifier[soElement] operator[SEP] identifier[offset] , identifier[e] operator[SEP] operator[SEP] Keyword[return] Other[0] operator[SEP]
}
|
public static CPRule remove(long CPRuleId)
throws com.liferay.commerce.product.exception.NoSuchCPRuleException {
return getPersistence().remove(CPRuleId);
} | class class_name[name] begin[{]
method[remove, return_type[type[CPRule]], modifier[public static], parameter[CPRuleId]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CPRule] identifier[remove] operator[SEP] Keyword[long] identifier[CPRuleId] operator[SEP] Keyword[throws] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[product] operator[SEP] identifier[exception] operator[SEP] identifier[NoSuchCPRuleException] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[CPRuleId] operator[SEP] operator[SEP]
}
|
public ListTopicsPagedResponse listTopics() throws Exception {
// [START pubsub_list_topics]
try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
ListTopicsRequest listTopicsRequest =
ListTopicsRequest.newBuilder().setProject(ProjectName.format(projectId)).build();
ListTopicsPagedResponse response = topicAdminClient.listTopics(listTopicsRequest);
Iterable<Topic> topics = response.iterateAll();
for (Topic topic : topics) {
// do something with the topic
}
return response;
}
// [END pubsub_list_topics]
} | class class_name[name] begin[{]
method[listTopics, return_type[type[ListTopicsPagedResponse]], modifier[public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=ListTopicsRequest, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=projectId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=ProjectName, selectors=[], type_arguments=None)], member=setProject, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=listTopicsRequest)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ListTopicsRequest, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=listTopicsRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listTopics, postfix_operators=[], prefix_operators=[], qualifier=topicAdminClient, selectors=[], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ListTopicsPagedResponse, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=iterateAll, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), name=topics)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Topic, sub_type=None))], dimensions=[], name=Iterable, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[]), control=EnhancedForControl(iterable=MemberReference(member=topics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=topic)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Topic, sub_type=None))), label=None), ReturnStatement(expression=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=topicAdminClient, type=ReferenceType(arguments=None, dimensions=[], name=TopicAdminClient, sub_type=None), value=MethodInvocation(arguments=[], member=create, postfix_operators=[], prefix_operators=[], qualifier=TopicAdminClient, selectors=[], type_arguments=None))])
end[}]
END[}] | Keyword[public] identifier[ListTopicsPagedResponse] identifier[listTopics] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[try] operator[SEP] identifier[TopicAdminClient] identifier[topicAdminClient] operator[=] identifier[TopicAdminClient] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] {
identifier[ListTopicsRequest] identifier[listTopicsRequest] operator[=] identifier[ListTopicsRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setProject] operator[SEP] identifier[ProjectName] operator[SEP] identifier[format] operator[SEP] identifier[projectId] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[ListTopicsPagedResponse] identifier[response] operator[=] identifier[topicAdminClient] operator[SEP] identifier[listTopics] operator[SEP] identifier[listTopicsRequest] operator[SEP] operator[SEP] identifier[Iterable] operator[<] identifier[Topic] operator[>] identifier[topics] operator[=] identifier[response] operator[SEP] identifier[iterateAll] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Topic] identifier[topic] operator[:] identifier[topics] operator[SEP] {
}
Keyword[return] identifier[response] operator[SEP]
}
}
|
@Override
public ListStreamsResult listStreams(ListStreamsRequest request) {
request = beforeClientExecution(request);
return executeListStreams(request);
} | class class_name[name] begin[{]
method[listStreams, return_type[type[ListStreamsResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeListStreams, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ListStreamsResult] identifier[listStreams] operator[SEP] identifier[ListStreamsRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeListStreams] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public long addAndGet(K key, long delta) {
outer: for (;;) {
AtomicLong atomic = map.get(key);
if (atomic == null) {
atomic = map.putIfAbsent(key, new AtomicLong(delta));
if (atomic == null) {
return delta;
}
// atomic is now non-null; fall through
}
for (;;) {
long oldValue = atomic.get();
if (oldValue == 0L) {
// don't compareAndSet a zero
if (map.replace(key, atomic, new AtomicLong(delta))) {
return delta;
}
// atomic replaced
continue outer;
}
long newValue = oldValue + delta;
if (atomic.compareAndSet(oldValue, newValue)) {
return newValue;
}
// value changed
}
}
} | class class_name[name] begin[{]
method[addAndGet, return_type[type[long]], modifier[public], parameter[key, delta]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), name=atomic)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AtomicLong, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=atomic, 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=atomic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=delta, 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=AtomicLong, sub_type=None))], member=putIfAbsent, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=atomic, 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=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))])), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=atomic, selectors=[], type_arguments=None), name=oldValue)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=oldValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0L), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=atomic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=delta, 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=AtomicLong, sub_type=None))], member=replace, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ContinueStatement(goto=outer, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=oldValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=delta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=newValue)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=oldValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareAndSet, postfix_operators=[], prefix_operators=[], qualifier=atomic, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=None, init=None, update=None), label=None)]), control=ForControl(condition=None, init=None, update=None), label=outer)
end[}]
END[}] | Keyword[public] Keyword[long] identifier[addAndGet] operator[SEP] identifier[K] identifier[key] , Keyword[long] identifier[delta] operator[SEP] {
identifier[outer] operator[:] Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[AtomicLong] identifier[atomic] operator[=] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[atomic] operator[==] Other[null] operator[SEP] {
identifier[atomic] operator[=] identifier[map] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[key] , Keyword[new] identifier[AtomicLong] operator[SEP] identifier[delta] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[atomic] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[delta] operator[SEP]
}
}
Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[long] identifier[oldValue] operator[=] identifier[atomic] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[oldValue] operator[==] Other[0L] operator[SEP] {
Keyword[if] operator[SEP] identifier[map] operator[SEP] identifier[replace] operator[SEP] identifier[key] , identifier[atomic] , Keyword[new] identifier[AtomicLong] operator[SEP] identifier[delta] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[delta] operator[SEP]
}
Keyword[continue] identifier[outer] operator[SEP]
}
Keyword[long] identifier[newValue] operator[=] identifier[oldValue] operator[+] identifier[delta] operator[SEP] Keyword[if] operator[SEP] identifier[atomic] operator[SEP] identifier[compareAndSet] operator[SEP] identifier[oldValue] , identifier[newValue] operator[SEP] operator[SEP] {
Keyword[return] identifier[newValue] operator[SEP]
}
}
}
}
|
public ApiResponse<ConfigResponse> getConfigurationWithHttpInfo(String types) throws ApiException {
com.squareup.okhttp.Call call = getConfigurationValidateBeforeCall(types, null, null);
Type localVarReturnType = new TypeToken<ConfigResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | class class_name[name] begin[{]
method[getConfigurationWithHttpInfo, return_type[type[ApiResponse]], modifier[public], parameter[types]] begin[{]
local_variable[type[com], call]
local_variable[type[Type], localVarReturnType]
return[call[apiClient.execute, parameter[member[.call], member[.localVarReturnType]]]]
end[}]
END[}] | Keyword[public] identifier[ApiResponse] operator[<] identifier[ConfigResponse] operator[>] identifier[getConfigurationWithHttpInfo] operator[SEP] identifier[String] identifier[types] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[getConfigurationValidateBeforeCall] operator[SEP] identifier[types] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[Type] identifier[localVarReturnType] operator[=] Keyword[new] identifier[TypeToken] operator[<] identifier[ConfigResponse] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[execute] operator[SEP] identifier[call] , identifier[localVarReturnType] operator[SEP] operator[SEP]
}
|
public double valueSum() {
// We want the exp(log-sum-exp), for stability
// This rearranges to exp(a)*(sum-exp)
double max = 0.0;
for (int[] assignment : this) {
double v = getAssignmentLogValue(assignment);
if (v > max) {
max = v;
}
}
double sumExp = 0.0;
for (int[] assignment : this) {
double assigmentLogValue = getAssignmentLogValue(assignment);
assert !Double.isNaN(assigmentLogValue);
sumExp += Math.exp(getAssignmentLogValue(assignment) - max);
}
assert !Double.isNaN(sumExp);
assert !Double.isNaN(max);
return sumExp * Math.exp(max);
} | class class_name[name] begin[{]
method[valueSum, return_type[type[double]], modifier[public], parameter[]] begin[{]
local_variable[type[double], max]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=assignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAssignmentLogValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=v)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=assignment)], modifiers=set(), type=BasicType(dimensions=[None], name=int))), label=None)
local_variable[type[double], sumExp]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=assignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAssignmentLogValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=assigmentLogValue)], modifiers=set(), type=BasicType(dimensions=[], name=double)), AssertStatement(condition=MethodInvocation(arguments=[MemberReference(member=assigmentLogValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNaN, postfix_operators=[], prefix_operators=['!'], qualifier=Double, selectors=[], type_arguments=None), label=None, value=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sumExp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=assignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAssignmentLogValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=exp, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=assignment)], modifiers=set(), type=BasicType(dimensions=[None], name=int))), label=None)
AssertStatement(condition=MethodInvocation(arguments=[MemberReference(member=sumExp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNaN, postfix_operators=[], prefix_operators=['!'], qualifier=Double, selectors=[], type_arguments=None), label=None, value=None)
AssertStatement(condition=MethodInvocation(arguments=[MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNaN, postfix_operators=[], prefix_operators=['!'], qualifier=Double, selectors=[], type_arguments=None), label=None, value=None)
return[binary_operation[member[.sumExp], *, call[Math.exp, parameter[member[.max]]]]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[valueSum] operator[SEP] operator[SEP] {
Keyword[double] identifier[max] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[assignment] operator[:] Keyword[this] operator[SEP] {
Keyword[double] identifier[v] operator[=] identifier[getAssignmentLogValue] operator[SEP] identifier[assignment] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[v] operator[>] identifier[max] operator[SEP] {
identifier[max] operator[=] identifier[v] operator[SEP]
}
}
Keyword[double] identifier[sumExp] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[assignment] operator[:] Keyword[this] operator[SEP] {
Keyword[double] identifier[assigmentLogValue] operator[=] identifier[getAssignmentLogValue] operator[SEP] identifier[assignment] operator[SEP] operator[SEP] Keyword[assert] operator[!] identifier[Double] operator[SEP] identifier[isNaN] operator[SEP] identifier[assigmentLogValue] operator[SEP] operator[SEP] identifier[sumExp] operator[+=] identifier[Math] operator[SEP] identifier[exp] operator[SEP] identifier[getAssignmentLogValue] operator[SEP] identifier[assignment] operator[SEP] operator[-] identifier[max] operator[SEP] operator[SEP]
}
Keyword[assert] operator[!] identifier[Double] operator[SEP] identifier[isNaN] operator[SEP] identifier[sumExp] operator[SEP] operator[SEP] Keyword[assert] operator[!] identifier[Double] operator[SEP] identifier[isNaN] operator[SEP] identifier[max] operator[SEP] operator[SEP] Keyword[return] identifier[sumExp] operator[*] identifier[Math] operator[SEP] identifier[exp] operator[SEP] identifier[max] operator[SEP] operator[SEP]
}
|
public boolean contains(int vertex1, int vertex2) {
SparseDirectedTypedEdgeSet<T> edges = vertexToEdges.get(vertex1);
return edges != null && edges.connects(vertex2);
} | class class_name[name] begin[{]
method[contains, return_type[type[boolean]], modifier[public], parameter[vertex1, vertex2]] begin[{]
local_variable[type[SparseDirectedTypedEdgeSet], edges]
return[binary_operation[binary_operation[member[.edges], !=, literal[null]], &&, call[edges.connects, parameter[member[.vertex2]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[contains] operator[SEP] Keyword[int] identifier[vertex1] , Keyword[int] identifier[vertex2] operator[SEP] {
identifier[SparseDirectedTypedEdgeSet] operator[<] identifier[T] operator[>] identifier[edges] operator[=] identifier[vertexToEdges] operator[SEP] identifier[get] operator[SEP] identifier[vertex1] operator[SEP] operator[SEP] Keyword[return] identifier[edges] operator[!=] Other[null] operator[&&] identifier[edges] operator[SEP] identifier[connects] operator[SEP] identifier[vertex2] operator[SEP] operator[SEP]
}
|
public static String getValue(String xpath, Document document) throws XPathExpressionException {
XPath xPathProcessor = XPathFactory.newInstance().newXPath();
return xPathProcessor.compile(xpath).evaluate(document);
} | class class_name[name] begin[{]
method[getValue, return_type[type[String]], modifier[public static], parameter[xpath, document]] begin[{]
local_variable[type[XPath], xPathProcessor]
return[call[xPathProcessor.compile, parameter[member[.xpath]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getValue] operator[SEP] identifier[String] identifier[xpath] , identifier[Document] identifier[document] operator[SEP] Keyword[throws] identifier[XPathExpressionException] {
identifier[XPath] identifier[xPathProcessor] operator[=] identifier[XPathFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[newXPath] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[xPathProcessor] operator[SEP] identifier[compile] operator[SEP] identifier[xpath] operator[SEP] operator[SEP] identifier[evaluate] operator[SEP] identifier[document] operator[SEP] operator[SEP]
}
|
public HtmlSanitizer.Policy apply(@Nonnull HtmlStreamEventReceiver out) {
return new ElementAndAttributePolicyBasedSanitizerPolicy(
postprocessor.wrap(out), policies, textContainers);
} | class class_name[name] begin[{]
method[apply, return_type[type[HtmlSanitizer]], modifier[public], parameter[out]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrap, postfix_operators=[], prefix_operators=[], qualifier=postprocessor, selectors=[], type_arguments=None), MemberReference(member=policies, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=textContainers, 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=ElementAndAttributePolicyBasedSanitizerPolicy, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[HtmlSanitizer] operator[SEP] identifier[Policy] identifier[apply] operator[SEP] annotation[@] identifier[Nonnull] identifier[HtmlStreamEventReceiver] identifier[out] operator[SEP] {
Keyword[return] Keyword[new] identifier[ElementAndAttributePolicyBasedSanitizerPolicy] operator[SEP] identifier[postprocessor] operator[SEP] identifier[wrap] operator[SEP] identifier[out] operator[SEP] , identifier[policies] , identifier[textContainers] operator[SEP] operator[SEP]
}
|
public static <K, V> Map<K, V> zip(Collection<K> keys, Collection<V> values) {
if (isEmpty(keys) || isEmpty(values)) {
return null;
}
final List<K> keyList = new ArrayList<K>(keys);
final List<V> valueList = new ArrayList<V>(values);
final int size = Math.min(keys.size(), values.size());
final Map<K, V> map = new HashMap<K, V>((int) (size / 0.75));
for (int i = 0; i < size; i++) {
map.put(keyList.get(i), valueList.get(i));
}
return map;
} | class class_name[name] begin[{]
method[zip, return_type[type[Map]], modifier[public static], parameter[keys, values]] begin[{]
if[binary_operation[call[.isEmpty, parameter[member[.keys]]], ||, call[.isEmpty, parameter[member[.values]]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[List], keyList]
local_variable[type[List], valueList]
local_variable[type[int], size]
local_variable[type[Map], map]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=keyList, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=valueList, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=map, 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[.map]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[zip] operator[SEP] identifier[Collection] operator[<] identifier[K] operator[>] identifier[keys] , identifier[Collection] operator[<] identifier[V] operator[>] identifier[values] operator[SEP] {
Keyword[if] operator[SEP] identifier[isEmpty] operator[SEP] identifier[keys] operator[SEP] operator[||] identifier[isEmpty] operator[SEP] identifier[values] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[K] operator[>] identifier[keyList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[K] operator[>] operator[SEP] identifier[keys] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[V] operator[>] identifier[valueList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[V] operator[>] operator[SEP] identifier[values] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[size] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[keys] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[values] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[map] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[size] operator[/] literal[Float] 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] {
identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[keyList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] , identifier[valueList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[map] operator[SEP]
}
|
public static HistogramAggregationIterator create(final List<HistogramSpan> spans,
final long start_time,
final long end_time,
final HistogramAggregation aggregation,
final DownsamplingSpecification downsampler,
final long query_start,
final long query_end,
final boolean is_rollup) {
final int size = spans.size();
final HistogramSeekableView[] iterators = new HistogramSeekableView[size];
for (int i = 0; i < size; i++) {
HistogramSeekableView it;
if (downsampler == DownsamplingSpecification.NO_DOWNSAMPLER) {
it = spans.get(i).spanIterator();
} else {
it = spans.get(i).downsampler(start_time, end_time, downsampler,
is_rollup, query_start, query_end);
}
iterators[i] = it;
}
return new HistogramAggregationIterator(iterators, start_time,
end_time, aggregation);
} | class class_name[name] begin[{]
method[create, return_type[type[HistogramAggregationIterator]], modifier[public static], parameter[spans, start_time, end_time, aggregation, downsampler, query_start, query_end, is_rollup]] begin[{]
local_variable[type[int], size]
local_variable[type[HistogramSeekableView], iterators]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=it)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HistogramSeekableView, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=downsampler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NO_DOWNSAMPLER, postfix_operators=[], prefix_operators=[], qualifier=DownsamplingSpecification, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=it, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=spans, selectors=[MethodInvocation(arguments=[MemberReference(member=start_time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=end_time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=downsampler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=is_rollup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=query_start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=query_end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=downsampler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=it, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=spans, selectors=[MethodInvocation(arguments=[], member=spanIterator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=iterators, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=it, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=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[ClassCreator(arguments=[MemberReference(member=iterators, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=start_time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=end_time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=aggregation, 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=HistogramAggregationIterator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[HistogramAggregationIterator] identifier[create] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[HistogramSpan] operator[>] identifier[spans] , Keyword[final] Keyword[long] identifier[start_time] , Keyword[final] Keyword[long] identifier[end_time] , Keyword[final] identifier[HistogramAggregation] identifier[aggregation] , Keyword[final] identifier[DownsamplingSpecification] identifier[downsampler] , Keyword[final] Keyword[long] identifier[query_start] , Keyword[final] Keyword[long] identifier[query_end] , Keyword[final] Keyword[boolean] identifier[is_rollup] operator[SEP] {
Keyword[final] Keyword[int] identifier[size] operator[=] identifier[spans] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[HistogramSeekableView] operator[SEP] operator[SEP] identifier[iterators] operator[=] Keyword[new] identifier[HistogramSeekableView] operator[SEP] identifier[size] 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] {
identifier[HistogramSeekableView] identifier[it] operator[SEP] Keyword[if] operator[SEP] identifier[downsampler] operator[==] identifier[DownsamplingSpecification] operator[SEP] identifier[NO_DOWNSAMPLER] operator[SEP] {
identifier[it] operator[=] identifier[spans] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[spanIterator] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[it] operator[=] identifier[spans] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[downsampler] operator[SEP] identifier[start_time] , identifier[end_time] , identifier[downsampler] , identifier[is_rollup] , identifier[query_start] , identifier[query_end] operator[SEP] operator[SEP]
}
identifier[iterators] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[it] operator[SEP]
}
Keyword[return] Keyword[new] identifier[HistogramAggregationIterator] operator[SEP] identifier[iterators] , identifier[start_time] , identifier[end_time] , identifier[aggregation] operator[SEP] operator[SEP]
}
|
public static String getStringAfter(final String src, final String toSearch, final int start) {
final int ind = src.indexOf(toSearch, start);
if (ind == -1)
return "";
return src.substring(ind + toSearch.length());
} | class class_name[name] begin[{]
method[getStringAfter, return_type[type[String]], modifier[public static], parameter[src, toSearch, start]] begin[{]
local_variable[type[int], ind]
if[binary_operation[member[.ind], ==, literal[1]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
return[call[src.substring, parameter[binary_operation[member[.ind], +, call[toSearch.length, parameter[]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getStringAfter] operator[SEP] Keyword[final] identifier[String] identifier[src] , Keyword[final] identifier[String] identifier[toSearch] , Keyword[final] Keyword[int] identifier[start] operator[SEP] {
Keyword[final] Keyword[int] identifier[ind] operator[=] identifier[src] operator[SEP] identifier[indexOf] operator[SEP] identifier[toSearch] , identifier[start] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ind] operator[==] operator[-] Other[1] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[return] identifier[src] operator[SEP] identifier[substring] operator[SEP] identifier[ind] operator[+] identifier[toSearch] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static List<File> ensureWriteableDirectory(List<File> dirs)
throws IOException {
for (Iterator<File> i = dirs.iterator(); i.hasNext();) {
FileUtils.ensureWriteableDirectory(i.next());
}
return dirs;
} | class class_name[name] begin[{]
method[ensureWriteableDirectory, return_type[type[List]], modifier[public static], parameter[dirs]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None)], member=ensureWriteableDirectory, postfix_operators=[], prefix_operators=[], qualifier=FileUtils, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=dirs, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
return[member[.dirs]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[File] operator[>] identifier[ensureWriteableDirectory] operator[SEP] identifier[List] operator[<] identifier[File] operator[>] identifier[dirs] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[File] operator[>] identifier[i] operator[=] identifier[dirs] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[FileUtils] operator[SEP] identifier[ensureWriteableDirectory] operator[SEP] identifier[i] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[dirs] operator[SEP]
}
|
public ServiceFuture<SharedAccessAuthorizationRuleResourceInner> createOrUpdateAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String authorizationRuleName, SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters, final ServiceCallback<SharedAccessAuthorizationRuleResourceInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName, parameters), serviceCallback);
} | class class_name[name] begin[{]
method[createOrUpdateAuthorizationRuleAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, namespaceName, authorizationRuleName, parameters, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.createOrUpdateAuthorizationRuleWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.namespaceName], member[.authorizationRuleName], member[.parameters]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[SharedAccessAuthorizationRuleResourceInner] operator[>] identifier[createOrUpdateAuthorizationRuleAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[namespaceName] , identifier[String] identifier[authorizationRuleName] , identifier[SharedAccessAuthorizationRuleCreateOrUpdateParameters] identifier[parameters] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[SharedAccessAuthorizationRuleResourceInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[createOrUpdateAuthorizationRuleWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[namespaceName] , identifier[authorizationRuleName] , identifier[parameters] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
private OkHttpConnector connector(GitHubServerConfig config) {
OkHttpClient client = new OkHttpClient().setProxy(getProxy(defaultIfBlank(config.getApiUrl(), GITHUB_URL)));
if (config.getClientCacheSize() > 0) {
Cache cache = toCacheDir().apply(config);
client.setCache(cache);
}
return new OkHttpConnector(new OkUrlFactory(client));
} | class class_name[name] begin[{]
method[connector, return_type[type[OkHttpConnector]], modifier[private], parameter[config]] begin[{]
local_variable[type[OkHttpClient], client]
if[binary_operation[call[config.getClientCacheSize, parameter[]], >, literal[0]]] begin[{]
local_variable[type[Cache], cache]
call[client.setCache, parameter[member[.cache]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=client, 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=OkUrlFactory, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OkHttpConnector, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[OkHttpConnector] identifier[connector] operator[SEP] identifier[GitHubServerConfig] identifier[config] operator[SEP] {
identifier[OkHttpClient] identifier[client] operator[=] Keyword[new] identifier[OkHttpClient] operator[SEP] operator[SEP] operator[SEP] identifier[setProxy] operator[SEP] identifier[getProxy] operator[SEP] identifier[defaultIfBlank] operator[SEP] identifier[config] operator[SEP] identifier[getApiUrl] operator[SEP] operator[SEP] , identifier[GITHUB_URL] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[getClientCacheSize] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[Cache] identifier[cache] operator[=] identifier[toCacheDir] operator[SEP] operator[SEP] operator[SEP] identifier[apply] operator[SEP] identifier[config] operator[SEP] operator[SEP] identifier[client] operator[SEP] identifier[setCache] operator[SEP] identifier[cache] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[OkHttpConnector] operator[SEP] Keyword[new] identifier[OkUrlFactory] operator[SEP] identifier[client] operator[SEP] operator[SEP] operator[SEP]
}
|
public int hasParameters(final String... iNames) {
int found = 0;
if (iNames != null && request.parameters != null)
for (String name : iNames)
found += request.parameters.containsKey(name) ? 1 : 0;
return found;
} | class class_name[name] begin[{]
method[hasParameters, return_type[type[int]], modifier[public], parameter[iNames]] begin[{]
local_variable[type[int], found]
if[binary_operation[binary_operation[member[.iNames], !=, literal[null]], &&, binary_operation[member[request.parameters], !=, literal[null]]]] begin[{]
ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=found, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=request.parameters, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))), label=None), control=EnhancedForControl(iterable=MemberReference(member=iNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.found]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[hasParameters] operator[SEP] Keyword[final] identifier[String] operator[...] identifier[iNames] operator[SEP] {
Keyword[int] identifier[found] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[iNames] operator[!=] Other[null] operator[&&] identifier[request] operator[SEP] identifier[parameters] operator[!=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[name] operator[:] identifier[iNames] operator[SEP] identifier[found] operator[+=] identifier[request] operator[SEP] identifier[parameters] operator[SEP] identifier[containsKey] operator[SEP] identifier[name] operator[SEP] operator[?] Other[1] operator[:] Other[0] operator[SEP] Keyword[return] identifier[found] operator[SEP]
}
|
public Object[] toArray()
{
Object[] result = new Object[size()];
Iterator<E> e = iterator();
for (int i = 0; e.hasNext(); i++)
{
result[i] = e.next();
}
return result;
} | class class_name[name] begin[{]
method[toArray, return_type[type[Object]], modifier[public], parameter[]] begin[{]
local_variable[type[Object], result]
local_variable[type[Iterator], e]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), 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[.result]]
end[}]
END[}] | Keyword[public] identifier[Object] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] {
identifier[Object] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[E] operator[>] identifier[e] operator[=] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[e] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[e] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public FessMessages addErrorsPropertyTypeFloat(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_property_type_float, arg0));
return this;
} | class class_name[name] begin[{]
method[addErrorsPropertyTypeFloat, return_type[type[FessMessages]], modifier[public], parameter[property, arg0]] begin[{]
call[.assertPropertyNotNull, parameter[member[.property]]]
call[.add, parameter[member[.property], ClassCreator(arguments=[MemberReference(member=ERRORS_property_type_float, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=arg0, 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=UserMessage, sub_type=None))]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[FessMessages] identifier[addErrorsPropertyTypeFloat] operator[SEP] identifier[String] identifier[property] , identifier[String] identifier[arg0] operator[SEP] {
identifier[assertPropertyNotNull] operator[SEP] identifier[property] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[property] , Keyword[new] identifier[UserMessage] operator[SEP] identifier[ERRORS_property_type_float] , identifier[arg0] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public EClass getPGPRG() {
if (pgprgEClass == null) {
pgprgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(423);
}
return pgprgEClass;
} | class class_name[name] begin[{]
method[getPGPRG, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.pgprgEClass], ==, literal[null]]] begin[{]
assign[member[.pgprgEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=423)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.pgprgEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getPGPRG] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[pgprgEClass] operator[==] Other[null] operator[SEP] {
identifier[pgprgEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[AfplibPackage] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[423] operator[SEP] operator[SEP]
}
Keyword[return] identifier[pgprgEClass] operator[SEP]
}
|
public Observable<Tuple2<LoaderType, BucketConfig>> loadConfig(final NetworkAddress seedNode, final String bucket,
final String password) {
LOGGER.debug("Loading Config for bucket {}", bucket);
return loadConfig(seedNode, bucket, bucket, password);
} | class class_name[name] begin[{]
method[loadConfig, return_type[type[Observable]], modifier[public], parameter[seedNode, bucket, password]] begin[{]
call[LOGGER.debug, parameter[literal["Loading Config for bucket {}"], member[.bucket]]]
return[call[.loadConfig, parameter[member[.seedNode], member[.bucket], member[.bucket], member[.password]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Tuple2] operator[<] identifier[LoaderType] , identifier[BucketConfig] operator[>] operator[>] identifier[loadConfig] operator[SEP] Keyword[final] identifier[NetworkAddress] identifier[seedNode] , Keyword[final] identifier[String] identifier[bucket] , Keyword[final] identifier[String] identifier[password] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[bucket] operator[SEP] operator[SEP] Keyword[return] identifier[loadConfig] operator[SEP] identifier[seedNode] , identifier[bucket] , identifier[bucket] , identifier[password] operator[SEP] operator[SEP]
}
|
public void addToTail(QueueElement qe) {
checkElementFree(qe);
if (head == null) {
head = qe;
tail = qe;
qe.queue = this;
} else {
qe.previous = tail;
qe.next = null;
tail.next = qe;
tail = qe;
}
qe.queue = this;
numElements++;
} | class class_name[name] begin[{]
method[addToTail, return_type[void], modifier[public], parameter[qe]] begin[{]
call[.checkElementFree, parameter[member[.qe]]]
if[binary_operation[member[.head], ==, literal[null]]] begin[{]
assign[member[.head], member[.qe]]
assign[member[.tail], member[.qe]]
assign[member[qe.queue], THIS[]]
else begin[{]
assign[member[qe.previous], member[.tail]]
assign[member[qe.next], literal[null]]
assign[member[tail.next], member[.qe]]
assign[member[.tail], member[.qe]]
end[}]
assign[member[qe.queue], THIS[]]
member[.numElements]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addToTail] operator[SEP] identifier[QueueElement] identifier[qe] operator[SEP] {
identifier[checkElementFree] operator[SEP] identifier[qe] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[head] operator[==] Other[null] operator[SEP] {
identifier[head] operator[=] identifier[qe] operator[SEP] identifier[tail] operator[=] identifier[qe] operator[SEP] identifier[qe] operator[SEP] identifier[queue] operator[=] Keyword[this] operator[SEP]
}
Keyword[else] {
identifier[qe] operator[SEP] identifier[previous] operator[=] identifier[tail] operator[SEP] identifier[qe] operator[SEP] identifier[next] operator[=] Other[null] operator[SEP] identifier[tail] operator[SEP] identifier[next] operator[=] identifier[qe] operator[SEP] identifier[tail] operator[=] identifier[qe] operator[SEP]
}
identifier[qe] operator[SEP] identifier[queue] operator[=] Keyword[this] operator[SEP] identifier[numElements] operator[++] operator[SEP]
}
|
protected StackableOperator createTermOperator(Term argument, int pos, Functor functor)
{
return new PositionalContextOperator(argument, pos, false, null, false, null, contextStack.peek());
} | class class_name[name] begin[{]
method[createTermOperator, return_type[type[StackableOperator]], modifier[protected], parameter[argument, pos, functor]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=argument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MethodInvocation(arguments=[], member=peek, postfix_operators=[], prefix_operators=[], qualifier=contextStack, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PositionalContextOperator, sub_type=None))]
end[}]
END[}] | Keyword[protected] identifier[StackableOperator] identifier[createTermOperator] operator[SEP] identifier[Term] identifier[argument] , Keyword[int] identifier[pos] , identifier[Functor] identifier[functor] operator[SEP] {
Keyword[return] Keyword[new] identifier[PositionalContextOperator] operator[SEP] identifier[argument] , identifier[pos] , literal[boolean] , Other[null] , literal[boolean] , Other[null] , identifier[contextStack] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public final Set<FilterEntry<T>> getAllFilterEntrys() {
HashSet<FilterEntry<T>> rs = new HashSet<>();
rs.addAll(getFilterEntrys());
rs.addAll(getFilterExpectEntrys());
return rs;
} | class class_name[name] begin[{]
method[getAllFilterEntrys, return_type[type[Set]], modifier[final public], parameter[]] begin[{]
local_variable[type[HashSet], rs]
call[rs.addAll, parameter[call[.getFilterEntrys, parameter[]]]]
call[rs.addAll, parameter[call[.getFilterExpectEntrys, parameter[]]]]
return[member[.rs]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Set] operator[<] identifier[FilterEntry] operator[<] identifier[T] operator[>] operator[>] identifier[getAllFilterEntrys] operator[SEP] operator[SEP] {
identifier[HashSet] operator[<] identifier[FilterEntry] operator[<] identifier[T] operator[>] operator[>] identifier[rs] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[rs] operator[SEP] identifier[addAll] operator[SEP] identifier[getFilterEntrys] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rs] operator[SEP] identifier[addAll] operator[SEP] identifier[getFilterExpectEntrys] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[rs] operator[SEP]
}
|
public void submitDifferencers()
{
assert !failed;
List<Differencer> differencers = new ArrayList<>();
// We need to difference all trees one against another
for (int i = 0; i < trees.size() - 1; ++i)
{
TreeResponse r1 = trees.get(i);
for (int j = i + 1; j < trees.size(); ++j)
{
TreeResponse r2 = trees.get(j);
Differencer differencer = new Differencer(desc, r1, r2);
differencers.add(differencer);
logger.debug("Queueing comparison {}", differencer);
}
}
waitForSync = new AtomicInteger(differencers.size());
for (Differencer differencer : differencers)
taskExecutor.submit(differencer);
trees.clear(); // allows gc to do its thing
} | class class_name[name] begin[{]
method[submitDifferencers, return_type[void], modifier[public], parameter[]] begin[{]
AssertStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), label=None, value=None)
local_variable[type[List], differencers]
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=trees, selectors=[], type_arguments=None), name=r1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TreeResponse, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=trees, selectors=[], type_arguments=None), name=r2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TreeResponse, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=desc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=r1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=r2, 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=Differencer, sub_type=None)), name=differencer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Differencer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=differencer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=differencers, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Queueing comparison {}"), MemberReference(member=differencer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=trees, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=trees, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
assign[member[.waitForSync], ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=differencers, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AtomicInteger, sub_type=None))]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=differencer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=submit, postfix_operators=[], prefix_operators=[], qualifier=taskExecutor, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=differencers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=differencer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Differencer, sub_type=None))), label=None)
call[trees.clear, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[submitDifferencers] operator[SEP] operator[SEP] {
Keyword[assert] operator[!] identifier[failed] operator[SEP] identifier[List] operator[<] identifier[Differencer] operator[>] identifier[differencers] operator[=] Keyword[new] identifier[ArrayList] 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[trees] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[TreeResponse] identifier[r1] operator[=] identifier[trees] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[i] operator[+] Other[1] operator[SEP] identifier[j] operator[<] identifier[trees] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[j] operator[SEP] {
identifier[TreeResponse] identifier[r2] operator[=] identifier[trees] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[Differencer] identifier[differencer] operator[=] Keyword[new] identifier[Differencer] operator[SEP] identifier[desc] , identifier[r1] , identifier[r2] operator[SEP] operator[SEP] identifier[differencers] operator[SEP] identifier[add] operator[SEP] identifier[differencer] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[differencer] operator[SEP] operator[SEP]
}
}
identifier[waitForSync] operator[=] Keyword[new] identifier[AtomicInteger] operator[SEP] identifier[differencers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Differencer] identifier[differencer] operator[:] identifier[differencers] operator[SEP] identifier[taskExecutor] operator[SEP] identifier[submit] operator[SEP] identifier[differencer] operator[SEP] operator[SEP] identifier[trees] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void markMergeRegions(FastQueue<float[]> regionColor,
FastQueue<Point2D_I32> modeLocation,
GrayS32 pixelToRegion ) {
for( int targetId = 0; targetId < modeLocation.size &&!stopRequested; targetId++ ) {
float[] color = regionColor.get(targetId);
Point2D_I32 location = modeLocation.get(targetId);
int x0 = location.x-searchRadius;
int x1 = location.x+searchRadius+1;
int y0 = location.y-searchRadius;
int y1 = location.y+searchRadius+1;
// ensure that all pixels it examines are inside the image
if( x0 < 0 ) x0 = 0;
if( x1 > pixelToRegion.width ) x1 = pixelToRegion.width;
if( y0 < 0 ) y0 = 0;
if( y1 > pixelToRegion.height ) y1 = pixelToRegion.height;
// look at the local neighborhood
for( int y = y0; y < y1; y++ ) {
for( int x = x0; x < x1; x++ ) {
int candidateId = pixelToRegion.unsafe_get(x,y);
// see if it is the same region
if( candidateId == targetId )
continue;
// see if the mode is near by
Point2D_I32 p = modeLocation.get(candidateId);
if( p.distance2(location) <= maxSpacialDistanceSq ) {
// see if the color is similar
float[] candidateColor = regionColor.get(candidateId);
float colorDistance = SegmentMeanShiftSearch.distanceSq(color,candidateColor);
if( colorDistance <= maxColorDistanceSq ) {
// mark the two regions as merged
markMerge(targetId, candidateId);
}
}
}
}
}
} | class class_name[name] begin[{]
method[markMergeRegions, return_type[void], modifier[protected], parameter[regionColor, modeLocation, pixelToRegion]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=targetId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=regionColor, selectors=[], type_arguments=None), name=color)], modifiers=set(), type=BasicType(dimensions=[None], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=targetId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=modeLocation, selectors=[], type_arguments=None), name=location)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Point2D_I32, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[]), operandr=MemberReference(member=searchRadius, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=x0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[]), operandr=MemberReference(member=searchRadius, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=x1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[]), operandr=MemberReference(member=searchRadius, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=y0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=location, selectors=[]), operandr=MemberReference(member=searchRadius, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=y1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=x0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=x0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=x1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=pixelToRegion, selectors=[]), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=x1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=pixelToRegion, selectors=[])), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=y0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=y0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=y1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=pixelToRegion, selectors=[]), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=y1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=pixelToRegion, selectors=[])), label=None)), ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unsafe_get, postfix_operators=[], prefix_operators=[], qualifier=pixelToRegion, selectors=[], type_arguments=None), name=candidateId)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=candidateId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=targetId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=candidateId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=modeLocation, selectors=[], type_arguments=None), name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Point2D_I32, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=distance2, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), operandr=MemberReference(member=maxSpacialDistanceSq, 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=candidateId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=regionColor, selectors=[], type_arguments=None), name=candidateColor)], modifiers=set(), type=BasicType(dimensions=[None], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=color, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=candidateColor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=distanceSq, postfix_operators=[], prefix_operators=[], qualifier=SegmentMeanShiftSearch, selectors=[], type_arguments=None), name=colorDistance)], modifiers=set(), type=BasicType(dimensions=[], name=float)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=colorDistance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxColorDistanceSq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=targetId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=candidateId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=markMerge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=x1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=x0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=x)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=x, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=y1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=y0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=y)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=y, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=targetId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=modeLocation, selectors=[]), operator=<), operandr=MemberReference(member=stopRequested, 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=targetId)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=targetId, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[markMergeRegions] operator[SEP] identifier[FastQueue] operator[<] Keyword[float] operator[SEP] operator[SEP] operator[>] identifier[regionColor] , identifier[FastQueue] operator[<] identifier[Point2D_I32] operator[>] identifier[modeLocation] , identifier[GrayS32] identifier[pixelToRegion] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[targetId] operator[=] Other[0] operator[SEP] identifier[targetId] operator[<] identifier[modeLocation] operator[SEP] identifier[size] operator[&&] operator[!] identifier[stopRequested] operator[SEP] identifier[targetId] operator[++] operator[SEP] {
Keyword[float] operator[SEP] operator[SEP] identifier[color] operator[=] identifier[regionColor] operator[SEP] identifier[get] operator[SEP] identifier[targetId] operator[SEP] operator[SEP] identifier[Point2D_I32] identifier[location] operator[=] identifier[modeLocation] operator[SEP] identifier[get] operator[SEP] identifier[targetId] operator[SEP] operator[SEP] Keyword[int] identifier[x0] operator[=] identifier[location] operator[SEP] identifier[x] operator[-] identifier[searchRadius] operator[SEP] Keyword[int] identifier[x1] operator[=] identifier[location] operator[SEP] identifier[x] operator[+] identifier[searchRadius] operator[+] Other[1] operator[SEP] Keyword[int] identifier[y0] operator[=] identifier[location] operator[SEP] identifier[y] operator[-] identifier[searchRadius] operator[SEP] Keyword[int] identifier[y1] operator[=] identifier[location] operator[SEP] identifier[y] operator[+] identifier[searchRadius] operator[+] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[x0] operator[<] Other[0] operator[SEP] identifier[x0] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[x1] operator[>] identifier[pixelToRegion] operator[SEP] identifier[width] operator[SEP] identifier[x1] operator[=] identifier[pixelToRegion] operator[SEP] identifier[width] operator[SEP] Keyword[if] operator[SEP] identifier[y0] operator[<] Other[0] operator[SEP] identifier[y0] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[y1] operator[>] identifier[pixelToRegion] operator[SEP] identifier[height] operator[SEP] identifier[y1] operator[=] identifier[pixelToRegion] operator[SEP] identifier[height] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[y] operator[=] identifier[y0] operator[SEP] identifier[y] operator[<] identifier[y1] operator[SEP] identifier[y] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[x] operator[=] identifier[x0] operator[SEP] identifier[x] operator[<] identifier[x1] operator[SEP] identifier[x] operator[++] operator[SEP] {
Keyword[int] identifier[candidateId] operator[=] identifier[pixelToRegion] operator[SEP] identifier[unsafe_get] operator[SEP] identifier[x] , identifier[y] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[candidateId] operator[==] identifier[targetId] operator[SEP] Keyword[continue] operator[SEP] identifier[Point2D_I32] identifier[p] operator[=] identifier[modeLocation] operator[SEP] identifier[get] operator[SEP] identifier[candidateId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[SEP] identifier[distance2] operator[SEP] identifier[location] operator[SEP] operator[<=] identifier[maxSpacialDistanceSq] operator[SEP] {
Keyword[float] operator[SEP] operator[SEP] identifier[candidateColor] operator[=] identifier[regionColor] operator[SEP] identifier[get] operator[SEP] identifier[candidateId] operator[SEP] operator[SEP] Keyword[float] identifier[colorDistance] operator[=] identifier[SegmentMeanShiftSearch] operator[SEP] identifier[distanceSq] operator[SEP] identifier[color] , identifier[candidateColor] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[colorDistance] operator[<=] identifier[maxColorDistanceSq] operator[SEP] {
identifier[markMerge] operator[SEP] identifier[targetId] , identifier[candidateId] operator[SEP] operator[SEP]
}
}
}
}
}
}
|
public List<DelegateListener<? extends BaseDelegateExecution>> getListeners(String eventName) {
List<DelegateListener<? extends BaseDelegateExecution>> listenerList = getListeners().get(eventName);
if (listenerList != null) {
return listenerList;
}
return Collections.emptyList();
} | class class_name[name] begin[{]
method[getListeners, return_type[type[List]], modifier[public], parameter[eventName]] begin[{]
local_variable[type[List], listenerList]
if[binary_operation[member[.listenerList], !=, literal[null]]] begin[{]
return[member[.listenerList]]
else begin[{]
None
end[}]
return[call[Collections.emptyList, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[DelegateListener] operator[<] operator[?] Keyword[extends] identifier[BaseDelegateExecution] operator[>] operator[>] identifier[getListeners] operator[SEP] identifier[String] identifier[eventName] operator[SEP] {
identifier[List] operator[<] identifier[DelegateListener] operator[<] operator[?] Keyword[extends] identifier[BaseDelegateExecution] operator[>] operator[>] identifier[listenerList] operator[=] identifier[getListeners] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[eventName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listenerList] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[listenerList] operator[SEP]
}
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
|
@Deprecated
public static String generateToken(String secret, String oid, String... payload) {
return generateToken(secret, Life.SHORT, oid, payload);
} | class class_name[name] begin[{]
method[generateToken, return_type[type[String]], modifier[public static], parameter[secret, oid, payload]] begin[{]
return[call[.generateToken, parameter[member[.secret], member[Life.SHORT], member[.oid], member[.payload]]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] identifier[String] identifier[generateToken] operator[SEP] identifier[String] identifier[secret] , identifier[String] identifier[oid] , identifier[String] operator[...] identifier[payload] operator[SEP] {
Keyword[return] identifier[generateToken] operator[SEP] identifier[secret] , identifier[Life] operator[SEP] identifier[SHORT] , identifier[oid] , identifier[payload] operator[SEP] operator[SEP]
}
|
public static void printOption(java.io.PrintStream stream,
Configurable configObj, Property prop)
{
if (prop.getType() != Property.Type.PROPERTY_FLAGS)
{
stream.printf(" %s; default= %s; type=%s;\n",
prop.getName(),
configObj.getPropertyAsString(prop.getName()),
prop.getType());
} else {
// it's a flag
stream.printf(" %s; default= %d; valid values=(",
prop.getName(),
configObj.getPropertyAsLong(prop.getName()));
int numSettings = prop.getNumFlagSettings();
long value = configObj.getPropertyAsLong(prop.getName());
for(int i = 0; i < numSettings; i++)
{
Property fprop = prop.getFlagConstant(i);
long flagMask = fprop.getDefault();
boolean isSet = (value & flagMask)>0;
stream.printf("%s%s; ",
isSet ? "+" : "-",
fprop.getName());
}
stream.printf("); type=%s;\n", prop.getType());
}
stream.printf(" help for %s: %s\n",
prop.getName(),
prop.getHelp() == null ? "no help available" : prop.getHelp());
} | class class_name[name] begin[{]
method[printOption, return_type[void], modifier[public static], parameter[stream, configObj, prop]] begin[{]
if[binary_operation[call[prop.getType, parameter[]], !=, member[Property.Type.PROPERTY_FLAGS]]] begin[{]
call[stream.printf, parameter[literal[" %s; default= %s; type=%s;\n"], call[prop.getName, parameter[]], call[configObj.getPropertyAsString, parameter[call[prop.getName, parameter[]]]], call[prop.getType, parameter[]]]]
else begin[{]
call[stream.printf, parameter[literal[" %s; default= %d; valid values=("], call[prop.getName, parameter[]], call[configObj.getPropertyAsLong, parameter[call[prop.getName, parameter[]]]]]]
local_variable[type[int], numSettings]
local_variable[type[long], value]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFlagConstant, postfix_operators=[], prefix_operators=[], qualifier=prop, selectors=[], type_arguments=None), name=fprop)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Property, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=fprop, selectors=[], type_arguments=None), name=flagMask)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=flagMask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), name=isSet)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s%s; "), TernaryExpression(condition=MemberReference(member=isSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-"), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="+")), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=fprop, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numSettings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[stream.printf, parameter[literal["); type=%s;\n"], call[prop.getType, parameter[]]]]
end[}]
call[stream.printf, parameter[literal[" help for %s: %s\n"], call[prop.getName, parameter[]], TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getHelp, postfix_operators=[], prefix_operators=[], qualifier=prop, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getHelp, postfix_operators=[], prefix_operators=[], qualifier=prop, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="no help available"))]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[printOption] operator[SEP] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[PrintStream] identifier[stream] , identifier[Configurable] identifier[configObj] , identifier[Property] identifier[prop] operator[SEP] {
Keyword[if] operator[SEP] identifier[prop] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[!=] identifier[Property] operator[SEP] identifier[Type] operator[SEP] identifier[PROPERTY_FLAGS] operator[SEP] {
identifier[stream] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[prop] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[configObj] operator[SEP] identifier[getPropertyAsString] operator[SEP] identifier[prop] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] , identifier[prop] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[stream] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[prop] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[configObj] operator[SEP] identifier[getPropertyAsLong] operator[SEP] identifier[prop] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[numSettings] operator[=] identifier[prop] operator[SEP] identifier[getNumFlagSettings] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[value] operator[=] identifier[configObj] operator[SEP] identifier[getPropertyAsLong] operator[SEP] identifier[prop] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[numSettings] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Property] identifier[fprop] operator[=] identifier[prop] operator[SEP] identifier[getFlagConstant] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[long] identifier[flagMask] operator[=] identifier[fprop] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isSet] operator[=] operator[SEP] identifier[value] operator[&] identifier[flagMask] operator[SEP] operator[>] Other[0] operator[SEP] identifier[stream] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[isSet] operator[?] literal[String] operator[:] literal[String] , identifier[fprop] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[stream] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[prop] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[stream] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[prop] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[prop] operator[SEP] identifier[getHelp] operator[SEP] operator[SEP] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[prop] operator[SEP] identifier[getHelp] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static MozuUrl deleteExtendedPropertyUrl(String key, String orderId, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/extendedproperties/{key}?updatemode={updateMode}&version={version}");
formatter.formatUrl("key", key);
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | class class_name[name] begin[{]
method[deleteExtendedPropertyUrl, return_type[type[MozuUrl]], modifier[public static], parameter[key, orderId, updateMode, version]] begin[{]
local_variable[type[UrlFormatter], formatter]
call[formatter.formatUrl, parameter[literal["key"], member[.key]]]
call[formatter.formatUrl, parameter[literal["orderId"], member[.orderId]]]
call[formatter.formatUrl, parameter[literal["updateMode"], member[.updateMode]]]
call[formatter.formatUrl, parameter[literal["version"], member[.version]]]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getResourceUrl, postfix_operators=[], prefix_operators=[], qualifier=formatter, selectors=[], type_arguments=None), MemberReference(member=TENANT_POD, postfix_operators=[], prefix_operators=[], qualifier=MozuUrl.UrlLocation, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MozuUrl, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[MozuUrl] identifier[deleteExtendedPropertyUrl] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[orderId] , identifier[String] identifier[updateMode] , identifier[String] identifier[version] operator[SEP] {
identifier[UrlFormatter] identifier[formatter] operator[=] Keyword[new] identifier[UrlFormatter] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[formatUrl] operator[SEP] literal[String] , identifier[key] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[formatUrl] operator[SEP] literal[String] , identifier[orderId] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[formatUrl] operator[SEP] literal[String] , identifier[updateMode] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[formatUrl] operator[SEP] literal[String] , identifier[version] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[MozuUrl] operator[SEP] identifier[formatter] operator[SEP] identifier[getResourceUrl] operator[SEP] operator[SEP] , identifier[MozuUrl] operator[SEP] identifier[UrlLocation] operator[SEP] identifier[TENANT_POD] operator[SEP] operator[SEP]
}
|
@Override
public ModifySnapshotScheduleResult modifySnapshotSchedule(ModifySnapshotScheduleRequest request) {
request = beforeClientExecution(request);
return executeModifySnapshotSchedule(request);
} | class class_name[name] begin[{]
method[modifySnapshotSchedule, return_type[type[ModifySnapshotScheduleResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeModifySnapshotSchedule, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ModifySnapshotScheduleResult] identifier[modifySnapshotSchedule] operator[SEP] identifier[ModifySnapshotScheduleRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeModifySnapshotSchedule] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static <K, V> BiMap<K, V> unmodifiableBiMap(BiMap<? extends K, ? extends V> bimap) {
return new UnmodifiableBiMap<K, V>(bimap, null);
} | class class_name[name] begin[{]
method[unmodifiableBiMap, return_type[type[BiMap]], modifier[public static], parameter[bimap]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=bimap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], 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=UnmodifiableBiMap, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[BiMap] operator[<] identifier[K] , identifier[V] operator[>] identifier[unmodifiableBiMap] operator[SEP] identifier[BiMap] operator[<] operator[?] Keyword[extends] identifier[K] , operator[?] Keyword[extends] identifier[V] operator[>] identifier[bimap] operator[SEP] {
Keyword[return] Keyword[new] identifier[UnmodifiableBiMap] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] identifier[bimap] , Other[null] operator[SEP] operator[SEP]
}
|
public static CPRuleUserSegmentRel[] findByCommerceUserSegmentEntryId_PrevAndNext(
long CPRuleUserSegmentRelId, long commerceUserSegmentEntryId,
OrderByComparator<CPRuleUserSegmentRel> orderByComparator)
throws com.liferay.commerce.product.exception.NoSuchCPRuleUserSegmentRelException {
return getPersistence()
.findByCommerceUserSegmentEntryId_PrevAndNext(CPRuleUserSegmentRelId,
commerceUserSegmentEntryId, orderByComparator);
} | class class_name[name] begin[{]
method[findByCommerceUserSegmentEntryId_PrevAndNext, return_type[type[CPRuleUserSegmentRel]], modifier[public static], parameter[CPRuleUserSegmentRelId, commerceUserSegmentEntryId, orderByComparator]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CPRuleUserSegmentRel] operator[SEP] operator[SEP] identifier[findByCommerceUserSegmentEntryId_PrevAndNext] operator[SEP] Keyword[long] identifier[CPRuleUserSegmentRelId] , Keyword[long] identifier[commerceUserSegmentEntryId] , identifier[OrderByComparator] operator[<] identifier[CPRuleUserSegmentRel] operator[>] identifier[orderByComparator] operator[SEP] Keyword[throws] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[product] operator[SEP] identifier[exception] operator[SEP] identifier[NoSuchCPRuleUserSegmentRelException] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[findByCommerceUserSegmentEntryId_PrevAndNext] operator[SEP] identifier[CPRuleUserSegmentRelId] , identifier[commerceUserSegmentEntryId] , identifier[orderByComparator] operator[SEP] operator[SEP]
}
|
private void removeEntriesStartingWith(String key) {
synchronized (eventMap) {
Iterator<String> iter = eventMap.keySet().iterator();
while (iter.hasNext()) {
String str = iter.next();
if (str.startsWith(key)) {
iter.remove();
}
}
}
} | class class_name[name] begin[{]
method[removeEntriesStartingWith, return_type[void], modifier[private], parameter[key]] begin[{]
SYNCHRONIZED[member[.eventMap]] BEGIN[{]
local_variable[type[Iterator], iter]
while[call[iter.hasNext, parameter[]]] begin[{]
local_variable[type[String], str]
if[call[str.startsWith, parameter[member[.key]]]] begin[{]
call[iter.remove, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[removeEntriesStartingWith] operator[SEP] identifier[String] identifier[key] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[eventMap] operator[SEP] {
identifier[Iterator] operator[<] identifier[String] operator[>] identifier[iter] operator[=] identifier[eventMap] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[str] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[str] operator[SEP] identifier[startsWith] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[iter] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public ApiResponse<ApiSuccessResponse> startMonitoringWithHttpInfo(StartMonitoringData startMonitoringData) throws ApiException {
com.squareup.okhttp.Call call = startMonitoringValidateBeforeCall(startMonitoringData, null, null);
Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | class class_name[name] begin[{]
method[startMonitoringWithHttpInfo, return_type[type[ApiResponse]], modifier[public], parameter[startMonitoringData]] begin[{]
local_variable[type[com], call]
local_variable[type[Type], localVarReturnType]
return[call[apiClient.execute, parameter[member[.call], member[.localVarReturnType]]]]
end[}]
END[}] | Keyword[public] identifier[ApiResponse] operator[<] identifier[ApiSuccessResponse] operator[>] identifier[startMonitoringWithHttpInfo] operator[SEP] identifier[StartMonitoringData] identifier[startMonitoringData] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[startMonitoringValidateBeforeCall] operator[SEP] identifier[startMonitoringData] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[Type] identifier[localVarReturnType] operator[=] Keyword[new] identifier[TypeToken] operator[<] identifier[ApiSuccessResponse] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[execute] operator[SEP] identifier[call] , identifier[localVarReturnType] operator[SEP] operator[SEP]
}
|
public String[] getLabels(Matcher matcher) {
if ((matcher instanceof AnyOfMatcher) && ((AnyOfMatcher)matcher).characters.toString().equals(matcher.getLabel())) {
AnyOfMatcher cMatcher = (AnyOfMatcher) matcher;
if (!cMatcher.characters.isSubtractive()) {
String[] labels = new String[cMatcher.characters.getChars().length];
for (int i = 0; i < labels.length; i++) {
labels[i] = '\'' + String.valueOf(cMatcher.characters.getChars()[i]) + '\'';
}
return labels;
}
}
return new String[] {matcher.getLabel()};
} | class class_name[name] begin[{]
method[getLabels, return_type[type[String]], modifier[public], parameter[matcher]] begin[{]
if[binary_operation[binary_operation[member[.matcher], instanceof, type[AnyOfMatcher]], &&, Cast(expression=MemberReference(member=matcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AnyOfMatcher, sub_type=None))]] begin[{]
local_variable[type[AnyOfMatcher], cMatcher]
if[call[cMatcher.characters.isSubtractive, parameter[]]] begin[{]
local_variable[type[String], labels]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=labels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\''), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getChars, postfix_operators=[], prefix_operators=[], qualifier=cMatcher.characters, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\''), operator=+)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=labels, 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[.labels]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getLabel, postfix_operators=[], prefix_operators=[], qualifier=matcher, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[String] operator[SEP] operator[SEP] identifier[getLabels] operator[SEP] identifier[Matcher] identifier[matcher] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[matcher] Keyword[instanceof] identifier[AnyOfMatcher] operator[SEP] operator[&&] operator[SEP] operator[SEP] identifier[AnyOfMatcher] operator[SEP] identifier[matcher] operator[SEP] operator[SEP] identifier[characters] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[matcher] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[AnyOfMatcher] identifier[cMatcher] operator[=] operator[SEP] identifier[AnyOfMatcher] operator[SEP] identifier[matcher] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[cMatcher] operator[SEP] identifier[characters] operator[SEP] identifier[isSubtractive] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[labels] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[cMatcher] operator[SEP] identifier[characters] operator[SEP] identifier[getChars] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[labels] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[labels] operator[SEP] identifier[i] operator[SEP] operator[=] literal[String] operator[+] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[cMatcher] operator[SEP] identifier[characters] operator[SEP] identifier[getChars] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP]
}
Keyword[return] identifier[labels] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[matcher] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP]
} operator[SEP]
}
|
public static List<Class<?>> getAllsuperClasses(Class<?> aClass){
List<Class<?>> result = new ArrayList<Class<?>>();
result.add(aClass);
Class<?> superclass = aClass.getSuperclass();
while(!isNull(superclass) && superclass != Object.class){
result.add(superclass);
superclass = superclass.getSuperclass();
}
return result;
} | class class_name[name] begin[{]
method[getAllsuperClasses, return_type[type[List]], modifier[public static], parameter[aClass]] begin[{]
local_variable[type[List], result]
call[result.add, parameter[member[.aClass]]]
local_variable[type[Class], superclass]
while[binary_operation[call[.isNull, parameter[member[.superclass]]], &&, binary_operation[member[.superclass], !=, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]] begin[{]
call[result.add, parameter[member[.superclass]]]
assign[member[.superclass], call[superclass.getSuperclass, parameter[]]]
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[getAllsuperClasses] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[aClass] operator[SEP] {
identifier[List] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[aClass] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[superclass] operator[=] identifier[aClass] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[isNull] operator[SEP] identifier[superclass] operator[SEP] operator[&&] identifier[superclass] operator[!=] identifier[Object] operator[SEP] Keyword[class] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[superclass] operator[SEP] operator[SEP] identifier[superclass] operator[=] identifier[superclass] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static float distance(float x1, float y1, float x2, float y2) {
return (float) Math.sqrt(distanceSquared(x1, y1, x2, y2));
} | class class_name[name] begin[{]
method[distance, return_type[type[float]], modifier[public static], parameter[x1, y1, x2, y2]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=x1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=x2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=distanceSquared, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=sqrt, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=float))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[float] identifier[distance] operator[SEP] Keyword[float] identifier[x1] , Keyword[float] identifier[y1] , Keyword[float] identifier[x2] , Keyword[float] identifier[y2] operator[SEP] {
Keyword[return] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[distanceSquared] operator[SEP] identifier[x1] , identifier[y1] , identifier[x2] , identifier[y2] operator[SEP] operator[SEP] operator[SEP]
}
|
@CheckReturnValue
public GuildManager setVerificationLevel(Guild.VerificationLevel level)
{
Checks.notNull(level, "Level");
Checks.check(level != Guild.VerificationLevel.UNKNOWN, "Level must not be UNKNOWN");
this.verificationLevel = level.getKey();
set |= VERIFICATION_LEVEL;
return this;
} | class class_name[name] begin[{]
method[setVerificationLevel, return_type[type[GuildManager]], modifier[public], parameter[level]] begin[{]
call[Checks.notNull, parameter[member[.level], literal["Level"]]]
call[Checks.check, parameter[binary_operation[member[.level], !=, member[Guild.VerificationLevel.UNKNOWN]], literal["Level must not be UNKNOWN"]]]
assign[THIS[member[None.verificationLevel]], call[level.getKey, parameter[]]]
assign[member[.set], member[.VERIFICATION_LEVEL]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] Keyword[public] identifier[GuildManager] identifier[setVerificationLevel] operator[SEP] identifier[Guild] operator[SEP] identifier[VerificationLevel] identifier[level] operator[SEP] {
identifier[Checks] operator[SEP] identifier[notNull] operator[SEP] identifier[level] , literal[String] operator[SEP] operator[SEP] identifier[Checks] operator[SEP] identifier[check] operator[SEP] identifier[level] operator[!=] identifier[Guild] operator[SEP] identifier[VerificationLevel] operator[SEP] identifier[UNKNOWN] , literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[verificationLevel] operator[=] identifier[level] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[|=] identifier[VERIFICATION_LEVEL] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static <T> Stream<T> observe(final BlockingQueue<T> queue, final BooleanSupplier hasMore, final long maxWaitIntervalInMillis,
final Runnable onComplete) {
N.checkArgNotNull(queue, "queue");
N.checkArgNotNull(hasMore, "hasMore");
N.checkArgPositive(maxWaitIntervalInMillis, "maxWaitIntervalInMillis");
N.checkArgNotNull(onComplete, "onComplete");
final Iterator<T> iter = new ObjIterator<T>() {
private T next = null;
@Override
public boolean hasNext() {
if (next == null && (hasMore.getAsBoolean() || queue.size() > 0)) {
try {
do {
next = queue.poll(maxWaitIntervalInMillis, TimeUnit.MILLISECONDS);
} while (next == null && (hasMore.getAsBoolean() || queue.size() > 0));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
return next != null;
}
@Override
public T next() {
if (hasNext() == false) {
throw new NoSuchElementException();
}
final T res = next;
next = null;
return res;
}
};
return of(iter).onClose(onComplete);
} | class class_name[name] begin[{]
method[observe, return_type[type[Stream]], modifier[public static], parameter[queue, hasMore, maxWaitIntervalInMillis, onComplete]] begin[{]
call[N.checkArgNotNull, parameter[member[.queue], literal["queue"]]]
call[N.checkArgNotNull, parameter[member[.hasMore], literal["hasMore"]]]
call[N.checkArgPositive, parameter[member[.maxWaitIntervalInMillis], literal["maxWaitIntervalInMillis"]]]
call[N.checkArgNotNull, parameter[member[.onComplete], literal["onComplete"]]]
local_variable[type[Iterator], iter]
return[call[.of, parameter[member[.iter]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Stream] operator[<] identifier[T] operator[>] identifier[observe] operator[SEP] Keyword[final] identifier[BlockingQueue] operator[<] identifier[T] operator[>] identifier[queue] , Keyword[final] identifier[BooleanSupplier] identifier[hasMore] , Keyword[final] Keyword[long] identifier[maxWaitIntervalInMillis] , Keyword[final] identifier[Runnable] identifier[onComplete] operator[SEP] {
identifier[N] operator[SEP] identifier[checkArgNotNull] operator[SEP] identifier[queue] , literal[String] operator[SEP] operator[SEP] identifier[N] operator[SEP] identifier[checkArgNotNull] operator[SEP] identifier[hasMore] , literal[String] operator[SEP] operator[SEP] identifier[N] operator[SEP] identifier[checkArgPositive] operator[SEP] identifier[maxWaitIntervalInMillis] , literal[String] operator[SEP] operator[SEP] identifier[N] operator[SEP] identifier[checkArgNotNull] operator[SEP] identifier[onComplete] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[T] operator[>] identifier[iter] operator[=] Keyword[new] identifier[ObjIterator] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] {
Keyword[private] identifier[T] identifier[next] operator[=] Other[null] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[next] operator[==] Other[null] operator[&&] operator[SEP] identifier[hasMore] operator[SEP] identifier[getAsBoolean] operator[SEP] operator[SEP] operator[||] identifier[queue] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[do] {
identifier[next] operator[=] identifier[queue] operator[SEP] identifier[poll] operator[SEP] identifier[maxWaitIntervalInMillis] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[next] operator[==] Other[null] operator[&&] operator[SEP] identifier[hasMore] operator[SEP] identifier[getAsBoolean] operator[SEP] operator[SEP] operator[||] identifier[queue] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[next] operator[!=] Other[null] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[T] identifier[next] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[==] literal[boolean] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoSuchElementException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[T] identifier[res] operator[=] identifier[next] operator[SEP] identifier[next] operator[=] Other[null] operator[SEP] Keyword[return] identifier[res] operator[SEP]
}
} operator[SEP] Keyword[return] identifier[of] operator[SEP] identifier[iter] operator[SEP] operator[SEP] identifier[onClose] operator[SEP] identifier[onComplete] operator[SEP] operator[SEP]
}
|
public @NotNull Link resolveLink(@NotNull Link link, @NotNull InternalLinkResolverOptions options) {
LinkRequest linkRequest = link.getLinkRequest();
ValueMap props = linkRequest.getResourceProperties();
// flag to indicate whether any link reference parameter set
boolean referenceSet = false;
// first try to get direct link target page
Page targetPage = link.getLinkRequest().getPage();
if (targetPage != null) {
referenceSet = true;
}
// if no target page is set get internal path that points to target page
if (targetPage == null) {
String targetPath = props.get(options.getPrimaryLinkRefProperty(), String.class);
if (StringUtils.isNotEmpty(targetPath)) {
referenceSet = true;
}
targetPage = getTargetPage(targetPath, options);
}
UrlHandlerConfig resolvingUrlHandlerConfig = urlHandlerConfig;
UrlHandler resolvingUrlHandler = urlHandler;
// use URL handler from target context for link URL building
if (targetPage != null && useTargetContext(options)) {
Resource resource = targetPage.getContentResource();
resolvingUrlHandlerConfig = AdaptTo.notNull(resource, UrlHandlerConfig.class);
resolvingUrlHandler = AdaptTo.notNull(resource, UrlHandler.class);
}
// if target page is a redirect or integrator page recursively resolve link to which the redirect points to
// (skip this redirection if edit mode is active)
if (targetPage != null
&& (linkHandlerConfig.isRedirect(targetPage) || resolvingUrlHandlerConfig.isIntegrator(targetPage))
&& wcmMode != WCMMode.EDIT) {
return recursiveResolveLink(targetPage, link);
}
// build link url
String linkUrl = null;
if (targetPage != null) {
link.setTargetPage(targetPage);
LinkArgs linkArgs = linkRequest.getLinkArgs();
String selectors = linkArgs.getSelectors();
String fileExtension = StringUtils.defaultString(linkArgs.getExtension(), FileExtension.HTML);
String suffix = linkArgs.getSuffix();
String queryString = linkArgs.getQueryString();
String fragment = linkArgs.getFragment();
// optionally override query parameters and fragment from link resource
queryString = props.get(LinkNameConstants.PN_LINK_QUERY_PARAM, queryString);
fragment = props.get(LinkNameConstants.PN_LINK_FRAGMENT, fragment);
// build link url
linkUrl = resolvingUrlHandler.get(targetPage)
.selectors(selectors)
.extension(fileExtension)
.suffix(suffix)
.queryString(queryString)
.fragment(fragment)
.urlMode(linkArgs.getUrlMode())
.buildExternalLinkUrl(targetPage);
}
// mark link as invalid if a reference was set that could not be resolved
if (linkUrl == null && referenceSet) {
link.setLinkReferenceInvalid(true);
}
// set link url
link.setUrl(linkUrl);
return link;
} | class class_name[name] begin[{]
method[resolveLink, return_type[type[Link]], modifier[public], parameter[link, options]] begin[{]
local_variable[type[LinkRequest], linkRequest]
local_variable[type[ValueMap], props]
local_variable[type[boolean], referenceSet]
local_variable[type[Page], targetPage]
if[binary_operation[member[.targetPage], !=, literal[null]]] begin[{]
assign[member[.referenceSet], literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.targetPage], ==, literal[null]]] begin[{]
local_variable[type[String], targetPath]
if[call[StringUtils.isNotEmpty, parameter[member[.targetPath]]]] begin[{]
assign[member[.referenceSet], literal[true]]
else begin[{]
None
end[}]
assign[member[.targetPage], call[.getTargetPage, parameter[member[.targetPath], member[.options]]]]
else begin[{]
None
end[}]
local_variable[type[UrlHandlerConfig], resolvingUrlHandlerConfig]
local_variable[type[UrlHandler], resolvingUrlHandler]
if[binary_operation[binary_operation[member[.targetPage], !=, literal[null]], &&, call[.useTargetContext, parameter[member[.options]]]]] begin[{]
local_variable[type[Resource], resource]
assign[member[.resolvingUrlHandlerConfig], call[AdaptTo.notNull, parameter[member[.resource], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UrlHandlerConfig, sub_type=None))]]]
assign[member[.resolvingUrlHandler], call[AdaptTo.notNull, parameter[member[.resource], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UrlHandler, sub_type=None))]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.targetPage], !=, literal[null]], &&, binary_operation[call[linkHandlerConfig.isRedirect, parameter[member[.targetPage]]], ||, call[resolvingUrlHandlerConfig.isIntegrator, parameter[member[.targetPage]]]]], &&, binary_operation[member[.wcmMode], !=, member[WCMMode.EDIT]]]] begin[{]
return[call[.recursiveResolveLink, parameter[member[.targetPage], member[.link]]]]
else begin[{]
None
end[}]
local_variable[type[String], linkUrl]
if[binary_operation[member[.targetPage], !=, literal[null]]] begin[{]
call[link.setTargetPage, parameter[member[.targetPage]]]
local_variable[type[LinkArgs], linkArgs]
local_variable[type[String], selectors]
local_variable[type[String], fileExtension]
local_variable[type[String], suffix]
local_variable[type[String], queryString]
local_variable[type[String], fragment]
assign[member[.queryString], call[props.get, parameter[member[LinkNameConstants.PN_LINK_QUERY_PARAM], member[.queryString]]]]
assign[member[.fragment], call[props.get, parameter[member[LinkNameConstants.PN_LINK_FRAGMENT], member[.fragment]]]]
assign[member[.linkUrl], call[resolvingUrlHandler.get, parameter[member[.targetPage]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.linkUrl], ==, literal[null]], &&, member[.referenceSet]]] begin[{]
call[link.setLinkReferenceInvalid, parameter[literal[true]]]
else begin[{]
None
end[}]
call[link.setUrl, parameter[member[.linkUrl]]]
return[member[.link]]
end[}]
END[}] | Keyword[public] annotation[@] identifier[NotNull] identifier[Link] identifier[resolveLink] operator[SEP] annotation[@] identifier[NotNull] identifier[Link] identifier[link] , annotation[@] identifier[NotNull] identifier[InternalLinkResolverOptions] identifier[options] operator[SEP] {
identifier[LinkRequest] identifier[linkRequest] operator[=] identifier[link] operator[SEP] identifier[getLinkRequest] operator[SEP] operator[SEP] operator[SEP] identifier[ValueMap] identifier[props] operator[=] identifier[linkRequest] operator[SEP] identifier[getResourceProperties] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[referenceSet] operator[=] literal[boolean] operator[SEP] identifier[Page] identifier[targetPage] operator[=] identifier[link] operator[SEP] identifier[getLinkRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getPage] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[targetPage] operator[!=] Other[null] operator[SEP] {
identifier[referenceSet] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[targetPage] operator[==] Other[null] operator[SEP] {
identifier[String] identifier[targetPath] operator[=] identifier[props] operator[SEP] identifier[get] operator[SEP] identifier[options] operator[SEP] identifier[getPrimaryLinkRefProperty] operator[SEP] operator[SEP] , identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[targetPath] operator[SEP] operator[SEP] {
identifier[referenceSet] operator[=] literal[boolean] operator[SEP]
}
identifier[targetPage] operator[=] identifier[getTargetPage] operator[SEP] identifier[targetPath] , identifier[options] operator[SEP] operator[SEP]
}
identifier[UrlHandlerConfig] identifier[resolvingUrlHandlerConfig] operator[=] identifier[urlHandlerConfig] operator[SEP] identifier[UrlHandler] identifier[resolvingUrlHandler] operator[=] identifier[urlHandler] operator[SEP] Keyword[if] operator[SEP] identifier[targetPage] operator[!=] Other[null] operator[&&] identifier[useTargetContext] operator[SEP] identifier[options] operator[SEP] operator[SEP] {
identifier[Resource] identifier[resource] operator[=] identifier[targetPage] operator[SEP] identifier[getContentResource] operator[SEP] operator[SEP] operator[SEP] identifier[resolvingUrlHandlerConfig] operator[=] identifier[AdaptTo] operator[SEP] identifier[notNull] operator[SEP] identifier[resource] , identifier[UrlHandlerConfig] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[resolvingUrlHandler] operator[=] identifier[AdaptTo] operator[SEP] identifier[notNull] operator[SEP] identifier[resource] , identifier[UrlHandler] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[targetPage] operator[!=] Other[null] operator[&&] operator[SEP] identifier[linkHandlerConfig] operator[SEP] identifier[isRedirect] operator[SEP] identifier[targetPage] operator[SEP] operator[||] identifier[resolvingUrlHandlerConfig] operator[SEP] identifier[isIntegrator] operator[SEP] identifier[targetPage] operator[SEP] operator[SEP] operator[&&] identifier[wcmMode] operator[!=] identifier[WCMMode] operator[SEP] identifier[EDIT] operator[SEP] {
Keyword[return] identifier[recursiveResolveLink] operator[SEP] identifier[targetPage] , identifier[link] operator[SEP] operator[SEP]
}
identifier[String] identifier[linkUrl] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[targetPage] operator[!=] Other[null] operator[SEP] {
identifier[link] operator[SEP] identifier[setTargetPage] operator[SEP] identifier[targetPage] operator[SEP] operator[SEP] identifier[LinkArgs] identifier[linkArgs] operator[=] identifier[linkRequest] operator[SEP] identifier[getLinkArgs] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[selectors] operator[=] identifier[linkArgs] operator[SEP] identifier[getSelectors] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[fileExtension] operator[=] identifier[StringUtils] operator[SEP] identifier[defaultString] operator[SEP] identifier[linkArgs] operator[SEP] identifier[getExtension] operator[SEP] operator[SEP] , identifier[FileExtension] operator[SEP] identifier[HTML] operator[SEP] operator[SEP] identifier[String] identifier[suffix] operator[=] identifier[linkArgs] operator[SEP] identifier[getSuffix] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[queryString] operator[=] identifier[linkArgs] operator[SEP] identifier[getQueryString] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[fragment] operator[=] identifier[linkArgs] operator[SEP] identifier[getFragment] operator[SEP] operator[SEP] operator[SEP] identifier[queryString] operator[=] identifier[props] operator[SEP] identifier[get] operator[SEP] identifier[LinkNameConstants] operator[SEP] identifier[PN_LINK_QUERY_PARAM] , identifier[queryString] operator[SEP] operator[SEP] identifier[fragment] operator[=] identifier[props] operator[SEP] identifier[get] operator[SEP] identifier[LinkNameConstants] operator[SEP] identifier[PN_LINK_FRAGMENT] , identifier[fragment] operator[SEP] operator[SEP] identifier[linkUrl] operator[=] identifier[resolvingUrlHandler] operator[SEP] identifier[get] operator[SEP] identifier[targetPage] operator[SEP] operator[SEP] identifier[selectors] operator[SEP] identifier[selectors] operator[SEP] operator[SEP] identifier[extension] operator[SEP] identifier[fileExtension] operator[SEP] operator[SEP] identifier[suffix] operator[SEP] identifier[suffix] operator[SEP] operator[SEP] identifier[queryString] operator[SEP] identifier[queryString] operator[SEP] operator[SEP] identifier[fragment] operator[SEP] identifier[fragment] operator[SEP] operator[SEP] identifier[urlMode] operator[SEP] identifier[linkArgs] operator[SEP] identifier[getUrlMode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[buildExternalLinkUrl] operator[SEP] identifier[targetPage] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[linkUrl] operator[==] Other[null] operator[&&] identifier[referenceSet] operator[SEP] {
identifier[link] operator[SEP] identifier[setLinkReferenceInvalid] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
identifier[link] operator[SEP] identifier[setUrl] operator[SEP] identifier[linkUrl] operator[SEP] operator[SEP] Keyword[return] identifier[link] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public EList<IfcApprovalRelationship> getIsRelatedWith() {
return (EList<IfcApprovalRelationship>) eGet(Ifc4Package.Literals.IFC_APPROVAL__IS_RELATED_WITH, true);
} | class class_name[name] begin[{]
method[getIsRelatedWith, return_type[type[EList]], modifier[public], parameter[]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=IFC_APPROVAL__IS_RELATED_WITH, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package.Literals, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=eGet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IfcApprovalRelationship, sub_type=None))], dimensions=[], name=EList, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[EList] operator[<] identifier[IfcApprovalRelationship] operator[>] identifier[getIsRelatedWith] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[EList] operator[<] identifier[IfcApprovalRelationship] operator[>] operator[SEP] identifier[eGet] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[Literals] operator[SEP] identifier[IFC_APPROVAL__IS_RELATED_WITH] , literal[boolean] operator[SEP] operator[SEP]
}
|
public void startActivityTransacted(ActivityHandle handle, Object activity,
int activityFlags) throws NullPointerException,
IllegalStateException, TransactionRequiredLocalException,
ActivityAlreadyExistsException, StartActivityException,
SLEEException {
if (doTraceLogs) {
logger.trace("startActivityTransacted( handle = " + handle
+ " , activity = " + activity + " , flags = "
+ activityFlags + " )");
}
checkStartActivityParameters(handle, activity);
// check tx state
txManager.mandateTransaction();
_startActivity(handle, activityFlags,null);
} | class class_name[name] begin[{]
method[startActivityTransacted, return_type[void], modifier[public], parameter[handle, activity, activityFlags]] begin[{]
if[member[.doTraceLogs]] begin[{]
call[logger.trace, parameter[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["startActivityTransacted( handle = "], +, member[.handle]], +, literal[" , activity = "]], +, member[.activity]], +, literal[" , flags = "]], +, member[.activityFlags]], +, literal[" )"]]]]
else begin[{]
None
end[}]
call[.checkStartActivityParameters, parameter[member[.handle], member[.activity]]]
call[txManager.mandateTransaction, parameter[]]
call[._startActivity, parameter[member[.handle], member[.activityFlags], literal[null]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[startActivityTransacted] operator[SEP] identifier[ActivityHandle] identifier[handle] , identifier[Object] identifier[activity] , Keyword[int] identifier[activityFlags] operator[SEP] Keyword[throws] identifier[NullPointerException] , identifier[IllegalStateException] , identifier[TransactionRequiredLocalException] , identifier[ActivityAlreadyExistsException] , identifier[StartActivityException] , identifier[SLEEException] {
Keyword[if] operator[SEP] identifier[doTraceLogs] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] identifier[handle] operator[+] literal[String] operator[+] identifier[activity] operator[+] literal[String] operator[+] identifier[activityFlags] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[checkStartActivityParameters] operator[SEP] identifier[handle] , identifier[activity] operator[SEP] operator[SEP] identifier[txManager] operator[SEP] identifier[mandateTransaction] operator[SEP] operator[SEP] operator[SEP] identifier[_startActivity] operator[SEP] identifier[handle] , identifier[activityFlags] , Other[null] operator[SEP] operator[SEP]
}
|
@Override
public Collection<Response> getResponses(String earliest) {
GenericType<Collection<Response>> responseType = new GenericType<Collection<Response>>() {};
Collection<Response> responses =
target
.path("api")
.path("v1.0")
.path("responses")
.queryParam("earliest", earliest)
.request()
.header(clientApplicationIdName, clientApplicationIdValue)
.get(responseType);
//make request
return responses;
} | class class_name[name] begin[{]
method[getResponses, return_type[type[Collection]], modifier[public], parameter[earliest]] begin[{]
local_variable[type[GenericType], responseType]
local_variable[type[Collection], responses]
return[member[.responses]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Collection] operator[<] identifier[Response] operator[>] identifier[getResponses] operator[SEP] identifier[String] identifier[earliest] operator[SEP] {
identifier[GenericType] operator[<] identifier[Collection] operator[<] identifier[Response] operator[>] operator[>] identifier[responseType] operator[=] Keyword[new] identifier[GenericType] operator[<] identifier[Collection] operator[<] identifier[Response] operator[>] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[Collection] operator[<] identifier[Response] operator[>] identifier[responses] operator[=] identifier[target] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[path] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[queryParam] operator[SEP] literal[String] , identifier[earliest] operator[SEP] operator[SEP] identifier[request] operator[SEP] operator[SEP] operator[SEP] identifier[header] operator[SEP] identifier[clientApplicationIdName] , identifier[clientApplicationIdValue] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[responseType] operator[SEP] operator[SEP] Keyword[return] identifier[responses] operator[SEP]
}
|
private String urlEncode(final String unencoded) throws DockerException {
try {
final String encode = URLEncoder.encode(unencoded, UTF_8.name());
return encode.replaceAll("\\+", "%20");
} catch (UnsupportedEncodingException e) {
throw new DockerException(e);
}
} | class class_name[name] begin[{]
method[urlEncode, return_type[type[String]], modifier[private], parameter[unencoded]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=unencoded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=UTF_8, selectors=[], type_arguments=None)], member=encode, postfix_operators=[], prefix_operators=[], qualifier=URLEncoder, selectors=[], type_arguments=None), name=encode)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\+"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%20")], member=replaceAll, postfix_operators=[], prefix_operators=[], qualifier=encode, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DockerException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] identifier[String] identifier[urlEncode] operator[SEP] Keyword[final] identifier[String] identifier[unencoded] operator[SEP] Keyword[throws] identifier[DockerException] {
Keyword[try] {
Keyword[final] identifier[String] identifier[encode] operator[=] identifier[URLEncoder] operator[SEP] identifier[encode] operator[SEP] identifier[unencoded] , identifier[UTF_8] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[encode] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DockerException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
private void unlockRunState(int oldRunState, int newRunState) {
if (!U.compareAndSwapInt(this, RUNSTATE, oldRunState, newRunState)) {
Object lock = stealCounter;
runState = newRunState; // clears RSIGNAL bit
if (lock != null)
synchronized (lock) { lock.notifyAll(); }
}
} | class class_name[name] begin[{]
method[unlockRunState, return_type[void], modifier[private], parameter[oldRunState, newRunState]] begin[{]
if[call[U.compareAndSwapInt, parameter[THIS[], member[.RUNSTATE], member[.oldRunState], member[.newRunState]]]] begin[{]
local_variable[type[Object], lock]
assign[member[.runState], member[.newRunState]]
if[binary_operation[member[.lock], !=, literal[null]]] begin[{]
SYNCHRONIZED[member[.lock]] BEGIN[{]
call[lock.notifyAll, parameter[]]
END[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[unlockRunState] operator[SEP] Keyword[int] identifier[oldRunState] , Keyword[int] identifier[newRunState] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[U] operator[SEP] identifier[compareAndSwapInt] operator[SEP] Keyword[this] , identifier[RUNSTATE] , identifier[oldRunState] , identifier[newRunState] operator[SEP] operator[SEP] {
identifier[Object] identifier[lock] operator[=] identifier[stealCounter] operator[SEP] identifier[runState] operator[=] identifier[newRunState] operator[SEP] Keyword[if] operator[SEP] identifier[lock] operator[!=] Other[null] operator[SEP] Keyword[synchronized] operator[SEP] identifier[lock] operator[SEP] {
identifier[lock] operator[SEP] identifier[notifyAll] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
protected JSONObject getJSONObject(final JSONArray jsonArray, final int index) {
JSONObject object = new JSONObject();
try {
object = (JSONObject) jsonArray.get(index);
}
catch(JSONException e) {
e.printStackTrace();
}
return object;
} | class class_name[name] begin[{]
method[getJSONObject, return_type[type[JSONObject]], modifier[protected], parameter[jsonArray, index]] begin[{]
local_variable[type[JSONObject], object]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=jsonArray, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=JSONObject, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JSONException']))], finally_block=None, label=None, resources=None)
return[member[.object]]
end[}]
END[}] | Keyword[protected] identifier[JSONObject] identifier[getJSONObject] operator[SEP] Keyword[final] identifier[JSONArray] identifier[jsonArray] , Keyword[final] Keyword[int] identifier[index] operator[SEP] {
identifier[JSONObject] identifier[object] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[object] operator[=] operator[SEP] identifier[JSONObject] operator[SEP] identifier[jsonArray] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JSONException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[object] operator[SEP]
}
|
private Set<String> parseInstanceIDs(final Map<String, String[]> queryParams) {
Set<String> ret = new TreeSet<String>();
Set<Map.Entry<String, String[]>> entries = queryParams.entrySet();
for (Map.Entry<String, String[]> entry : entries) {
if (null != entry && null != entry.getKey()
&& entry.getKey().matches("InstanceId\\.(\\d)+")) {
if (null != entry.getValue() && entry.getValue().length > 0) {
ret.add(entry.getValue()[0]);
}
}
}
return ret;
} | class class_name[name] begin[{]
method[parseInstanceIDs, return_type[type[Set]], modifier[private], parameter[queryParams]] begin[{]
local_variable[type[Set], ret]
local_variable[type[Set], entries]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), operator=!=), operator=&&), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="InstanceId\\.(\\d)+")], member=matches, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=entries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.ret]]
end[}]
END[}] | Keyword[private] identifier[Set] operator[<] identifier[String] operator[>] identifier[parseInstanceIDs] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[queryParams] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[ret] operator[=] Keyword[new] identifier[TreeSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] operator[>] identifier[entries] operator[=] identifier[queryParams] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[entry] operator[:] identifier[entries] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[entry] operator[&&] Other[null] operator[!=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[&&] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[matches] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[&&] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public static Bitmap renderPath(Path path) {
RectF bounds = new RectF();
path.computeBounds(bounds, false);
Bitmap bitmap = Bitmap.createBitmap((int) bounds.right, (int) bounds.bottom, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Paint paint = new LPaint();
paint.setAntiAlias(true);
paint.setColor(Color.BLUE);
canvas.drawPath(path, paint);
return bitmap;
} | class class_name[name] begin[{]
method[renderPath, return_type[type[Bitmap]], modifier[public static], parameter[path]] begin[{]
local_variable[type[RectF], bounds]
call[path.computeBounds, parameter[member[.bounds], literal[false]]]
local_variable[type[Bitmap], bitmap]
local_variable[type[Canvas], canvas]
local_variable[type[Paint], paint]
call[paint.setAntiAlias, parameter[literal[true]]]
call[paint.setColor, parameter[member[Color.BLUE]]]
call[canvas.drawPath, parameter[member[.path], member[.paint]]]
return[member[.bitmap]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Bitmap] identifier[renderPath] operator[SEP] identifier[Path] identifier[path] operator[SEP] {
identifier[RectF] identifier[bounds] operator[=] Keyword[new] identifier[RectF] operator[SEP] operator[SEP] operator[SEP] identifier[path] operator[SEP] identifier[computeBounds] operator[SEP] identifier[bounds] , literal[boolean] operator[SEP] operator[SEP] identifier[Bitmap] identifier[bitmap] operator[=] identifier[Bitmap] operator[SEP] identifier[createBitmap] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[bounds] operator[SEP] identifier[right] , operator[SEP] Keyword[int] operator[SEP] identifier[bounds] operator[SEP] identifier[bottom] , identifier[Bitmap] operator[SEP] identifier[Config] operator[SEP] identifier[ARGB_8888] operator[SEP] operator[SEP] identifier[Canvas] identifier[canvas] operator[=] Keyword[new] identifier[Canvas] operator[SEP] identifier[bitmap] operator[SEP] operator[SEP] identifier[Paint] identifier[paint] operator[=] Keyword[new] identifier[LPaint] operator[SEP] operator[SEP] operator[SEP] identifier[paint] operator[SEP] identifier[setAntiAlias] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[paint] operator[SEP] identifier[setColor] operator[SEP] identifier[Color] operator[SEP] identifier[BLUE] operator[SEP] operator[SEP] identifier[canvas] operator[SEP] identifier[drawPath] operator[SEP] identifier[path] , identifier[paint] operator[SEP] operator[SEP] Keyword[return] identifier[bitmap] operator[SEP]
}
|
public List<CmsGroup> getManageableGroups(CmsObject cms, String ouFqn, boolean includeSubOus) throws CmsException {
List<CmsGroup> groups = new ArrayList<CmsGroup>();
Iterator<CmsOrganizationalUnit> it = getOrgUnitsForRole(
cms,
CmsRole.ACCOUNT_MANAGER.forOrgUnit(ouFqn),
includeSubOus).iterator();
while (it.hasNext()) {
CmsOrganizationalUnit orgUnit = it.next();
groups.addAll(OpenCms.getOrgUnitManager().getGroups(cms, orgUnit.getName(), false));
}
return groups;
} | class class_name[name] begin[{]
method[getManageableGroups, return_type[type[List]], modifier[public], parameter[cms, ouFqn, includeSubOus]] begin[{]
local_variable[type[List], groups]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[CmsOrganizationalUnit], orgUnit]
call[groups.addAll, parameter[call[OpenCms.getOrgUnitManager, parameter[]]]]
end[}]
return[member[.groups]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[CmsGroup] operator[>] identifier[getManageableGroups] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[String] identifier[ouFqn] , Keyword[boolean] identifier[includeSubOus] operator[SEP] Keyword[throws] identifier[CmsException] {
identifier[List] operator[<] identifier[CmsGroup] operator[>] identifier[groups] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[CmsGroup] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[CmsOrganizationalUnit] operator[>] identifier[it] operator[=] identifier[getOrgUnitsForRole] operator[SEP] identifier[cms] , identifier[CmsRole] operator[SEP] identifier[ACCOUNT_MANAGER] operator[SEP] identifier[forOrgUnit] operator[SEP] identifier[ouFqn] operator[SEP] , identifier[includeSubOus] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[CmsOrganizationalUnit] identifier[orgUnit] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[groups] operator[SEP] identifier[addAll] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getOrgUnitManager] operator[SEP] operator[SEP] operator[SEP] identifier[getGroups] operator[SEP] identifier[cms] , identifier[orgUnit] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[groups] operator[SEP]
}
|
private boolean hasLocaleDependencies() {
for (CmsSearchIndexSource source : getIndex().getSources()) {
if (source.getIndexer().isLocaleDependenciesEnable()) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[hasLocaleDependencies, return_type[type[boolean]], modifier[private], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getIndexer, postfix_operators=[], prefix_operators=[], qualifier=source, selectors=[MethodInvocation(arguments=[], member=isLocaleDependenciesEnable, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSources, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=source)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsSearchIndexSource, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[hasLocaleDependencies] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[CmsSearchIndexSource] identifier[source] operator[:] identifier[getIndex] operator[SEP] operator[SEP] operator[SEP] identifier[getSources] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[getIndexer] operator[SEP] operator[SEP] operator[SEP] identifier[isLocaleDependenciesEnable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void marshall(GetRoomRequest getRoomRequest, ProtocolMarshaller protocolMarshaller) {
if (getRoomRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getRoomRequest.getRoomArn(), ROOMARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[getRoomRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.getRoomRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRoomArn, postfix_operators=[], prefix_operators=[], qualifier=getRoomRequest, selectors=[], type_arguments=None), MemberReference(member=ROOMARN_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[GetRoomRequest] identifier[getRoomRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[getRoomRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getRoomRequest] operator[SEP] identifier[getRoomArn] operator[SEP] operator[SEP] , identifier[ROOMARN_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public String convertObjectFunctionSetSpecificationDCAFnSetToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
} | class class_name[name] begin[{]
method[convertObjectFunctionSetSpecificationDCAFnSetToString, return_type[type[String]], modifier[public], parameter[eDataType, instanceValue]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=instanceValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=instanceValue, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] identifier[String] identifier[convertObjectFunctionSetSpecificationDCAFnSetToString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[Object] identifier[instanceValue] operator[SEP] {
Keyword[return] identifier[instanceValue] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[instanceValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean remove(String scope, Object key) throws InvalidScopeException, InternalCacheEngineException {
if (logger.isDebugEnabled()) {
logger.debug("Removing item with key " + key + " from scope " + scope);
}
try {
return cacheStoreAdapter.remove(scope, key);
} catch (InvalidScopeException ex) {
throw ex;
} catch (Exception ex) {
throw new InternalCacheEngineException("Exception while removing item with key " +
key + " from scope " + scope, ex);
}
} | class class_name[name] begin[{]
method[remove, return_type[type[boolean]], modifier[public], parameter[scope, key]] begin[{]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
call[logger.debug, parameter[binary_operation[binary_operation[binary_operation[literal["Removing item with key "], +, member[.key]], +, literal[" from scope "]], +, member[.scope]]]]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=scope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=cacheStoreAdapter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['InvalidScopeException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception while removing item with key "), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" from scope "), operator=+), operandr=MemberReference(member=scope, 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=InternalCacheEngineException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[remove] operator[SEP] identifier[String] identifier[scope] , identifier[Object] identifier[key] operator[SEP] Keyword[throws] identifier[InvalidScopeException] , identifier[InternalCacheEngineException] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] identifier[scope] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[cacheStoreAdapter] operator[SEP] identifier[remove] operator[SEP] identifier[scope] , identifier[key] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InvalidScopeException] identifier[ex] operator[SEP] {
Keyword[throw] identifier[ex] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InternalCacheEngineException] operator[SEP] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[+] identifier[scope] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("unchecked")
synchronized <N extends Number> N parse(final Class<N> type, final String text) {
final Number result;
if(lenient) {
try {
result = formatter.parse(text);
} catch(ParseException e) {
throw new TextParseException(text, type, e);
}
} else {
ParsePosition position = new ParsePosition(0);
result = formatter.parse(text, position);
if(position.getIndex() != text.length()) {
throw new TextParseException(text, type, String.format("Cannot parse '%s' using fromat %s", text, getPattern()));
}
}
try {
if(result instanceof BigDecimal) {
// if set DecimalFormat#setParseBigDecimal(true)
return (N) convertWithBigDecimal(type, (BigDecimal) result, text);
} else {
return (N) convertWithNumber(type, result, text);
}
} catch(NumberFormatException | ArithmeticException e) {
throw new TextParseException(text, type, e);
}
} | class class_name[name] begin[{]
method[parse, return_type[type[N]], modifier[synchronized], parameter[type, text]] begin[{]
local_variable[type[Number], result]
if[member[.lenient]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=formatter, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=TextParseException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ParseException']))], finally_block=None, label=None, resources=None)
else begin[{]
local_variable[type[ParsePosition], position]
assign[member[.result], call[formatter.parse, parameter[member[.text], member[.position]]]]
if[binary_operation[call[position.getIndex, parameter[]], !=, call[text.length, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot parse '%s' using fromat %s"), MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getPattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TextParseException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=BigDecimal, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convertWithNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=N, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BigDecimal, sub_type=None)), MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convertWithBigDecimal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=N, sub_type=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=TextParseException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException', 'ArithmeticException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[synchronized] operator[<] identifier[N] Keyword[extends] identifier[Number] operator[>] identifier[N] identifier[parse] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[N] operator[>] identifier[type] , Keyword[final] identifier[String] identifier[text] operator[SEP] {
Keyword[final] identifier[Number] identifier[result] operator[SEP] Keyword[if] operator[SEP] identifier[lenient] operator[SEP] {
Keyword[try] {
identifier[result] operator[=] identifier[formatter] operator[SEP] identifier[parse] operator[SEP] identifier[text] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ParseException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TextParseException] operator[SEP] identifier[text] , identifier[type] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[ParsePosition] identifier[position] operator[=] Keyword[new] identifier[ParsePosition] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[formatter] operator[SEP] identifier[parse] operator[SEP] identifier[text] , identifier[position] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[position] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[!=] identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TextParseException] operator[SEP] identifier[text] , identifier[type] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[text] , identifier[getPattern] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[try] {
Keyword[if] operator[SEP] identifier[result] Keyword[instanceof] identifier[BigDecimal] operator[SEP] {
Keyword[return] operator[SEP] identifier[N] operator[SEP] identifier[convertWithBigDecimal] operator[SEP] identifier[type] , operator[SEP] identifier[BigDecimal] operator[SEP] identifier[result] , identifier[text] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] operator[SEP] identifier[N] operator[SEP] identifier[convertWithNumber] operator[SEP] identifier[type] , identifier[result] , identifier[text] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] operator[|] identifier[ArithmeticException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TextParseException] operator[SEP] identifier[text] , identifier[type] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static <T> T getLast(List<T> list) {
if (isEmpty(list)) {
return null;
}
return list.get(list.size() - 1);
} | class class_name[name] begin[{]
method[getLast, return_type[type[T]], modifier[public static], parameter[list]] begin[{]
if[call[.isEmpty, parameter[member[.list]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[list.get, parameter[binary_operation[call[list.size, parameter[]], -, literal[1]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[getLast] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[list] operator[SEP] {
Keyword[if] operator[SEP] identifier[isEmpty] operator[SEP] identifier[list] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP] identifier[get] operator[SEP] identifier[list] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
|
public List<NodePair> match(GraphPair graphPair) {
Validate.argumentIsNotNull(graphPair);
List<NodePair> pairs = new ArrayList<>();
Map<GlobalId, ObjectNode> rightMap = asMap(graphPair.getRightNodeSet());
for (ObjectNode left : graphPair.getLeftNodeSet()) {
GlobalId key = left.getGlobalId();
if (rightMap.containsKey(key)) {
pairs.add(new RealNodePair(left, rightMap.get(key)));
}
}
return pairs;
} | class class_name[name] begin[{]
method[match, return_type[type[List]], modifier[public], parameter[graphPair]] begin[{]
call[Validate.argumentIsNotNull, parameter[member[.graphPair]]]
local_variable[type[List], pairs]
local_variable[type[Map], rightMap]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getGlobalId, postfix_operators=[], prefix_operators=[], qualifier=left, selectors=[], type_arguments=None), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=GlobalId, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=rightMap, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=rightMap, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RealNodePair, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=pairs, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getLeftNodeSet, postfix_operators=[], prefix_operators=[], qualifier=graphPair, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=left)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ObjectNode, sub_type=None))), label=None)
return[member[.pairs]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[NodePair] operator[>] identifier[match] operator[SEP] identifier[GraphPair] identifier[graphPair] operator[SEP] {
identifier[Validate] operator[SEP] identifier[argumentIsNotNull] operator[SEP] identifier[graphPair] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[NodePair] operator[>] identifier[pairs] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[GlobalId] , identifier[ObjectNode] operator[>] identifier[rightMap] operator[=] identifier[asMap] operator[SEP] identifier[graphPair] operator[SEP] identifier[getRightNodeSet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ObjectNode] identifier[left] operator[:] identifier[graphPair] operator[SEP] identifier[getLeftNodeSet] operator[SEP] operator[SEP] operator[SEP] {
identifier[GlobalId] identifier[key] operator[=] identifier[left] operator[SEP] identifier[getGlobalId] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rightMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[pairs] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[RealNodePair] operator[SEP] identifier[left] , identifier[rightMap] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[pairs] operator[SEP]
}
|
private Object executeBatch(Object implObject, Method method, Object[] args)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException,
SQLException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "executeBatch", new Object[]
{ this, args[0] });
if (childWrapper != null) {
closeAndRemoveResultSet();
}
if (childWrappers != null && !childWrappers.isEmpty()) {
closeAndRemoveResultSets();
}
enforceStatementProperties();
Object results = method.invoke(implObject, args);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "executeBatch", results instanceof int[] ? Arrays.toString((int[]) results) : results);
return results;
} | class class_name[name] begin[{]
method[executeBatch, return_type[type[Object]], modifier[private], parameter[implObject, method, args]] begin[{]
local_variable[type[boolean], isTraceOn]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[member[.tc], literal["executeBatch"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[member[.childWrapper], !=, literal[null]]] begin[{]
call[.closeAndRemoveResultSet, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.childWrappers], !=, literal[null]], &&, call[childWrappers.isEmpty, parameter[]]]] begin[{]
call[.closeAndRemoveResultSets, parameter[]]
else begin[{]
None
end[}]
call[.enforceStatementProperties, parameter[]]
local_variable[type[Object], results]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["executeBatch"], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BasicType(dimensions=[None], name=int), operator=instanceof), if_false=MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[Cast(expression=MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[None], name=int))], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None))]]
else begin[{]
None
end[}]
return[member[.results]]
end[}]
END[}] | Keyword[private] identifier[Object] identifier[executeBatch] operator[SEP] identifier[Object] identifier[implObject] , identifier[Method] identifier[method] , identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[IllegalAccessException] , identifier[IllegalArgumentException] , identifier[InvocationTargetException] , identifier[SQLException] {
Keyword[final] Keyword[boolean] identifier[isTraceOn] operator[=] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
Keyword[this] , identifier[args] operator[SEP] Other[0] operator[SEP]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[childWrapper] operator[!=] Other[null] operator[SEP] {
identifier[closeAndRemoveResultSet] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[childWrappers] operator[!=] Other[null] operator[&&] operator[!] identifier[childWrappers] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[closeAndRemoveResultSets] operator[SEP] operator[SEP] operator[SEP]
}
identifier[enforceStatementProperties] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[results] operator[=] identifier[method] operator[SEP] identifier[invoke] operator[SEP] identifier[implObject] , identifier[args] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[results] Keyword[instanceof] Keyword[int] operator[SEP] operator[SEP] operator[?] identifier[Arrays] operator[SEP] identifier[toString] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[results] operator[SEP] operator[:] identifier[results] operator[SEP] operator[SEP] Keyword[return] identifier[results] operator[SEP]
}
|
static String getSQLTypeName(Field.Type type) throws OnRecordErrorException {
switch (type) {
case BOOLEAN:
return "BOOLEAN";
case CHAR:
return "CHAR";
case BYTE:
return "BINARY";
case SHORT:
return "SMALLINT";
case INTEGER:
return "INTEGER";
case LONG:
return "BIGINT";
case FLOAT:
return "FLOAT";
case DOUBLE:
return "DOUBLE";
case DATE:
return "DATE";
case TIME:
return "TIME";
case DATETIME:
return "TIMESTAMP";
case DECIMAL:
return "DECIMAL";
case STRING:
return "VARCHAR";
case BYTE_ARRAY:
return "VARBINARY";
case LIST_MAP:
case MAP:
throw new OnRecordErrorException(JdbcErrors.JDBC_05, "Unsupported list or map type: MAP");
case LIST:
return "ARRAY";
default:
throw new OnRecordErrorException(JdbcErrors.JDBC_05, "Unsupported type: " + type.name());
}
} | class class_name[name] begin[{]
method[getSQLTypeName, return_type[type[String]], modifier[static], parameter[type]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['BOOLEAN'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BOOLEAN"), label=None)]), SwitchStatementCase(case=['CHAR'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CHAR"), label=None)]), SwitchStatementCase(case=['BYTE'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BINARY"), label=None)]), SwitchStatementCase(case=['SHORT'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SMALLINT"), label=None)]), SwitchStatementCase(case=['INTEGER'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTEGER"), label=None)]), SwitchStatementCase(case=['LONG'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BIGINT"), label=None)]), SwitchStatementCase(case=['FLOAT'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="FLOAT"), label=None)]), SwitchStatementCase(case=['DOUBLE'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DOUBLE"), label=None)]), SwitchStatementCase(case=['DATE'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DATE"), label=None)]), SwitchStatementCase(case=['TIME'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="TIME"), label=None)]), SwitchStatementCase(case=['DATETIME'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="TIMESTAMP"), label=None)]), SwitchStatementCase(case=['DECIMAL'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DECIMAL"), label=None)]), SwitchStatementCase(case=['STRING'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="VARCHAR"), label=None)]), SwitchStatementCase(case=['BYTE_ARRAY'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="VARBINARY"), label=None)]), SwitchStatementCase(case=['LIST_MAP', 'MAP'], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=JDBC_05, postfix_operators=[], prefix_operators=[], qualifier=JdbcErrors, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported list or map type: MAP")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OnRecordErrorException, sub_type=None)), label=None)]), SwitchStatementCase(case=['LIST'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ARRAY"), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=JDBC_05, postfix_operators=[], prefix_operators=[], qualifier=JdbcErrors, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported type: "), operandr=MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OnRecordErrorException, sub_type=None)), label=None)])], expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[static] identifier[String] identifier[getSQLTypeName] operator[SEP] identifier[Field] operator[SEP] identifier[Type] identifier[type] operator[SEP] Keyword[throws] identifier[OnRecordErrorException] {
Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[BOOLEAN] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CHAR] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[BYTE] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[SHORT] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[INTEGER] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[LONG] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[FLOAT] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[DOUBLE] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[DATE] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[TIME] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[DATETIME] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[DECIMAL] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[STRING] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[BYTE_ARRAY] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[LIST_MAP] operator[:] Keyword[case] identifier[MAP] operator[:] Keyword[throw] Keyword[new] identifier[OnRecordErrorException] operator[SEP] identifier[JdbcErrors] operator[SEP] identifier[JDBC_05] , literal[String] operator[SEP] operator[SEP] Keyword[case] identifier[LIST] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[OnRecordErrorException] operator[SEP] identifier[JdbcErrors] operator[SEP] identifier[JDBC_05] , literal[String] operator[+] identifier[type] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void loadServiceEndpointsByDNSService(final Callback<List<EndpointDefinition>> callback,
final String serviceURL) {
final DnsClient dnsClient = dnsClientProvider.get();
dnsClient.resolveSRV(serviceURL, event ->
{
if (event.succeeded()) {
if (debug) logger.debug("loadServiceEndpointsByDNSService SUCCESS serviceURL={} ", serviceURL);
callback.resolve(convertEndpoints(event.result()));
} else {
Throwable error = event.cause();
logger.info("loadServiceEndpointsByDNSService FAILURE " + serviceURL, error);
attemptRecover(callback, serviceURL, error);
}
}
);
} | class class_name[name] begin[{]
method[loadServiceEndpointsByDNSService, return_type[void], modifier[public], parameter[callback, serviceURL]] begin[{]
local_variable[type[DnsClient], dnsClient]
call[dnsClient.resolveSRV, parameter[member[.serviceURL], LambdaExpression(body=[IfStatement(condition=MethodInvocation(arguments=[], member=succeeded, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=cause, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None), name=error)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="loadServiceEndpointsByDNSService FAILURE "), operandr=MemberReference(member=serviceURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=callback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=serviceURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=attemptRecover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="loadServiceEndpointsByDNSService SUCCESS serviceURL={} "), MemberReference(member=serviceURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=result, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None)], member=convertEndpoints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=resolve, postfix_operators=[], prefix_operators=[], qualifier=callback, selectors=[], type_arguments=None), label=None)]))], parameters=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[loadServiceEndpointsByDNSService] operator[SEP] Keyword[final] identifier[Callback] operator[<] identifier[List] operator[<] identifier[EndpointDefinition] operator[>] operator[>] identifier[callback] , Keyword[final] identifier[String] identifier[serviceURL] operator[SEP] {
Keyword[final] identifier[DnsClient] identifier[dnsClient] operator[=] identifier[dnsClientProvider] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[dnsClient] operator[SEP] identifier[resolveSRV] operator[SEP] identifier[serviceURL] , identifier[event] operator[->] {
Keyword[if] operator[SEP] identifier[event] operator[SEP] identifier[succeeded] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[debug] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[serviceURL] operator[SEP] operator[SEP] identifier[callback] operator[SEP] identifier[resolve] operator[SEP] identifier[convertEndpoints] operator[SEP] identifier[event] operator[SEP] identifier[result] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Throwable] identifier[error] operator[=] identifier[event] operator[SEP] identifier[cause] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[serviceURL] , identifier[error] operator[SEP] operator[SEP] identifier[attemptRecover] operator[SEP] identifier[callback] , identifier[serviceURL] , identifier[error] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AfplibPackage.MPO__RG:
getRG().clear();
getRG().addAll((Collection<? extends MPORG>)newValue);
return;
}
super.eSet(featureID, newValue);
} | class class_name[name] begin[{]
method[eSet, return_type[void], modifier[public], parameter[featureID, newValue]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=MPO__RG, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getRG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=clear, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getRG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=MPORG, sub_type=None))], dimensions=[], name=Collection, sub_type=None))], member=addAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eSet] operator[SEP] Keyword[int] identifier[featureID] , identifier[Object] identifier[newValue] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[MPO__RG] operator[:] identifier[getRG] operator[SEP] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[getRG] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[MPORG] operator[>] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eSet] operator[SEP] identifier[featureID] , identifier[newValue] operator[SEP] operator[SEP]
}
|
@Deprecated
public static void link (Activity context, String token, boolean verifyPermissions, SocializeAuthListener listener){
proxy.link(context, token, verifyPermissions, listener);
} | class class_name[name] begin[{]
method[link, return_type[void], modifier[public static], parameter[context, token, verifyPermissions, listener]] begin[{]
call[proxy.link, parameter[member[.context], member[.token], member[.verifyPermissions], member[.listener]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] Keyword[void] identifier[link] operator[SEP] identifier[Activity] identifier[context] , identifier[String] identifier[token] , Keyword[boolean] identifier[verifyPermissions] , identifier[SocializeAuthListener] identifier[listener] operator[SEP] {
identifier[proxy] operator[SEP] identifier[link] operator[SEP] identifier[context] , identifier[token] , identifier[verifyPermissions] , identifier[listener] operator[SEP] operator[SEP]
}
|
public String updateFile(final UpdateFileRequest request) throws AbstractCosException {
request.check_param();
String url = buildUrl(request);
String sign = Sign.getOneEffectiveSign(request.getBucketName(), request.getCosPath(), this.cred);
HttpRequest httpRequest = new HttpRequest();
httpRequest.setUrl(url);
httpRequest.addHeader(RequestHeaderKey.Authorization, sign);
httpRequest.addHeader(RequestHeaderKey.Content_TYPE, RequestHeaderValue.ContentType.JSON);
httpRequest.addHeader(RequestHeaderKey.USER_AGENT, this.config.getUserAgent());
httpRequest.addParam(RequestBodyKey.OP, RequestBodyValue.OP.UPDATE);
int updateFlag = request.getUpdateFlag();
httpRequest.addParam(RequestBodyKey.UPDATE_FLAG, String.valueOf(updateFlag));
if ((updateFlag & 0x01) != 0) {
httpRequest.addParam(RequestBodyKey.BIZ_ATTR, request.getBizAttr());
}
if ((updateFlag & 0x40) != 0) {
String customHeaderStr = new JSONObject(request.getCustomHeaders()).toString();
httpRequest.addParam(RequestBodyKey.CUSTOM_HEADERS, customHeaderStr);
}
if ((updateFlag & 0x80) != 0) {
httpRequest.addParam(RequestBodyKey.AUTHORITY, request.getAuthority().toString());
}
httpRequest.setMethod(HttpMethod.POST);
httpRequest.setContentType(HttpContentType.APPLICATION_JSON);
return httpClient.sendHttpRequest(httpRequest);
} | class class_name[name] begin[{]
method[updateFile, return_type[type[String]], modifier[public], parameter[request]] begin[{]
call[request.check_param, parameter[]]
local_variable[type[String], url]
local_variable[type[String], sign]
local_variable[type[HttpRequest], httpRequest]
call[httpRequest.setUrl, parameter[member[.url]]]
call[httpRequest.addHeader, parameter[member[RequestHeaderKey.Authorization], member[.sign]]]
call[httpRequest.addHeader, parameter[member[RequestHeaderKey.Content_TYPE], member[RequestHeaderValue.ContentType.JSON]]]
call[httpRequest.addHeader, parameter[member[RequestHeaderKey.USER_AGENT], THIS[member[None.config]call[None.getUserAgent, parameter[]]]]]
call[httpRequest.addParam, parameter[member[RequestBodyKey.OP], member[RequestBodyValue.OP.UPDATE]]]
local_variable[type[int], updateFlag]
call[httpRequest.addParam, parameter[member[RequestBodyKey.UPDATE_FLAG], call[String.valueOf, parameter[member[.updateFlag]]]]]
if[binary_operation[binary_operation[member[.updateFlag], &, literal[0x01]], !=, literal[0]]] begin[{]
call[httpRequest.addParam, parameter[member[RequestBodyKey.BIZ_ATTR], call[request.getBizAttr, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.updateFlag], &, literal[0x40]], !=, literal[0]]] begin[{]
local_variable[type[String], customHeaderStr]
call[httpRequest.addParam, parameter[member[RequestBodyKey.CUSTOM_HEADERS], member[.customHeaderStr]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.updateFlag], &, literal[0x80]], !=, literal[0]]] begin[{]
call[httpRequest.addParam, parameter[member[RequestBodyKey.AUTHORITY], call[request.getAuthority, parameter[]]]]
else begin[{]
None
end[}]
call[httpRequest.setMethod, parameter[member[HttpMethod.POST]]]
call[httpRequest.setContentType, parameter[member[HttpContentType.APPLICATION_JSON]]]
return[call[httpClient.sendHttpRequest, parameter[member[.httpRequest]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[updateFile] operator[SEP] Keyword[final] identifier[UpdateFileRequest] identifier[request] operator[SEP] Keyword[throws] identifier[AbstractCosException] {
identifier[request] operator[SEP] identifier[check_param] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[url] operator[=] identifier[buildUrl] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[String] identifier[sign] operator[=] identifier[Sign] operator[SEP] identifier[getOneEffectiveSign] operator[SEP] identifier[request] operator[SEP] identifier[getBucketName] operator[SEP] operator[SEP] , identifier[request] operator[SEP] identifier[getCosPath] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[cred] operator[SEP] operator[SEP] identifier[HttpRequest] identifier[httpRequest] operator[=] Keyword[new] identifier[HttpRequest] operator[SEP] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[setUrl] operator[SEP] identifier[url] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[RequestHeaderKey] operator[SEP] identifier[Authorization] , identifier[sign] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[RequestHeaderKey] operator[SEP] identifier[Content_TYPE] , identifier[RequestHeaderValue] operator[SEP] identifier[ContentType] operator[SEP] identifier[JSON] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[RequestHeaderKey] operator[SEP] identifier[USER_AGENT] , Keyword[this] operator[SEP] identifier[config] operator[SEP] identifier[getUserAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[OP] , identifier[RequestBodyValue] operator[SEP] identifier[OP] operator[SEP] identifier[UPDATE] operator[SEP] operator[SEP] Keyword[int] identifier[updateFlag] operator[=] identifier[request] operator[SEP] identifier[getUpdateFlag] operator[SEP] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[UPDATE_FLAG] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[updateFlag] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[updateFlag] operator[&] literal[Integer] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[BIZ_ATTR] , identifier[request] operator[SEP] identifier[getBizAttr] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[updateFlag] operator[&] literal[Integer] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[String] identifier[customHeaderStr] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] identifier[request] operator[SEP] identifier[getCustomHeaders] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[CUSTOM_HEADERS] , identifier[customHeaderStr] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[updateFlag] operator[&] literal[Integer] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[httpRequest] operator[SEP] identifier[addParam] operator[SEP] identifier[RequestBodyKey] operator[SEP] identifier[AUTHORITY] , identifier[request] operator[SEP] identifier[getAuthority] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[httpRequest] operator[SEP] identifier[setMethod] operator[SEP] identifier[HttpMethod] operator[SEP] identifier[POST] operator[SEP] operator[SEP] identifier[httpRequest] operator[SEP] identifier[setContentType] operator[SEP] identifier[HttpContentType] operator[SEP] identifier[APPLICATION_JSON] operator[SEP] operator[SEP] Keyword[return] identifier[httpClient] operator[SEP] identifier[sendHttpRequest] operator[SEP] identifier[httpRequest] operator[SEP] operator[SEP]
}
|
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_conf_revision_history_responses result = (ns_conf_revision_history_responses) service.get_payload_formatter().string_to_resource(ns_conf_revision_history_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_revision_history_response_array);
}
ns_conf_revision_history[] result_ns_conf_revision_history = new ns_conf_revision_history[result.ns_conf_revision_history_response_array.length];
for(int i = 0; i < result.ns_conf_revision_history_response_array.length; i++)
{
result_ns_conf_revision_history[i] = result.ns_conf_revision_history_response_array[i].ns_conf_revision_history[0];
}
return result_ns_conf_revision_history;
} | class class_name[name] begin[{]
method[get_nitro_bulk_response, return_type[type[base_resource]], modifier[protected], parameter[service, response]] begin[{]
local_variable[type[ns_conf_revision_history_responses], result]
if[binary_operation[member[result.errorcode], !=, literal[0]]] begin[{]
if[binary_operation[member[result.errorcode], ==, member[.SESSION_NOT_EXISTS]]] begin[{]
call[service.clear_session, parameter[]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), MemberReference(member=errorcode, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), Cast(expression=MemberReference(member=ns_conf_revision_history_response_array, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), type=ReferenceType(arguments=None, dimensions=[None], name=base_response, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=nitro_exception, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ns_conf_revision_history], result_ns_conf_revision_history]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result_ns_conf_revision_history, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=ns_conf_revision_history_response_array, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=ns_conf_revision_history, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])), 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=result.ns_conf_revision_history_response_array, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.result_ns_conf_revision_history]]
end[}]
END[}] | Keyword[protected] identifier[base_resource] operator[SEP] operator[SEP] identifier[get_nitro_bulk_response] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[response] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[ns_conf_revision_history_responses] identifier[result] operator[=] operator[SEP] identifier[ns_conf_revision_history_responses] operator[SEP] identifier[service] operator[SEP] identifier[get_payload_formatter] operator[SEP] operator[SEP] operator[SEP] identifier[string_to_resource] operator[SEP] identifier[ns_conf_revision_history_responses] operator[SEP] Keyword[class] , identifier[response] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[errorcode] operator[!=] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[errorcode] operator[==] identifier[SESSION_NOT_EXISTS] operator[SEP] identifier[service] operator[SEP] identifier[clear_session] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[nitro_exception] operator[SEP] identifier[result] operator[SEP] identifier[message] , identifier[result] operator[SEP] identifier[errorcode] , operator[SEP] identifier[base_response] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[ns_conf_revision_history_response_array] operator[SEP] operator[SEP]
}
identifier[ns_conf_revision_history] operator[SEP] operator[SEP] identifier[result_ns_conf_revision_history] operator[=] Keyword[new] identifier[ns_conf_revision_history] operator[SEP] identifier[result] operator[SEP] identifier[ns_conf_revision_history_response_array] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[result] operator[SEP] identifier[ns_conf_revision_history_response_array] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result_ns_conf_revision_history] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[result] operator[SEP] identifier[ns_conf_revision_history_response_array] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[ns_conf_revision_history] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result_ns_conf_revision_history] operator[SEP]
}
|
@JSONField(serialize = false)
public List<Obj> getSequential() {
List<Obj> sequential = new ArrayList<>();
if (getList() != null) {
for (Obj obj : getList()) {
if (obj.isSequential()) {
sequential.add(obj);
}
}
}
return sequential;
} | class class_name[name] begin[{]
method[getSequential, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], sequential]
if[binary_operation[call[.getList, parameter[]], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isSequential, postfix_operators=[], prefix_operators=[], qualifier=obj, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=sequential, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=obj)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Obj, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.sequential]]
end[}]
END[}] | annotation[@] identifier[JSONField] operator[SEP] identifier[serialize] operator[=] literal[boolean] operator[SEP] Keyword[public] identifier[List] operator[<] identifier[Obj] operator[>] identifier[getSequential] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Obj] operator[>] identifier[sequential] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getList] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Obj] identifier[obj] operator[:] identifier[getList] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[obj] operator[SEP] identifier[isSequential] operator[SEP] operator[SEP] operator[SEP] {
identifier[sequential] operator[SEP] identifier[add] operator[SEP] identifier[obj] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[sequential] operator[SEP]
}
|
public static <T> RuntimeSchema<T> createFrom(Class<T> typeClass,
Map<String, String> declaredFields, IdStrategy strategy)
{
if (typeClass.isInterface()
|| Modifier.isAbstract(typeClass.getModifiers()))
{
throw new RuntimeException(
"The root object can neither be an abstract "
+ "class nor interface: \"" + typeClass.getName());
}
final ArrayList<Field<T>> fields = new ArrayList<Field<T>>(
declaredFields.size());
int i = 0;
for (Map.Entry<String, String> entry : declaredFields.entrySet())
{
final java.lang.reflect.Field f;
try
{
f = typeClass.getDeclaredField(entry.getKey());
}
catch (Exception e)
{
throw new IllegalArgumentException("Exception on field: "
+ entry.getKey(), e);
}
final int mod = f.getModifiers();
if (!Modifier.isStatic(mod) && !Modifier.isTransient(mod) && f.getAnnotation(Exclude.class) == null)
{
final Field<T> field = RuntimeFieldFactory.getFieldFactory(
f.getType(), strategy).create(++i, entry.getValue(), f,
strategy);
fields.add(field);
}
}
return new RuntimeSchema<T>(typeClass, fields, RuntimeEnv.newInstantiator(typeClass));
} | class class_name[name] begin[{]
method[createFrom, return_type[type[RuntimeSchema]], modifier[public static], parameter[typeClass, declaredFields, strategy]] begin[{]
if[binary_operation[call[typeClass.isInterface, parameter[]], ||, call[Modifier.isAbstract, parameter[call[typeClass.getModifiers, parameter[]]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The root object can neither be an abstract "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="class nor interface: \""), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=typeClass, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ArrayList], fields]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=f)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=lang, sub_type=ReferenceType(arguments=None, dimensions=None, name=reflect, sub_type=ReferenceType(arguments=None, dimensions=None, name=Field, sub_type=None))))), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=getDeclaredField, postfix_operators=[], prefix_operators=[], qualifier=typeClass, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception on field: "), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, 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=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getModifiers, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), name=mod)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=mod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isStatic, postfix_operators=[], prefix_operators=['!'], qualifier=Modifier, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=mod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isTransient, postfix_operators=[], prefix_operators=['!'], qualifier=Modifier, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exclude, sub_type=None))], member=getAnnotation, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), MemberReference(member=strategy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFieldFactory, postfix_operators=[], prefix_operators=[], qualifier=RuntimeFieldFactory, selectors=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=strategy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=create, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=field)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Field, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=declaredFields, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[ClassCreator(arguments=[MemberReference(member=typeClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=typeClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInstantiator, postfix_operators=[], prefix_operators=[], qualifier=RuntimeEnv, selectors=[], type_arguments=None)], 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=T, sub_type=None))], dimensions=None, name=RuntimeSchema, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[RuntimeSchema] operator[<] identifier[T] operator[>] identifier[createFrom] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[typeClass] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[declaredFields] , identifier[IdStrategy] identifier[strategy] operator[SEP] {
Keyword[if] operator[SEP] identifier[typeClass] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[||] identifier[Modifier] operator[SEP] identifier[isAbstract] operator[SEP] identifier[typeClass] operator[SEP] identifier[getModifiers] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] literal[String] operator[+] identifier[typeClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[ArrayList] operator[<] identifier[Field] operator[<] identifier[T] operator[>] operator[>] identifier[fields] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Field] operator[<] identifier[T] operator[>] operator[>] operator[SEP] identifier[declaredFields] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[>] identifier[entry] operator[:] identifier[declaredFields] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[reflect] operator[SEP] identifier[Field] identifier[f] operator[SEP] Keyword[try] {
identifier[f] operator[=] identifier[typeClass] operator[SEP] identifier[getDeclaredField] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[mod] operator[=] identifier[f] operator[SEP] identifier[getModifiers] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Modifier] operator[SEP] identifier[isStatic] operator[SEP] identifier[mod] operator[SEP] operator[&&] operator[!] identifier[Modifier] operator[SEP] identifier[isTransient] operator[SEP] identifier[mod] operator[SEP] operator[&&] identifier[f] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[Exclude] operator[SEP] Keyword[class] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[final] identifier[Field] operator[<] identifier[T] operator[>] identifier[field] operator[=] identifier[RuntimeFieldFactory] operator[SEP] identifier[getFieldFactory] operator[SEP] identifier[f] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[strategy] operator[SEP] operator[SEP] identifier[create] operator[SEP] operator[++] identifier[i] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[f] , identifier[strategy] operator[SEP] operator[SEP] identifier[fields] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[RuntimeSchema] operator[<] identifier[T] operator[>] operator[SEP] identifier[typeClass] , identifier[fields] , identifier[RuntimeEnv] operator[SEP] identifier[newInstantiator] operator[SEP] identifier[typeClass] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void selectMerge( int pruneId , FastQueue<float[]> regionColor ) {
// Grab information on the region which is being pruned
Node n = pruneGraph.get(pruneId);
float[] targetColor = regionColor.get(n.segment);
// segment ID and distance away from the most similar neighbor
int bestId = -1;
float bestDistance = Float.MAX_VALUE;
// Examine all the segments it is connected to to see which one it is most similar too
for( int i = 0; i < n.edges.size; i++ ) {
int segment = n.edges.get(i);
float[] neighborColor = regionColor.get(segment);
float d = SegmentMeanShiftSearch.distanceSq(targetColor, neighborColor);
if( d < bestDistance ) {
bestDistance = d;
bestId = segment;
}
}
if( bestId == -1 )
throw new RuntimeException("No neighbors? Something went really wrong.");
markMerge(n.segment, bestId);
} | class class_name[name] begin[{]
method[selectMerge, return_type[void], modifier[protected], parameter[pruneId, regionColor]] begin[{]
local_variable[type[Node], n]
local_variable[type[float], targetColor]
local_variable[type[int], bestId]
local_variable[type[float], bestDistance]
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=n.edges, selectors=[], type_arguments=None), name=segment)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=regionColor, selectors=[], type_arguments=None), name=neighborColor)], modifiers=set(), type=BasicType(dimensions=[None], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=targetColor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=neighborColor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=distanceSq, postfix_operators=[], prefix_operators=[], qualifier=SegmentMeanShiftSearch, selectors=[], type_arguments=None), name=d)], modifiers=set(), type=BasicType(dimensions=[], name=float)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bestDistance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestDistance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=n.edges, 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)
if[binary_operation[member[.bestId], ==, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No neighbors? Something went really wrong.")], 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[}]
call[.markMerge, parameter[member[n.segment], member[.bestId]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[selectMerge] operator[SEP] Keyword[int] identifier[pruneId] , identifier[FastQueue] operator[<] Keyword[float] operator[SEP] operator[SEP] operator[>] identifier[regionColor] operator[SEP] {
identifier[Node] identifier[n] operator[=] identifier[pruneGraph] operator[SEP] identifier[get] operator[SEP] identifier[pruneId] operator[SEP] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[targetColor] operator[=] identifier[regionColor] operator[SEP] identifier[get] operator[SEP] identifier[n] operator[SEP] identifier[segment] operator[SEP] operator[SEP] Keyword[int] identifier[bestId] operator[=] operator[-] Other[1] operator[SEP] Keyword[float] identifier[bestDistance] operator[=] identifier[Float] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[n] operator[SEP] identifier[edges] operator[SEP] identifier[size] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[segment] operator[=] identifier[n] operator[SEP] identifier[edges] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[neighborColor] operator[=] identifier[regionColor] operator[SEP] identifier[get] operator[SEP] identifier[segment] operator[SEP] operator[SEP] Keyword[float] identifier[d] operator[=] identifier[SegmentMeanShiftSearch] operator[SEP] identifier[distanceSq] operator[SEP] identifier[targetColor] , identifier[neighborColor] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[d] operator[<] identifier[bestDistance] operator[SEP] {
identifier[bestDistance] operator[=] identifier[d] operator[SEP] identifier[bestId] operator[=] identifier[segment] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[bestId] operator[==] operator[-] Other[1] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[markMerge] operator[SEP] identifier[n] operator[SEP] identifier[segment] , identifier[bestId] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({"rawtypes", "unchecked"})
public static void swap(List<?> list, int i, int j) {
// instead of using a raw type here, it's possible to capture
// the wildcard but it will require a call to a supplementary
// private method
final List l = list;
l.set(i, l.set(j, l.get(i)));
} | class class_name[name] begin[{]
method[swap, return_type[void], modifier[public static], parameter[list, i, j]] begin[{]
local_variable[type[List], l]
call[l.set, parameter[member[.i], call[l.set, parameter[member[.j], call[l.get, parameter[member[.i]]]]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] Keyword[public] Keyword[static] Keyword[void] identifier[swap] operator[SEP] identifier[List] operator[<] operator[?] operator[>] identifier[list] , Keyword[int] identifier[i] , Keyword[int] identifier[j] operator[SEP] {
Keyword[final] identifier[List] identifier[l] operator[=] identifier[list] operator[SEP] identifier[l] operator[SEP] identifier[set] operator[SEP] identifier[i] , identifier[l] operator[SEP] identifier[set] operator[SEP] identifier[j] , identifier[l] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public int get24( int x , int y ) {
int i = startIndex + y*stride+x*3;
return ((data[i]&0xFF) << 16) | ((data[i+1]&0xFF) << 8) | (data[i+2]&0xFF);
} | class class_name[name] begin[{]
method[get24, return_type[type[int]], modifier[public], parameter[x, y]] begin[{]
local_variable[type[int], i]
return[binary_operation[binary_operation[binary_operation[binary_operation[member[.data], &, literal[0xFF]], <<, literal[16]], |, binary_operation[binary_operation[member[.data], &, literal[0xFF]], <<, literal[8]]], |, binary_operation[member[.data], &, literal[0xFF]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[get24] operator[SEP] Keyword[int] identifier[x] , Keyword[int] identifier[y] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[startIndex] operator[+] identifier[y] operator[*] identifier[stride] operator[+] identifier[x] operator[*] Other[3] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[16] operator[SEP] operator[|] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[8] operator[SEP] operator[|] operator[SEP] identifier[data] operator[SEP] identifier[i] operator[+] Other[2] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.