code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
private static <K,V> void copyColor(final Node<K,V> from, final Node<K,V> to,
final int index) {
if (to != null) {
if (from == null) {
// by default, make it black
to.setBlack(index);
} else {
to.copyColor(from, index);
}
}
} | class class_name[name] begin[{]
method[copyColor, return_type[void], modifier[private static], parameter[from, to, index]] begin[{]
if[binary_operation[member[.to], !=, literal[null]]] begin[{]
if[binary_operation[member[.from], ==, literal[null]]] begin[{]
call[to.setBlack, parameter[member[.index]]]
else begin[{]
call[to.copyColor, parameter[member[.from], member[.index]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] Keyword[void] identifier[copyColor] operator[SEP] Keyword[final] identifier[Node] operator[<] identifier[K] , identifier[V] operator[>] identifier[from] , Keyword[final] identifier[Node] operator[<] identifier[K] , identifier[V] operator[>] identifier[to] , Keyword[final] Keyword[int] identifier[index] operator[SEP] {
Keyword[if] operator[SEP] identifier[to] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[from] operator[==] Other[null] operator[SEP] {
identifier[to] operator[SEP] identifier[setBlack] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[to] operator[SEP] identifier[copyColor] operator[SEP] identifier[from] , identifier[index] operator[SEP] operator[SEP]
}
}
}
|
public Boolean getBoolean(String name) {
Object o = get(name);
if (o instanceof Boolean) {
return (Boolean)o;
}
if (o != null) {
try {
String string = o.toString();
if (string != null) {
return GrailsStringUtils.toBoolean(string);
}
}
catch (Exception e) {}
}
return null;
} | class class_name[name] begin[{]
method[getBoolean, return_type[type[Boolean]], modifier[public], parameter[name]] begin[{]
local_variable[type[Object], o]
if[binary_operation[member[.o], instanceof, type[Boolean]]] begin[{]
return[Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.o], !=, literal[null]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=o, selectors=[], type_arguments=None), name=string)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=string, 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=MethodInvocation(arguments=[MemberReference(member=string, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toBoolean, postfix_operators=[], prefix_operators=[], qualifier=GrailsStringUtils, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[Boolean] identifier[getBoolean] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[Object] identifier[o] operator[=] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[Boolean] operator[SEP] {
Keyword[return] operator[SEP] identifier[Boolean] operator[SEP] identifier[o] operator[SEP]
}
Keyword[if] operator[SEP] identifier[o] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[String] identifier[string] operator[=] identifier[o] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[string] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[GrailsStringUtils] operator[SEP] identifier[toBoolean] operator[SEP] identifier[string] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public void assertIsPositive(Description description, BigDecimal actual) {
comparables.assertGreaterThan(description, actual, ZERO);
} | class class_name[name] begin[{]
method[assertIsPositive, return_type[void], modifier[public], parameter[description, actual]] begin[{]
call[comparables.assertGreaterThan, parameter[member[.description], member[.actual], member[.ZERO]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[assertIsPositive] operator[SEP] identifier[Description] identifier[description] , identifier[BigDecimal] identifier[actual] operator[SEP] {
identifier[comparables] operator[SEP] identifier[assertGreaterThan] operator[SEP] identifier[description] , identifier[actual] , identifier[ZERO] operator[SEP] operator[SEP]
}
|
public void sort( float[] values, float[] valuesToFollow ) {
this.valuesToSortFloat = values;
this.valuesToFollowFloat = valuesToFollow;
number = values.length;
monitor.beginTask("Sorting...", -1);
monitor.worked(1);
quicksortFloat(0, number - 1);
monitor.done();
} | class class_name[name] begin[{]
method[sort, return_type[void], modifier[public], parameter[values, valuesToFollow]] begin[{]
assign[THIS[member[None.valuesToSortFloat]], member[.values]]
assign[THIS[member[None.valuesToFollowFloat]], member[.valuesToFollow]]
assign[member[.number], member[values.length]]
call[monitor.beginTask, parameter[literal["Sorting..."], literal[1]]]
call[monitor.worked, parameter[literal[1]]]
call[.quicksortFloat, parameter[literal[0], binary_operation[member[.number], -, literal[1]]]]
call[monitor.done, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[sort] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[values] , Keyword[float] operator[SEP] operator[SEP] identifier[valuesToFollow] operator[SEP] {
Keyword[this] operator[SEP] identifier[valuesToSortFloat] operator[=] identifier[values] operator[SEP] Keyword[this] operator[SEP] identifier[valuesToFollowFloat] operator[=] identifier[valuesToFollow] operator[SEP] identifier[number] operator[=] identifier[values] operator[SEP] identifier[length] operator[SEP] identifier[monitor] operator[SEP] identifier[beginTask] operator[SEP] literal[String] , operator[-] Other[1] operator[SEP] operator[SEP] identifier[monitor] operator[SEP] identifier[worked] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[quicksortFloat] operator[SEP] Other[0] , identifier[number] operator[-] Other[1] operator[SEP] operator[SEP] identifier[monitor] operator[SEP] identifier[done] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("rawtypes")
public List mget(Object... keys) {
Jedis jedis = getJedis();
try {
byte[][] keysBytesArray = keysToBytesArray(keys);
List<byte[]> data = jedis.mget(keysBytesArray);
return valueListFromBytesList(data);
}
finally {close(jedis);}
} | class class_name[name] begin[{]
method[mget, return_type[type[List]], modifier[public], parameter[keys]] begin[{]
local_variable[type[Jedis], jedis]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=keysToBytesArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=keysBytesArray)], modifiers=set(), type=BasicType(dimensions=[None, None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=keysBytesArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mget, postfix_operators=[], prefix_operators=[], qualifier=jedis, selectors=[], type_arguments=None), name=data)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte))], dimensions=[], name=List, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueListFromBytesList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jedis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[List] identifier[mget] operator[SEP] identifier[Object] operator[...] identifier[keys] operator[SEP] {
identifier[Jedis] identifier[jedis] operator[=] identifier[getJedis] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[byte] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[keysBytesArray] operator[=] identifier[keysToBytesArray] operator[SEP] identifier[keys] operator[SEP] operator[SEP] identifier[List] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[data] operator[=] identifier[jedis] operator[SEP] identifier[mget] operator[SEP] identifier[keysBytesArray] operator[SEP] operator[SEP] Keyword[return] identifier[valueListFromBytesList] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[close] operator[SEP] identifier[jedis] operator[SEP] operator[SEP]
}
}
|
public String getTableNames(boolean bAddQuotes)
{
return (m_tableName == null) ? Record.formatTableNames(REGISTRATION_FILE, bAddQuotes) : super.getTableNames(bAddQuotes);
} | class class_name[name] begin[{]
method[getTableNames, return_type[type[String]], modifier[public], parameter[bAddQuotes]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=m_tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=SuperMethodInvocation(arguments=[MemberReference(member=bAddQuotes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTableNames, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=REGISTRATION_FILE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bAddQuotes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=formatTableNames, postfix_operators=[], prefix_operators=[], qualifier=Record, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getTableNames] operator[SEP] Keyword[boolean] identifier[bAddQuotes] operator[SEP] {
Keyword[return] operator[SEP] identifier[m_tableName] operator[==] Other[null] operator[SEP] operator[?] identifier[Record] operator[SEP] identifier[formatTableNames] operator[SEP] identifier[REGISTRATION_FILE] , identifier[bAddQuotes] operator[SEP] operator[:] Keyword[super] operator[SEP] identifier[getTableNames] operator[SEP] identifier[bAddQuotes] operator[SEP] operator[SEP]
}
|
public boolean handle(ServerHttpRequest request, ServerHttpResponse response)
throws IOException {
for (HandlerMapper mapper : this.mappers) {
Handler handler = mapper.getHandler(request);
if (handler != null) {
handle(handler, request, response);
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[handle, return_type[type[boolean]], modifier[public], parameter[request, response]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getHandler, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), name=handler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Handler, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=mappers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mapper)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HandlerMapper, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[handle] operator[SEP] identifier[ServerHttpRequest] identifier[request] , identifier[ServerHttpResponse] identifier[response] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[for] operator[SEP] identifier[HandlerMapper] identifier[mapper] operator[:] Keyword[this] operator[SEP] identifier[mappers] operator[SEP] {
identifier[Handler] identifier[handler] operator[=] identifier[mapper] operator[SEP] identifier[getHandler] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[handler] operator[!=] Other[null] operator[SEP] {
identifier[handle] operator[SEP] identifier[handler] , identifier[request] , identifier[response] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static PrometheusMeterRegistry prometheus() {
PrometheusMeterRegistry prometheusRegistry = new PrometheusMeterRegistry(new PrometheusConfig() {
@Override
public Duration step() {
return Duration.ofSeconds(10);
}
@Override
@Nullable
public String get(String k) {
return null;
}
});
try {
HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
server.createContext("/prometheus", httpExchange -> {
String response = prometheusRegistry.scrape();
httpExchange.sendResponseHeaders(200, response.length());
OutputStream os = httpExchange.getResponseBody();
os.write(response.getBytes());
os.close();
});
new Thread(server::start).run();
} catch (IOException e) {
throw new RuntimeException(e);
}
return prometheusRegistry;
} | class class_name[name] begin[{]
method[prometheus, return_type[type[PrometheusMeterRegistry]], modifier[public static], parameter[]] begin[{]
local_variable[type[PrometheusMeterRegistry], prometheusRegistry]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8080)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InetSocketAddress, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=create, postfix_operators=[], prefix_operators=[], qualifier=HttpServer, selectors=[], type_arguments=None), name=server)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HttpServer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/prometheus"), LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=scrape, postfix_operators=[], prefix_operators=[], qualifier=prometheusRegistry, selectors=[], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=200), MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], member=sendResponseHeaders, postfix_operators=[], prefix_operators=[], qualifier=httpExchange, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResponseBody, postfix_operators=[], prefix_operators=[], qualifier=httpExchange, selectors=[], type_arguments=None), name=os)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OutputStream, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], member=write, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=httpExchange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=createContext, postfix_operators=[], prefix_operators=[], qualifier=server, selectors=[], type_arguments=None), label=None), StatementExpression(expression=ClassCreator(arguments=[MethodReference(expression=MemberReference(member=server, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=run, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Thread, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
return[member[.prometheusRegistry]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PrometheusMeterRegistry] identifier[prometheus] operator[SEP] operator[SEP] {
identifier[PrometheusMeterRegistry] identifier[prometheusRegistry] operator[=] Keyword[new] identifier[PrometheusMeterRegistry] operator[SEP] Keyword[new] identifier[PrometheusConfig] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Duration] identifier[step] operator[SEP] operator[SEP] {
Keyword[return] identifier[Duration] operator[SEP] identifier[ofSeconds] operator[SEP] Other[10] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] annotation[@] identifier[Nullable] Keyword[public] identifier[String] identifier[get] operator[SEP] identifier[String] identifier[k] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[try] {
identifier[HttpServer] identifier[server] operator[=] identifier[HttpServer] operator[SEP] identifier[create] operator[SEP] Keyword[new] identifier[InetSocketAddress] operator[SEP] Other[8080] operator[SEP] , Other[0] operator[SEP] operator[SEP] identifier[server] operator[SEP] identifier[createContext] operator[SEP] literal[String] , identifier[httpExchange] operator[->] {
identifier[String] identifier[response] operator[=] identifier[prometheusRegistry] operator[SEP] identifier[scrape] operator[SEP] operator[SEP] operator[SEP] identifier[httpExchange] operator[SEP] identifier[sendResponseHeaders] operator[SEP] Other[200] , identifier[response] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[OutputStream] identifier[os] operator[=] identifier[httpExchange] operator[SEP] identifier[getResponseBody] operator[SEP] operator[SEP] operator[SEP] identifier[os] operator[SEP] identifier[write] operator[SEP] identifier[response] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[os] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[new] identifier[Thread] operator[SEP] identifier[server] operator[::] identifier[start] operator[SEP] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[prometheusRegistry] operator[SEP]
}
|
public static void resetIfAppVersionChanged(Context context) {
SharedPreferences prefs = getSharedPreferences(context);
int appVersionCode = Integer.MIN_VALUE;
final int previousAppVersionCode = prefs.getInt(PREF_KEY_APP_VERSION_CODE, Integer.MIN_VALUE);
try {
appVersionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Occurred PackageManager.NameNotFoundException", e);
}
if (previousAppVersionCode != appVersionCode) {
SharedPreferences.Editor prefsEditor = prefs.edit();
prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, 0);
prefsEditor.putLong(PREF_KEY_APP_THIS_VERSION_CODE_LAUNCH_COUNT, 0);
prefsEditor.putLong(PREF_KEY_APP_FIRST_LAUNCHED_DATE, 0);
prefsEditor.putInt(PREF_KEY_APP_VERSION_CODE, Integer.MIN_VALUE);
prefsEditor.putLong(PREF_KEY_RATE_CLICK_DATE, 0);
prefsEditor.putLong(PREF_KEY_REMINDER_CLICK_DATE, 0);
prefsEditor.putBoolean(PREF_KEY_DO_NOT_SHOW_AGAIN, false);
prefsEditor.commit();
}
} | class class_name[name] begin[{]
method[resetIfAppVersionChanged, return_type[void], modifier[public static], parameter[context]] begin[{]
local_variable[type[SharedPreferences], prefs]
local_variable[type[int], appVersionCode]
local_variable[type[int], previousAppVersionCode]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=appVersionCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getPackageManager, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPackageName, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=getPackageInfo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MemberReference(member=versionCode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Occurred PackageManager.NameNotFoundException"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=w, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['PackageManager.NameNotFoundException']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.previousAppVersionCode], !=, member[.appVersionCode]]] begin[{]
local_variable[type[SharedPreferences], prefsEditor]
call[prefsEditor.putLong, parameter[member[.PREF_KEY_APP_LAUNCH_COUNT], literal[0]]]
call[prefsEditor.putLong, parameter[member[.PREF_KEY_APP_THIS_VERSION_CODE_LAUNCH_COUNT], literal[0]]]
call[prefsEditor.putLong, parameter[member[.PREF_KEY_APP_FIRST_LAUNCHED_DATE], literal[0]]]
call[prefsEditor.putInt, parameter[member[.PREF_KEY_APP_VERSION_CODE], member[Integer.MIN_VALUE]]]
call[prefsEditor.putLong, parameter[member[.PREF_KEY_RATE_CLICK_DATE], literal[0]]]
call[prefsEditor.putLong, parameter[member[.PREF_KEY_REMINDER_CLICK_DATE], literal[0]]]
call[prefsEditor.putBoolean, parameter[member[.PREF_KEY_DO_NOT_SHOW_AGAIN], literal[false]]]
call[prefsEditor.commit, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[resetIfAppVersionChanged] operator[SEP] identifier[Context] identifier[context] operator[SEP] {
identifier[SharedPreferences] identifier[prefs] operator[=] identifier[getSharedPreferences] operator[SEP] identifier[context] operator[SEP] operator[SEP] Keyword[int] identifier[appVersionCode] operator[=] identifier[Integer] operator[SEP] identifier[MIN_VALUE] operator[SEP] Keyword[final] Keyword[int] identifier[previousAppVersionCode] operator[=] identifier[prefs] operator[SEP] identifier[getInt] operator[SEP] identifier[PREF_KEY_APP_VERSION_CODE] , identifier[Integer] operator[SEP] identifier[MIN_VALUE] operator[SEP] operator[SEP] Keyword[try] {
identifier[appVersionCode] operator[=] identifier[context] operator[SEP] identifier[getPackageManager] operator[SEP] operator[SEP] operator[SEP] identifier[getPackageInfo] operator[SEP] identifier[context] operator[SEP] identifier[getPackageName] operator[SEP] operator[SEP] , Other[0] operator[SEP] operator[SEP] identifier[versionCode] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[PackageManager] operator[SEP] identifier[NameNotFoundException] identifier[e] operator[SEP] {
identifier[Log] operator[SEP] identifier[w] operator[SEP] identifier[TAG] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[previousAppVersionCode] operator[!=] identifier[appVersionCode] operator[SEP] {
identifier[SharedPreferences] operator[SEP] identifier[Editor] identifier[prefsEditor] operator[=] identifier[prefs] operator[SEP] identifier[edit] operator[SEP] operator[SEP] operator[SEP] identifier[prefsEditor] operator[SEP] identifier[putLong] operator[SEP] identifier[PREF_KEY_APP_LAUNCH_COUNT] , Other[0] operator[SEP] operator[SEP] identifier[prefsEditor] operator[SEP] identifier[putLong] operator[SEP] identifier[PREF_KEY_APP_THIS_VERSION_CODE_LAUNCH_COUNT] , Other[0] operator[SEP] operator[SEP] identifier[prefsEditor] operator[SEP] identifier[putLong] operator[SEP] identifier[PREF_KEY_APP_FIRST_LAUNCHED_DATE] , Other[0] operator[SEP] operator[SEP] identifier[prefsEditor] operator[SEP] identifier[putInt] operator[SEP] identifier[PREF_KEY_APP_VERSION_CODE] , identifier[Integer] operator[SEP] identifier[MIN_VALUE] operator[SEP] operator[SEP] identifier[prefsEditor] operator[SEP] identifier[putLong] operator[SEP] identifier[PREF_KEY_RATE_CLICK_DATE] , Other[0] operator[SEP] operator[SEP] identifier[prefsEditor] operator[SEP] identifier[putLong] operator[SEP] identifier[PREF_KEY_REMINDER_CLICK_DATE] , Other[0] operator[SEP] operator[SEP] identifier[prefsEditor] operator[SEP] identifier[putBoolean] operator[SEP] identifier[PREF_KEY_DO_NOT_SHOW_AGAIN] , literal[boolean] operator[SEP] operator[SEP] identifier[prefsEditor] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("WeakerAccess")
public static NumberField buildRMST(int requestingPlayer, Message.MenuIdentifier targetMenu,
CdjStatus.TrackSourceSlot slot) {
return buildRMST(requestingPlayer, targetMenu, slot, CdjStatus.TrackType.REKORDBOX);
} | class class_name[name] begin[{]
method[buildRMST, return_type[type[NumberField]], modifier[public static], parameter[requestingPlayer, targetMenu, slot]] begin[{]
return[call[.buildRMST, parameter[member[.requestingPlayer], member[.targetMenu], member[.slot], member[CdjStatus.TrackType.REKORDBOX]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] identifier[NumberField] identifier[buildRMST] operator[SEP] Keyword[int] identifier[requestingPlayer] , identifier[Message] operator[SEP] identifier[MenuIdentifier] identifier[targetMenu] , identifier[CdjStatus] operator[SEP] identifier[TrackSourceSlot] identifier[slot] operator[SEP] {
Keyword[return] identifier[buildRMST] operator[SEP] identifier[requestingPlayer] , identifier[targetMenu] , identifier[slot] , identifier[CdjStatus] operator[SEP] identifier[TrackType] operator[SEP] identifier[REKORDBOX] operator[SEP] operator[SEP]
}
|
private static boolean shouldRetry(final int status, final String content) {
switch (status) {
case 200:
return false;
case 404:
return analyse404Response(content);
case 500:
return analyse500Response(content);
case 300:
case 301:
case 302:
case 303:
case 307:
case 401:
case 408:
case 409:
case 412:
case 416:
case 417:
case 501:
case 502:
case 503:
case 504:
return true;
default:
LOGGER.info("Received a View HTTP response code ({}) I did not expect, not retrying.", status);
return false;
}
} | class class_name[name] begin[{]
method[shouldRetry, return_type[type[boolean]], modifier[private static], parameter[status, content]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=200)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=404)], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=content, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=analyse404Response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=500)], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=content, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=analyse500Response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=300), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=301), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=302), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=303), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=307), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=401), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=408), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=409), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=412), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=416), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=417), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=501), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=502), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=503), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=504)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Received a View HTTP response code ({}) I did not expect, not retrying."), MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])], expression=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[shouldRetry] operator[SEP] Keyword[final] Keyword[int] identifier[status] , Keyword[final] identifier[String] identifier[content] operator[SEP] {
Keyword[switch] operator[SEP] identifier[status] operator[SEP] {
Keyword[case] Other[200] operator[:] Keyword[return] literal[boolean] operator[SEP] Keyword[case] Other[404] operator[:] Keyword[return] identifier[analyse404Response] operator[SEP] identifier[content] operator[SEP] operator[SEP] Keyword[case] Other[500] operator[:] Keyword[return] identifier[analyse500Response] operator[SEP] identifier[content] operator[SEP] operator[SEP] Keyword[case] Other[300] operator[:] Keyword[case] Other[301] operator[:] Keyword[case] Other[302] operator[:] Keyword[case] Other[303] operator[:] Keyword[case] Other[307] operator[:] Keyword[case] Other[401] operator[:] Keyword[case] Other[408] operator[:] Keyword[case] Other[409] operator[:] Keyword[case] Other[412] operator[:] Keyword[case] Other[416] operator[:] Keyword[case] Other[417] operator[:] Keyword[case] Other[501] operator[:] Keyword[case] Other[502] operator[:] Keyword[case] Other[503] operator[:] Keyword[case] Other[504] operator[:] Keyword[return] literal[boolean] operator[SEP] Keyword[default] operator[:] identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[status] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
|
private void appendRoles(final StringBuilder builder, final User user) {
for (final UserRoleName role : user.getRoles()) {
append(builder, ",", role.name());
}
} | class class_name[name] begin[{]
method[appendRoles, return_type[void], modifier[private], parameter[builder, user]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=builder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=","), MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=role, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRoles, postfix_operators=[], prefix_operators=[], qualifier=user, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=role)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=UserRoleName, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[appendRoles] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[builder] , Keyword[final] identifier[User] identifier[user] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[UserRoleName] identifier[role] operator[:] identifier[user] operator[SEP] identifier[getRoles] operator[SEP] operator[SEP] operator[SEP] {
identifier[append] operator[SEP] identifier[builder] , literal[String] , identifier[role] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private boolean fillReadBuffer() throws IOException {
// TODO: Add reading from error stream of external process. Otherwise the InputFormat might get deadlocked!
// stream was completely processed
if(noMoreStreamInput) {
if(this.readBufferReadPos == this.readBufferFillPos) {
this.noMoreRecordBuffers = true;
return false;
} else {
throw new RuntimeException("External process produced incomplete record");
}
}
// the buffer was completely filled and processed
if(this.readBufferReadPos == this.readBuffer.length &&
this.readBufferRemainSpace == 0) {
// reset counters and fill again
this.readBufferFillPos = 0;
this.readBufferRemainSpace = this.readBuffer.length;
this.readBufferReadPos = 0;
}
// as long as not at least one record is complete
while(this.readBufferFillPos - this.readBufferReadPos < this.recordLength) {
// read from stdout
int readCnt = super.extProcOutStream.read(this.readBuffer, this.readBufferFillPos, this.readBufferRemainSpace);
if(readCnt == -1) {
// the is nothing more to read
this.noMoreStreamInput = true;
return false;
} else {
// update fill position and remain cnt
this.readBufferFillPos += readCnt;
this.readBufferRemainSpace -= readCnt;
}
}
return true;
} | class class_name[name] begin[{]
method[fillReadBuffer, return_type[type[boolean]], modifier[private], parameter[]] begin[{]
if[member[.noMoreStreamInput]] begin[{]
if[binary_operation[THIS[member[None.readBufferReadPos]], ==, THIS[member[None.readBufferFillPos]]]] begin[{]
assign[THIS[member[None.noMoreRecordBuffers]], literal[true]]
return[literal[false]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="External process produced incomplete record")], 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)
end[}]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[THIS[member[None.readBufferReadPos]], ==, THIS[member[None.readBuffer]member[None.length]]], &&, binary_operation[THIS[member[None.readBufferRemainSpace]], ==, literal[0]]]] begin[{]
assign[THIS[member[None.readBufferFillPos]], literal[0]]
assign[THIS[member[None.readBufferRemainSpace]], THIS[member[None.readBuffer]member[None.length]]]
assign[THIS[member[None.readBufferReadPos]], literal[0]]
else begin[{]
None
end[}]
while[binary_operation[binary_operation[THIS[member[None.readBufferFillPos]], -, THIS[member[None.readBufferReadPos]]], <, THIS[member[None.recordLength]]]] begin[{]
local_variable[type[int], readCnt]
if[binary_operation[member[.readCnt], ==, literal[1]]] begin[{]
assign[THIS[member[None.noMoreStreamInput]], literal[true]]
return[literal[false]]
else begin[{]
assign[THIS[member[None.readBufferFillPos]], member[.readCnt]]
assign[THIS[member[None.readBufferRemainSpace]], member[.readCnt]]
end[}]
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[fillReadBuffer] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[noMoreStreamInput] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[readBufferReadPos] operator[==] Keyword[this] operator[SEP] identifier[readBufferFillPos] operator[SEP] {
Keyword[this] operator[SEP] identifier[noMoreRecordBuffers] operator[=] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[readBufferReadPos] operator[==] Keyword[this] operator[SEP] identifier[readBuffer] operator[SEP] identifier[length] operator[&&] Keyword[this] operator[SEP] identifier[readBufferRemainSpace] operator[==] Other[0] operator[SEP] {
Keyword[this] operator[SEP] identifier[readBufferFillPos] operator[=] Other[0] operator[SEP] Keyword[this] operator[SEP] identifier[readBufferRemainSpace] operator[=] Keyword[this] operator[SEP] identifier[readBuffer] operator[SEP] identifier[length] operator[SEP] Keyword[this] operator[SEP] identifier[readBufferReadPos] operator[=] Other[0] operator[SEP]
}
Keyword[while] operator[SEP] Keyword[this] operator[SEP] identifier[readBufferFillPos] operator[-] Keyword[this] operator[SEP] identifier[readBufferReadPos] operator[<] Keyword[this] operator[SEP] identifier[recordLength] operator[SEP] {
Keyword[int] identifier[readCnt] operator[=] Keyword[super] operator[SEP] identifier[extProcOutStream] operator[SEP] identifier[read] operator[SEP] Keyword[this] operator[SEP] identifier[readBuffer] , Keyword[this] operator[SEP] identifier[readBufferFillPos] , Keyword[this] operator[SEP] identifier[readBufferRemainSpace] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[readCnt] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[this] operator[SEP] identifier[noMoreStreamInput] operator[=] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[readBufferFillPos] operator[+=] identifier[readCnt] operator[SEP] Keyword[this] operator[SEP] identifier[readBufferRemainSpace] operator[-=] identifier[readCnt] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
protected String[] extractClientCertificateChain(HttpServletRequest request)
{
for (ClientCertificateExtractor extractor : clientCertificateExtractors)
{
String[] chain = extractor.extractClientCertificateChain(request);
if (chain != null && chain.length > 0)
{
return chain;
}
}
return null;
} | class class_name[name] begin[{]
method[extractClientCertificateChain, return_type[type[String]], modifier[protected], parameter[request]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extractClientCertificateChain, postfix_operators=[], prefix_operators=[], qualifier=extractor, selectors=[], type_arguments=None), name=chain)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=chain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=chain, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=chain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=clientCertificateExtractors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=extractor)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ClientCertificateExtractor, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[protected] identifier[String] operator[SEP] operator[SEP] identifier[extractClientCertificateChain] operator[SEP] identifier[HttpServletRequest] identifier[request] operator[SEP] {
Keyword[for] operator[SEP] identifier[ClientCertificateExtractor] identifier[extractor] operator[:] identifier[clientCertificateExtractors] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[chain] operator[=] identifier[extractor] operator[SEP] identifier[extractClientCertificateChain] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[chain] operator[!=] Other[null] operator[&&] identifier[chain] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[return] identifier[chain] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public static Set<BioPAXElement> runCommonStreamWithPOIMultiSet(
Set<Set<BioPAXElement>> sourceSets,
Model model,
Direction direction,
int limit,
Filter... filters)
{
Graph graph;
if (model.getLevel() == BioPAXLevel.L3)
{
graph = new GraphL3(model, filters);
}
else return Collections.emptySet();
Collection<Set<Node>> nodes = prepareNodeSetsFromSets(sourceSets, graph);
if (nodes.size() < 2) return Collections.emptySet();
return runCommonStreamWithPOIContinued(nodes, direction, limit, graph);
} | class class_name[name] begin[{]
method[runCommonStreamWithPOIMultiSet, return_type[type[Set]], modifier[public static], parameter[sourceSets, model, direction, limit, filters]] begin[{]
local_variable[type[Graph], graph]
if[binary_operation[call[model.getLevel, parameter[]], ==, member[BioPAXLevel.L3]]] begin[{]
assign[member[.graph], ClassCreator(arguments=[MemberReference(member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=filters, 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=GraphL3, sub_type=None))]
else begin[{]
return[call[Collections.emptySet, parameter[]]]
end[}]
local_variable[type[Collection], nodes]
if[binary_operation[call[nodes.size, parameter[]], <, literal[2]]] begin[{]
return[call[Collections.emptySet, parameter[]]]
else begin[{]
None
end[}]
return[call[.runCommonStreamWithPOIContinued, parameter[member[.nodes], member[.direction], member[.limit], member[.graph]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[BioPAXElement] operator[>] identifier[runCommonStreamWithPOIMultiSet] operator[SEP] identifier[Set] operator[<] identifier[Set] operator[<] identifier[BioPAXElement] operator[>] operator[>] identifier[sourceSets] , identifier[Model] identifier[model] , identifier[Direction] identifier[direction] , Keyword[int] identifier[limit] , identifier[Filter] operator[...] identifier[filters] operator[SEP] {
identifier[Graph] identifier[graph] operator[SEP] Keyword[if] operator[SEP] identifier[model] operator[SEP] identifier[getLevel] operator[SEP] operator[SEP] operator[==] identifier[BioPAXLevel] operator[SEP] identifier[L3] operator[SEP] {
identifier[graph] operator[=] Keyword[new] identifier[GraphL3] operator[SEP] identifier[model] , identifier[filters] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[return] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[Set] operator[<] identifier[Node] operator[>] operator[>] identifier[nodes] operator[=] identifier[prepareNodeSetsFromSets] operator[SEP] identifier[sourceSets] , identifier[graph] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] Other[2] operator[SEP] Keyword[return] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[runCommonStreamWithPOIContinued] operator[SEP] identifier[nodes] , identifier[direction] , identifier[limit] , identifier[graph] operator[SEP] operator[SEP]
}
|
public void addNewItems(List<M> newItems) {
if (this.items == null) {
this.items = createEmptyList();
}
this.items.addAll(newItems);
} | class class_name[name] begin[{]
method[addNewItems, return_type[void], modifier[public], parameter[newItems]] begin[{]
if[binary_operation[THIS[member[None.items]], ==, literal[null]]] begin[{]
assign[THIS[member[None.items]], call[.createEmptyList, parameter[]]]
else begin[{]
None
end[}]
THIS[member[None.items]call[None.addAll, parameter[member[.newItems]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addNewItems] operator[SEP] identifier[List] operator[<] identifier[M] operator[>] identifier[newItems] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[items] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[items] operator[=] identifier[createEmptyList] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[items] operator[SEP] identifier[addAll] operator[SEP] identifier[newItems] operator[SEP] operator[SEP]
}
|
public void dumpNoTabs(PrintStream out) {
// out.println("seq\tversion\ttime\tclasses\tNCSS\tadded\tnewCode\tfixed\tremoved\tretained\tdead\tactive");
print(3, true, out, "seq");
out.print(' ');
print(19, false, out, "version");
out.print(' ');
print(formatDates ? 12 : 10, false, out, "time");
print(1 + 7, true, out, "classes");
print(1 + WIDTH, true, out, "NCSS");
print(1 + WIDTH, true, out, "added");
print(1 + WIDTH, true, out, "newCode");
print(1 + WIDTH, true, out, "fixed");
print(1 + WIDTH, true, out, "removed");
print(1 + WIDTH, true, out, "retained");
print(1 + WIDTH, true, out, "dead");
print(1 + WIDTH, true, out, "active");
out.println();
// note: if we were allowed to depend on JDK 1.5 we could use
// out.printf():
// Object line[] = { "seq", "version", "time", "classes", "NCSS",
// "added", "newCode", "fixed", "removed", "retained", "dead", "active"
// };
// out.printf("%3s %-19s %-16s %7s %7s %7s %7s %7s %7s %8s %6s %7s%n",
// line);
for (int i = 0; i < versionList.length; ++i) {
Version version = versionList[i];
AppVersion appVersion = sequenceToAppVersionMap.get(version.getSequence());
print(3, true, out, i); // out.print(i);
out.print(' '); // '\t'
print(19, false, out, appVersion != null ? appVersion.getReleaseName() : "");
out.print(' ');
long ts = (appVersion != null ? appVersion.getTimestamp() : 0L);
if (formatDates) {
print(12, false, out, dateFormat.format(ts));
} else {
print(10, false, out, ts / 1000);
}
out.print(' ');
print(7, true, out, appVersion != null ? appVersion.getNumClasses() : 0);
out.print(' ');
print(WIDTH, true, out, appVersion != null ? appVersion.getCodeSize() : 0);
for (int j = 0; j < TUPLE_SIZE; ++j) {
out.print(' ');
print(WIDTH, true, out, version.get(j));
}
out.println();
}
} | class class_name[name] begin[{]
method[dumpNoTabs, return_type[void], modifier[public], parameter[out]] begin[{]
call[.print, parameter[literal[3], literal[true], member[.out], literal["seq"]]]
call[out.print, parameter[literal[' ']]]
call[.print, parameter[literal[19], literal[false], member[.out], literal["version"]]]
call[out.print, parameter[literal[' ']]]
call[.print, parameter[TernaryExpression(condition=MemberReference(member=formatDates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=12)), literal[false], member[.out], literal["time"]]]
call[.print, parameter[binary_operation[literal[1], +, literal[7]], literal[true], member[.out], literal["classes"]]]
call[.print, parameter[binary_operation[literal[1], +, member[.WIDTH]], literal[true], member[.out], literal["NCSS"]]]
call[.print, parameter[binary_operation[literal[1], +, member[.WIDTH]], literal[true], member[.out], literal["added"]]]
call[.print, parameter[binary_operation[literal[1], +, member[.WIDTH]], literal[true], member[.out], literal["newCode"]]]
call[.print, parameter[binary_operation[literal[1], +, member[.WIDTH]], literal[true], member[.out], literal["fixed"]]]
call[.print, parameter[binary_operation[literal[1], +, member[.WIDTH]], literal[true], member[.out], literal["removed"]]]
call[.print, parameter[binary_operation[literal[1], +, member[.WIDTH]], literal[true], member[.out], literal["retained"]]]
call[.print, parameter[binary_operation[literal[1], +, member[.WIDTH]], literal[true], member[.out], literal["dead"]]]
call[.print, parameter[binary_operation[literal[1], +, member[.WIDTH]], literal[true], member[.out], literal["active"]]]
call[out.println, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=versionList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=version)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Version, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSequence, postfix_operators=[], prefix_operators=[], qualifier=version, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=sequenceToAppVersionMap, selectors=[], type_arguments=None), name=appVersion)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AppVersion, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=print, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=print, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=19), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=appVersion, 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=""), if_true=MethodInvocation(arguments=[], member=getReleaseName, postfix_operators=[], prefix_operators=[], qualifier=appVersion, selectors=[], type_arguments=None))], member=print, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=print, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=appVersion, 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=0L), if_true=MethodInvocation(arguments=[], member=getTimestamp, postfix_operators=[], prefix_operators=[], qualifier=appVersion, selectors=[], type_arguments=None)), name=ts)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=MemberReference(member=formatDates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=/)], member=print, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=12), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=ts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=dateFormat, selectors=[], type_arguments=None)], member=print, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=print, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=7), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=appVersion, 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=0), if_true=MethodInvocation(arguments=[], member=getNumClasses, postfix_operators=[], prefix_operators=[], qualifier=appVersion, selectors=[], type_arguments=None))], member=print, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=print, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=WIDTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=appVersion, 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=0), if_true=MethodInvocation(arguments=[], member=getCodeSize, postfix_operators=[], prefix_operators=[], qualifier=appVersion, selectors=[], type_arguments=None))], member=print, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=print, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=WIDTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=version, selectors=[], type_arguments=None)], member=print, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=TUPLE_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=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=println, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=versionList, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[dumpNoTabs] operator[SEP] identifier[PrintStream] identifier[out] operator[SEP] {
identifier[print] operator[SEP] Other[3] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[19] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] identifier[formatDates] operator[?] Other[12] operator[:] Other[10] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[1] operator[+] Other[7] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[1] operator[+] identifier[WIDTH] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[1] operator[+] identifier[WIDTH] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[1] operator[+] identifier[WIDTH] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[1] operator[+] identifier[WIDTH] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[1] operator[+] identifier[WIDTH] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[1] operator[+] identifier[WIDTH] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[1] operator[+] identifier[WIDTH] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[1] operator[+] identifier[WIDTH] , literal[boolean] , identifier[out] , literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[versionList] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[Version] identifier[version] operator[=] identifier[versionList] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[AppVersion] identifier[appVersion] operator[=] identifier[sequenceToAppVersionMap] operator[SEP] identifier[get] operator[SEP] identifier[version] operator[SEP] identifier[getSequence] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[3] , literal[boolean] , identifier[out] , identifier[i] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[19] , literal[boolean] , identifier[out] , identifier[appVersion] operator[!=] Other[null] operator[?] identifier[appVersion] operator[SEP] identifier[getReleaseName] operator[SEP] operator[SEP] operator[:] literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[ts] operator[=] operator[SEP] identifier[appVersion] operator[!=] Other[null] operator[?] identifier[appVersion] operator[SEP] identifier[getTimestamp] operator[SEP] operator[SEP] operator[:] Other[0L] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[formatDates] operator[SEP] {
identifier[print] operator[SEP] Other[12] , literal[boolean] , identifier[out] , identifier[dateFormat] operator[SEP] identifier[format] operator[SEP] identifier[ts] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[print] operator[SEP] Other[10] , literal[boolean] , identifier[out] , identifier[ts] operator[/] Other[1000] operator[SEP] operator[SEP]
}
identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] Other[7] , literal[boolean] , identifier[out] , identifier[appVersion] operator[!=] Other[null] operator[?] identifier[appVersion] operator[SEP] identifier[getNumClasses] operator[SEP] operator[SEP] operator[:] Other[0] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] identifier[WIDTH] , literal[boolean] , identifier[out] , identifier[appVersion] operator[!=] Other[null] operator[?] identifier[appVersion] operator[SEP] identifier[getCodeSize] operator[SEP] operator[SEP] operator[:] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[TUPLE_SIZE] operator[SEP] operator[++] identifier[j] operator[SEP] {
identifier[out] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[print] operator[SEP] identifier[WIDTH] , literal[boolean] , identifier[out] , identifier[version] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP]
}
identifier[out] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public IfcSIPrefix createIfcSIPrefixFromString(EDataType eDataType, String initialValue) {
IfcSIPrefix result = IfcSIPrefix.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} | class class_name[name] begin[{]
method[createIfcSIPrefixFromString, return_type[type[IfcSIPrefix]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[IfcSIPrefix], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[IfcSIPrefix] identifier[createIfcSIPrefixFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[IfcSIPrefix] identifier[result] operator[=] identifier[IfcSIPrefix] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public LocalDateTime minusHours(int hours) {
if (hours == 0) {
return this;
}
long instant = getChronology().hours().subtract(getLocalMillis(), hours);
return withLocalMillis(instant);
} | class class_name[name] begin[{]
method[minusHours, return_type[type[LocalDateTime]], modifier[public], parameter[hours]] begin[{]
if[binary_operation[member[.hours], ==, literal[0]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
local_variable[type[long], instant]
return[call[.withLocalMillis, parameter[member[.instant]]]]
end[}]
END[}] | Keyword[public] identifier[LocalDateTime] identifier[minusHours] operator[SEP] Keyword[int] identifier[hours] operator[SEP] {
Keyword[if] operator[SEP] identifier[hours] operator[==] Other[0] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[long] identifier[instant] operator[=] identifier[getChronology] operator[SEP] operator[SEP] operator[SEP] identifier[hours] operator[SEP] operator[SEP] operator[SEP] identifier[subtract] operator[SEP] identifier[getLocalMillis] operator[SEP] operator[SEP] , identifier[hours] operator[SEP] operator[SEP] Keyword[return] identifier[withLocalMillis] operator[SEP] identifier[instant] operator[SEP] operator[SEP]
}
|
public HalRepresentation embedded(String rel, Object embedded) {
this.embedded.put(rel, embedded);
return this;
} | class class_name[name] begin[{]
method[embedded, return_type[type[HalRepresentation]], modifier[public], parameter[rel, embedded]] begin[{]
THIS[member[None.embedded]call[None.put, parameter[member[.rel], member[.embedded]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[HalRepresentation] identifier[embedded] operator[SEP] identifier[String] identifier[rel] , identifier[Object] identifier[embedded] operator[SEP] {
Keyword[this] operator[SEP] identifier[embedded] operator[SEP] identifier[put] operator[SEP] identifier[rel] , identifier[embedded] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public boolean exists() {
URL url;
if (this.clazz != null) {
url = this.clazz.getResource(this.path);
} else {
url = this.classLoader.getResource(this.path);
}
return (url != null);
} | class class_name[name] begin[{]
method[exists, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[URL], url]
if[binary_operation[THIS[member[None.clazz]], !=, literal[null]]] begin[{]
assign[member[.url], THIS[member[None.clazz]call[None.getResource, parameter[THIS[member[None.path]]]]]]
else begin[{]
assign[member[.url], THIS[member[None.classLoader]call[None.getResource, parameter[THIS[member[None.path]]]]]]
end[}]
return[binary_operation[member[.url], !=, literal[null]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[exists] operator[SEP] operator[SEP] {
identifier[URL] identifier[url] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[clazz] operator[!=] Other[null] operator[SEP] {
identifier[url] operator[=] Keyword[this] operator[SEP] identifier[clazz] operator[SEP] identifier[getResource] operator[SEP] Keyword[this] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[url] operator[=] Keyword[this] operator[SEP] identifier[classLoader] operator[SEP] identifier[getResource] operator[SEP] Keyword[this] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[url] operator[!=] Other[null] operator[SEP] operator[SEP]
}
|
public static List<String> listAllTables() {
int items = 100;
ListTablesResult ltr = getClient().listTables(items);
List<String> tables = new LinkedList<>();
String lastKey;
do {
tables.addAll(ltr.getTableNames());
lastKey = ltr.getLastEvaluatedTableName();
logger.info("Found {} tables. Total found: {}.", ltr.getTableNames().size(), tables.size());
if (lastKey == null) {
break;
}
ltr = getClient().listTables(lastKey, items);
} while (!ltr.getTableNames().isEmpty());
return tables;
} | class class_name[name] begin[{]
method[listAllTables, return_type[type[List]], modifier[public static], parameter[]] begin[{]
local_variable[type[int], items]
local_variable[type[ListTablesResult], ltr]
local_variable[type[List], tables]
local_variable[type[String], lastKey]
do[call[ltr.getTableNames, parameter[]]] begin[{]
call[tables.addAll, parameter[call[ltr.getTableNames, parameter[]]]]
assign[member[.lastKey], call[ltr.getLastEvaluatedTableName, parameter[]]]
call[logger.info, parameter[literal["Found {} tables. Total found: {}."], call[ltr.getTableNames, parameter[]], call[tables.size, parameter[]]]]
if[binary_operation[member[.lastKey], ==, literal[null]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.ltr], call[.getClient, parameter[]]]
end[}]
return[member[.tables]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[listAllTables] operator[SEP] operator[SEP] {
Keyword[int] identifier[items] operator[=] Other[100] operator[SEP] identifier[ListTablesResult] identifier[ltr] operator[=] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[listTables] operator[SEP] identifier[items] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[tables] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[lastKey] operator[SEP] Keyword[do] {
identifier[tables] operator[SEP] identifier[addAll] operator[SEP] identifier[ltr] operator[SEP] identifier[getTableNames] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[lastKey] operator[=] identifier[ltr] operator[SEP] identifier[getLastEvaluatedTableName] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[ltr] operator[SEP] identifier[getTableNames] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[tables] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastKey] operator[==] Other[null] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[ltr] operator[=] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[listTables] operator[SEP] identifier[lastKey] , identifier[items] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] operator[!] identifier[ltr] operator[SEP] identifier[getTableNames] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[tables] operator[SEP]
}
|
private Set<CmsUUID> getSetFromUUIDStrings(String[] uuids) {
Set<CmsUUID> res = new HashSet<CmsUUID>();
for (String uuid : uuids) {
res.add(new CmsUUID(uuid));
}
return res;
} | class class_name[name] begin[{]
method[getSetFromUUIDStrings, return_type[type[Set]], modifier[private], parameter[uuids]] begin[{]
local_variable[type[Set], res]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=uuid, 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=CmsUUID, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=uuids, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=uuid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.res]]
end[}]
END[}] | Keyword[private] identifier[Set] operator[<] identifier[CmsUUID] operator[>] identifier[getSetFromUUIDStrings] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[uuids] operator[SEP] {
identifier[Set] operator[<] identifier[CmsUUID] operator[>] identifier[res] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[CmsUUID] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[uuid] operator[:] identifier[uuids] operator[SEP] {
identifier[res] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[CmsUUID] operator[SEP] identifier[uuid] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[res] operator[SEP]
}
|
public void removeGroup(String group) {
if (worldGroupExist(group)) {
Common.getInstance().getStorageHandler().getStorageEngine().removeWorldGroup(group);
list.remove(group);
}
} | class class_name[name] begin[{]
method[removeGroup, return_type[void], modifier[public], parameter[group]] begin[{]
if[call[.worldGroupExist, parameter[member[.group]]]] begin[{]
call[Common.getInstance, parameter[]]
call[list.remove, parameter[member[.group]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeGroup] operator[SEP] identifier[String] identifier[group] operator[SEP] {
Keyword[if] operator[SEP] identifier[worldGroupExist] operator[SEP] identifier[group] operator[SEP] operator[SEP] {
identifier[Common] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getStorageHandler] operator[SEP] operator[SEP] operator[SEP] identifier[getStorageEngine] operator[SEP] operator[SEP] operator[SEP] identifier[removeWorldGroup] operator[SEP] identifier[group] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[remove] operator[SEP] identifier[group] operator[SEP] operator[SEP]
}
}
|
private void checkArgumentsMatchParameters(
Node call,
FunctionType functionType,
Iterator<Node> arguments,
Iterator<Node> parameters,
int firstParameterIndex) {
int spreadArgumentCount = 0;
int normalArgumentCount = firstParameterIndex;
boolean checkArgumentTypeAgainstParameter = true;
Node parameter = null;
Node argument = null;
while (arguments.hasNext()) {
// get the next argument
argument = arguments.next();
// Count normal & spread arguments.
if (argument.isSpread()) {
// we have some form of this case
// someCall(arg1, arg2, ...firstSpreadExpression, argN, ...secondSpreadExpression)
spreadArgumentCount++;
// Once we see a spread parameter, we can no longer match up arguments with parameters.
checkArgumentTypeAgainstParameter = false;
} else {
normalArgumentCount++;
}
// Get the next parameter, if we're still matching parameters and arguments.
if (checkArgumentTypeAgainstParameter) {
if (parameters.hasNext()) {
parameter = parameters.next();
} else if (parameter != null && parameter.isVarArgs()) {
// use varargs for all remaining parameters
} else {
// else we ran out of parameters and will report that after this loop
parameter = null;
checkArgumentTypeAgainstParameter = false;
}
}
if (checkArgumentTypeAgainstParameter) {
validator.expectArgumentMatchesParameter(
argument, getJSType(argument), getJSType(parameter), call, normalArgumentCount);
}
}
int minArity = functionType.getMinArity();
int maxArity = functionType.getMaxArity();
if (spreadArgumentCount > 0) {
if (normalArgumentCount > maxArity) {
// We cannot reliably check whether the total argument count is wrong, but we can at
// least tell if there are more arguments than the function can handle even ignoring the
// spreads.
report(
call,
WRONG_ARGUMENT_COUNT,
typeRegistry.getReadableTypeNameNoDeref(call.getFirstChild()),
"at least " + String.valueOf(normalArgumentCount),
String.valueOf(minArity),
maxArity == Integer.MAX_VALUE ? "" : " and no more than " + maxArity + " argument(s)");
}
} else {
if (minArity > normalArgumentCount || maxArity < normalArgumentCount) {
report(
call,
WRONG_ARGUMENT_COUNT,
typeRegistry.getReadableTypeNameNoDeref(call.getFirstChild()),
String.valueOf(normalArgumentCount),
String.valueOf(minArity),
maxArity == Integer.MAX_VALUE ? "" : " and no more than " + maxArity + " argument(s)");
}
}
} | class class_name[name] begin[{]
method[checkArgumentsMatchParameters, return_type[void], modifier[private], parameter[call, functionType, arguments, parameters, firstParameterIndex]] begin[{]
local_variable[type[int], spreadArgumentCount]
local_variable[type[int], normalArgumentCount]
local_variable[type[boolean], checkArgumentTypeAgainstParameter]
local_variable[type[Node], parameter]
local_variable[type[Node], argument]
while[call[arguments.hasNext, parameter[]]] begin[{]
assign[member[.argument], call[arguments.next, parameter[]]]
if[call[argument.isSpread, parameter[]]] begin[{]
member[.spreadArgumentCount]
assign[member[.checkArgumentTypeAgainstParameter], literal[false]]
else begin[{]
member[.normalArgumentCount]
end[}]
if[member[.checkArgumentTypeAgainstParameter]] begin[{]
if[call[parameters.hasNext, parameter[]]] begin[{]
assign[member[.parameter], call[parameters.next, parameter[]]]
else begin[{]
if[binary_operation[binary_operation[member[.parameter], !=, literal[null]], &&, call[parameter.isVarArgs, parameter[]]]] begin[{]
else begin[{]
assign[member[.parameter], literal[null]]
assign[member[.checkArgumentTypeAgainstParameter], literal[false]]
end[}]
end[}]
else begin[{]
None
end[}]
if[member[.checkArgumentTypeAgainstParameter]] begin[{]
call[validator.expectArgumentMatchesParameter, parameter[member[.argument], call[.getJSType, parameter[member[.argument]]], call[.getJSType, parameter[member[.parameter]]], member[.call], member[.normalArgumentCount]]]
else begin[{]
None
end[}]
end[}]
local_variable[type[int], minArity]
local_variable[type[int], maxArity]
if[binary_operation[member[.spreadArgumentCount], >, literal[0]]] begin[{]
if[binary_operation[member[.normalArgumentCount], >, member[.maxArity]]] begin[{]
call[.report, parameter[member[.call], member[.WRONG_ARGUMENT_COUNT], call[typeRegistry.getReadableTypeNameNoDeref, parameter[call[call.getFirstChild, parameter[]]]], binary_operation[literal["at least "], +, call[String.valueOf, parameter[member[.normalArgumentCount]]]], call[String.valueOf, parameter[member[.minArity]]], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=maxArity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), operator===), if_false=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" and no more than "), operandr=MemberReference(member=maxArity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" argument(s)"), operator=+), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[binary_operation[member[.minArity], >, member[.normalArgumentCount]], ||, binary_operation[member[.maxArity], <, member[.normalArgumentCount]]]] begin[{]
call[.report, parameter[member[.call], member[.WRONG_ARGUMENT_COUNT], call[typeRegistry.getReadableTypeNameNoDeref, parameter[call[call.getFirstChild, parameter[]]]], call[String.valueOf, parameter[member[.normalArgumentCount]]], call[String.valueOf, parameter[member[.minArity]]], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=maxArity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), operator===), if_false=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" and no more than "), operandr=MemberReference(member=maxArity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" argument(s)"), operator=+), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[checkArgumentsMatchParameters] operator[SEP] identifier[Node] identifier[call] , identifier[FunctionType] identifier[functionType] , identifier[Iterator] operator[<] identifier[Node] operator[>] identifier[arguments] , identifier[Iterator] operator[<] identifier[Node] operator[>] identifier[parameters] , Keyword[int] identifier[firstParameterIndex] operator[SEP] {
Keyword[int] identifier[spreadArgumentCount] operator[=] Other[0] operator[SEP] Keyword[int] identifier[normalArgumentCount] operator[=] identifier[firstParameterIndex] operator[SEP] Keyword[boolean] identifier[checkArgumentTypeAgainstParameter] operator[=] literal[boolean] operator[SEP] identifier[Node] identifier[parameter] operator[=] Other[null] operator[SEP] identifier[Node] identifier[argument] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] identifier[arguments] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[argument] operator[=] identifier[arguments] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[argument] operator[SEP] identifier[isSpread] operator[SEP] operator[SEP] operator[SEP] {
identifier[spreadArgumentCount] operator[++] operator[SEP] identifier[checkArgumentTypeAgainstParameter] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[normalArgumentCount] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] identifier[checkArgumentTypeAgainstParameter] operator[SEP] {
Keyword[if] operator[SEP] identifier[parameters] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[parameter] operator[=] identifier[parameters] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[parameter] operator[!=] Other[null] operator[&&] identifier[parameter] operator[SEP] identifier[isVarArgs] operator[SEP] operator[SEP] operator[SEP] {
}
Keyword[else] {
identifier[parameter] operator[=] Other[null] operator[SEP] identifier[checkArgumentTypeAgainstParameter] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[checkArgumentTypeAgainstParameter] operator[SEP] {
identifier[validator] operator[SEP] identifier[expectArgumentMatchesParameter] operator[SEP] identifier[argument] , identifier[getJSType] operator[SEP] identifier[argument] operator[SEP] , identifier[getJSType] operator[SEP] identifier[parameter] operator[SEP] , identifier[call] , identifier[normalArgumentCount] operator[SEP] operator[SEP]
}
}
Keyword[int] identifier[minArity] operator[=] identifier[functionType] operator[SEP] identifier[getMinArity] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[maxArity] operator[=] identifier[functionType] operator[SEP] identifier[getMaxArity] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[spreadArgumentCount] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[normalArgumentCount] operator[>] identifier[maxArity] operator[SEP] {
identifier[report] operator[SEP] identifier[call] , identifier[WRONG_ARGUMENT_COUNT] , identifier[typeRegistry] operator[SEP] identifier[getReadableTypeNameNoDeref] operator[SEP] identifier[call] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[SEP] , literal[String] operator[+] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[normalArgumentCount] operator[SEP] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[minArity] operator[SEP] , identifier[maxArity] operator[==] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[?] literal[String] operator[:] literal[String] operator[+] identifier[maxArity] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[minArity] operator[>] identifier[normalArgumentCount] operator[||] identifier[maxArity] operator[<] identifier[normalArgumentCount] operator[SEP] {
identifier[report] operator[SEP] identifier[call] , identifier[WRONG_ARGUMENT_COUNT] , identifier[typeRegistry] operator[SEP] identifier[getReadableTypeNameNoDeref] operator[SEP] identifier[call] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[SEP] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[normalArgumentCount] operator[SEP] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[minArity] operator[SEP] , identifier[maxArity] operator[==] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[?] literal[String] operator[:] literal[String] operator[+] identifier[maxArity] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
|
public InvocationRouter<InvocationBaratine> buildRouter(WebApp webApp)
{
// find views
InjectorAmp inject = webApp.inject();
buildViews(inject);
ArrayList<RouteMap> mapList = new ArrayList<>();
ServicesAmp manager = webApp.services();
ServiceRefAmp serviceRef = manager.newService(new RouteService()).ref();
while (_routes.size() > 0) {
ArrayList<RouteWebApp> routes = new ArrayList<>(_routes);
_routes.clear();
for (RouteWebApp route : routes) {
mapList.addAll(route.toMap(inject, serviceRef));
}
}
/*
for (RouteConfig config : _routeList) {
RouteBaratine route = config.buildRoute();
mapList.add(new RouteMap("", route));
}
*/
RouteMap []routeArray = new RouteMap[mapList.size()];
mapList.toArray(routeArray);
return new InvocationRouterWebApp(webApp, routeArray);
} | class class_name[name] begin[{]
method[buildRouter, return_type[type[InvocationRouter]], modifier[public], parameter[webApp]] begin[{]
local_variable[type[InjectorAmp], inject]
call[.buildViews, parameter[member[.inject]]]
local_variable[type[ArrayList], mapList]
local_variable[type[ServicesAmp], manager]
local_variable[type[ServiceRefAmp], serviceRef]
while[binary_operation[call[_routes.size, parameter[]], >, literal[0]]] begin[{]
local_variable[type[ArrayList], routes]
call[_routes.clear, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=inject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=serviceRef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toMap, postfix_operators=[], prefix_operators=[], qualifier=route, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=mapList, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=routes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=route)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RouteWebApp, sub_type=None))), label=None)
end[}]
local_variable[type[RouteMap], routeArray]
call[mapList.toArray, parameter[member[.routeArray]]]
return[ClassCreator(arguments=[MemberReference(member=webApp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=routeArray, 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=InvocationRouterWebApp, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[InvocationRouter] operator[<] identifier[InvocationBaratine] operator[>] identifier[buildRouter] operator[SEP] identifier[WebApp] identifier[webApp] operator[SEP] {
identifier[InjectorAmp] identifier[inject] operator[=] identifier[webApp] operator[SEP] identifier[inject] operator[SEP] operator[SEP] operator[SEP] identifier[buildViews] operator[SEP] identifier[inject] operator[SEP] operator[SEP] identifier[ArrayList] operator[<] identifier[RouteMap] operator[>] identifier[mapList] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[ServicesAmp] identifier[manager] operator[=] identifier[webApp] operator[SEP] identifier[services] operator[SEP] operator[SEP] operator[SEP] identifier[ServiceRefAmp] identifier[serviceRef] operator[=] identifier[manager] operator[SEP] identifier[newService] operator[SEP] Keyword[new] identifier[RouteService] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ref] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[_routes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[ArrayList] operator[<] identifier[RouteWebApp] operator[>] identifier[routes] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[_routes] operator[SEP] operator[SEP] identifier[_routes] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[RouteWebApp] identifier[route] operator[:] identifier[routes] operator[SEP] {
identifier[mapList] operator[SEP] identifier[addAll] operator[SEP] identifier[route] operator[SEP] identifier[toMap] operator[SEP] identifier[inject] , identifier[serviceRef] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[RouteMap] operator[SEP] operator[SEP] identifier[routeArray] operator[=] Keyword[new] identifier[RouteMap] operator[SEP] identifier[mapList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[mapList] operator[SEP] identifier[toArray] operator[SEP] identifier[routeArray] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[InvocationRouterWebApp] operator[SEP] identifier[webApp] , identifier[routeArray] operator[SEP] operator[SEP]
}
|
public static Collection<Class> getClassSimpleDependencies(Class c)
{
HashSet<Class> result = new HashSet<Class>();
result.add(c); //add the own class
//declared subclasses
Class[] declaredClasses = c.getDeclaredClasses();
for(Class cl : declaredClasses) {
result.add(cl);
}
//fields
Field[] declaredFields = c.getDeclaredFields();
for(Field f : declaredFields) {
if (!BASETYPES.contains(f.getType().getName()))
result.add(f.getType());
}
//method arguments/return
Method[] declaredMethods = c.getDeclaredMethods();
for(Method m : declaredMethods) {
result.add(m.getReturnType());
for(Class pc : m.getParameterTypes()) {
if (!BASETYPES.contains(pc.getName()))
result.add(pc);
}
}
return result;
} | class class_name[name] begin[{]
method[getClassSimpleDependencies, return_type[type[Collection]], modifier[public static], parameter[c]] begin[{]
local_variable[type[HashSet], result]
call[result.add, parameter[member[.c]]]
local_variable[type[Class], declaredClasses]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=declaredClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=cl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None))), label=None)
local_variable[type[Field], declaredFields]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=BASETYPES, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=declaredFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))), label=None)
local_variable[type[Method], declaredMethods]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getReturnType, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=pc, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=BASETYPES, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=pc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=declaredMethods, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Collection] operator[<] identifier[Class] operator[>] identifier[getClassSimpleDependencies] operator[SEP] identifier[Class] identifier[c] operator[SEP] {
identifier[HashSet] operator[<] identifier[Class] operator[>] identifier[result] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[Class] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[Class] operator[SEP] operator[SEP] identifier[declaredClasses] operator[=] identifier[c] operator[SEP] identifier[getDeclaredClasses] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Class] identifier[cl] operator[:] identifier[declaredClasses] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[cl] operator[SEP] operator[SEP]
}
identifier[Field] operator[SEP] operator[SEP] identifier[declaredFields] operator[=] identifier[c] operator[SEP] identifier[getDeclaredFields] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Field] identifier[f] operator[:] identifier[declaredFields] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[BASETYPES] operator[SEP] identifier[contains] operator[SEP] identifier[f] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[f] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Method] operator[SEP] operator[SEP] identifier[declaredMethods] operator[=] identifier[c] operator[SEP] identifier[getDeclaredMethods] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Method] identifier[m] operator[:] identifier[declaredMethods] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[m] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Class] identifier[pc] operator[:] identifier[m] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[BASETYPES] operator[SEP] identifier[contains] operator[SEP] identifier[pc] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[pc] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
private void _buildWhere(
final SearchCriteria criteria,
final StringBuilder stmt,
final List<Object> params
)
{
Binding binding = (criteria == null ? null : criteria.getBinding());
// FulltextMatch match = (criteria == null ? null : criteria.getFulltextMatch());
// Binding matchBinding = null;
// if (match != null) {
// matchBinding = _toFulltextBinding( match );
// }
// if (binding == null) {
// binding = matchBinding;
// } else {
// if (matchBinding != null) {
// binding = new AndBinding( binding, matchBinding );
// }
// }
if (binding != null ){
stmt.append( _WHERE_ );
_buildBinding( binding, stmt, params );
//throws SearchException
}
} | class class_name[name] begin[{]
method[_buildWhere, return_type[void], modifier[private], parameter[criteria, stmt, params]] begin[{]
local_variable[type[Binding], binding]
if[binary_operation[member[.binding], !=, literal[null]]] begin[{]
call[stmt.append, parameter[member[._WHERE_]]]
call[._buildBinding, parameter[member[.binding], member[.stmt], member[.params]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[_buildWhere] operator[SEP] Keyword[final] identifier[SearchCriteria] identifier[criteria] , Keyword[final] identifier[StringBuilder] identifier[stmt] , Keyword[final] identifier[List] operator[<] identifier[Object] operator[>] identifier[params] operator[SEP] {
identifier[Binding] identifier[binding] operator[=] operator[SEP] identifier[criteria] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[criteria] operator[SEP] identifier[getBinding] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binding] operator[!=] Other[null] operator[SEP] {
identifier[stmt] operator[SEP] identifier[append] operator[SEP] identifier[_WHERE_] operator[SEP] operator[SEP] identifier[_buildBinding] operator[SEP] identifier[binding] , identifier[stmt] , identifier[params] operator[SEP] operator[SEP]
}
}
|
public void deleteMessage(String id, String reservationId, String subscriberName) throws IOException {
String payload = gson.toJson(new SubscribedMessageOptions(reservationId, subscriberName));
IronReader reader = client.delete("queues/" + name + "/messages/" + id, payload);
reader.close();
} | class class_name[name] begin[{]
method[deleteMessage, return_type[void], modifier[public], parameter[id, reservationId, subscriberName]] begin[{]
local_variable[type[String], payload]
local_variable[type[IronReader], reader]
call[reader.close, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[deleteMessage] operator[SEP] identifier[String] identifier[id] , identifier[String] identifier[reservationId] , identifier[String] identifier[subscriberName] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[payload] operator[=] identifier[gson] operator[SEP] identifier[toJson] operator[SEP] Keyword[new] identifier[SubscribedMessageOptions] operator[SEP] identifier[reservationId] , identifier[subscriberName] operator[SEP] operator[SEP] operator[SEP] identifier[IronReader] identifier[reader] operator[=] identifier[client] operator[SEP] identifier[delete] operator[SEP] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[+] identifier[id] , identifier[payload] operator[SEP] operator[SEP] identifier[reader] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void copyDirectories(String[] directories, String[] destinationDirectories) throws IOException {
copyDirectories(getFiles(directories), getFiles(destinationDirectories));
} | class class_name[name] begin[{]
method[copyDirectories, return_type[void], modifier[public static], parameter[directories, destinationDirectories]] begin[{]
call[.copyDirectories, parameter[call[.getFiles, parameter[member[.directories]]], call[.getFiles, parameter[member[.destinationDirectories]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[copyDirectories] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[directories] , identifier[String] operator[SEP] operator[SEP] identifier[destinationDirectories] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[copyDirectories] operator[SEP] identifier[getFiles] operator[SEP] identifier[directories] operator[SEP] , identifier[getFiles] operator[SEP] identifier[destinationDirectories] operator[SEP] operator[SEP] operator[SEP]
}
|
public static BigInteger getSafePrime(UnsignedInteger32 maximumSize) {
BigInteger prime = group1;
for(Iterator<BigInteger> it = safePrimes.iterator(); it.hasNext(); ) {
BigInteger p = it.next();
int len = p.bitLength();
if(len > maximumSize.intValue()) {
break;
}
prime = p;
}
return prime;
} | class class_name[name] begin[{]
method[getSafePrime, return_type[type[BigInteger]], modifier[public static], parameter[maximumSize]] begin[{]
local_variable[type[BigInteger], prime]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BigInteger, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=bitLength, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), name=len)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=intValue, postfix_operators=[], prefix_operators=[], qualifier=maximumSize, selectors=[], type_arguments=None), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=prime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=safePrimes, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BigInteger, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
return[member[.prime]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[BigInteger] identifier[getSafePrime] operator[SEP] identifier[UnsignedInteger32] identifier[maximumSize] operator[SEP] {
identifier[BigInteger] identifier[prime] operator[=] identifier[group1] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[BigInteger] operator[>] identifier[it] operator[=] identifier[safePrimes] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[BigInteger] identifier[p] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] identifier[p] operator[SEP] identifier[bitLength] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[len] operator[>] identifier[maximumSize] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[prime] operator[=] identifier[p] operator[SEP]
}
Keyword[return] identifier[prime] operator[SEP]
}
|
@Override
public EClass getIfcWindow() {
if (ifcWindowEClass == null) {
ifcWindowEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(764);
}
return ifcWindowEClass;
} | class class_name[name] begin[{]
method[getIfcWindow, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcWindowEClass], ==, literal[null]]] begin[{]
assign[member[.ifcWindowEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, 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=764)], 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[.ifcWindowEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcWindow] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcWindowEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcWindowEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[764] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcWindowEClass] operator[SEP]
}
|
@Override
public void initialized(IntrospectedTable introspectedTable) {
// 1. 获取表单独配置
if (introspectedTable.getTableConfigurationProperty(PRO_TABLE_OVERRIDE) != null) {
String override = introspectedTable.getTableConfigurationProperty(PRO_TABLE_OVERRIDE);
try {
IntrospectedTableTools.setDomainObjectName(introspectedTable, getContext(), override);
} catch (Exception e) {
logger.error("itfsw:插件" + this.getClass().getTypeName() + "使用tableOverride替换时异常!", e);
}
} else if (getProperties().getProperty(PRO_SEARCH_STRING) != null) {
String searchString = getProperties().getProperty(PRO_SEARCH_STRING);
String replaceString = getProperties().getProperty(PRO_REPLACE_STRING);
String domainObjectName = introspectedTable.getFullyQualifiedTable().getDomainObjectName();
Pattern pattern = Pattern.compile(searchString);
Matcher matcher = pattern.matcher(domainObjectName);
domainObjectName = matcher.replaceAll(replaceString);
// 命名规范化 首字母大写
domainObjectName = FormatTools.upFirstChar(domainObjectName);
try {
IntrospectedTableTools.setDomainObjectName(introspectedTable, getContext(), domainObjectName);
} catch (Exception e) {
logger.error("itfsw:插件" + this.getClass().getTypeName() + "使用searchString、replaceString替换时异常!", e);
}
}
super.initialized(introspectedTable);
} | class class_name[name] begin[{]
method[initialized, return_type[void], modifier[public], parameter[introspectedTable]] begin[{]
if[binary_operation[call[introspectedTable.getTableConfigurationProperty, parameter[member[.PRO_TABLE_OVERRIDE]]], !=, literal[null]]] begin[{]
local_variable[type[String], override]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=introspectedTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=override, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDomainObjectName, postfix_operators=[], prefix_operators=[], qualifier=IntrospectedTableTools, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="itfsw:插件"), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTypeName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="使用tableOverride替换时异常!"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
if[binary_operation[call[.getProperties, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[String], searchString]
local_variable[type[String], replaceString]
local_variable[type[String], domainObjectName]
local_variable[type[Pattern], pattern]
local_variable[type[Matcher], matcher]
assign[member[.domainObjectName], call[matcher.replaceAll, parameter[member[.replaceString]]]]
assign[member[.domainObjectName], call[FormatTools.upFirstChar, parameter[member[.domainObjectName]]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=introspectedTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=domainObjectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDomainObjectName, postfix_operators=[], prefix_operators=[], qualifier=IntrospectedTableTools, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="itfsw:插件"), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTypeName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="使用searchString、replaceString替换时异常!"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=introspectedTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initialized, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[initialized] operator[SEP] identifier[IntrospectedTable] identifier[introspectedTable] operator[SEP] {
Keyword[if] operator[SEP] identifier[introspectedTable] operator[SEP] identifier[getTableConfigurationProperty] operator[SEP] identifier[PRO_TABLE_OVERRIDE] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[override] operator[=] identifier[introspectedTable] operator[SEP] identifier[getTableConfigurationProperty] operator[SEP] identifier[PRO_TABLE_OVERRIDE] operator[SEP] operator[SEP] Keyword[try] {
identifier[IntrospectedTableTools] operator[SEP] identifier[setDomainObjectName] operator[SEP] identifier[introspectedTable] , identifier[getContext] operator[SEP] operator[SEP] , identifier[override] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[getProperty] operator[SEP] identifier[PRO_SEARCH_STRING] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[searchString] operator[=] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[getProperty] operator[SEP] identifier[PRO_SEARCH_STRING] operator[SEP] operator[SEP] identifier[String] identifier[replaceString] operator[=] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[getProperty] operator[SEP] identifier[PRO_REPLACE_STRING] operator[SEP] operator[SEP] identifier[String] identifier[domainObjectName] operator[=] identifier[introspectedTable] operator[SEP] identifier[getFullyQualifiedTable] operator[SEP] operator[SEP] operator[SEP] identifier[getDomainObjectName] operator[SEP] operator[SEP] operator[SEP] identifier[Pattern] identifier[pattern] operator[=] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] identifier[searchString] operator[SEP] operator[SEP] identifier[Matcher] identifier[matcher] operator[=] identifier[pattern] operator[SEP] identifier[matcher] operator[SEP] identifier[domainObjectName] operator[SEP] operator[SEP] identifier[domainObjectName] operator[=] identifier[matcher] operator[SEP] identifier[replaceAll] operator[SEP] identifier[replaceString] operator[SEP] operator[SEP] identifier[domainObjectName] operator[=] identifier[FormatTools] operator[SEP] identifier[upFirstChar] operator[SEP] identifier[domainObjectName] operator[SEP] operator[SEP] Keyword[try] {
identifier[IntrospectedTableTools] operator[SEP] identifier[setDomainObjectName] operator[SEP] identifier[introspectedTable] , identifier[getContext] operator[SEP] operator[SEP] , identifier[domainObjectName] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[super] operator[SEP] identifier[initialized] operator[SEP] identifier[introspectedTable] operator[SEP] operator[SEP]
}
|
public IntStreamEx prepend(IntStream other) {
return new IntStreamEx(IntStream.concat(other, stream()), context.combine(other));
} | class class_name[name] begin[{]
method[prepend, return_type[type[IntStreamEx]], modifier[public], parameter[other]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=concat, postfix_operators=[], prefix_operators=[], qualifier=IntStream, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=combine, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IntStreamEx, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[IntStreamEx] identifier[prepend] operator[SEP] identifier[IntStream] identifier[other] operator[SEP] {
Keyword[return] Keyword[new] identifier[IntStreamEx] operator[SEP] identifier[IntStream] operator[SEP] identifier[concat] operator[SEP] identifier[other] , identifier[stream] operator[SEP] operator[SEP] operator[SEP] , identifier[context] operator[SEP] identifier[combine] operator[SEP] identifier[other] operator[SEP] operator[SEP] operator[SEP]
}
|
public ServiceFuture<OperationStatus> updateAsync(UUID appId, ApplicationUpdateObject applicationUpdateObject, final ServiceCallback<OperationStatus> serviceCallback) {
return ServiceFuture.fromResponse(updateWithServiceResponseAsync(appId, applicationUpdateObject), serviceCallback);
} | class class_name[name] begin[{]
method[updateAsync, return_type[type[ServiceFuture]], modifier[public], parameter[appId, applicationUpdateObject, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.updateWithServiceResponseAsync, parameter[member[.appId], member[.applicationUpdateObject]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[OperationStatus] operator[>] identifier[updateAsync] operator[SEP] identifier[UUID] identifier[appId] , identifier[ApplicationUpdateObject] identifier[applicationUpdateObject] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[OperationStatus] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[updateWithServiceResponseAsync] operator[SEP] identifier[appId] , identifier[applicationUpdateObject] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
protected int searchBucketIndex(byte[] key, int leftIndex, int rightIndex) {
if (KeyUtils.compareKey(key, maxRangeValues[rightIndex]) > 0) {
return 0;
}
int idx = Arrays.binarySearch(maxRangeValues, leftIndex, rightIndex, key, new ByteArrayComparator());
idx = idx < 0 ? -idx - 1 : idx;
if (idx > rightIndex) {
return -1;
} else {
return idx;
}
} | class class_name[name] begin[{]
method[searchBucketIndex, return_type[type[int]], modifier[protected], parameter[key, leftIndex, rightIndex]] begin[{]
if[binary_operation[call[KeyUtils.compareKey, parameter[member[.key], member[.maxRangeValues]]], >, literal[0]]] begin[{]
return[literal[0]]
else begin[{]
None
end[}]
local_variable[type[int], idx]
assign[member[.idx], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), if_false=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=BinaryOperation(operandl=MemberReference(member=idx, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]
if[binary_operation[member[.idx], >, member[.rightIndex]]] begin[{]
return[literal[1]]
else begin[{]
return[member[.idx]]
end[}]
end[}]
END[}] | Keyword[protected] Keyword[int] identifier[searchBucketIndex] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[key] , Keyword[int] identifier[leftIndex] , Keyword[int] identifier[rightIndex] operator[SEP] {
Keyword[if] operator[SEP] identifier[KeyUtils] operator[SEP] identifier[compareKey] operator[SEP] identifier[key] , identifier[maxRangeValues] operator[SEP] identifier[rightIndex] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] Other[0] operator[SEP]
}
Keyword[int] identifier[idx] operator[=] identifier[Arrays] operator[SEP] identifier[binarySearch] operator[SEP] identifier[maxRangeValues] , identifier[leftIndex] , identifier[rightIndex] , identifier[key] , Keyword[new] identifier[ByteArrayComparator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[idx] operator[=] identifier[idx] operator[<] Other[0] operator[?] operator[-] identifier[idx] operator[-] Other[1] operator[:] identifier[idx] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] identifier[rightIndex] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[idx] operator[SEP]
}
}
|
public static void addJob(
String jobName,
Class<? extends Job> jobClass,
Map<String, Object> params,
boolean isConcurrencyAllowed)
throws SundialSchedulerException {
try {
JobDataMap jobDataMap = new JobDataMap();
if (params != null) {
for (Entry<String, Object> entry : params.entrySet()) {
jobDataMap.put(entry.getKey(), entry.getValue());
}
}
JobDetail jobDetail =
newJobBuilder(jobClass)
.withIdentity(jobName)
.usingJobData(jobDataMap)
.isConcurrencyAllowed(isConcurrencyAllowed)
.build();
getScheduler().addJob(jobDetail);
} catch (SchedulerException e) {
logger.error("ERROR ADDING JOB!!!", e);
throw new SundialSchedulerException("ERROR ADDING JOB!!!", e);
}
} | class class_name[name] begin[{]
method[addJob, return_type[void], modifier[public static], parameter[jobName, jobClass, params, isConcurrencyAllowed]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JobDataMap, sub_type=None)), name=jobDataMap)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JobDataMap, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=jobDataMap, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=jobClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newJobBuilder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=jobName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withIdentity, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=jobDataMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=usingJobData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=isConcurrencyAllowed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isConcurrencyAllowed, 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=jobDetail)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JobDetail, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getScheduler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=jobDetail, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addJob, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ERROR ADDING JOB!!!"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ERROR ADDING JOB!!!"), 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=SundialSchedulerException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SchedulerException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[addJob] operator[SEP] identifier[String] identifier[jobName] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Job] operator[>] identifier[jobClass] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[params] , Keyword[boolean] identifier[isConcurrencyAllowed] operator[SEP] Keyword[throws] identifier[SundialSchedulerException] {
Keyword[try] {
identifier[JobDataMap] identifier[jobDataMap] operator[=] Keyword[new] identifier[JobDataMap] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[params] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[entry] operator[:] identifier[params] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[jobDataMap] operator[SEP] identifier[put] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[JobDetail] identifier[jobDetail] operator[=] identifier[newJobBuilder] operator[SEP] identifier[jobClass] operator[SEP] operator[SEP] identifier[withIdentity] operator[SEP] identifier[jobName] operator[SEP] operator[SEP] identifier[usingJobData] operator[SEP] identifier[jobDataMap] operator[SEP] operator[SEP] identifier[isConcurrencyAllowed] operator[SEP] identifier[isConcurrencyAllowed] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[getScheduler] operator[SEP] operator[SEP] operator[SEP] identifier[addJob] operator[SEP] identifier[jobDetail] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SchedulerException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SundialSchedulerException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
String parseLine(CharCursor is, LineMap lineMap)
throws IOException
{
int ch = is.read();
_buf.clear();
String filename = null;
int line = 0;
// Take 3: match /.*:\d+:/
_token.clear();
line:
for (; ch != is.DONE; ch = is.read()) {
while (ch == ':') {
line = 0;
for (ch = is.read(); ch >= '0' && ch <= '9'; ch = is.read())
line = 10 * line + ch - '0';
if (ch == ':' && line > 0) {
filename = _token.toString();
break line;
}
else {
_token.append(':');
if (line > 0)
_token.append(line);
}
}
if (ch != is.DONE)
_token.append((char) ch);
}
if (filename == null)
return null;
int column = 0;
// skip added junk like jikes extra "emacs" style columns
for (; ch != is.DONE && ch != ' '; ch = is.read()) {
}
for (; ch == ' '; ch = is.read()) {
}
// now gather the message
_buf.clear();
for (; ch != is.DONE; ch = is.read())
_buf.append((char) ch);
String message = _buf.toString();
if (lineMap != null)
return lineMap.convertError(filename, line, 0, message);
else
return filename + ":" + line + ": " + message;
} | class class_name[name] begin[{]
method[parseLine, return_type[type[String]], modifier[default], parameter[is, lineMap]] begin[{]
local_variable[type[int], ch]
call[_buf.clear, parameter[]]
local_variable[type[String], filename]
local_variable[type[int], line]
call[_token.clear, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), ForStatement(body=StatementExpression(expression=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), operandr=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=-)), label=None), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='9'), operator=<=), operator=&&), init=[Assignment(expressionl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None))], update=[Assignment(expressionl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None))]), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=':'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=':')], member=append, postfix_operators=[], prefix_operators=[], qualifier=_token, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=_token, selectors=[], type_arguments=None), label=None))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=filename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=_token, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=line, label=None)]))]), condition=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=':'), operator===), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DONE, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))], member=append, postfix_operators=[], prefix_operators=[], qualifier=_token, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DONE, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[]), operator=!=), init=None, update=[Assignment(expressionl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None))]), label=line)
if[binary_operation[member[.filename], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], column]
ForStatement(body=BlockStatement(label=None, statements=[]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DONE, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[]), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operator=&&), init=None, update=[Assignment(expressionl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None))]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator===), init=None, update=[Assignment(expressionl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None))]), label=None)
call[_buf.clear, parameter[]]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))], member=append, postfix_operators=[], prefix_operators=[], qualifier=_buf, selectors=[], type_arguments=None), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DONE, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[]), operator=!=), init=None, update=[Assignment(expressionl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None))]), label=None)
local_variable[type[String], message]
if[binary_operation[member[.lineMap], !=, literal[null]]] begin[{]
return[call[lineMap.convertError, parameter[member[.filename], member[.line], literal[0], member[.message]]]]
else begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[member[.filename], +, literal[":"]], +, member[.line]], +, literal[": "]], +, member[.message]]]
end[}]
end[}]
END[}] | identifier[String] identifier[parseLine] operator[SEP] identifier[CharCursor] identifier[is] , identifier[LineMap] identifier[lineMap] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[ch] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] identifier[_buf] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[filename] operator[=] Other[null] operator[SEP] Keyword[int] identifier[line] operator[=] Other[0] operator[SEP] identifier[_token] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[line] operator[:] Keyword[for] operator[SEP] operator[SEP] identifier[ch] operator[!=] identifier[is] operator[SEP] identifier[DONE] operator[SEP] identifier[ch] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[ch] operator[==] literal[String] operator[SEP] {
identifier[line] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[ch] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] identifier[ch] operator[>=] literal[String] operator[&&] identifier[ch] operator[<=] literal[String] operator[SEP] identifier[ch] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] identifier[line] operator[=] Other[10] operator[*] identifier[line] operator[+] identifier[ch] operator[-] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[ch] operator[==] literal[String] operator[&&] identifier[line] operator[>] Other[0] operator[SEP] {
identifier[filename] operator[=] identifier[_token] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[break] identifier[line] operator[SEP]
}
Keyword[else] {
identifier[_token] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[line] operator[>] Other[0] operator[SEP] identifier[_token] operator[SEP] identifier[append] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[ch] operator[!=] identifier[is] operator[SEP] identifier[DONE] operator[SEP] identifier[_token] operator[SEP] identifier[append] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[ch] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[filename] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[int] identifier[column] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] operator[SEP] identifier[ch] operator[!=] identifier[is] operator[SEP] identifier[DONE] operator[&&] identifier[ch] operator[!=] literal[String] operator[SEP] identifier[ch] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] {
}
Keyword[for] operator[SEP] operator[SEP] identifier[ch] operator[==] literal[String] operator[SEP] identifier[ch] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] {
}
identifier[_buf] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] operator[SEP] identifier[ch] operator[!=] identifier[is] operator[SEP] identifier[DONE] operator[SEP] identifier[ch] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] identifier[_buf] operator[SEP] identifier[append] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[ch] operator[SEP] operator[SEP] identifier[String] identifier[message] operator[=] identifier[_buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lineMap] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[lineMap] operator[SEP] identifier[convertError] operator[SEP] identifier[filename] , identifier[line] , Other[0] , identifier[message] operator[SEP] operator[SEP] Keyword[else] Keyword[return] identifier[filename] operator[+] literal[String] operator[+] identifier[line] operator[+] literal[String] operator[+] identifier[message] operator[SEP]
}
|
public static void setProperties( Properties prp ) {
Config.prp = new Properties( prp );
try {
Config.prp.putAll( System.getProperties() );
} catch( SecurityException se ) {
if( log.level > 1 )
log.println( "SecurityException: jcifs.smb1 will ignore System properties" );
}
} | class class_name[name] begin[{]
method[setProperties, return_type[void], modifier[public static], parameter[prp]] begin[{]
assign[member[Config.prp], ClassCreator(arguments=[MemberReference(member=prp, 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=Properties, sub_type=None))]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProperties, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None)], member=putAll, postfix_operators=[], prefix_operators=[], qualifier=Config.prp, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=level, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SecurityException: jcifs.smb1 will ignore System properties")], member=println, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=se, types=['SecurityException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setProperties] operator[SEP] identifier[Properties] identifier[prp] operator[SEP] {
identifier[Config] operator[SEP] identifier[prp] operator[=] Keyword[new] identifier[Properties] operator[SEP] identifier[prp] operator[SEP] operator[SEP] Keyword[try] {
identifier[Config] operator[SEP] identifier[prp] operator[SEP] identifier[putAll] operator[SEP] identifier[System] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SecurityException] identifier[se] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[level] operator[>] Other[1] operator[SEP] identifier[log] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public static double doubleValue(Object value)
throws NumberFormatException
{
if (value == null) return 0.0;
Class c = value.getClass();
if (c.getSuperclass() == Number.class) return ((Number) value).doubleValue();
if (c == Boolean.class) return ((Boolean) value).booleanValue() ? 1 : 0;
if (c == Character.class) return ((Character) value).charValue();
String s = stringValue(value, true);
return (s.length() == 0) ? 0.0 : Double.parseDouble(s);
} | class class_name[name] begin[{]
method[doubleValue, return_type[type[double]], modifier[public static], parameter[value]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
return[literal[0.0]]
else begin[{]
None
end[}]
local_variable[type[Class], c]
if[binary_operation[call[c.getSuperclass, parameter[]], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Number, sub_type=None))]] begin[{]
return[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.c], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Boolean, sub_type=None))]] begin[{]
return[TernaryExpression(condition=Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=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))]
else begin[{]
None
end[}]
if[binary_operation[member[.c], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Character, sub_type=None))]] begin[{]
return[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Character, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], s]
return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseDouble, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[doubleValue] operator[SEP] identifier[Object] identifier[value] operator[SEP] Keyword[throws] identifier[NumberFormatException] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] Keyword[return] literal[Float] operator[SEP] identifier[Class] identifier[c] operator[=] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[==] identifier[Number] operator[SEP] Keyword[class] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] identifier[Boolean] operator[SEP] Keyword[class] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[Boolean] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[?] Other[1] operator[:] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] identifier[Character] operator[SEP] Keyword[class] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[Character] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[charValue] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[s] operator[=] identifier[stringValue] operator[SEP] identifier[value] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[?] literal[Float] operator[:] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[s] operator[SEP] operator[SEP]
}
|
public boolean scrollRecyclerViewToTop(int index) {
if(config.commandLogging){
Log.d(config.commandLoggingTag, "scrollRecyclerViewToTop("+index+")");
}
if(!config.shouldScroll) {
return false;
}
View recyclerView = viewFetcher.getRecyclerView(index, Timeout.getSmallTimeout());
scroller.scrollViewAllTheWay(recyclerView, Scroller.UP);
return false;
} | class class_name[name] begin[{]
method[scrollRecyclerViewToTop, return_type[type[boolean]], modifier[public], parameter[index]] begin[{]
if[member[config.commandLogging]] begin[{]
call[Log.d, parameter[member[config.commandLoggingTag], binary_operation[binary_operation[literal["scrollRecyclerViewToTop("], +, member[.index]], +, literal[")"]]]]
else begin[{]
None
end[}]
if[member[config.shouldScroll]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[View], recyclerView]
call[scroller.scrollViewAllTheWay, parameter[member[.recyclerView], member[Scroller.UP]]]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[scrollRecyclerViewToTop] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[commandLogging] operator[SEP] {
identifier[Log] operator[SEP] identifier[d] operator[SEP] identifier[config] operator[SEP] identifier[commandLoggingTag] , literal[String] operator[+] identifier[index] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[config] operator[SEP] identifier[shouldScroll] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[View] identifier[recyclerView] operator[=] identifier[viewFetcher] operator[SEP] identifier[getRecyclerView] operator[SEP] identifier[index] , identifier[Timeout] operator[SEP] identifier[getSmallTimeout] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[scroller] operator[SEP] identifier[scrollViewAllTheWay] operator[SEP] identifier[recyclerView] , identifier[Scroller] operator[SEP] identifier[UP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public String upgradeCatalogAsNeeded(InMemoryJarfile outputJar)
throws IOException
{
// getBuildInfoFromJar() performs some validation.
String[] buildInfoLines = CatalogUtil.getBuildInfoFromJar(outputJar);
String versionFromCatalog = buildInfoLines[0];
// Set if an upgrade happens.
String upgradedFromVersion = null;
// Check if it's compatible (or the upgrade is being forced).
// getConfig() may return null if it's being mocked for a test.
if ( VoltDB.Configuration.m_forceCatalogUpgrade
|| !versionFromCatalog.equals(VoltDB.instance().getVersionString())) {
// Patch the buildinfo.
String versionFromVoltDB = VoltDB.instance().getVersionString();
buildInfoLines[0] = versionFromVoltDB;
buildInfoLines[1] = String.format("voltdb-auto-upgrade-to-%s", versionFromVoltDB);
byte[] buildInfoBytes = StringUtils.join(buildInfoLines, "\n").getBytes();
outputJar.put(CatalogUtil.CATALOG_BUILDINFO_FILENAME, buildInfoBytes);
// Gather DDL files for re-compilation
List<VoltCompilerReader> ddlReaderList = new ArrayList<>();
Entry<String, byte[]> entry = outputJar.firstEntry();
while (entry != null) {
String path = entry.getKey();
// ENG-12980: only look for auto-gen.ddl on root directory
if (AUTOGEN_DDL_FILE_NAME.equalsIgnoreCase(path)) {
ddlReaderList.add(new VoltCompilerJarFileReader(outputJar, path));
break;
}
entry = outputJar.higherEntry(entry.getKey());
}
if (ddlReaderList.size() == 0) {
// did not find auto generated DDL file during upgrade
throw new IOException("Could not find " + AUTOGEN_DDL_FILE_NAME + " in the catalog "
+ "compiled by VoltDB " + versionFromCatalog);
}
// Use the in-memory jarfile-provided class loader so that procedure
// classes can be found and copied to the new file that gets written.
ClassLoader originalClassLoader = m_classLoader;
// Compile and save the file to voltdbroot. Assume it's a test environment if there
// is no catalog context available.
String jarName = String.format("catalog-%s.jar", versionFromVoltDB);
String textName = String.format("catalog-%s.out", versionFromVoltDB);
CatalogContext catalogContext = VoltDB.instance().getCatalogContext();
final String outputJarPath = (catalogContext != null
? new File(VoltDB.instance().getVoltDBRootPath(), jarName).getPath()
: VoltDB.Configuration.getPathToCatalogForTest(jarName));
// Place the compiler output in a text file in the same folder.
final String outputTextPath = (catalogContext != null
? new File(VoltDB.instance().getVoltDBRootPath(), textName).getPath()
: VoltDB.Configuration.getPathToCatalogForTest(textName));
try {
m_classLoader = outputJar.getLoader();
consoleLog.info(String.format(
"Version %s catalog will be automatically upgraded to version %s.",
versionFromCatalog, versionFromVoltDB));
// Do the compilation work.
boolean success = compileInternalToFile(outputJarPath, null, null, ddlReaderList, outputJar);
// Sanitize the *.sql files in the jarfile so that only the autogenerated
// canonical DDL file will be used for future compilations
// Bomb out if we failed to generate the canonical DDL
if (success) {
boolean foundCanonicalDDL = false;
entry = outputJar.firstEntry();
while (entry != null) {
String path = entry.getKey();
if (path.toLowerCase().endsWith(".sql")) {
if (!path.toLowerCase().equals(AUTOGEN_DDL_FILE_NAME)) {
outputJar.remove(path);
}
else {
foundCanonicalDDL = true;
}
}
entry = outputJar.higherEntry(entry.getKey());
}
success = foundCanonicalDDL;
}
if (success) {
// Set up the return string.
upgradedFromVersion = versionFromCatalog;
}
// Summarize the results to a file.
// Briefly log success or failure and mention the output text file.
PrintStream outputStream = new PrintStream(outputTextPath);
try {
if (success) {
summarizeSuccess(outputStream, outputStream, outputJarPath);
consoleLog.info(String.format(
"The catalog was automatically upgraded from " +
"version %s to %s and saved to \"%s\". " +
"Compiler output is available in \"%s\".",
versionFromCatalog, versionFromVoltDB,
outputJarPath, outputTextPath));
}
else {
summarizeErrors(outputStream, outputStream);
outputStream.close();
compilerLog.error("Catalog upgrade failed.");
compilerLog.info(String.format(
"Had attempted to perform an automatic version upgrade of a " +
"catalog that was compiled by an older %s version of VoltDB, " +
"but the automatic upgrade failed. The cluster will not be " +
"able to start until the incompatibility is fixed. " +
"Try re-compiling the catalog with the newer %s version " +
"of the VoltDB compiler. Compiler output from the failed " +
"upgrade is available in \"%s\".",
versionFromCatalog, versionFromVoltDB, outputTextPath));
throw new IOException(String.format(
"Catalog upgrade failed. You will need to recompile using voltdb compile."));
}
}
finally {
outputStream.close();
}
}
catch (IOException ioe) {
// Do nothing because this could come from the normal failure path
throw ioe;
}
catch (Exception e) {
compilerLog.error("Catalog upgrade failed with error:");
compilerLog.error(e.getMessage());
compilerLog.info(String.format(
"Had attempted to perform an automatic version upgrade of a " +
"catalog that was compiled by an older %s version of VoltDB, " +
"but the automatic upgrade failed. The cluster will not be " +
"able to start until the incompatibility is fixed. " +
"Try re-compiling the catalog with the newer %s version " +
"of the VoltDB compiler. Compiler output from the failed " +
"upgrade is available in \"%s\".",
versionFromCatalog, versionFromVoltDB, outputTextPath));
throw new IOException(String.format(
"Catalog upgrade failed. You will need to recompile using voltdb compile."));
}
finally {
// Restore the original class loader
m_classLoader = originalClassLoader;
}
}
return upgradedFromVersion;
} | class class_name[name] begin[{]
method[upgradeCatalogAsNeeded, return_type[type[String]], modifier[public], parameter[outputJar]] begin[{]
local_variable[type[String], buildInfoLines]
local_variable[type[String], versionFromCatalog]
local_variable[type[String], upgradedFromVersion]
if[binary_operation[member[VoltDB.Configuration.m_forceCatalogUpgrade], ||, call[versionFromCatalog.equals, parameter[call[VoltDB.instance, parameter[]]]]]] begin[{]
local_variable[type[String], versionFromVoltDB]
assign[member[.buildInfoLines], member[.versionFromVoltDB]]
assign[member[.buildInfoLines], call[String.format, parameter[literal["voltdb-auto-upgrade-to-%s"], member[.versionFromVoltDB]]]]
local_variable[type[byte], buildInfoBytes]
call[outputJar.put, parameter[member[CatalogUtil.CATALOG_BUILDINFO_FILENAME], member[.buildInfoBytes]]]
local_variable[type[List], ddlReaderList]
local_variable[type[Entry], entry]
while[binary_operation[member[.entry], !=, literal[null]]] begin[{]
local_variable[type[String], path]
if[call[AUTOGEN_DDL_FILE_NAME.equalsIgnoreCase, parameter[member[.path]]]] begin[{]
call[ddlReaderList.add, parameter[ClassCreator(arguments=[MemberReference(member=outputJar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=path, 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=VoltCompilerJarFileReader, sub_type=None))]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.entry], call[outputJar.higherEntry, parameter[call[entry.getKey, parameter[]]]]]
end[}]
if[binary_operation[call[ddlReaderList.size, parameter[]], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not find "), operandr=MemberReference(member=AUTOGEN_DDL_FILE_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" in the catalog "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="compiled by VoltDB "), operator=+), operandr=MemberReference(member=versionFromCatalog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ClassLoader], originalClassLoader]
local_variable[type[String], jarName]
local_variable[type[String], textName]
local_variable[type[CatalogContext], catalogContext]
local_variable[type[String], outputJarPath]
local_variable[type[String], outputTextPath]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_classLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getLoader, postfix_operators=[], prefix_operators=[], qualifier=outputJar, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Version %s catalog will be automatically upgraded to version %s."), MemberReference(member=versionFromCatalog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=versionFromVoltDB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=consoleLog, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=outputJarPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=ddlReaderList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outputJar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compileInternalToFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=success)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MemberReference(member=success, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=foundCanonicalDDL)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=firstEntry, postfix_operators=[], prefix_operators=[], qualifier=outputJar, selectors=[], type_arguments=None)), label=None), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=toLowerCase, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".sql")], member=endsWith, 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=[IfStatement(condition=MethodInvocation(arguments=[], member=toLowerCase, postfix_operators=[], prefix_operators=['!'], qualifier=path, selectors=[MethodInvocation(arguments=[MemberReference(member=AUTOGEN_DDL_FILE_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=foundCanonicalDDL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=outputJar, selectors=[], type_arguments=None), label=None)]))])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=entry, 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=higherEntry, postfix_operators=[], prefix_operators=[], qualifier=outputJar, selectors=[], type_arguments=None)), label=None)]), condition=BinaryOperation(operandl=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=success, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=foundCanonicalDDL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), IfStatement(condition=MemberReference(member=success, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=upgradedFromVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=versionFromCatalog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=outputTextPath, 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=PrintStream, sub_type=None)), name=outputStream)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PrintStream, sub_type=None)), TryStatement(block=[IfStatement(condition=MemberReference(member=success, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=outputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=summarizeErrors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=outputStream, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Catalog upgrade failed.")], member=error, postfix_operators=[], prefix_operators=[], qualifier=compilerLog, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Had attempted to perform an automatic version upgrade of a "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="catalog that was compiled by an older %s version of VoltDB, "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="but the automatic upgrade failed. The cluster will not be "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="able to start until the incompatibility is fixed. "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Try re-compiling the catalog with the newer %s version "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="of the VoltDB compiler. Compiler output from the failed "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="upgrade is available in \"%s\"."), operator=+), MemberReference(member=versionFromCatalog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=versionFromVoltDB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outputTextPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=compilerLog, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Catalog upgrade failed. You will need to recompile using voltdb compile.")], 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=IOException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=outputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outputJarPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=summarizeSuccess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The catalog was automatically upgraded from "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="version %s to %s and saved to \"%s\". "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Compiler output is available in \"%s\"."), operator=+), MemberReference(member=versionFromCatalog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=versionFromVoltDB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outputJarPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outputTextPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=consoleLog, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=outputStream, selectors=[], type_arguments=None), label=None)], label=None, resources=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=ioe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ioe, types=['IOException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Catalog upgrade failed with error:")], member=error, postfix_operators=[], prefix_operators=[], qualifier=compilerLog, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=compilerLog, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Had attempted to perform an automatic version upgrade of a "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="catalog that was compiled by an older %s version of VoltDB, "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="but the automatic upgrade failed. The cluster will not be "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="able to start until the incompatibility is fixed. "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Try re-compiling the catalog with the newer %s version "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="of the VoltDB compiler. Compiler output from the failed "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="upgrade is available in \"%s\"."), operator=+), MemberReference(member=versionFromCatalog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=versionFromVoltDB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outputTextPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=compilerLog, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Catalog upgrade failed. You will need to recompile using voltdb compile.")], 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_classLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=originalClassLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
return[member[.upgradedFromVersion]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[upgradeCatalogAsNeeded] operator[SEP] identifier[InMemoryJarfile] identifier[outputJar] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] operator[SEP] operator[SEP] identifier[buildInfoLines] operator[=] identifier[CatalogUtil] operator[SEP] identifier[getBuildInfoFromJar] operator[SEP] identifier[outputJar] operator[SEP] operator[SEP] identifier[String] identifier[versionFromCatalog] operator[=] identifier[buildInfoLines] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[String] identifier[upgradedFromVersion] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[VoltDB] operator[SEP] identifier[Configuration] operator[SEP] identifier[m_forceCatalogUpgrade] operator[||] operator[!] identifier[versionFromCatalog] operator[SEP] identifier[equals] operator[SEP] identifier[VoltDB] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[getVersionString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[versionFromVoltDB] operator[=] identifier[VoltDB] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[getVersionString] operator[SEP] operator[SEP] operator[SEP] identifier[buildInfoLines] operator[SEP] Other[0] operator[SEP] operator[=] identifier[versionFromVoltDB] operator[SEP] identifier[buildInfoLines] operator[SEP] Other[1] operator[SEP] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[versionFromVoltDB] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[buildInfoBytes] operator[=] identifier[StringUtils] operator[SEP] identifier[join] operator[SEP] identifier[buildInfoLines] , literal[String] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] identifier[outputJar] operator[SEP] identifier[put] operator[SEP] identifier[CatalogUtil] operator[SEP] identifier[CATALOG_BUILDINFO_FILENAME] , identifier[buildInfoBytes] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[VoltCompilerReader] operator[>] identifier[ddlReaderList] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Entry] operator[<] identifier[String] , Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[entry] operator[=] identifier[outputJar] operator[SEP] identifier[firstEntry] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[entry] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[AUTOGEN_DDL_FILE_NAME] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
identifier[ddlReaderList] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[VoltCompilerJarFileReader] operator[SEP] identifier[outputJar] , identifier[path] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
identifier[entry] operator[=] identifier[outputJar] operator[SEP] identifier[higherEntry] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ddlReaderList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[AUTOGEN_DDL_FILE_NAME] operator[+] literal[String] operator[+] literal[String] operator[+] identifier[versionFromCatalog] operator[SEP] operator[SEP]
}
identifier[ClassLoader] identifier[originalClassLoader] operator[=] identifier[m_classLoader] operator[SEP] identifier[String] identifier[jarName] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[versionFromVoltDB] operator[SEP] operator[SEP] identifier[String] identifier[textName] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[versionFromVoltDB] operator[SEP] operator[SEP] identifier[CatalogContext] identifier[catalogContext] operator[=] identifier[VoltDB] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[getCatalogContext] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[outputJarPath] operator[=] operator[SEP] identifier[catalogContext] operator[!=] Other[null] operator[?] Keyword[new] identifier[File] operator[SEP] identifier[VoltDB] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[getVoltDBRootPath] operator[SEP] operator[SEP] , identifier[jarName] operator[SEP] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[:] identifier[VoltDB] operator[SEP] identifier[Configuration] operator[SEP] identifier[getPathToCatalogForTest] operator[SEP] identifier[jarName] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[outputTextPath] operator[=] operator[SEP] identifier[catalogContext] operator[!=] Other[null] operator[?] Keyword[new] identifier[File] operator[SEP] identifier[VoltDB] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[getVoltDBRootPath] operator[SEP] operator[SEP] , identifier[textName] operator[SEP] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[:] identifier[VoltDB] operator[SEP] identifier[Configuration] operator[SEP] identifier[getPathToCatalogForTest] operator[SEP] identifier[textName] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[m_classLoader] operator[=] identifier[outputJar] operator[SEP] identifier[getLoader] operator[SEP] operator[SEP] operator[SEP] identifier[consoleLog] operator[SEP] identifier[info] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[versionFromCatalog] , identifier[versionFromVoltDB] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[success] operator[=] identifier[compileInternalToFile] operator[SEP] identifier[outputJarPath] , Other[null] , Other[null] , identifier[ddlReaderList] , identifier[outputJar] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[success] operator[SEP] {
Keyword[boolean] identifier[foundCanonicalDDL] operator[=] literal[boolean] operator[SEP] identifier[entry] operator[=] identifier[outputJar] operator[SEP] identifier[firstEntry] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[entry] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[path] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[path] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[AUTOGEN_DDL_FILE_NAME] operator[SEP] operator[SEP] {
identifier[outputJar] operator[SEP] identifier[remove] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[foundCanonicalDDL] operator[=] literal[boolean] operator[SEP]
}
}
identifier[entry] operator[=] identifier[outputJar] operator[SEP] identifier[higherEntry] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[success] operator[=] identifier[foundCanonicalDDL] operator[SEP]
}
Keyword[if] operator[SEP] identifier[success] operator[SEP] {
identifier[upgradedFromVersion] operator[=] identifier[versionFromCatalog] operator[SEP]
}
identifier[PrintStream] identifier[outputStream] operator[=] Keyword[new] identifier[PrintStream] operator[SEP] identifier[outputTextPath] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[success] operator[SEP] {
identifier[summarizeSuccess] operator[SEP] identifier[outputStream] , identifier[outputStream] , identifier[outputJarPath] operator[SEP] operator[SEP] identifier[consoleLog] operator[SEP] identifier[info] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] , identifier[versionFromCatalog] , identifier[versionFromVoltDB] , identifier[outputJarPath] , identifier[outputTextPath] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[summarizeErrors] operator[SEP] identifier[outputStream] , identifier[outputStream] operator[SEP] operator[SEP] identifier[outputStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[compilerLog] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[compilerLog] operator[SEP] identifier[info] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] , identifier[versionFromCatalog] , identifier[versionFromVoltDB] , identifier[outputTextPath] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[outputStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ioe] operator[SEP] {
Keyword[throw] identifier[ioe] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[compilerLog] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[compilerLog] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[compilerLog] operator[SEP] identifier[info] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] , identifier[versionFromCatalog] , identifier[versionFromVoltDB] , identifier[outputTextPath] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[m_classLoader] operator[=] identifier[originalClassLoader] operator[SEP]
}
}
Keyword[return] identifier[upgradedFromVersion] operator[SEP]
}
|
private static <T> void writeConfig(BufferedWriter writer, DatabaseTableConfig<T> config) throws IOException,
SQLException {
writer.append(CONFIG_FILE_START_MARKER);
writer.newLine();
if (config.getDataClass() != null) {
writer.append(FIELD_NAME_DATA_CLASS).append('=').append(config.getDataClass().getName());
writer.newLine();
}
if (config.getTableName() != null) {
writer.append(FIELD_NAME_TABLE_NAME).append('=').append(config.getTableName());
writer.newLine();
}
writer.append(CONFIG_FILE_FIELDS_START);
writer.newLine();
if (config.getFieldConfigs() != null) {
for (DatabaseFieldConfig field : config.getFieldConfigs()) {
DatabaseFieldConfigLoader.write(writer, field, config.getTableName());
}
}
writer.append(CONFIG_FILE_FIELDS_END);
writer.newLine();
writer.append(CONFIG_FILE_END_MARKER);
writer.newLine();
} | class class_name[name] begin[{]
method[writeConfig, return_type[void], modifier[private static], parameter[writer, config]] begin[{]
call[writer.append, parameter[member[.CONFIG_FILE_START_MARKER]]]
call[writer.newLine, parameter[]]
if[binary_operation[call[config.getDataClass, parameter[]], !=, literal[null]]] begin[{]
call[writer.append, parameter[member[.FIELD_NAME_DATA_CLASS]]]
call[writer.newLine, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[call[config.getTableName, parameter[]], !=, literal[null]]] begin[{]
call[writer.append, parameter[member[.FIELD_NAME_TABLE_NAME]]]
call[writer.newLine, parameter[]]
else begin[{]
None
end[}]
call[writer.append, parameter[member[.CONFIG_FILE_FIELDS_START]]]
call[writer.newLine, parameter[]]
if[binary_operation[call[config.getFieldConfigs, parameter[]], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None)], member=write, postfix_operators=[], prefix_operators=[], qualifier=DatabaseFieldConfigLoader, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFieldConfigs, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DatabaseFieldConfig, sub_type=None))), label=None)
else begin[{]
None
end[}]
call[writer.append, parameter[member[.CONFIG_FILE_FIELDS_END]]]
call[writer.newLine, parameter[]]
call[writer.append, parameter[member[.CONFIG_FILE_END_MARKER]]]
call[writer.newLine, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[static] operator[<] identifier[T] operator[>] Keyword[void] identifier[writeConfig] operator[SEP] identifier[BufferedWriter] identifier[writer] , identifier[DatabaseTableConfig] operator[<] identifier[T] operator[>] identifier[config] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SQLException] {
identifier[writer] operator[SEP] identifier[append] operator[SEP] identifier[CONFIG_FILE_START_MARKER] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[getDataClass] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[writer] operator[SEP] identifier[append] operator[SEP] identifier[FIELD_NAME_DATA_CLASS] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[config] operator[SEP] identifier[getDataClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[writer] operator[SEP] identifier[append] operator[SEP] identifier[FIELD_NAME_TABLE_NAME] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[config] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[append] operator[SEP] identifier[CONFIG_FILE_FIELDS_START] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[getFieldConfigs] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[DatabaseFieldConfig] identifier[field] operator[:] identifier[config] operator[SEP] identifier[getFieldConfigs] operator[SEP] operator[SEP] operator[SEP] {
identifier[DatabaseFieldConfigLoader] operator[SEP] identifier[write] operator[SEP] identifier[writer] , identifier[field] , identifier[config] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[writer] operator[SEP] identifier[append] operator[SEP] identifier[CONFIG_FILE_FIELDS_END] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[append] operator[SEP] identifier[CONFIG_FILE_END_MARKER] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP]
}
|
protected String getTail() {
String tail = "";
if (this.offset < this.limit) {
tail = new String(this.buffer, this.offset, this.limit - this.offset + 1);
}
return tail;
} | class class_name[name] begin[{]
method[getTail, return_type[type[String]], modifier[protected], parameter[]] begin[{]
local_variable[type[String], tail]
if[binary_operation[THIS[member[None.offset]], <, THIS[member[None.limit]]]] begin[{]
assign[member[.tail], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=buffer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=offset, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), BinaryOperation(operandl=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=limit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=offset, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
else begin[{]
None
end[}]
return[member[.tail]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[getTail] operator[SEP] operator[SEP] {
identifier[String] identifier[tail] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[offset] operator[<] Keyword[this] operator[SEP] identifier[limit] operator[SEP] {
identifier[tail] operator[=] Keyword[new] identifier[String] operator[SEP] Keyword[this] operator[SEP] identifier[buffer] , Keyword[this] operator[SEP] identifier[offset] , Keyword[this] operator[SEP] identifier[limit] operator[-] Keyword[this] operator[SEP] identifier[offset] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[tail] operator[SEP]
}
|
public Matrix removeColumn(int j) {
if (j >= columns || j < 0) {
throw new IndexOutOfBoundsException("Illegal column number, must be 0.." + (columns - 1));
}
Matrix result = blankOfShape(rows, columns - 1);
for (int jj = 0; jj < j; jj++) {
result.setColumn(jj, getColumn(jj));
}
for (int jj = j + 1; jj < columns; jj++) {
result.setColumn(jj - 1, getColumn(jj));
}
return result;
} | class class_name[name] begin[{]
method[removeColumn, return_type[type[Matrix]], modifier[public], parameter[j]] begin[{]
if[binary_operation[binary_operation[member[.j], >=, member[.columns]], ||, binary_operation[member[.j], <, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal column number, must be 0.."), operandr=BinaryOperation(operandl=MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Matrix], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=jj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setColumn, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=jj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=j, 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=jj)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=jj, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=jj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), MethodInvocation(arguments=[MemberReference(member=jj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setColumn, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=jj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=jj)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=jj, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[Matrix] identifier[removeColumn] operator[SEP] Keyword[int] identifier[j] operator[SEP] {
Keyword[if] operator[SEP] identifier[j] operator[>=] identifier[columns] operator[||] identifier[j] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] literal[String] operator[+] operator[SEP] identifier[columns] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Matrix] identifier[result] operator[=] identifier[blankOfShape] operator[SEP] identifier[rows] , identifier[columns] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[jj] operator[=] Other[0] operator[SEP] identifier[jj] operator[<] identifier[j] operator[SEP] identifier[jj] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[setColumn] operator[SEP] identifier[jj] , identifier[getColumn] operator[SEP] identifier[jj] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[jj] operator[=] identifier[j] operator[+] Other[1] operator[SEP] identifier[jj] operator[<] identifier[columns] operator[SEP] identifier[jj] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[setColumn] operator[SEP] identifier[jj] operator[-] Other[1] , identifier[getColumn] operator[SEP] identifier[jj] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static boolean isDiagonalPositive( DMatrixRMaj a ) {
for( int i = 0; i < a.numRows; i++ ) {
if( !(a.get(i,i) >= 0) )
return false;
}
return true;
} | class class_name[name] begin[{]
method[isDiagonalPositive, return_type[type[boolean]], modifier[public static], parameter[a]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numRows, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isDiagonalPositive] operator[SEP] identifier[DMatrixRMaj] identifier[a] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[a] operator[SEP] identifier[numRows] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[a] operator[SEP] identifier[get] operator[SEP] identifier[i] , identifier[i] operator[SEP] operator[>=] Other[0] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private void visitFrame(final Frame f) {
int i, t;
int nTop = 0;
int nLocal = 0;
int nStack = 0;
int[] locals = f.inputLocals;
int[] stacks = f.inputStack;
// computes the number of locals (ignores TOP types that are just after
// a LONG or a DOUBLE, and all trailing TOP types)
for (i = 0; i < locals.length; ++i) {
t = locals[i];
if (t == Frame.TOP) {
++nTop;
} else {
nLocal += nTop + 1;
nTop = 0;
}
if (t == Frame.LONG || t == Frame.DOUBLE) {
++i;
}
}
// computes the stack size (ignores TOP types that are just after
// a LONG or a DOUBLE)
for (i = 0; i < stacks.length; ++i) {
t = stacks[i];
++nStack;
if (t == Frame.LONG || t == Frame.DOUBLE) {
++i;
}
}
// visits the frame and its content
startFrame(f.owner.position, nLocal, nStack);
for (i = 0; nLocal > 0; ++i, --nLocal) {
t = locals[i];
frame[frameIndex++] = t;
if (t == Frame.LONG || t == Frame.DOUBLE) {
++i;
}
}
for (i = 0; i < stacks.length; ++i) {
t = stacks[i];
frame[frameIndex++] = t;
if (t == Frame.LONG || t == Frame.DOUBLE) {
++i;
}
}
endFrame();
} | class class_name[name] begin[{]
method[visitFrame, return_type[void], modifier[private], parameter[f]] begin[{]
local_variable[type[int], i]
local_variable[type[int], nTop]
local_variable[type[int], nLocal]
local_variable[type[int], nStack]
local_variable[type[int], locals]
local_variable[type[int], stacks]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=locals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=TOP, postfix_operators=[], prefix_operators=[], qualifier=Frame, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=nLocal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=nTop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=nTop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=nTop, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=Frame, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=Frame, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=locals, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=stacks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=MemberReference(member=nStack, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=Frame, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=Frame, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=stacks, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
call[.startFrame, parameter[member[f.owner.position], member[.nLocal], member[.nStack]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=locals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=frame, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=frameIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=Frame, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=Frame, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=nLocal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), MemberReference(member=nLocal, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[])]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=stacks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=frame, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=frameIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=Frame, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DOUBLE, postfix_operators=[], prefix_operators=[], qualifier=Frame, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=stacks, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
call[.endFrame, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[visitFrame] operator[SEP] Keyword[final] identifier[Frame] identifier[f] operator[SEP] {
Keyword[int] identifier[i] , identifier[t] operator[SEP] Keyword[int] identifier[nTop] operator[=] Other[0] operator[SEP] Keyword[int] identifier[nLocal] operator[=] Other[0] operator[SEP] Keyword[int] identifier[nStack] operator[=] Other[0] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[locals] operator[=] identifier[f] operator[SEP] identifier[inputLocals] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[stacks] operator[=] identifier[f] operator[SEP] identifier[inputStack] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[locals] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[t] operator[=] identifier[locals] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[==] identifier[Frame] operator[SEP] identifier[TOP] operator[SEP] {
operator[++] identifier[nTop] operator[SEP]
}
Keyword[else] {
identifier[nLocal] operator[+=] identifier[nTop] operator[+] Other[1] operator[SEP] identifier[nTop] operator[=] Other[0] operator[SEP]
}
Keyword[if] operator[SEP] identifier[t] operator[==] identifier[Frame] operator[SEP] identifier[LONG] operator[||] identifier[t] operator[==] identifier[Frame] operator[SEP] identifier[DOUBLE] operator[SEP] {
operator[++] identifier[i] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[stacks] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[t] operator[=] identifier[stacks] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[++] identifier[nStack] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[==] identifier[Frame] operator[SEP] identifier[LONG] operator[||] identifier[t] operator[==] identifier[Frame] operator[SEP] identifier[DOUBLE] operator[SEP] {
operator[++] identifier[i] operator[SEP]
}
}
identifier[startFrame] operator[SEP] identifier[f] operator[SEP] identifier[owner] operator[SEP] identifier[position] , identifier[nLocal] , identifier[nStack] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[nLocal] operator[>] Other[0] operator[SEP] operator[++] identifier[i] , operator[--] identifier[nLocal] operator[SEP] {
identifier[t] operator[=] identifier[locals] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[frameIndex] operator[++] operator[SEP] operator[=] identifier[t] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[==] identifier[Frame] operator[SEP] identifier[LONG] operator[||] identifier[t] operator[==] identifier[Frame] operator[SEP] identifier[DOUBLE] operator[SEP] {
operator[++] identifier[i] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[stacks] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[t] operator[=] identifier[stacks] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[frameIndex] operator[++] operator[SEP] operator[=] identifier[t] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[==] identifier[Frame] operator[SEP] identifier[LONG] operator[||] identifier[t] operator[==] identifier[Frame] operator[SEP] identifier[DOUBLE] operator[SEP] {
operator[++] identifier[i] operator[SEP]
}
}
identifier[endFrame] operator[SEP] operator[SEP] operator[SEP]
}
|
int execute(final int idx, TestScript testScript, ApplicationContext appCtx) {
int ret = idx;
switch (key) {
case START:
ret = idx + 1;
break;
case BACK:
ret = idx - 1;
break;
case CURRENT:
ret = idx;
break;
case FORWARD:
ret = idx + 1;
break;
case EXEC_STEP_NO:
ret = testScript.getIndexByScriptNo(body);
break;
case SET_STEP_NO:
ret = testScript.getIndexByScriptNo(body) - 1;
break;
case LOC:
LocatorChecker check = appCtx.getBean(LocatorChecker.class);
Locator locator = Locator.build(body);
if (locator.isNa()) {
LOG.info("format.valid");
} else {
check.check(locator);
}
break;
case SHOW_PARAM:
showParam(appCtx);
break;
case INPUT_PARAM:
inputParam(appCtx);
break;
case EXPORT:
try {
TestScriptGenerateTool exporter = appCtx.getBean(TestScriptGenerateTool.class);
exporter.generateFromPage();
} catch (Exception e) {
LOG.error("export.error", e);
}
break;
case OPEN_SRCIPT:
try {
Desktop.getDesktop().open(testScript.getScriptFile());
} catch (IOException e) {
LOG.error("unexpected.error", e);
}
break;
case EXIT:
ret = testScript.getTestStepList().size();
break;
default:
break;
}
return ret;
} | class class_name[name] begin[{]
method[execute, return_type[type[int]], modifier[default], parameter[idx, testScript, appCtx]] begin[{]
local_variable[type[int], ret]
SwitchStatement(cases=[SwitchStatementCase(case=['START'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['BACK'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CURRENT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['FORWARD'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['EXEC_STEP_NO'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIndexByScriptNo, postfix_operators=[], prefix_operators=[], qualifier=testScript, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['SET_STEP_NO'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIndexByScriptNo, postfix_operators=[], prefix_operators=[], qualifier=testScript, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['LOC'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocatorChecker, sub_type=None))], member=getBean, postfix_operators=[], prefix_operators=[], qualifier=appCtx, selectors=[], type_arguments=None), name=check)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LocatorChecker, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=build, postfix_operators=[], prefix_operators=[], qualifier=Locator, selectors=[], type_arguments=None), name=locator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Locator, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isNa, postfix_operators=[], prefix_operators=[], qualifier=locator, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=locator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=check, postfix_operators=[], prefix_operators=[], qualifier=check, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="format.valid")], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['SHOW_PARAM'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=appCtx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=showParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['INPUT_PARAM'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=appCtx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=inputParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['EXPORT'], statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TestScriptGenerateTool, sub_type=None))], member=getBean, postfix_operators=[], prefix_operators=[], qualifier=appCtx, selectors=[], type_arguments=None), name=exporter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TestScriptGenerateTool, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=generateFromPage, postfix_operators=[], prefix_operators=[], qualifier=exporter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="export.error"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['OPEN_SRCIPT'], statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getDesktop, postfix_operators=[], prefix_operators=[], qualifier=Desktop, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getScriptFile, postfix_operators=[], prefix_operators=[], qualifier=testScript, selectors=[], type_arguments=None)], member=open, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unexpected.error"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['EXIT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getTestStepList, postfix_operators=[], prefix_operators=[], qualifier=testScript, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[BreakStatement(goto=None, label=None)])], expression=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[member[.ret]]
end[}]
END[}] | Keyword[int] identifier[execute] operator[SEP] Keyword[final] Keyword[int] identifier[idx] , identifier[TestScript] identifier[testScript] , identifier[ApplicationContext] identifier[appCtx] operator[SEP] {
Keyword[int] identifier[ret] operator[=] identifier[idx] operator[SEP] Keyword[switch] operator[SEP] identifier[key] operator[SEP] {
Keyword[case] identifier[START] operator[:] identifier[ret] operator[=] identifier[idx] operator[+] Other[1] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[BACK] operator[:] identifier[ret] operator[=] identifier[idx] operator[-] Other[1] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CURRENT] operator[:] identifier[ret] operator[=] identifier[idx] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[FORWARD] operator[:] identifier[ret] operator[=] identifier[idx] operator[+] Other[1] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[EXEC_STEP_NO] operator[:] identifier[ret] operator[=] identifier[testScript] operator[SEP] identifier[getIndexByScriptNo] operator[SEP] identifier[body] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[SET_STEP_NO] operator[:] identifier[ret] operator[=] identifier[testScript] operator[SEP] identifier[getIndexByScriptNo] operator[SEP] identifier[body] operator[SEP] operator[-] Other[1] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[LOC] operator[:] identifier[LocatorChecker] identifier[check] operator[=] identifier[appCtx] operator[SEP] identifier[getBean] operator[SEP] identifier[LocatorChecker] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Locator] identifier[locator] operator[=] identifier[Locator] operator[SEP] identifier[build] operator[SEP] identifier[body] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[locator] operator[SEP] identifier[isNa] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[check] operator[SEP] identifier[check] operator[SEP] identifier[locator] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[SHOW_PARAM] operator[:] identifier[showParam] operator[SEP] identifier[appCtx] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[INPUT_PARAM] operator[:] identifier[inputParam] operator[SEP] identifier[appCtx] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[EXPORT] operator[:] Keyword[try] {
identifier[TestScriptGenerateTool] identifier[exporter] operator[=] identifier[appCtx] operator[SEP] identifier[getBean] operator[SEP] identifier[TestScriptGenerateTool] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[exporter] operator[SEP] identifier[generateFromPage] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[OPEN_SRCIPT] operator[:] Keyword[try] {
identifier[Desktop] operator[SEP] identifier[getDesktop] operator[SEP] operator[SEP] operator[SEP] identifier[open] operator[SEP] identifier[testScript] operator[SEP] identifier[getScriptFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[EXIT] operator[:] identifier[ret] operator[=] identifier[testScript] operator[SEP] identifier[getTestStepList] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[break] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public void assertGreaterThan(Description description, Short actual, short expected) {
assertNotNull(description, actual);
if (!isGreaterThan(actual, expected)) {
throw failures.failure(description, ShouldBeGreaterThan.shouldBeGreaterThan(actual, expected));
}
} | class class_name[name] begin[{]
method[assertGreaterThan, return_type[void], modifier[public], parameter[description, actual, expected]] begin[{]
call[.assertNotNull, parameter[member[.description], member[.actual]]]
if[call[.isGreaterThan, parameter[member[.actual], member[.expected]]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=description, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=actual, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=expected, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=shouldBeGreaterThan, postfix_operators=[], prefix_operators=[], qualifier=ShouldBeGreaterThan, selectors=[], type_arguments=None)], member=failure, postfix_operators=[], prefix_operators=[], qualifier=failures, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[assertGreaterThan] operator[SEP] identifier[Description] identifier[description] , identifier[Short] identifier[actual] , Keyword[short] identifier[expected] operator[SEP] {
identifier[assertNotNull] operator[SEP] identifier[description] , identifier[actual] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isGreaterThan] operator[SEP] identifier[actual] , identifier[expected] operator[SEP] operator[SEP] {
Keyword[throw] identifier[failures] operator[SEP] identifier[failure] operator[SEP] identifier[description] , identifier[ShouldBeGreaterThan] operator[SEP] identifier[shouldBeGreaterThan] operator[SEP] identifier[actual] , identifier[expected] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Matrix4x3d arcball(double radius, double centerX, double centerY, double centerZ, double angleX, double angleY, Matrix4x3d dest) {
double m30 = m20 * -radius + this.m30;
double m31 = m21 * -radius + this.m31;
double m32 = m22 * -radius + this.m32;
double sin = Math.sin(angleX);
double cos = Math.cosFromSin(sin, angleX);
double nm10 = m10 * cos + m20 * sin;
double nm11 = m11 * cos + m21 * sin;
double nm12 = m12 * cos + m22 * sin;
double m20 = this.m20 * cos - m10 * sin;
double m21 = this.m21 * cos - m11 * sin;
double m22 = this.m22 * cos - m12 * sin;
sin = Math.sin(angleY);
cos = Math.cosFromSin(sin, angleY);
double nm00 = m00 * cos - m20 * sin;
double nm01 = m01 * cos - m21 * sin;
double nm02 = m02 * cos - m22 * sin;
double nm20 = m00 * sin + m20 * cos;
double nm21 = m01 * sin + m21 * cos;
double nm22 = m02 * sin + m22 * cos;
dest.m30 = -nm00 * centerX - nm10 * centerY - nm20 * centerZ + m30;
dest.m31 = -nm01 * centerX - nm11 * centerY - nm21 * centerZ + m31;
dest.m32 = -nm02 * centerX - nm12 * centerY - nm22 * centerZ + m32;
dest.m20 = nm20;
dest.m21 = nm21;
dest.m22 = nm22;
dest.m10 = nm10;
dest.m11 = nm11;
dest.m12 = nm12;
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
return dest;
} | class class_name[name] begin[{]
method[arcball, return_type[type[Matrix4x3d]], modifier[public], parameter[radius, centerX, centerY, centerZ, angleX, angleY, dest]] begin[{]
local_variable[type[double], m30]
local_variable[type[double], m31]
local_variable[type[double], m32]
local_variable[type[double], sin]
local_variable[type[double], cos]
local_variable[type[double], nm10]
local_variable[type[double], nm11]
local_variable[type[double], nm12]
local_variable[type[double], m20]
local_variable[type[double], m21]
local_variable[type[double], m22]
assign[member[.sin], call[Math.sin, parameter[member[.angleY]]]]
assign[member[.cos], call[Math.cosFromSin, parameter[member[.sin], member[.angleY]]]]
local_variable[type[double], nm00]
local_variable[type[double], nm01]
local_variable[type[double], nm02]
local_variable[type[double], nm20]
local_variable[type[double], nm21]
local_variable[type[double], nm22]
assign[member[dest.m30], binary_operation[binary_operation[binary_operation[binary_operation[member[.nm00], *, member[.centerX]], -, binary_operation[member[.nm10], *, member[.centerY]]], -, binary_operation[member[.nm20], *, member[.centerZ]]], +, member[.m30]]]
assign[member[dest.m31], binary_operation[binary_operation[binary_operation[binary_operation[member[.nm01], *, member[.centerX]], -, binary_operation[member[.nm11], *, member[.centerY]]], -, binary_operation[member[.nm21], *, member[.centerZ]]], +, member[.m31]]]
assign[member[dest.m32], binary_operation[binary_operation[binary_operation[binary_operation[member[.nm02], *, member[.centerX]], -, binary_operation[member[.nm12], *, member[.centerY]]], -, binary_operation[member[.nm22], *, member[.centerZ]]], +, member[.m32]]]
assign[member[dest.m20], member[.nm20]]
assign[member[dest.m21], member[.nm21]]
assign[member[dest.m22], member[.nm22]]
assign[member[dest.m10], member[.nm10]]
assign[member[dest.m11], member[.nm11]]
assign[member[dest.m12], member[.nm12]]
assign[member[dest.m00], member[.nm00]]
assign[member[dest.m01], member[.nm01]]
assign[member[dest.m02], member[.nm02]]
assign[member[dest.properties], binary_operation[member[.properties], &, binary_operation[member[.PROPERTY_IDENTITY], |, member[.PROPERTY_TRANSLATION]]]]
return[member[.dest]]
end[}]
END[}] | Keyword[public] identifier[Matrix4x3d] identifier[arcball] operator[SEP] Keyword[double] identifier[radius] , Keyword[double] identifier[centerX] , Keyword[double] identifier[centerY] , Keyword[double] identifier[centerZ] , Keyword[double] identifier[angleX] , Keyword[double] identifier[angleY] , identifier[Matrix4x3d] identifier[dest] operator[SEP] {
Keyword[double] identifier[m30] operator[=] identifier[m20] operator[*] operator[-] identifier[radius] operator[+] Keyword[this] operator[SEP] identifier[m30] operator[SEP] Keyword[double] identifier[m31] operator[=] identifier[m21] operator[*] operator[-] identifier[radius] operator[+] Keyword[this] operator[SEP] identifier[m31] operator[SEP] Keyword[double] identifier[m32] operator[=] identifier[m22] operator[*] operator[-] identifier[radius] operator[+] Keyword[this] operator[SEP] identifier[m32] operator[SEP] Keyword[double] identifier[sin] operator[=] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[angleX] operator[SEP] operator[SEP] Keyword[double] identifier[cos] operator[=] identifier[Math] operator[SEP] identifier[cosFromSin] operator[SEP] identifier[sin] , identifier[angleX] operator[SEP] operator[SEP] Keyword[double] identifier[nm10] operator[=] identifier[m10] operator[*] identifier[cos] operator[+] identifier[m20] operator[*] identifier[sin] operator[SEP] Keyword[double] identifier[nm11] operator[=] identifier[m11] operator[*] identifier[cos] operator[+] identifier[m21] operator[*] identifier[sin] operator[SEP] Keyword[double] identifier[nm12] operator[=] identifier[m12] operator[*] identifier[cos] operator[+] identifier[m22] operator[*] identifier[sin] operator[SEP] Keyword[double] identifier[m20] operator[=] Keyword[this] operator[SEP] identifier[m20] operator[*] identifier[cos] operator[-] identifier[m10] operator[*] identifier[sin] operator[SEP] Keyword[double] identifier[m21] operator[=] Keyword[this] operator[SEP] identifier[m21] operator[*] identifier[cos] operator[-] identifier[m11] operator[*] identifier[sin] operator[SEP] Keyword[double] identifier[m22] operator[=] Keyword[this] operator[SEP] identifier[m22] operator[*] identifier[cos] operator[-] identifier[m12] operator[*] identifier[sin] operator[SEP] identifier[sin] operator[=] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[angleY] operator[SEP] operator[SEP] identifier[cos] operator[=] identifier[Math] operator[SEP] identifier[cosFromSin] operator[SEP] identifier[sin] , identifier[angleY] operator[SEP] operator[SEP] Keyword[double] identifier[nm00] operator[=] identifier[m00] operator[*] identifier[cos] operator[-] identifier[m20] operator[*] identifier[sin] operator[SEP] Keyword[double] identifier[nm01] operator[=] identifier[m01] operator[*] identifier[cos] operator[-] identifier[m21] operator[*] identifier[sin] operator[SEP] Keyword[double] identifier[nm02] operator[=] identifier[m02] operator[*] identifier[cos] operator[-] identifier[m22] operator[*] identifier[sin] operator[SEP] Keyword[double] identifier[nm20] operator[=] identifier[m00] operator[*] identifier[sin] operator[+] identifier[m20] operator[*] identifier[cos] operator[SEP] Keyword[double] identifier[nm21] operator[=] identifier[m01] operator[*] identifier[sin] operator[+] identifier[m21] operator[*] identifier[cos] operator[SEP] Keyword[double] identifier[nm22] operator[=] identifier[m02] operator[*] identifier[sin] operator[+] identifier[m22] operator[*] identifier[cos] operator[SEP] identifier[dest] operator[SEP] identifier[m30] operator[=] operator[-] identifier[nm00] operator[*] identifier[centerX] operator[-] identifier[nm10] operator[*] identifier[centerY] operator[-] identifier[nm20] operator[*] identifier[centerZ] operator[+] identifier[m30] operator[SEP] identifier[dest] operator[SEP] identifier[m31] operator[=] operator[-] identifier[nm01] operator[*] identifier[centerX] operator[-] identifier[nm11] operator[*] identifier[centerY] operator[-] identifier[nm21] operator[*] identifier[centerZ] operator[+] identifier[m31] operator[SEP] identifier[dest] operator[SEP] identifier[m32] operator[=] operator[-] identifier[nm02] operator[*] identifier[centerX] operator[-] identifier[nm12] operator[*] identifier[centerY] operator[-] identifier[nm22] operator[*] identifier[centerZ] operator[+] identifier[m32] operator[SEP] identifier[dest] operator[SEP] identifier[m20] operator[=] identifier[nm20] operator[SEP] identifier[dest] operator[SEP] identifier[m21] operator[=] identifier[nm21] operator[SEP] identifier[dest] operator[SEP] identifier[m22] operator[=] identifier[nm22] operator[SEP] identifier[dest] operator[SEP] identifier[m10] operator[=] identifier[nm10] operator[SEP] identifier[dest] operator[SEP] identifier[m11] operator[=] identifier[nm11] operator[SEP] identifier[dest] operator[SEP] identifier[m12] operator[=] identifier[nm12] operator[SEP] identifier[dest] operator[SEP] identifier[m00] operator[=] identifier[nm00] operator[SEP] identifier[dest] operator[SEP] identifier[m01] operator[=] identifier[nm01] operator[SEP] identifier[dest] operator[SEP] identifier[m02] operator[=] identifier[nm02] operator[SEP] identifier[dest] operator[SEP] identifier[properties] operator[=] identifier[properties] operator[&] operator[~] operator[SEP] identifier[PROPERTY_IDENTITY] operator[|] identifier[PROPERTY_TRANSLATION] operator[SEP] operator[SEP] Keyword[return] identifier[dest] operator[SEP]
}
|
private void writeExternalEntry0(ReplicableEntry entry, Bytes destination) {
destination.writeByte(ENTRY_HUNK);
destination.writeStopBit(entry.originTimestamp());
if (entry.originIdentifier() == 0)
throw new IllegalStateException("Identifier can't be 0");
destination.writeByte(entry.originIdentifier());
Data key;
boolean isDeleted;
if (entry instanceof MapEntry) {
isDeleted = false;
key = ((MapEntry) entry).key();
} else {
isDeleted = true;
key = ((MapAbsentEntry) entry).absentKey();
}
destination.writeBoolean(isDeleted);
keySizeMarshaller.writeSize(destination, key.size());
key.writeTo(destination, destination.writePosition());
destination.writeSkip(key.size());
boolean debugEnabled = LOG.isDebugEnabled();
String message = null;
if (debugEnabled) {
if (isDeleted) {
LOG.debug("WRITING ENTRY TO DEST - into local-id={}, remove(key={})",
identifier(), key);
} else {
message = String.format(
"WRITING ENTRY TO DEST - into local-id=%d, put(key=%s,",
identifier(), key);
}
}
if (isDeleted)
return;
Data value = ((MapEntry) entry).value();
valueSizeMarshaller.writeSize(destination, value.size());
value.writeTo(destination, destination.writePosition());
destination.writeSkip(value.size());
if (debugEnabled) {
LOG.debug(message + "value=" + value + ")");
}
} | class class_name[name] begin[{]
method[writeExternalEntry0, return_type[void], modifier[private], parameter[entry, destination]] begin[{]
call[destination.writeByte, parameter[member[.ENTRY_HUNK]]]
call[destination.writeStopBit, parameter[call[entry.originTimestamp, parameter[]]]]
if[binary_operation[call[entry.originIdentifier, parameter[]], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Identifier can't be 0")], 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[}]
call[destination.writeByte, parameter[call[entry.originIdentifier, parameter[]]]]
local_variable[type[Data], key]
local_variable[type[boolean], isDeleted]
if[binary_operation[member[.entry], instanceof, type[MapEntry]]] begin[{]
assign[member[.isDeleted], literal[false]]
assign[member[.key], Cast(expression=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=MapEntry, sub_type=None))]
else begin[{]
assign[member[.isDeleted], literal[true]]
assign[member[.key], Cast(expression=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=MapAbsentEntry, sub_type=None))]
end[}]
call[destination.writeBoolean, parameter[member[.isDeleted]]]
call[keySizeMarshaller.writeSize, parameter[member[.destination], call[key.size, parameter[]]]]
call[key.writeTo, parameter[member[.destination], call[destination.writePosition, parameter[]]]]
call[destination.writeSkip, parameter[call[key.size, parameter[]]]]
local_variable[type[boolean], debugEnabled]
local_variable[type[String], message]
if[member[.debugEnabled]] begin[{]
if[member[.isDeleted]] begin[{]
call[LOG.debug, parameter[literal["WRITING ENTRY TO DEST - into local-id={}, remove(key={})"], call[.identifier, parameter[]], member[.key]]]
else begin[{]
assign[member[.message], call[String.format, parameter[literal["WRITING ENTRY TO DEST - into local-id=%d, put(key=%s,"], call[.identifier, parameter[]], member[.key]]]]
end[}]
else begin[{]
None
end[}]
if[member[.isDeleted]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[Data], value]
call[valueSizeMarshaller.writeSize, parameter[member[.destination], call[value.size, parameter[]]]]
call[value.writeTo, parameter[member[.destination], call[destination.writePosition, parameter[]]]]
call[destination.writeSkip, parameter[call[value.size, parameter[]]]]
if[member[.debugEnabled]] begin[{]
call[LOG.debug, parameter[binary_operation[binary_operation[binary_operation[member[.message], +, literal["value="]], +, member[.value]], +, literal[")"]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[writeExternalEntry0] operator[SEP] identifier[ReplicableEntry] identifier[entry] , identifier[Bytes] identifier[destination] operator[SEP] {
identifier[destination] operator[SEP] identifier[writeByte] operator[SEP] identifier[ENTRY_HUNK] operator[SEP] operator[SEP] identifier[destination] operator[SEP] identifier[writeStopBit] operator[SEP] identifier[entry] operator[SEP] identifier[originTimestamp] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[originIdentifier] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[destination] operator[SEP] identifier[writeByte] operator[SEP] identifier[entry] operator[SEP] identifier[originIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Data] identifier[key] operator[SEP] Keyword[boolean] identifier[isDeleted] operator[SEP] Keyword[if] operator[SEP] identifier[entry] Keyword[instanceof] identifier[MapEntry] operator[SEP] {
identifier[isDeleted] operator[=] literal[boolean] operator[SEP] identifier[key] operator[=] operator[SEP] operator[SEP] identifier[MapEntry] operator[SEP] identifier[entry] operator[SEP] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[isDeleted] operator[=] literal[boolean] operator[SEP] identifier[key] operator[=] operator[SEP] operator[SEP] identifier[MapAbsentEntry] operator[SEP] identifier[entry] operator[SEP] operator[SEP] identifier[absentKey] operator[SEP] operator[SEP] operator[SEP]
}
identifier[destination] operator[SEP] identifier[writeBoolean] operator[SEP] identifier[isDeleted] operator[SEP] operator[SEP] identifier[keySizeMarshaller] operator[SEP] identifier[writeSize] operator[SEP] identifier[destination] , identifier[key] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[writeTo] operator[SEP] identifier[destination] , identifier[destination] operator[SEP] identifier[writePosition] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[destination] operator[SEP] identifier[writeSkip] operator[SEP] identifier[key] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[debugEnabled] operator[=] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[message] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[debugEnabled] operator[SEP] {
Keyword[if] operator[SEP] identifier[isDeleted] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[identifier] operator[SEP] operator[SEP] , identifier[key] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[message] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[identifier] operator[SEP] operator[SEP] , identifier[key] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[isDeleted] operator[SEP] Keyword[return] operator[SEP] identifier[Data] identifier[value] operator[=] operator[SEP] operator[SEP] identifier[MapEntry] operator[SEP] identifier[entry] operator[SEP] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[valueSizeMarshaller] operator[SEP] identifier[writeSize] operator[SEP] identifier[destination] , identifier[value] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[SEP] identifier[writeTo] operator[SEP] identifier[destination] , identifier[destination] operator[SEP] identifier[writePosition] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[destination] operator[SEP] identifier[writeSkip] operator[SEP] identifier[value] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[debugEnabled] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] identifier[message] operator[+] literal[String] operator[+] identifier[value] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public JSONObject toJSONObject() throws JSONException {
final JSONObject ret = new JSONObject();
ret.put(Keys.OBJECT_ID, getId());
ret.put(Plugin.PLUGIN_NAME, getName());
ret.put(Plugin.PLUGIN_VERSION, getVersion());
ret.put(Plugin.PLUGIN_AUTHOR, getAuthor());
ret.put(Plugin.PLUGIN_STATUS, getStatus().name());
ret.put(Plugin.PLUGIN_SETTING, getSetting().toString());
return ret;
} | class class_name[name] begin[{]
method[toJSONObject, return_type[type[JSONObject]], modifier[public], parameter[]] begin[{]
local_variable[type[JSONObject], ret]
call[ret.put, parameter[member[Keys.OBJECT_ID], call[.getId, parameter[]]]]
call[ret.put, parameter[member[Plugin.PLUGIN_NAME], call[.getName, parameter[]]]]
call[ret.put, parameter[member[Plugin.PLUGIN_VERSION], call[.getVersion, parameter[]]]]
call[ret.put, parameter[member[Plugin.PLUGIN_AUTHOR], call[.getAuthor, parameter[]]]]
call[ret.put, parameter[member[Plugin.PLUGIN_STATUS], call[.getStatus, parameter[]]]]
call[ret.put, parameter[member[Plugin.PLUGIN_SETTING], call[.getSetting, parameter[]]]]
return[member[.ret]]
end[}]
END[}] | Keyword[public] identifier[JSONObject] identifier[toJSONObject] operator[SEP] operator[SEP] Keyword[throws] identifier[JSONException] {
Keyword[final] identifier[JSONObject] identifier[ret] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[Keys] operator[SEP] identifier[OBJECT_ID] , identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[Plugin] operator[SEP] identifier[PLUGIN_NAME] , identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[Plugin] operator[SEP] identifier[PLUGIN_VERSION] , identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[Plugin] operator[SEP] identifier[PLUGIN_AUTHOR] , identifier[getAuthor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[Plugin] operator[SEP] identifier[PLUGIN_STATUS] , identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[Plugin] operator[SEP] identifier[PLUGIN_SETTING] , identifier[getSetting] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
|
private ServerEventHandler createServerEventHandler(
SFSEventType type, Class<?> clazz) {
try {
return (ServerEventHandler)
ReflectClassUtil.newInstance(
clazz, BaseAppContext.class, context);
} catch (ExtensionException e) {
getLogger().error("Error when create server event handlers", e);
throw new RuntimeException("Can not create event handler of class "
+ clazz, e);
}
} | class class_name[name] begin[{]
method[createServerEventHandler, return_type[type[ServerEventHandler]], modifier[private], parameter[type, clazz]] begin[{]
TryStatement(block=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BaseAppContext, sub_type=None)), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=ReflectClassUtil, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ServerEventHandler, sub_type=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error when create server event handlers"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can not create event handler of class "), operandr=MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ExtensionException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] identifier[ServerEventHandler] identifier[createServerEventHandler] operator[SEP] identifier[SFSEventType] identifier[type] , identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[SEP] {
Keyword[try] {
Keyword[return] operator[SEP] identifier[ServerEventHandler] operator[SEP] identifier[ReflectClassUtil] operator[SEP] identifier[newInstance] operator[SEP] identifier[clazz] , identifier[BaseAppContext] operator[SEP] Keyword[class] , identifier[context] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ExtensionException] identifier[e] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[clazz] , identifier[e] operator[SEP] operator[SEP]
}
}
|
static <K,V> boolean checkInvariants(TreeNode<K,V> t) {
TreeNode<K,V> tp = t.parent, tl = t.left, tr = t.right,
tb = t.prev, tn = (TreeNode<K,V>)t.next;
if (tb != null && tb.next != t)
return false;
if (tn != null && tn.prev != t)
return false;
if (tp != null && t != tp.left && t != tp.right)
return false;
if (tl != null && (tl.parent != t || tl.hash > t.hash))
return false;
if (tr != null && (tr.parent != t || tr.hash < t.hash))
return false;
if (t.red && tl != null && tl.red && tr != null && tr.red)
return false;
if (tl != null && !checkInvariants(tl))
return false;
if (tr != null && !checkInvariants(tr))
return false;
return true;
} | class class_name[name] begin[{]
method[checkInvariants, return_type[type[boolean]], modifier[static], parameter[t]] begin[{]
local_variable[type[TreeNode], tp]
if[binary_operation[binary_operation[member[.tb], !=, literal[null]], &&, binary_operation[member[tb.next], !=, member[.t]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.tn], !=, literal[null]], &&, binary_operation[member[tn.prev], !=, member[.t]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.tp], !=, literal[null]], &&, binary_operation[member[.t], !=, member[tp.left]]], &&, binary_operation[member[.t], !=, member[tp.right]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.tl], !=, literal[null]], &&, binary_operation[binary_operation[member[tl.parent], !=, member[.t]], ||, binary_operation[member[tl.hash], >, member[t.hash]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.tr], !=, literal[null]], &&, binary_operation[binary_operation[member[tr.parent], !=, member[.t]], ||, binary_operation[member[tr.hash], <, member[t.hash]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[t.red], &&, binary_operation[member[.tl], !=, literal[null]]], &&, member[tl.red]], &&, binary_operation[member[.tr], !=, literal[null]]], &&, member[tr.red]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.tl], !=, literal[null]], &&, call[.checkInvariants, parameter[member[.tl]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.tr], !=, literal[null]], &&, call[.checkInvariants, parameter[member[.tr]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] Keyword[boolean] identifier[checkInvariants] operator[SEP] identifier[TreeNode] operator[<] identifier[K] , identifier[V] operator[>] identifier[t] operator[SEP] {
identifier[TreeNode] operator[<] identifier[K] , identifier[V] operator[>] identifier[tp] operator[=] identifier[t] operator[SEP] identifier[parent] , identifier[tl] operator[=] identifier[t] operator[SEP] identifier[left] , identifier[tr] operator[=] identifier[t] operator[SEP] identifier[right] , identifier[tb] operator[=] identifier[t] operator[SEP] identifier[prev] , identifier[tn] operator[=] operator[SEP] identifier[TreeNode] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] identifier[t] operator[SEP] identifier[next] operator[SEP] Keyword[if] operator[SEP] identifier[tb] operator[!=] Other[null] operator[&&] identifier[tb] operator[SEP] identifier[next] operator[!=] identifier[t] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[tn] operator[!=] Other[null] operator[&&] identifier[tn] operator[SEP] identifier[prev] operator[!=] identifier[t] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[tp] operator[!=] Other[null] operator[&&] identifier[t] operator[!=] identifier[tp] operator[SEP] identifier[left] operator[&&] identifier[t] operator[!=] identifier[tp] operator[SEP] identifier[right] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[tl] operator[!=] Other[null] operator[&&] operator[SEP] identifier[tl] operator[SEP] identifier[parent] operator[!=] identifier[t] operator[||] identifier[tl] operator[SEP] identifier[hash] operator[>] identifier[t] operator[SEP] identifier[hash] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[tr] operator[!=] Other[null] operator[&&] operator[SEP] identifier[tr] operator[SEP] identifier[parent] operator[!=] identifier[t] operator[||] identifier[tr] operator[SEP] identifier[hash] operator[<] identifier[t] operator[SEP] identifier[hash] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[red] operator[&&] identifier[tl] operator[!=] Other[null] operator[&&] identifier[tl] operator[SEP] identifier[red] operator[&&] identifier[tr] operator[!=] Other[null] operator[&&] identifier[tr] operator[SEP] identifier[red] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[tl] operator[!=] Other[null] operator[&&] operator[!] identifier[checkInvariants] operator[SEP] identifier[tl] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[tr] operator[!=] Other[null] operator[&&] operator[!] identifier[checkInvariants] operator[SEP] identifier[tr] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public CompoundActivity addActivity(Activity activity) {
if(activity != null) {
logger.trace("adding sub-activity '{}' to list", activity.getId());
activities.add(activity);
}
return this;
} | class class_name[name] begin[{]
method[addActivity, return_type[type[CompoundActivity]], modifier[public], parameter[activity]] begin[{]
if[binary_operation[member[.activity], !=, literal[null]]] begin[{]
call[logger.trace, parameter[literal["adding sub-activity '{}' to list"], call[activity.getId, parameter[]]]]
call[activities.add, parameter[member[.activity]]]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CompoundActivity] identifier[addActivity] operator[SEP] identifier[Activity] identifier[activity] operator[SEP] {
Keyword[if] operator[SEP] identifier[activity] operator[!=] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[activity] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[activities] operator[SEP] identifier[add] operator[SEP] identifier[activity] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static void attach(Environment environment) {
Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
MutablePropertySources sources = ((ConfigurableEnvironment) environment)
.getPropertySources();
PropertySource<?> attached = sources.get(ATTACHED_PROPERTY_SOURCE_NAME);
if (attached != null && attached.getSource() != sources) {
sources.remove(ATTACHED_PROPERTY_SOURCE_NAME);
attached = null;
}
if (attached == null) {
sources.addFirst(new ConfigurationPropertySourcesPropertySource(
ATTACHED_PROPERTY_SOURCE_NAME,
new SpringConfigurationPropertySources(sources)));
}
} | class class_name[name] begin[{]
method[attach, return_type[void], modifier[public static], parameter[environment]] begin[{]
call[Assert.isInstanceOf, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConfigurableEnvironment, sub_type=None)), member[.environment]]]
local_variable[type[MutablePropertySources], sources]
local_variable[type[PropertySource], attached]
if[binary_operation[binary_operation[member[.attached], !=, literal[null]], &&, binary_operation[call[attached.getSource, parameter[]], !=, member[.sources]]]] begin[{]
call[sources.remove, parameter[member[.ATTACHED_PROPERTY_SOURCE_NAME]]]
assign[member[.attached], literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.attached], ==, literal[null]]] begin[{]
call[sources.addFirst, parameter[ClassCreator(arguments=[MemberReference(member=ATTACHED_PROPERTY_SOURCE_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=sources, 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=SpringConfigurationPropertySources, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConfigurationPropertySourcesPropertySource, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[attach] operator[SEP] identifier[Environment] identifier[environment] operator[SEP] {
identifier[Assert] operator[SEP] identifier[isInstanceOf] operator[SEP] identifier[ConfigurableEnvironment] operator[SEP] Keyword[class] , identifier[environment] operator[SEP] operator[SEP] identifier[MutablePropertySources] identifier[sources] operator[=] operator[SEP] operator[SEP] identifier[ConfigurableEnvironment] operator[SEP] identifier[environment] operator[SEP] operator[SEP] identifier[getPropertySources] operator[SEP] operator[SEP] operator[SEP] identifier[PropertySource] operator[<] operator[?] operator[>] identifier[attached] operator[=] identifier[sources] operator[SEP] identifier[get] operator[SEP] identifier[ATTACHED_PROPERTY_SOURCE_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attached] operator[!=] Other[null] operator[&&] identifier[attached] operator[SEP] identifier[getSource] operator[SEP] operator[SEP] operator[!=] identifier[sources] operator[SEP] {
identifier[sources] operator[SEP] identifier[remove] operator[SEP] identifier[ATTACHED_PROPERTY_SOURCE_NAME] operator[SEP] operator[SEP] identifier[attached] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[attached] operator[==] Other[null] operator[SEP] {
identifier[sources] operator[SEP] identifier[addFirst] operator[SEP] Keyword[new] identifier[ConfigurationPropertySourcesPropertySource] operator[SEP] identifier[ATTACHED_PROPERTY_SOURCE_NAME] , Keyword[new] identifier[SpringConfigurationPropertySources] operator[SEP] identifier[sources] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AfplibPackage.COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR__PROC_MODE:
setProcMode((Integer)newValue);
return;
case AfplibPackage.COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR__CMR_SCPE:
setCMRScpe((Integer)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=COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR__PROC_MODE, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setProcMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR__CMR_SCPE, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setCMRScpe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], 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[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[COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR__PROC_MODE] operator[:] identifier[setProcMode] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR__CMR_SCPE] operator[:] identifier[setCMRScpe] operator[SEP] operator[SEP] identifier[Integer] 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]
}
|
public CrawlElement withText(String text) {
if (this.underXpath == null || this.underXpath.isEmpty()) {
this.underXpath = "//" + this.tagName + "[text()=" + escapeApostrophes(text) + "]";
} else {
this.underXpath = this.underXpath + " | " + "//" + this.tagName + "[text()="
+ escapeApostrophes(text) + "]";
}
return this;
} | class class_name[name] begin[{]
method[withText, return_type[type[CrawlElement]], modifier[public], parameter[text]] begin[{]
if[binary_operation[binary_operation[THIS[member[None.underXpath]], ==, literal[null]], ||, THIS[member[None.underXpath]call[None.isEmpty, parameter[]]]]] begin[{]
assign[THIS[member[None.underXpath]], binary_operation[binary_operation[binary_operation[binary_operation[literal["//"], +, THIS[member[None.tagName]]], +, literal["[text()="]], +, call[.escapeApostrophes, parameter[member[.text]]]], +, literal["]"]]]
else begin[{]
assign[THIS[member[None.underXpath]], binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[THIS[member[None.underXpath]], +, literal[" | "]], +, literal["//"]], +, THIS[member[None.tagName]]], +, literal["[text()="]], +, call[.escapeApostrophes, parameter[member[.text]]]], +, literal["]"]]]
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CrawlElement] identifier[withText] operator[SEP] identifier[String] identifier[text] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[underXpath] operator[==] Other[null] operator[||] Keyword[this] operator[SEP] identifier[underXpath] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[underXpath] operator[=] literal[String] operator[+] Keyword[this] operator[SEP] identifier[tagName] operator[+] literal[String] operator[+] identifier[escapeApostrophes] operator[SEP] identifier[text] operator[SEP] operator[+] literal[String] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[underXpath] operator[=] Keyword[this] operator[SEP] identifier[underXpath] operator[+] literal[String] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[tagName] operator[+] literal[String] operator[+] identifier[escapeApostrophes] operator[SEP] identifier[text] operator[SEP] operator[+] literal[String] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "sphericalCSRef")
public JAXBElement<SphericalCSRefType> createSphericalCSRef(SphericalCSRefType value) {
return new JAXBElement<SphericalCSRefType>(_SphericalCSRef_QNAME, SphericalCSRefType.class, null, value);
} | class class_name[name] begin[{]
method[createSphericalCSRef, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_SphericalCSRef_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SphericalCSRefType, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SphericalCSRefType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[SphericalCSRefType] operator[>] identifier[createSphericalCSRef] operator[SEP] identifier[SphericalCSRefType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[SphericalCSRefType] operator[>] operator[SEP] identifier[_SphericalCSRef_QNAME] , identifier[SphericalCSRefType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
@Nonnull
public static LocalDate getCurrentOrNextWorkDay (@Nullable final IHolidayManager aHolidayMgr)
{
if (aHolidayMgr == null)
return CalendarHelper.getCurrentOrNextWorkDay ();
LocalDate aDT = PDTFactory.getCurrentLocalDate ();
while (!isWorkDay (aDT, aHolidayMgr))
aDT = aDT.plusDays (1);
return aDT;
} | class class_name[name] begin[{]
method[getCurrentOrNextWorkDay, return_type[type[LocalDate]], modifier[public static], parameter[aHolidayMgr]] begin[{]
if[binary_operation[member[.aHolidayMgr], ==, literal[null]]] begin[{]
return[call[CalendarHelper.getCurrentOrNextWorkDay, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[LocalDate], aDT]
while[call[.isWorkDay, parameter[member[.aDT], member[.aHolidayMgr]]]] begin[{]
assign[member[.aDT], call[aDT.plusDays, parameter[literal[1]]]]
end[}]
return[member[.aDT]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[LocalDate] identifier[getCurrentOrNextWorkDay] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[IHolidayManager] identifier[aHolidayMgr] operator[SEP] {
Keyword[if] operator[SEP] identifier[aHolidayMgr] operator[==] Other[null] operator[SEP] Keyword[return] identifier[CalendarHelper] operator[SEP] identifier[getCurrentOrNextWorkDay] operator[SEP] operator[SEP] operator[SEP] identifier[LocalDate] identifier[aDT] operator[=] identifier[PDTFactory] operator[SEP] identifier[getCurrentLocalDate] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[isWorkDay] operator[SEP] identifier[aDT] , identifier[aHolidayMgr] operator[SEP] operator[SEP] identifier[aDT] operator[=] identifier[aDT] operator[SEP] identifier[plusDays] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[aDT] operator[SEP]
}
|
public void encode(InputStream inStream, OutputStream outStream)
throws IOException {
int j;
int numBytes;
byte tmpbuffer[] = new byte[bytesPerLine()];
encodeBufferPrefix(outStream);
while (true) {
numBytes = readFully(inStream, tmpbuffer);
if (numBytes == 0) {
break;
}
encodeLinePrefix(outStream, numBytes);
for (j = 0; j < numBytes; j += bytesPerAtom()) {
if ((j + bytesPerAtom()) <= numBytes) {
encodeAtom(outStream, tmpbuffer, j, bytesPerAtom());
} else {
encodeAtom(outStream, tmpbuffer, j, (numBytes)- j);
}
}
if (numBytes < bytesPerLine()) {
break;
} else {
encodeLineSuffix(outStream);
}
}
encodeBufferSuffix(outStream);
} | class class_name[name] begin[{]
method[encode, return_type[void], modifier[public], parameter[inStream, outStream]] begin[{]
local_variable[type[int], j]
local_variable[type[int], numBytes]
local_variable[type[byte], tmpbuffer]
call[.encodeBufferPrefix, parameter[member[.outStream]]]
while[literal[true]] begin[{]
assign[member[.numBytes], call[.readFully, parameter[member[.inStream], member[.tmpbuffer]]]]
if[binary_operation[member[.numBytes], ==, literal[0]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
call[.encodeLinePrefix, parameter[member[.outStream], member[.numBytes]]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=bytesPerAtom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=MemberReference(member=numBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=outStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tmpbuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MemberReference(member=j, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=numBytes, sub_type=None))], member=encodeAtom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=outStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tmpbuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=bytesPerAtom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=encodeAtom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[Assignment(expressionl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=bytesPerAtom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]), label=None)
if[binary_operation[member[.numBytes], <, call[.bytesPerLine, parameter[]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
call[.encodeLineSuffix, parameter[member[.outStream]]]
end[}]
end[}]
call[.encodeBufferSuffix, parameter[member[.outStream]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[encode] operator[SEP] identifier[InputStream] identifier[inStream] , identifier[OutputStream] identifier[outStream] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[j] operator[SEP] Keyword[int] identifier[numBytes] operator[SEP] Keyword[byte] identifier[tmpbuffer] operator[SEP] operator[SEP] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[bytesPerLine] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[encodeBufferPrefix] operator[SEP] identifier[outStream] operator[SEP] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[numBytes] operator[=] identifier[readFully] operator[SEP] identifier[inStream] , identifier[tmpbuffer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[numBytes] operator[==] Other[0] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[encodeLinePrefix] operator[SEP] identifier[outStream] , identifier[numBytes] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[numBytes] operator[SEP] identifier[j] operator[+=] identifier[bytesPerAtom] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[j] operator[+] identifier[bytesPerAtom] operator[SEP] operator[SEP] operator[SEP] operator[<=] identifier[numBytes] operator[SEP] {
identifier[encodeAtom] operator[SEP] identifier[outStream] , identifier[tmpbuffer] , identifier[j] , identifier[bytesPerAtom] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[encodeAtom] operator[SEP] identifier[outStream] , identifier[tmpbuffer] , identifier[j] , operator[SEP] identifier[numBytes] operator[SEP] operator[-] identifier[j] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[numBytes] operator[<] identifier[bytesPerLine] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[else] {
identifier[encodeLineSuffix] operator[SEP] identifier[outStream] operator[SEP] operator[SEP]
}
}
identifier[encodeBufferSuffix] operator[SEP] identifier[outStream] operator[SEP] operator[SEP]
}
|
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// Verify OAuth callback
Uri uri = intent.getData();
if (uri != null && uri.getScheme().equals(OAUTH_CALLBACK_SCHEME)) {
String verifier = uri.getQueryParameter(OAuth.OAUTH_VERIFIER);
new UpworkRetrieveAccessTokenTask().execute(verifier);
}
} | class class_name[name] begin[{]
method[onNewIntent, return_type[void], modifier[public], parameter[intent]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=intent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onNewIntent, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[Uri], uri]
if[binary_operation[binary_operation[member[.uri], !=, literal[null]], &&, call[uri.getScheme, parameter[]]]] begin[{]
local_variable[type[String], verifier]
ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=verifier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=execute, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=UpworkRetrieveAccessTokenTask, sub_type=None))
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onNewIntent] operator[SEP] identifier[Intent] identifier[intent] operator[SEP] {
Keyword[super] operator[SEP] identifier[onNewIntent] operator[SEP] identifier[intent] operator[SEP] operator[SEP] identifier[Uri] identifier[uri] operator[=] identifier[intent] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uri] operator[!=] Other[null] operator[&&] identifier[uri] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[OAUTH_CALLBACK_SCHEME] operator[SEP] operator[SEP] {
identifier[String] identifier[verifier] operator[=] identifier[uri] operator[SEP] identifier[getQueryParameter] operator[SEP] identifier[OAuth] operator[SEP] identifier[OAUTH_VERIFIER] operator[SEP] operator[SEP] Keyword[new] identifier[UpworkRetrieveAccessTokenTask] operator[SEP] operator[SEP] operator[SEP] identifier[execute] operator[SEP] identifier[verifier] operator[SEP] operator[SEP]
}
}
|
public static boolean isEdgeListItem(
Context context, AccessibilityNodeInfoCompat node, int direction, NodeFilter filter) {
if (node == null) {
return false;
}
if ((direction <= 0) && isMatchingEdgeListItem(context, node,
NodeFocusFinder.SEARCH_BACKWARD, FILTER_SCROLL_BACKWARD.and(filter))) {
return true;
}
if ((direction >= 0) && isMatchingEdgeListItem(context, node,
NodeFocusFinder.SEARCH_FORWARD, FILTER_SCROLL_FORWARD.and(filter))) {
return true;
}
return false;
} | class class_name[name] begin[{]
method[isEdgeListItem, return_type[type[boolean]], modifier[public static], parameter[context, node, direction, filter]] begin[{]
if[binary_operation[member[.node], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.direction], <=, literal[0]], &&, call[.isMatchingEdgeListItem, parameter[member[.context], member[.node], member[NodeFocusFinder.SEARCH_BACKWARD], call[FILTER_SCROLL_BACKWARD.and, parameter[member[.filter]]]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.direction], >=, literal[0]], &&, call[.isMatchingEdgeListItem, parameter[member[.context], member[.node], member[NodeFocusFinder.SEARCH_FORWARD], call[FILTER_SCROLL_FORWARD.and, parameter[member[.filter]]]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isEdgeListItem] operator[SEP] identifier[Context] identifier[context] , identifier[AccessibilityNodeInfoCompat] identifier[node] , Keyword[int] identifier[direction] , identifier[NodeFilter] identifier[filter] operator[SEP] {
Keyword[if] operator[SEP] identifier[node] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[direction] operator[<=] Other[0] operator[SEP] operator[&&] identifier[isMatchingEdgeListItem] operator[SEP] identifier[context] , identifier[node] , identifier[NodeFocusFinder] operator[SEP] identifier[SEARCH_BACKWARD] , identifier[FILTER_SCROLL_BACKWARD] operator[SEP] identifier[and] operator[SEP] identifier[filter] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[direction] operator[>=] Other[0] operator[SEP] operator[&&] identifier[isMatchingEdgeListItem] operator[SEP] identifier[context] , identifier[node] , identifier[NodeFocusFinder] operator[SEP] identifier[SEARCH_FORWARD] , identifier[FILTER_SCROLL_FORWARD] operator[SEP] identifier[and] operator[SEP] identifier[filter] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static boolean polygonDisjointPolyline_(Polygon polygon_a,
Polyline polyline_b, double tolerance,
ProgressTracker progress_tracker) {
// Quick rasterize test to see whether the the geometries are disjoint,
// or if one is contained in the other.
int relation = tryRasterizedContainsOrDisjoint_(polygon_a, polyline_b,
tolerance, true);
if (relation == Relation.disjoint)
return true;
if (relation == Relation.contains || relation == Relation.intersects)
return false;
return polygonDisjointMultiPath_(polygon_a, polyline_b, tolerance,
progress_tracker);
} | class class_name[name] begin[{]
method[polygonDisjointPolyline_, return_type[type[boolean]], modifier[private static], parameter[polygon_a, polyline_b, tolerance, progress_tracker]] begin[{]
local_variable[type[int], relation]
if[binary_operation[member[.relation], ==, member[Relation.disjoint]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.relation], ==, member[Relation.contains]], ||, binary_operation[member[.relation], ==, member[Relation.intersects]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[call[.polygonDisjointMultiPath_, parameter[member[.polygon_a], member[.polyline_b], member[.tolerance], member[.progress_tracker]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[polygonDisjointPolyline_] operator[SEP] identifier[Polygon] identifier[polygon_a] , identifier[Polyline] identifier[polyline_b] , Keyword[double] identifier[tolerance] , identifier[ProgressTracker] identifier[progress_tracker] operator[SEP] {
Keyword[int] identifier[relation] operator[=] identifier[tryRasterizedContainsOrDisjoint_] operator[SEP] identifier[polygon_a] , identifier[polyline_b] , identifier[tolerance] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[relation] operator[==] identifier[Relation] operator[SEP] identifier[disjoint] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[relation] operator[==] identifier[Relation] operator[SEP] identifier[contains] operator[||] identifier[relation] operator[==] identifier[Relation] operator[SEP] identifier[intersects] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] identifier[polygonDisjointMultiPath_] operator[SEP] identifier[polygon_a] , identifier[polyline_b] , identifier[tolerance] , identifier[progress_tracker] operator[SEP] operator[SEP]
}
|
@CheckReturnValue
public AuditableRestAction<Void> modifyMemberRoles(Member member, Collection<Role> roles)
{
Checks.notNull(member, "Member");
Checks.notNull(roles, "Roles");
checkGuild(member.getGuild(), "Member");
roles.forEach(role ->
{
Checks.notNull(role, "Role in collection");
checkGuild(role.getGuild(), "Role: " + role.toString());
checkPosition(role);
});
Checks.check(!roles.contains(getGuild().getPublicRole()),
"Cannot add the PublicRole of a Guild to a Member. All members have this role by default!");
// Return an empty rest action if there were no changes
final List<Role> memberRoles = member.getRoles();
if (memberRoles.size() == roles.size() && memberRoles.containsAll(roles))
return new AuditableRestAction.EmptyRestAction<>(getGuild().getJDA());
//Make sure that the current managed roles are preserved and no new ones are added.
List<Role> currentManaged = memberRoles.stream().filter(Role::isManaged).collect(Collectors.toList());
List<Role> newManaged = roles.stream().filter(Role::isManaged).collect(Collectors.toList());
if (!currentManaged.isEmpty() || !newManaged.isEmpty())
{
if (!newManaged.containsAll(currentManaged))
{
currentManaged.removeAll(newManaged);
throw new IllegalArgumentException("Cannot remove managed roles from a member! Roles: " + currentManaged.toString());
}
if (!currentManaged.containsAll(newManaged))
{
newManaged.removeAll(currentManaged);
throw new IllegalArgumentException("Cannot add managed roles to a member! Roles: " + newManaged.toString());
}
}
//This is identical to the rest action stuff in #modifyMemberRoles(Member, Collection<Role>, Collection<Role>)
JSONObject body = new JSONObject()
.put("roles", roles.stream().map(Role::getId).collect(Collectors.toList()));
Route.CompiledRoute route = Route.Guilds.MODIFY_MEMBER.compile(getGuild().getId(), member.getUser().getId());
return new AuditableRestAction<Void>(getGuild().getJDA(), route, body)
{
@Override
protected void handleResponse(Response response, Request<Void> request)
{
if (response.isOk())
request.onSuccess(null);
else
request.onFailure(response);
}
};
} | class class_name[name] begin[{]
method[modifyMemberRoles, return_type[type[AuditableRestAction]], modifier[public], parameter[member, roles]] begin[{]
call[Checks.notNull, parameter[member[.member], literal["Member"]]]
call[Checks.notNull, parameter[member[.roles], literal["Roles"]]]
call[.checkGuild, parameter[call[member.getGuild, parameter[]], literal["Member"]]]
call[roles.forEach, parameter[LambdaExpression(body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=role, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Role in collection")], member=notNull, postfix_operators=[], prefix_operators=[], qualifier=Checks, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getGuild, postfix_operators=[], prefix_operators=[], qualifier=role, selectors=[], type_arguments=None), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Role: "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=role, selectors=[], type_arguments=None), operator=+)], member=checkGuild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=role, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=role, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
call[Checks.check, parameter[call[roles.contains, parameter[call[.getGuild, parameter[]]]], literal["Cannot add the PublicRole of a Guild to a Member. All members have this role by default!"]]]
local_variable[type[List], memberRoles]
if[binary_operation[binary_operation[call[memberRoles.size, parameter[]], ==, call[roles.size, parameter[]]], &&, call[memberRoles.containsAll, parameter[member[.roles]]]]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getGuild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getJDA, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AuditableRestAction, sub_type=ReferenceType(arguments=[], dimensions=None, name=EmptyRestAction, sub_type=None)))]
else begin[{]
None
end[}]
local_variable[type[List], currentManaged]
local_variable[type[List], newManaged]
if[binary_operation[call[currentManaged.isEmpty, parameter[]], ||, call[newManaged.isEmpty, parameter[]]]] begin[{]
if[call[newManaged.containsAll, parameter[member[.currentManaged]]]] begin[{]
call[currentManaged.removeAll, parameter[member[.newManaged]]]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot remove managed roles from a member! Roles: "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=currentManaged, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[currentManaged.containsAll, parameter[member[.newManaged]]]] begin[{]
call[newManaged.removeAll, parameter[member[.currentManaged]]]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot add managed roles to a member! Roles: "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=newManaged, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[JSONObject], body]
local_variable[type[Route], route]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getGuild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getJDA, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=route, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[], member=isOk, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onFailure, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=onSuccess, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), label=None))], documentation=None, modifiers={'protected'}, name=handleResponse, parameters=[FormalParameter(annotations=[], modifiers=set(), name=response, type=ReferenceType(arguments=None, dimensions=[], name=Response, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=request, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None))], dimensions=[], name=Request, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None))], dimensions=None, name=AuditableRestAction, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] Keyword[public] identifier[AuditableRestAction] operator[<] identifier[Void] operator[>] identifier[modifyMemberRoles] operator[SEP] identifier[Member] identifier[member] , identifier[Collection] operator[<] identifier[Role] operator[>] identifier[roles] operator[SEP] {
identifier[Checks] operator[SEP] identifier[notNull] operator[SEP] identifier[member] , literal[String] operator[SEP] operator[SEP] identifier[Checks] operator[SEP] identifier[notNull] operator[SEP] identifier[roles] , literal[String] operator[SEP] operator[SEP] identifier[checkGuild] operator[SEP] identifier[member] operator[SEP] identifier[getGuild] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[roles] operator[SEP] identifier[forEach] operator[SEP] identifier[role] operator[->] {
identifier[Checks] operator[SEP] identifier[notNull] operator[SEP] identifier[role] , literal[String] operator[SEP] operator[SEP] identifier[checkGuild] operator[SEP] identifier[role] operator[SEP] identifier[getGuild] operator[SEP] operator[SEP] , literal[String] operator[+] identifier[role] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[checkPosition] operator[SEP] identifier[role] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[Checks] operator[SEP] identifier[check] operator[SEP] operator[!] identifier[roles] operator[SEP] identifier[contains] operator[SEP] identifier[getGuild] operator[SEP] operator[SEP] operator[SEP] identifier[getPublicRole] operator[SEP] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Role] operator[>] identifier[memberRoles] operator[=] identifier[member] operator[SEP] identifier[getRoles] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[memberRoles] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] identifier[roles] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[&&] identifier[memberRoles] operator[SEP] identifier[containsAll] operator[SEP] identifier[roles] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[AuditableRestAction] operator[SEP] identifier[EmptyRestAction] operator[<] operator[>] operator[SEP] identifier[getGuild] operator[SEP] operator[SEP] operator[SEP] identifier[getJDA] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Role] operator[>] identifier[currentManaged] operator[=] identifier[memberRoles] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[Role] operator[::] identifier[isManaged] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Role] operator[>] identifier[newManaged] operator[=] identifier[roles] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[Role] operator[::] identifier[isManaged] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[currentManaged] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] operator[!] identifier[newManaged] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[newManaged] operator[SEP] identifier[containsAll] operator[SEP] identifier[currentManaged] operator[SEP] operator[SEP] {
identifier[currentManaged] operator[SEP] identifier[removeAll] operator[SEP] identifier[newManaged] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[currentManaged] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[currentManaged] operator[SEP] identifier[containsAll] operator[SEP] identifier[newManaged] operator[SEP] operator[SEP] {
identifier[newManaged] operator[SEP] identifier[removeAll] operator[SEP] identifier[currentManaged] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[newManaged] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[JSONObject] identifier[body] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[roles] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[Role] operator[::] identifier[getId] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Route] operator[SEP] identifier[CompiledRoute] identifier[route] operator[=] identifier[Route] operator[SEP] identifier[Guilds] operator[SEP] identifier[MODIFY_MEMBER] operator[SEP] identifier[compile] operator[SEP] identifier[getGuild] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[member] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[AuditableRestAction] operator[<] identifier[Void] operator[>] operator[SEP] identifier[getGuild] operator[SEP] operator[SEP] operator[SEP] identifier[getJDA] operator[SEP] operator[SEP] , identifier[route] , identifier[body] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[handleResponse] operator[SEP] identifier[Response] identifier[response] , identifier[Request] operator[<] identifier[Void] operator[>] identifier[request] operator[SEP] {
Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[isOk] operator[SEP] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[onSuccess] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[else] identifier[request] operator[SEP] identifier[onFailure] operator[SEP] identifier[response] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public void forwardPendingTaskToRejoinNode(long[] replicasAdded, long snapshotSpHandle) {
if (tmLog.isDebugEnabled()) {
tmLog.debug("Forward pending tasks in backlog to rejoin node: " + Arrays.toString(replicasAdded));
}
if (replicasAdded.length == 0) {
return;
}
boolean sentAny = false;
for (Map.Entry<DuplicateCounterKey, DuplicateCounter> entry : m_duplicateCounters.entrySet()) {
if (snapshotSpHandle < entry.getKey().m_spHandle) {
if (!sentAny) {
sentAny = true;
if (tmLog.isDebugEnabled()) {
tmLog.debug("Start forwarding pending tasks to rejoin node.");
}
}
// Then forward any message after the MP txn, I expect them are all Iv2InitiateMessages
if (tmLog.isDebugEnabled()) {
tmLog.debug(entry.getValue().getOpenMessage().getMessageInfo());
}
m_mailbox.send(replicasAdded, entry.getValue().getOpenMessage());
}
}
if (sentAny && tmLog.isDebugEnabled()) {
tmLog.debug("Finish forwarding pending tasks to rejoin node.");
}
} | class class_name[name] begin[{]
method[forwardPendingTaskToRejoinNode, return_type[void], modifier[public], parameter[replicasAdded, snapshotSpHandle]] begin[{]
if[call[tmLog.isDebugEnabled, parameter[]]] begin[{]
call[tmLog.debug, parameter[binary_operation[literal["Forward pending tasks in backlog to rejoin node: "], +, call[Arrays.toString, parameter[member[.replicasAdded]]]]]]
else begin[{]
None
end[}]
if[binary_operation[member[replicasAdded.length], ==, literal[0]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[boolean], sentAny]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=snapshotSpHandle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MemberReference(member=m_spHandle, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=sentAny, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sentAny, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tmLog, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Start forwarding pending tasks to rejoin node.")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=tmLog, selectors=[], type_arguments=None), label=None)]))])), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tmLog, selectors=[], type_arguments=None), 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=[MethodInvocation(arguments=[], member=getOpenMessage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getMessageInfo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=tmLog, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=replicasAdded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=getOpenMessage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=send, postfix_operators=[], prefix_operators=[], qualifier=m_mailbox, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=m_duplicateCounters, 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=DuplicateCounterKey, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DuplicateCounter, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
if[binary_operation[member[.sentAny], &&, call[tmLog.isDebugEnabled, parameter[]]]] begin[{]
call[tmLog.debug, parameter[literal["Finish forwarding pending tasks to rejoin node."]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[forwardPendingTaskToRejoinNode] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[replicasAdded] , Keyword[long] identifier[snapshotSpHandle] operator[SEP] {
Keyword[if] operator[SEP] identifier[tmLog] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[tmLog] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[Arrays] operator[SEP] identifier[toString] operator[SEP] identifier[replicasAdded] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[replicasAdded] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[boolean] identifier[sentAny] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[DuplicateCounterKey] , identifier[DuplicateCounter] operator[>] identifier[entry] operator[:] identifier[m_duplicateCounters] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[snapshotSpHandle] operator[<] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[m_spHandle] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[sentAny] operator[SEP] {
identifier[sentAny] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[tmLog] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[tmLog] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[tmLog] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[tmLog] operator[SEP] identifier[debug] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[getOpenMessage] operator[SEP] operator[SEP] operator[SEP] identifier[getMessageInfo] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[m_mailbox] operator[SEP] identifier[send] operator[SEP] identifier[replicasAdded] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[getOpenMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[sentAny] operator[&&] identifier[tmLog] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[tmLog] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public ConfigRenderOptions setOriginComments(boolean value) {
if (value == originComments)
return this;
else
return new ConfigRenderOptions(value, comments, formatted, json);
} | class class_name[name] begin[{]
method[setOriginComments, return_type[type[ConfigRenderOptions]], modifier[public], parameter[value]] begin[{]
if[binary_operation[member[.value], ==, member[.originComments]]] begin[{]
return[THIS[]]
else begin[{]
return[ClassCreator(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=comments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=formatted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=json, 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=ConfigRenderOptions, sub_type=None))]
end[}]
end[}]
END[}] | Keyword[public] identifier[ConfigRenderOptions] identifier[setOriginComments] operator[SEP] Keyword[boolean] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] identifier[originComments] operator[SEP] Keyword[return] Keyword[this] operator[SEP] Keyword[else] Keyword[return] Keyword[new] identifier[ConfigRenderOptions] operator[SEP] identifier[value] , identifier[comments] , identifier[formatted] , identifier[json] operator[SEP] operator[SEP]
}
|
@Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLSubObjectPropertyOfAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | class class_name[name] begin[{]
method[deserializeInstance, return_type[void], modifier[public], parameter[streamReader, instance]] begin[{]
call[.deserialize, parameter[member[.streamReader], member[.instance]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[deserializeInstance] operator[SEP] identifier[SerializationStreamReader] identifier[streamReader] , identifier[OWLSubObjectPropertyOfAxiomImpl] identifier[instance] operator[SEP] Keyword[throws] identifier[SerializationException] {
identifier[deserialize] operator[SEP] identifier[streamReader] , identifier[instance] operator[SEP] operator[SEP]
}
|
public void putMetadata(MFile file, String key, byte[] value) {
if (store == null) initMM();
if (store != null) store.put(file.getPath()+"#"+key, value);
} | class class_name[name] begin[{]
method[putMetadata, return_type[void], modifier[public], parameter[file, key, value]] begin[{]
if[binary_operation[member[.store], ==, literal[null]]] begin[{]
call[.initMM, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.store], !=, literal[null]]] begin[{]
call[store.put, parameter[binary_operation[binary_operation[call[file.getPath, parameter[]], +, literal["#"]], +, member[.key]], member[.value]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[putMetadata] operator[SEP] identifier[MFile] identifier[file] , identifier[String] identifier[key] , Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[store] operator[==] Other[null] operator[SEP] identifier[initMM] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[store] operator[!=] Other[null] operator[SEP] identifier[store] operator[SEP] identifier[put] operator[SEP] identifier[file] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
|
void invoke(HttpRequest request) throws Exception {
bodyConsumer = null;
Object invokeResult;
try {
args[0] = this.request = request;
invokeResult = method.invoke(handler, args);
} catch (InvocationTargetException e) {
exceptionHandler.handle(e.getTargetException(), request, responder);
return;
} catch (Throwable t) {
exceptionHandler.handle(t, request, responder);
return;
}
if (isStreaming) {
// Casting guarantee to be succeeded.
bodyConsumer = (BodyConsumer) invokeResult;
}
} | class class_name[name] begin[{]
method[invoke, return_type[void], modifier[default], parameter[request]] begin[{]
assign[member[.bodyConsumer], literal[null]]
local_variable[type[Object], invokeResult]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), type==, value=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=request, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=invokeResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTargetException, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=responder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handle, postfix_operators=[], prefix_operators=[], qualifier=exceptionHandler, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvocationTargetException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=responder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handle, postfix_operators=[], prefix_operators=[], qualifier=exceptionHandler, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
if[member[.isStreaming]] begin[{]
assign[member[.bodyConsumer], Cast(expression=MemberReference(member=invokeResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BodyConsumer, sub_type=None))]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[invoke] operator[SEP] identifier[HttpRequest] identifier[request] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[bodyConsumer] operator[=] Other[null] operator[SEP] identifier[Object] identifier[invokeResult] operator[SEP] Keyword[try] {
identifier[args] operator[SEP] Other[0] operator[SEP] operator[=] Keyword[this] operator[SEP] identifier[request] operator[=] identifier[request] operator[SEP] identifier[invokeResult] operator[=] identifier[method] operator[SEP] identifier[invoke] operator[SEP] identifier[handler] , identifier[args] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InvocationTargetException] identifier[e] operator[SEP] {
identifier[exceptionHandler] operator[SEP] identifier[handle] operator[SEP] identifier[e] operator[SEP] identifier[getTargetException] operator[SEP] operator[SEP] , identifier[request] , identifier[responder] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[exceptionHandler] operator[SEP] identifier[handle] operator[SEP] identifier[t] , identifier[request] , identifier[responder] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isStreaming] operator[SEP] {
identifier[bodyConsumer] operator[=] operator[SEP] identifier[BodyConsumer] operator[SEP] identifier[invokeResult] operator[SEP]
}
}
|
public MethodInfo getMethodInfo(String methodName) throws JinxException {
JinxUtils.validateParams(methodName);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.reflection.getMethodInfo");
params.put("method_name", methodName);
return jinx.flickrGet(params, MethodInfo.class, false);
} | class class_name[name] begin[{]
method[getMethodInfo, return_type[type[MethodInfo]], modifier[public], parameter[methodName]] begin[{]
call[JinxUtils.validateParams, parameter[member[.methodName]]]
local_variable[type[Map], params]
call[params.put, parameter[literal["method"], literal["flickr.reflection.getMethodInfo"]]]
call[params.put, parameter[literal["method_name"], member[.methodName]]]
return[call[jinx.flickrGet, parameter[member[.params], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MethodInfo, sub_type=None)), literal[false]]]]
end[}]
END[}] | Keyword[public] identifier[MethodInfo] identifier[getMethodInfo] operator[SEP] identifier[String] identifier[methodName] operator[SEP] Keyword[throws] identifier[JinxException] {
identifier[JinxUtils] operator[SEP] identifier[validateParams] operator[SEP] identifier[methodName] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[=] Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[methodName] operator[SEP] operator[SEP] Keyword[return] identifier[jinx] operator[SEP] identifier[flickrGet] operator[SEP] identifier[params] , identifier[MethodInfo] operator[SEP] Keyword[class] , literal[boolean] operator[SEP] operator[SEP]
}
|
public static String escapeJS(String str, char quotesUsed) {
return escapeJS(str, quotesUsed, (CharsetEncoder) null);
} | class class_name[name] begin[{]
method[escapeJS, return_type[type[String]], modifier[public static], parameter[str, quotesUsed]] begin[{]
return[call[.escapeJS, parameter[member[.str], member[.quotesUsed], Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[], name=CharsetEncoder, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[escapeJS] operator[SEP] identifier[String] identifier[str] , Keyword[char] identifier[quotesUsed] operator[SEP] {
Keyword[return] identifier[escapeJS] operator[SEP] identifier[str] , identifier[quotesUsed] , operator[SEP] identifier[CharsetEncoder] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
|
private ConfigurationAdmin getConfigurationAdmin( final BundleContext bundleContext )
{
final ServiceReference ref = bundleContext.getServiceReference( ConfigurationAdmin.class.getName() );
if( ref == null )
{
throw new IllegalStateException( "Cannot find a configuration admin service" );
}
return (ConfigurationAdmin) bundleContext.getService( ref );
} | class class_name[name] begin[{]
method[getConfigurationAdmin, return_type[type[ConfigurationAdmin]], modifier[private], parameter[bundleContext]] begin[{]
local_variable[type[ServiceReference], ref]
if[binary_operation[member[.ref], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot find a configuration admin service")], 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[Cast(expression=MethodInvocation(arguments=[MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getService, postfix_operators=[], prefix_operators=[], qualifier=bundleContext, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ConfigurationAdmin, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[ConfigurationAdmin] identifier[getConfigurationAdmin] operator[SEP] Keyword[final] identifier[BundleContext] identifier[bundleContext] operator[SEP] {
Keyword[final] identifier[ServiceReference] identifier[ref] operator[=] identifier[bundleContext] operator[SEP] identifier[getServiceReference] operator[SEP] identifier[ConfigurationAdmin] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ref] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[ConfigurationAdmin] operator[SEP] identifier[bundleContext] operator[SEP] identifier[getService] operator[SEP] identifier[ref] operator[SEP] operator[SEP]
}
|
@Override
public void write(TextWriterStream out, String label, int[] v) {
StringBuilder buf = new StringBuilder();
if(label != null) {
buf.append(label).append('=');
}
if(v != null) {
FormatUtil.formatTo(buf, v, " ");
}
out.inlinePrintNoQuotes(buf.toString());
} | class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[out, label, v]] begin[{]
local_variable[type[StringBuilder], buf]
if[binary_operation[member[.label], !=, literal[null]]] begin[{]
call[buf.append, parameter[member[.label]]]
else begin[{]
None
end[}]
if[binary_operation[member[.v], !=, literal[null]]] begin[{]
call[FormatUtil.formatTo, parameter[member[.buf], member[.v], literal[" "]]]
else begin[{]
None
end[}]
call[out.inlinePrintNoQuotes, parameter[call[buf.toString, parameter[]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[write] operator[SEP] identifier[TextWriterStream] identifier[out] , identifier[String] identifier[label] , Keyword[int] operator[SEP] operator[SEP] identifier[v] operator[SEP] {
identifier[StringBuilder] identifier[buf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[label] operator[!=] Other[null] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[label] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[v] operator[!=] Other[null] operator[SEP] {
identifier[FormatUtil] operator[SEP] identifier[formatTo] operator[SEP] identifier[buf] , identifier[v] , literal[String] operator[SEP] operator[SEP]
}
identifier[out] operator[SEP] identifier[inlinePrintNoQuotes] operator[SEP] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> int combineMultisetHash(boolean finalize,
Iterator<? extends T> hashObjectIterator, Hasher<T> hasher) {
int hash = 0;
while (hashObjectIterator.hasNext()) {
hash += hasher.hash(hashObjectIterator.next());
}
if (finalize) {
hash = combineListHash(hash);
}
return hash;
} | class class_name[name] begin[{]
method[combineMultisetHash, return_type[type[int]], modifier[public static], parameter[finalize, hashObjectIterator, hasher]] begin[{]
local_variable[type[int], hash]
while[call[hashObjectIterator.hasNext, parameter[]]] begin[{]
assign[member[.hash], call[hasher.hash, parameter[call[hashObjectIterator.next, parameter[]]]]]
end[}]
if[member[.finalize]] begin[{]
assign[member[.hash], call[.combineListHash, parameter[member[.hash]]]]
else begin[{]
None
end[}]
return[member[.hash]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[int] identifier[combineMultisetHash] operator[SEP] Keyword[boolean] identifier[finalize] , identifier[Iterator] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] identifier[hashObjectIterator] , identifier[Hasher] operator[<] identifier[T] operator[>] identifier[hasher] operator[SEP] {
Keyword[int] identifier[hash] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[hashObjectIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[hash] operator[+=] identifier[hasher] operator[SEP] identifier[hash] operator[SEP] identifier[hashObjectIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[finalize] operator[SEP] {
identifier[hash] operator[=] identifier[combineListHash] operator[SEP] identifier[hash] operator[SEP] operator[SEP]
}
Keyword[return] identifier[hash] operator[SEP]
}
|
public static String[] createScriptArgs(
final Map<String, Map<String, String>> localDataContext,
final INodeEntry node,
final String scriptargs,
final String[] scriptargsarr,
final String scriptinterpreter,
final boolean interpreterargsquoted
)
{
return createScriptArgs(
localDataContext,
node,
scriptargs,
scriptargsarr,
scriptinterpreter,
interpreterargsquoted,
null
);
} | class class_name[name] begin[{]
method[createScriptArgs, return_type[type[String]], modifier[public static], parameter[localDataContext, node, scriptargs, scriptargsarr, scriptinterpreter, interpreterargsquoted]] begin[{]
return[call[.createScriptArgs, parameter[member[.localDataContext], member[.node], member[.scriptargs], member[.scriptargsarr], member[.scriptinterpreter], member[.interpreterargsquoted], literal[null]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] operator[SEP] operator[SEP] identifier[createScriptArgs] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[localDataContext] , Keyword[final] identifier[INodeEntry] identifier[node] , Keyword[final] identifier[String] identifier[scriptargs] , Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[scriptargsarr] , Keyword[final] identifier[String] identifier[scriptinterpreter] , Keyword[final] Keyword[boolean] identifier[interpreterargsquoted] operator[SEP] {
Keyword[return] identifier[createScriptArgs] operator[SEP] identifier[localDataContext] , identifier[node] , identifier[scriptargs] , identifier[scriptargsarr] , identifier[scriptinterpreter] , identifier[interpreterargsquoted] , Other[null] operator[SEP] operator[SEP]
}
|
public void setChildren(List<PrintComponent<?>> children) {
this.children = children;
// needed for Json unmarshall !!!!
for (PrintComponent<?> child : children) {
child.setParent(this);
}
} | class class_name[name] begin[{]
method[setChildren, return_type[void], modifier[public], parameter[children]] begin[{]
assign[THIS[member[None.children]], member[.children]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=setParent, postfix_operators=[], prefix_operators=[], qualifier=child, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=children, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=child)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=PrintComponent, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setChildren] operator[SEP] identifier[List] operator[<] identifier[PrintComponent] operator[<] operator[?] operator[>] operator[>] identifier[children] operator[SEP] {
Keyword[this] operator[SEP] identifier[children] operator[=] identifier[children] operator[SEP] Keyword[for] operator[SEP] identifier[PrintComponent] operator[<] operator[?] operator[>] identifier[child] operator[:] identifier[children] operator[SEP] {
identifier[child] operator[SEP] identifier[setParent] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
}
|
public static <Type> NegateValidator<Type> create(@NonNull final CharSequence errorMessage,
@NonNull final Validator<Type> validator) {
return new NegateValidator<>(errorMessage, validator);
} | class class_name[name] begin[{]
method[create, return_type[type[NegateValidator]], modifier[public static], parameter[errorMessage, validator]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=errorMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=validator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=NegateValidator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[Type] operator[>] identifier[NegateValidator] operator[<] identifier[Type] operator[>] identifier[create] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[CharSequence] identifier[errorMessage] , annotation[@] identifier[NonNull] Keyword[final] identifier[Validator] operator[<] identifier[Type] operator[>] identifier[validator] operator[SEP] {
Keyword[return] Keyword[new] identifier[NegateValidator] operator[<] operator[>] operator[SEP] identifier[errorMessage] , identifier[validator] operator[SEP] operator[SEP]
}
|
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
int ecount = in.readInt();
for (int ii = 0; ii < ecount; ii++) {
@SuppressWarnings("unchecked") K key = (K)in.readObject();
@SuppressWarnings("unchecked") V value = (V)in.readObject();
put(key, value);
}
} | class class_name[name] begin[{]
method[readObject, return_type[void], modifier[public], parameter[in]] begin[{]
local_variable[type[int], ecount]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unchecked"), name=SuppressWarnings)], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), LocalVariableDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unchecked"), name=SuppressWarnings)], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None)), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ecount, 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=ii)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ii, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[readObject] operator[SEP] identifier[ObjectInputStream] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ClassNotFoundException] {
Keyword[int] identifier[ecount] operator[=] identifier[in] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ii] operator[=] Other[0] operator[SEP] identifier[ii] operator[<] identifier[ecount] operator[SEP] identifier[ii] operator[++] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[K] identifier[key] operator[=] operator[SEP] identifier[K] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[V] identifier[value] operator[=] operator[SEP] identifier[V] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
}
|
public static SwipeBack attach(Activity activity, Type type, Position position, int dragMode, SwipeBackTransformer transformer) {
SwipeBack swipeBack = createSwipeBack(activity, dragMode, position, type, transformer);
swipeBack.setId(R.id.sb__swipeBack);
switch (dragMode) {
case SwipeBack.DRAG_CONTENT:
attachToContent(activity, swipeBack);
break;
case SwipeBack.DRAG_WINDOW:
attachToDecor(activity, swipeBack);
break;
default:
throw new RuntimeException("Unknown drag mode: " + dragMode);
}
return swipeBack;
} | class class_name[name] begin[{]
method[attach, return_type[type[SwipeBack]], modifier[public static], parameter[activity, type, position, dragMode, transformer]] begin[{]
local_variable[type[SwipeBack], swipeBack]
call[swipeBack.setId, parameter[member[R.id.sb__swipeBack]]]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=DRAG_CONTENT, postfix_operators=[], prefix_operators=[], qualifier=SwipeBack, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=activity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=swipeBack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=attachToContent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=DRAG_WINDOW, postfix_operators=[], prefix_operators=[], qualifier=SwipeBack, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=activity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=swipeBack, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=attachToDecor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown drag mode: "), operandr=MemberReference(member=dragMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)])], expression=MemberReference(member=dragMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[member[.swipeBack]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SwipeBack] identifier[attach] operator[SEP] identifier[Activity] identifier[activity] , identifier[Type] identifier[type] , identifier[Position] identifier[position] , Keyword[int] identifier[dragMode] , identifier[SwipeBackTransformer] identifier[transformer] operator[SEP] {
identifier[SwipeBack] identifier[swipeBack] operator[=] identifier[createSwipeBack] operator[SEP] identifier[activity] , identifier[dragMode] , identifier[position] , identifier[type] , identifier[transformer] operator[SEP] operator[SEP] identifier[swipeBack] operator[SEP] identifier[setId] operator[SEP] identifier[R] operator[SEP] identifier[id] operator[SEP] identifier[sb__swipeBack] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[dragMode] operator[SEP] {
Keyword[case] identifier[SwipeBack] operator[SEP] identifier[DRAG_CONTENT] operator[:] identifier[attachToContent] operator[SEP] identifier[activity] , identifier[swipeBack] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[SwipeBack] operator[SEP] identifier[DRAG_WINDOW] operator[:] identifier[attachToDecor] operator[SEP] identifier[activity] , identifier[swipeBack] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[dragMode] operator[SEP] operator[SEP]
}
Keyword[return] identifier[swipeBack] operator[SEP]
}
|
static RollupStats getOrNull(Vec vec, final Key rskey ) {
Value val = DKV.get(rskey);
if( val == null ) // No rollup stats present?
return vec.length() > 0 ? /*not computed*/null : /*empty vec*/new RollupStats(0);
RollupStats rs = val.get(RollupStats.class);
return rs.isReady() ? rs : null;
} | class class_name[name] begin[{]
method[getOrNull, return_type[type[RollupStats]], modifier[static], parameter[vec, rskey]] begin[{]
local_variable[type[Value], val]
if[binary_operation[member[.val], ==, literal[null]]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=vec, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), if_false=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RollupStats, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
else begin[{]
None
end[}]
local_variable[type[RollupStats], rs]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=isReady, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[static] identifier[RollupStats] identifier[getOrNull] operator[SEP] identifier[Vec] identifier[vec] , Keyword[final] identifier[Key] identifier[rskey] operator[SEP] {
identifier[Value] identifier[val] operator[=] identifier[DKV] operator[SEP] identifier[get] operator[SEP] identifier[rskey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[==] Other[null] operator[SEP] Keyword[return] identifier[vec] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[?] Other[null] operator[:] Keyword[new] identifier[RollupStats] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[RollupStats] identifier[rs] operator[=] identifier[val] operator[SEP] identifier[get] operator[SEP] identifier[RollupStats] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[return] identifier[rs] operator[SEP] identifier[isReady] operator[SEP] operator[SEP] operator[?] identifier[rs] operator[:] Other[null] operator[SEP]
}
|
public boolean contains(Bbox other) {
if (other.getX() < this.getX()) {
return false;
}
if (other.getY() < this.getY()) {
return false;
}
if (other.getEndPoint().getX() > this.getEndPoint().getX()) {
return false;
}
if (other.getEndPoint().getY() > this.getEndPoint().getY()) {
return false;
}
return true;
} | class class_name[name] begin[{]
method[contains, return_type[type[boolean]], modifier[public], parameter[other]] begin[{]
if[binary_operation[call[other.getX, parameter[]], <, THIS[call[None.getX, parameter[]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[call[other.getY, parameter[]], <, THIS[call[None.getY, parameter[]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[call[other.getEndPoint, parameter[]], >, THIS[call[None.getEndPoint, parameter[]]call[None.getX, parameter[]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[call[other.getEndPoint, parameter[]], >, THIS[call[None.getEndPoint, parameter[]]call[None.getY, parameter[]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[contains] operator[SEP] identifier[Bbox] identifier[other] operator[SEP] {
Keyword[if] operator[SEP] identifier[other] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[<] Keyword[this] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[other] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[<] Keyword[this] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[other] operator[SEP] identifier[getEndPoint] operator[SEP] operator[SEP] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[>] Keyword[this] operator[SEP] identifier[getEndPoint] operator[SEP] operator[SEP] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[other] operator[SEP] identifier[getEndPoint] operator[SEP] operator[SEP] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[>] Keyword[this] operator[SEP] identifier[getEndPoint] operator[SEP] operator[SEP] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public DescribeDeploymentsRequest withDeploymentIds(String... deploymentIds) {
if (this.deploymentIds == null) {
setDeploymentIds(new com.amazonaws.internal.SdkInternalList<String>(deploymentIds.length));
}
for (String ele : deploymentIds) {
this.deploymentIds.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withDeploymentIds, return_type[type[DescribeDeploymentsRequest]], modifier[public], parameter[deploymentIds]] begin[{]
if[binary_operation[THIS[member[None.deploymentIds]], ==, literal[null]]] begin[{]
call[.setDeploymentIds, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=deploymentIds, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=deploymentIds, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=deploymentIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[DescribeDeploymentsRequest] identifier[withDeploymentIds] operator[SEP] identifier[String] operator[...] identifier[deploymentIds] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[deploymentIds] operator[==] Other[null] operator[SEP] {
identifier[setDeploymentIds] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] identifier[deploymentIds] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[deploymentIds] operator[SEP] {
Keyword[this] operator[SEP] identifier[deploymentIds] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public void init(Query query, SearchIndex index) throws IOException
{
ism = index.getContext().getItemStateManager();
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[query, index]] begin[{]
assign[member[.ism], call[index.getContext, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[init] operator[SEP] identifier[Query] identifier[query] , identifier[SearchIndex] identifier[index] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[ism] operator[=] identifier[index] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getItemStateManager] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(DeletePolicyRequest deletePolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (deletePolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deletePolicyRequest.getPolicyId(), POLICYID_BINDING);
protocolMarshaller.marshall(deletePolicyRequest.getDeleteAllPolicyResources(), DELETEALLPOLICYRESOURCES_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[deletePolicyRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deletePolicyRequest], ==, 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=getPolicyId, postfix_operators=[], prefix_operators=[], qualifier=deletePolicyRequest, selectors=[], type_arguments=None), MemberReference(member=POLICYID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDeleteAllPolicyResources, postfix_operators=[], prefix_operators=[], qualifier=deletePolicyRequest, selectors=[], type_arguments=None), MemberReference(member=DELETEALLPOLICYRESOURCES_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[DeletePolicyRequest] identifier[deletePolicyRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deletePolicyRequest] 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[deletePolicyRequest] operator[SEP] identifier[getPolicyId] operator[SEP] operator[SEP] , identifier[POLICYID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[deletePolicyRequest] operator[SEP] identifier[getDeleteAllPolicyResources] operator[SEP] operator[SEP] , identifier[DELETEALLPOLICYRESOURCES_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]
}
}
|
protected boolean onItemClicked() {
if (isEnabled()) {
m_overlay.closeSubMenus();
if (hasSubMenu()) {
openSubMenu();
return false;
} else {
if (m_rootComponent.isHideAutomatically()) {
closeContextMenu();
return true;
}
return false;
}
}
return false;
} | class class_name[name] begin[{]
method[onItemClicked, return_type[type[boolean]], modifier[protected], parameter[]] begin[{]
if[call[.isEnabled, parameter[]]] begin[{]
call[m_overlay.closeSubMenus, parameter[]]
if[call[.hasSubMenu, parameter[]]] begin[{]
call[.openSubMenu, parameter[]]
return[literal[false]]
else begin[{]
if[call[m_rootComponent.isHideAutomatically, parameter[]]] begin[{]
call[.closeContextMenu, parameter[]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[onItemClicked] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_overlay] operator[SEP] identifier[closeSubMenus] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hasSubMenu] operator[SEP] operator[SEP] operator[SEP] {
identifier[openSubMenu] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[m_rootComponent] operator[SEP] identifier[isHideAutomatically] operator[SEP] operator[SEP] operator[SEP] {
identifier[closeContextMenu] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void reload() {
try {
if (file.exists()) {
try(FileReader fileReader = new FileReader(file)) {
props.load(fileReader);
}
}
} catch (IOException e) {
FOKLogger.log(Prefs.class.getName(), Level.SEVERE, FOKLogger.DEFAULT_ERROR_TEXT, e);
}
} | class class_name[name] begin[{]
method[reload, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fileReader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=load, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=fileReader, type=ReferenceType(arguments=None, dimensions=[], name=FileReader, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=file, 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=FileReader, sub_type=None)))])]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Prefs, sub_type=None)), MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=DEFAULT_ERROR_TEXT, postfix_operators=[], prefix_operators=[], qualifier=FOKLogger, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=FOKLogger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[reload] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] operator[SEP] identifier[FileReader] identifier[fileReader] operator[=] Keyword[new] identifier[FileReader] operator[SEP] identifier[file] operator[SEP] operator[SEP] {
identifier[props] operator[SEP] identifier[load] operator[SEP] identifier[fileReader] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[FOKLogger] operator[SEP] identifier[log] operator[SEP] identifier[Prefs] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[Level] operator[SEP] identifier[SEVERE] , identifier[FOKLogger] operator[SEP] identifier[DEFAULT_ERROR_TEXT] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static String hmacMd5(String data, String key) {
return hmacMd5(data.getBytes(), key.getBytes());
} | class class_name[name] begin[{]
method[hmacMd5, return_type[type[String]], modifier[public static], parameter[data, key]] begin[{]
return[call[.hmacMd5, parameter[call[data.getBytes, parameter[]], call[key.getBytes, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[hmacMd5] operator[SEP] identifier[String] identifier[data] , identifier[String] identifier[key] operator[SEP] {
Keyword[return] identifier[hmacMd5] operator[SEP] identifier[data] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] , identifier[key] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setSharedStyle(org.kie.dmn.model.api.dmndi.Style value) {
this.sharedStyle = value;
} | class class_name[name] begin[{]
method[setSharedStyle, return_type[void], modifier[public], parameter[value]] begin[{]
assign[THIS[member[None.sharedStyle]], member[.value]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setSharedStyle] operator[SEP] identifier[org] operator[SEP] identifier[kie] operator[SEP] identifier[dmn] operator[SEP] identifier[model] operator[SEP] identifier[api] operator[SEP] identifier[dmndi] operator[SEP] identifier[Style] identifier[value] operator[SEP] {
Keyword[this] operator[SEP] identifier[sharedStyle] operator[=] identifier[value] operator[SEP]
}
|
public TaskStatus executeTask(ApplicationDefinition appDef, Task task) {
checkServiceState();
Tenant tenant = Tenant.getTenant(appDef);
m_logger.debug("Checking that task {} in tenant {} is not running", task.getTaskID(), tenant);
TaskRecord taskRecord = null;
synchronized (m_executeLock) {
taskRecord = waitForTaskStatus(tenant, task, s -> s != TaskStatus.IN_PROGRESS);
taskRecord.setStatus(TaskStatus.NEVER_EXECUTED);
updateTaskStatus(tenant, taskRecord, false);
attemptToExecuteTask(appDef, task, taskRecord);
}
m_logger.debug("Checking that task {} in tenant {} has completed", tenant, task.getTaskID());
taskRecord = waitForTaskStatus(tenant, task, s -> TaskStatus.isCompleted(s));
return taskRecord.getStatus();
} | class class_name[name] begin[{]
method[executeTask, return_type[type[TaskStatus]], modifier[public], parameter[appDef, task]] begin[{]
call[.checkServiceState, parameter[]]
local_variable[type[Tenant], tenant]
call[m_logger.debug, parameter[literal["Checking that task {} in tenant {} is not running"], call[task.getTaskID, parameter[]], member[.tenant]]]
local_variable[type[TaskRecord], taskRecord]
SYNCHRONIZED[member[.m_executeLock]] BEGIN[{]
assign[member[.taskRecord], call[.waitForTaskStatus, parameter[member[.tenant], member[.task], LambdaExpression(body=BinaryOperation(operandl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=IN_PROGRESS, postfix_operators=[], prefix_operators=[], qualifier=TaskStatus, selectors=[]), operator=!=), parameters=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
call[taskRecord.setStatus, parameter[member[TaskStatus.NEVER_EXECUTED]]]
call[.updateTaskStatus, parameter[member[.tenant], member[.taskRecord], literal[false]]]
call[.attemptToExecuteTask, parameter[member[.appDef], member[.task], member[.taskRecord]]]
END[}]
call[m_logger.debug, parameter[literal["Checking that task {} in tenant {} has completed"], member[.tenant], call[task.getTaskID, parameter[]]]]
assign[member[.taskRecord], call[.waitForTaskStatus, parameter[member[.tenant], member[.task], LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isCompleted, postfix_operators=[], prefix_operators=[], qualifier=TaskStatus, selectors=[], type_arguments=None), parameters=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
return[call[taskRecord.getStatus, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[TaskStatus] identifier[executeTask] operator[SEP] identifier[ApplicationDefinition] identifier[appDef] , identifier[Task] identifier[task] operator[SEP] {
identifier[checkServiceState] operator[SEP] operator[SEP] operator[SEP] identifier[Tenant] identifier[tenant] operator[=] identifier[Tenant] operator[SEP] identifier[getTenant] operator[SEP] identifier[appDef] operator[SEP] operator[SEP] identifier[m_logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[task] operator[SEP] identifier[getTaskID] operator[SEP] operator[SEP] , identifier[tenant] operator[SEP] operator[SEP] identifier[TaskRecord] identifier[taskRecord] operator[=] Other[null] operator[SEP] Keyword[synchronized] operator[SEP] identifier[m_executeLock] operator[SEP] {
identifier[taskRecord] operator[=] identifier[waitForTaskStatus] operator[SEP] identifier[tenant] , identifier[task] , identifier[s] operator[->] identifier[s] operator[!=] identifier[TaskStatus] operator[SEP] identifier[IN_PROGRESS] operator[SEP] operator[SEP] identifier[taskRecord] operator[SEP] identifier[setStatus] operator[SEP] identifier[TaskStatus] operator[SEP] identifier[NEVER_EXECUTED] operator[SEP] operator[SEP] identifier[updateTaskStatus] operator[SEP] identifier[tenant] , identifier[taskRecord] , literal[boolean] operator[SEP] operator[SEP] identifier[attemptToExecuteTask] operator[SEP] identifier[appDef] , identifier[task] , identifier[taskRecord] operator[SEP] operator[SEP]
}
identifier[m_logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[tenant] , identifier[task] operator[SEP] identifier[getTaskID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[taskRecord] operator[=] identifier[waitForTaskStatus] operator[SEP] identifier[tenant] , identifier[task] , identifier[s] operator[->] identifier[TaskStatus] operator[SEP] identifier[isCompleted] operator[SEP] identifier[s] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[taskRecord] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void registerBindingConfigurationEntries(Iterable<BindingConfigurationEntry> bindings) {
for (BindingConfigurationEntry nextBinding : bindings) {
try {
registerBindingConfigurationEntry(nextBinding);
} catch (IllegalStateException e) {
// Ignore this - it can happen when introspecting class mappings
}
}
} | class class_name[name] begin[{]
method[registerBindingConfigurationEntries, return_type[void], modifier[protected], parameter[bindings]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=nextBinding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=registerBindingConfigurationEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalStateException']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=bindings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=nextBinding)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BindingConfigurationEntry, sub_type=None))), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[registerBindingConfigurationEntries] operator[SEP] identifier[Iterable] operator[<] identifier[BindingConfigurationEntry] operator[>] identifier[bindings] operator[SEP] {
Keyword[for] operator[SEP] identifier[BindingConfigurationEntry] identifier[nextBinding] operator[:] identifier[bindings] operator[SEP] {
Keyword[try] {
identifier[registerBindingConfigurationEntry] operator[SEP] identifier[nextBinding] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalStateException] identifier[e] operator[SEP] {
}
}
}
|
private void inflateLayers(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)
throws XmlPullParserException, IOException {
final LayerState state = mLayerState;
final int innerDepth = parser.getDepth() + 1;
int type;
int depth;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
&& ((depth = parser.getDepth()) >= innerDepth || type != XmlPullParser.END_TAG)) {
if (type != XmlPullParser.START_TAG) {
continue;
}
if (depth > innerDepth || !parser.getName().equals("item")) {
continue;
}
final ChildDrawable layer = new ChildDrawable();
final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.LayerDrawableItem);
updateLayerFromTypedArray(layer, a);
a.recycle();
// If the layer doesn't have a drawable or unresolved theme
// attribute for a drawable, attempt to parse one from the child
// element.
if (layer.mDrawable == null && (layer.mThemeAttrs == null ||
layer.mThemeAttrs[R.styleable.LayerDrawableItem_android_drawable] == 0)) {
while ((type = parser.next()) == XmlPullParser.TEXT) {
}
if (type != XmlPullParser.START_TAG) {
throw new XmlPullParserException(parser.getPositionDescription()
+ ": <item> tag requires a 'drawable' attribute or "
+ "child tag defining a drawable");
}
layer.mDrawable = LollipopDrawablesCompat.createFromXmlInner(r, parser, attrs, theme);
}
if (layer.mDrawable != null) {
state.mChildrenChangingConfigurations |=
layer.mDrawable.getChangingConfigurations();
layer.mDrawable.setCallback(this);
}
addLayer(layer);
}
} | class class_name[name] begin[{]
method[inflateLayers, return_type[void], modifier[private], parameter[r, parser, attrs, theme]] begin[{]
local_variable[type[LayerState], state]
local_variable[type[int], innerDepth]
local_variable[type[int], type]
local_variable[type[int], depth]
while[binary_operation[binary_operation[assign[member[.type], call[parser.next, parameter[]]], !=, member[XmlPullParser.END_DOCUMENT]], &&, binary_operation[binary_operation[assign[member[.depth], call[parser.getDepth, parameter[]]], >=, member[.innerDepth]], ||, binary_operation[member[.type], !=, member[XmlPullParser.END_TAG]]]]] begin[{]
if[binary_operation[member[.type], !=, member[XmlPullParser.START_TAG]]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.depth], >, member[.innerDepth]], ||, call[parser.getName, parameter[]]]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[ChildDrawable], layer]
local_variable[type[TypedArray], a]
call[.updateLayerFromTypedArray, parameter[member[.layer], member[.a]]]
call[a.recycle, parameter[]]
if[binary_operation[binary_operation[member[layer.mDrawable], ==, literal[null]], &&, binary_operation[binary_operation[member[layer.mThemeAttrs], ==, literal[null]], ||, binary_operation[member[layer.mThemeAttrs], ==, literal[0]]]]] begin[{]
while[binary_operation[assign[member[.type], call[parser.next, parameter[]]], ==, member[XmlPullParser.TEXT]]] begin[{]
end[}]
if[binary_operation[member[.type], !=, member[XmlPullParser.START_TAG]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPositionDescription, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": <item> tag requires a 'drawable' attribute or "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="child tag defining a drawable"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XmlPullParserException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[layer.mDrawable], call[LollipopDrawablesCompat.createFromXmlInner, parameter[member[.r], member[.parser], member[.attrs], member[.theme]]]]
else begin[{]
None
end[}]
if[binary_operation[member[layer.mDrawable], !=, literal[null]]] begin[{]
assign[member[state.mChildrenChangingConfigurations], call[layer.mDrawable.getChangingConfigurations, parameter[]]]
call[layer.mDrawable.setCallback, parameter[THIS[]]]
else begin[{]
None
end[}]
call[.addLayer, parameter[member[.layer]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[inflateLayers] operator[SEP] identifier[Resources] identifier[r] , identifier[XmlPullParser] identifier[parser] , identifier[AttributeSet] identifier[attrs] , identifier[Resources] operator[SEP] identifier[Theme] identifier[theme] operator[SEP] Keyword[throws] identifier[XmlPullParserException] , identifier[IOException] {
Keyword[final] identifier[LayerState] identifier[state] operator[=] identifier[mLayerState] operator[SEP] Keyword[final] Keyword[int] identifier[innerDepth] operator[=] identifier[parser] operator[SEP] identifier[getDepth] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] Keyword[int] identifier[type] operator[SEP] Keyword[int] identifier[depth] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[type] operator[=] identifier[parser] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[!=] identifier[XmlPullParser] operator[SEP] identifier[END_DOCUMENT] operator[&&] operator[SEP] operator[SEP] identifier[depth] operator[=] identifier[parser] operator[SEP] identifier[getDepth] operator[SEP] operator[SEP] operator[SEP] operator[>=] identifier[innerDepth] operator[||] identifier[type] operator[!=] identifier[XmlPullParser] operator[SEP] identifier[END_TAG] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[!=] identifier[XmlPullParser] operator[SEP] identifier[START_TAG] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[depth] operator[>] identifier[innerDepth] operator[||] operator[!] identifier[parser] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[final] identifier[ChildDrawable] identifier[layer] operator[=] Keyword[new] identifier[ChildDrawable] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[TypedArray] identifier[a] operator[=] identifier[obtainAttributes] operator[SEP] identifier[r] , identifier[theme] , identifier[attrs] , identifier[R] operator[SEP] identifier[styleable] operator[SEP] identifier[LayerDrawableItem] operator[SEP] operator[SEP] identifier[updateLayerFromTypedArray] operator[SEP] identifier[layer] , identifier[a] operator[SEP] operator[SEP] identifier[a] operator[SEP] identifier[recycle] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[layer] operator[SEP] identifier[mDrawable] operator[==] Other[null] operator[&&] operator[SEP] identifier[layer] operator[SEP] identifier[mThemeAttrs] operator[==] Other[null] operator[||] identifier[layer] operator[SEP] identifier[mThemeAttrs] operator[SEP] identifier[R] operator[SEP] identifier[styleable] operator[SEP] identifier[LayerDrawableItem_android_drawable] operator[SEP] operator[==] Other[0] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] operator[SEP] identifier[type] operator[=] identifier[parser] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[==] identifier[XmlPullParser] operator[SEP] identifier[TEXT] operator[SEP] {
}
Keyword[if] operator[SEP] identifier[type] operator[!=] identifier[XmlPullParser] operator[SEP] identifier[START_TAG] operator[SEP] {
Keyword[throw] Keyword[new] identifier[XmlPullParserException] operator[SEP] identifier[parser] operator[SEP] identifier[getPositionDescription] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[layer] operator[SEP] identifier[mDrawable] operator[=] identifier[LollipopDrawablesCompat] operator[SEP] identifier[createFromXmlInner] operator[SEP] identifier[r] , identifier[parser] , identifier[attrs] , identifier[theme] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[layer] operator[SEP] identifier[mDrawable] operator[!=] Other[null] operator[SEP] {
identifier[state] operator[SEP] identifier[mChildrenChangingConfigurations] operator[|=] identifier[layer] operator[SEP] identifier[mDrawable] operator[SEP] identifier[getChangingConfigurations] operator[SEP] operator[SEP] operator[SEP] identifier[layer] operator[SEP] identifier[mDrawable] operator[SEP] identifier[setCallback] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
identifier[addLayer] operator[SEP] identifier[layer] operator[SEP] operator[SEP]
}
}
|
@Override
public final byte[] getApiMessageIdAsBytes() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getApiMessageIdAsBytes");
byte[] value = (byte[]) getApi().getField(JsApiAccess.MESSAGEID);
if (value != null) {
byte[] copy = new byte[value.length];
System.arraycopy(value, 0, copy, 0, value.length);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getApiMessageIdAsBytes", copy);
return copy;
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getApiMessageIdAsBytes", null);
return null;
}
} | class class_name[name] begin[{]
method[getApiMessageIdAsBytes, return_type[type[byte]], modifier[final public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["getApiMessageIdAsBytes"]]]
else begin[{]
None
end[}]
local_variable[type[byte], value]
if[binary_operation[member[.value], !=, literal[null]]] begin[{]
local_variable[type[byte], copy]
call[System.arraycopy, parameter[member[.value], literal[0], member[.copy], literal[0], member[value.length]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["getApiMessageIdAsBytes"], member[.copy]]]
else begin[{]
None
end[}]
return[member[.copy]]
else begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["getApiMessageIdAsBytes"], literal[null]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[getApiMessageIdAsBytes] 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] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[MESSAGEID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[copy] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[value] , Other[0] , identifier[copy] , Other[0] , identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[copy] operator[SEP] operator[SEP] Keyword[return] identifier[copy] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , Other[null] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
public ResourceRepresentation<V> withLinks(List<Link> links) {
links.forEach(
link -> {
String rel = Links.getRel(link);
Support.checkRelType(rel);
validateSingletonRel(rel);
});
final TreeMap<String, Rel> updatedRels =
links
.map(Links::getRel)
.foldLeft(
rels,
(accum, rel) ->
!accum.containsKey(rel) ? accum.put(rel, Rels.natural(rel)) : accum);
final List<Link> updatedLinks = this.links.appendAll(links);
return new ResourceRepresentation<>(
content, updatedLinks, updatedRels, namespaceManager, value, resources);
} | class class_name[name] begin[{]
method[withLinks, return_type[type[ResourceRepresentation]], modifier[public], parameter[links]] begin[{]
call[links.forEach, parameter[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=link, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRel, postfix_operators=[], prefix_operators=[], qualifier=Links, selectors=[], type_arguments=None), name=rel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkRelType, postfix_operators=[], prefix_operators=[], qualifier=Support, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=validateSingletonRel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=link, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
local_variable[type[TreeMap], updatedRels]
local_variable[type[List], updatedLinks]
return[ClassCreator(arguments=[MemberReference(member=content, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=updatedLinks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=updatedRels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=namespaceManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ResourceRepresentation, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[ResourceRepresentation] operator[<] identifier[V] operator[>] identifier[withLinks] operator[SEP] identifier[List] operator[<] identifier[Link] operator[>] identifier[links] operator[SEP] {
identifier[links] operator[SEP] identifier[forEach] operator[SEP] identifier[link] operator[->] {
identifier[String] identifier[rel] operator[=] identifier[Links] operator[SEP] identifier[getRel] operator[SEP] identifier[link] operator[SEP] operator[SEP] identifier[Support] operator[SEP] identifier[checkRelType] operator[SEP] identifier[rel] operator[SEP] operator[SEP] identifier[validateSingletonRel] operator[SEP] identifier[rel] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[final] identifier[TreeMap] operator[<] identifier[String] , identifier[Rel] operator[>] identifier[updatedRels] operator[=] identifier[links] operator[SEP] identifier[map] operator[SEP] identifier[Links] operator[::] identifier[getRel] operator[SEP] operator[SEP] identifier[foldLeft] operator[SEP] identifier[rels] , operator[SEP] identifier[accum] , identifier[rel] operator[SEP] operator[->] operator[!] identifier[accum] operator[SEP] identifier[containsKey] operator[SEP] identifier[rel] operator[SEP] operator[?] identifier[accum] operator[SEP] identifier[put] operator[SEP] identifier[rel] , identifier[Rels] operator[SEP] identifier[natural] operator[SEP] identifier[rel] operator[SEP] operator[SEP] operator[:] identifier[accum] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Link] operator[>] identifier[updatedLinks] operator[=] Keyword[this] operator[SEP] identifier[links] operator[SEP] identifier[appendAll] operator[SEP] identifier[links] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ResourceRepresentation] operator[<] operator[>] operator[SEP] identifier[content] , identifier[updatedLinks] , identifier[updatedRels] , identifier[namespaceManager] , identifier[value] , identifier[resources] operator[SEP] operator[SEP]
}
|
public Observable<FileServerInner> getAsync(String resourceGroupName, String workspaceName, String fileServerName) {
return getWithServiceResponseAsync(resourceGroupName, workspaceName, fileServerName).map(new Func1<ServiceResponse<FileServerInner>, FileServerInner>() {
@Override
public FileServerInner call(ServiceResponse<FileServerInner> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[getAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, workspaceName, fileServerName]] begin[{]
return[call[.getWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.workspaceName], member[.fileServerName]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[FileServerInner] operator[>] identifier[getAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[workspaceName] , identifier[String] identifier[fileServerName] operator[SEP] {
Keyword[return] identifier[getWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[workspaceName] , identifier[fileServerName] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[FileServerInner] operator[>] , identifier[FileServerInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[FileServerInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[FileServerInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Override
public DeleteDatabaseResult deleteDatabase(DeleteDatabaseRequest request) {
request = beforeClientExecution(request);
return executeDeleteDatabase(request);
} | class class_name[name] begin[{]
method[deleteDatabase, return_type[type[DeleteDatabaseResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDeleteDatabase, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DeleteDatabaseResult] identifier[deleteDatabase] operator[SEP] identifier[DeleteDatabaseRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDeleteDatabase] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public ActivityController<T> configurationChange(final Configuration newConfiguration) {
final Configuration currentConfig = component.getResources().getConfiguration();
final int changedBits = currentConfig.diff(newConfiguration);
currentConfig.setTo(newConfiguration);
// TODO: throw on changedBits == 0 since it non-intuitively calls onConfigurationChanged
// Can the activity handle itself ALL configuration changes?
if ((getActivityInfo(component.getApplication()).configChanges & changedBits) == changedBits) {
shadowMainLooper.runPaused(() -> component.onConfigurationChanged(newConfiguration));
return this;
} else {
@SuppressWarnings("unchecked")
final T recreatedActivity = (T) ReflectionHelpers.callConstructor(component.getClass());
final _Activity_ _recreatedActivity_ = reflector(_Activity_.class, recreatedActivity);
shadowMainLooper.runPaused(
new Runnable() {
@Override
public void run() {
// Set flags
ReflectionHelpers.setField(
Activity.class, component, "mChangingConfigurations", true);
ReflectionHelpers.setField(
Activity.class, component, "mConfigChangeFlags", changedBits);
// Perform activity destruction
final Bundle outState = new Bundle();
// The order of onPause/onStop/onSaveInstanceState is undefined, but is usually:
// onPause -> onSaveInstanceState -> onStop
_component_.performPause();
_component_.performSaveInstanceState(outState);
if (RuntimeEnvironment.getApiLevel() <= M) {
_component_.performStop();
} else if (RuntimeEnvironment.getApiLevel() <= O_MR1) {
_component_.performStop(true);
} else {
_component_.performStop(true, "configurationChange");
}
// This is the true and complete retained state, including loaders and retained
// fragments.
final Object nonConfigInstance = _component_.retainNonConfigurationInstances();
// This is the activity's "user" state
final Object activityConfigInstance =
nonConfigInstance == null
? null // No framework or user state.
: reflector(_NonConfigurationInstances_.class, nonConfigInstance)
.getActivity();
_component_.performDestroy();
// Restore theme in case it was set in the test manually.
// This is not technically what happens but is purely to make this easier to use in
// Robolectric.
ShadowContextThemeWrapper shadowContextThemeWrapper = Shadow.extract(component);
int theme = shadowContextThemeWrapper.callGetThemeResId();
// Setup controller for the new activity
attached = false;
component = recreatedActivity;
_component_ = _recreatedActivity_;
// TODO: Pass nonConfigurationInstance here instead of setting
// mLastNonConfigurationInstances directly below. This field must be set before
// attach. Since current implementation sets it after attach(), initialization is not
// done correctly. For instance, fragment marked as retained is not retained.
attach(/*lastNonConfigurationInstances=*/ null);
if (theme != 0) {
recreatedActivity.setTheme(theme);
}
// Set saved non config instance
_recreatedActivity_.setLastNonConfigurationInstances(nonConfigInstance);
ShadowActivity shadowActivity = Shadow.extract(recreatedActivity);
shadowActivity.setLastNonConfigurationInstance(activityConfigInstance);
// Create lifecycle
_recreatedActivity_.performCreate(outState);
if (RuntimeEnvironment.getApiLevel() <= O_MR1) {
_recreatedActivity_.performStart();
} else {
_recreatedActivity_.performStart("configurationChange");
}
_recreatedActivity_.performRestoreInstanceState(outState);
_recreatedActivity_.onPostCreate(outState);
if (RuntimeEnvironment.getApiLevel() <= O_MR1) {
_recreatedActivity_.performResume();
} else {
_recreatedActivity_.performResume(true, "configurationChange");
}
_recreatedActivity_.onPostResume();
// TODO: Call visible() too.
}
});
}
return this;
} | class class_name[name] begin[{]
method[configurationChange, return_type[type[ActivityController]], modifier[public], parameter[newConfiguration]] begin[{]
local_variable[type[Configuration], currentConfig]
local_variable[type[int], changedBits]
call[currentConfig.setTo, parameter[member[.newConfiguration]]]
if[binary_operation[binary_operation[call[.getActivityInfo, parameter[call[component.getApplication, parameter[]]]], &, member[.changedBits]], ==, member[.changedBits]]] begin[{]
call[shadowMainLooper.runPaused, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=newConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onConfigurationChanged, postfix_operators=[], prefix_operators=[], qualifier=component, selectors=[], type_arguments=None), parameters=[])]]
return[THIS[]]
else begin[{]
local_variable[type[T], recreatedActivity]
local_variable[type[_Activity_], _recreatedActivity_]
call[shadowMainLooper.runPaused, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Activity, sub_type=None)), MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mChangingConfigurations"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setField, postfix_operators=[], prefix_operators=[], qualifier=ReflectionHelpers, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Activity, sub_type=None)), MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mConfigChangeFlags"), MemberReference(member=changedBits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setField, postfix_operators=[], prefix_operators=[], qualifier=ReflectionHelpers, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Bundle, sub_type=None)), name=outState)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Bundle, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=performPause, postfix_operators=[], prefix_operators=[], qualifier=_component_, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=outState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=performSaveInstanceState, postfix_operators=[], prefix_operators=[], qualifier=_component_, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getApiLevel, postfix_operators=[], prefix_operators=[], qualifier=RuntimeEnvironment, selectors=[], type_arguments=None), operandr=MemberReference(member=M, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getApiLevel, postfix_operators=[], prefix_operators=[], qualifier=RuntimeEnvironment, selectors=[], type_arguments=None), operandr=MemberReference(member=O_MR1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="configurationChange")], member=performStop, postfix_operators=[], prefix_operators=[], qualifier=_component_, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=performStop, postfix_operators=[], prefix_operators=[], qualifier=_component_, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=performStop, postfix_operators=[], prefix_operators=[], qualifier=_component_, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=retainNonConfigurationInstances, postfix_operators=[], prefix_operators=[], qualifier=_component_, selectors=[], type_arguments=None), name=nonConfigInstance)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=nonConfigInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=_NonConfigurationInstances_, sub_type=None)), MemberReference(member=nonConfigInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reflector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getActivity, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), name=activityConfigInstance)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=performDestroy, postfix_operators=[], prefix_operators=[], qualifier=_component_, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extract, postfix_operators=[], prefix_operators=[], qualifier=Shadow, selectors=[], type_arguments=None), name=shadowContextThemeWrapper)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ShadowContextThemeWrapper, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=callGetThemeResId, postfix_operators=[], prefix_operators=[], qualifier=shadowContextThemeWrapper, selectors=[], type_arguments=None), name=theme)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=attached, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=recreatedActivity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=_component_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=_recreatedActivity_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=attach, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTheme, postfix_operators=[], prefix_operators=[], qualifier=recreatedActivity, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=nonConfigInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLastNonConfigurationInstances, postfix_operators=[], prefix_operators=[], qualifier=_recreatedActivity_, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=recreatedActivity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extract, postfix_operators=[], prefix_operators=[], qualifier=Shadow, selectors=[], type_arguments=None), name=shadowActivity)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ShadowActivity, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=activityConfigInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLastNonConfigurationInstance, postfix_operators=[], prefix_operators=[], qualifier=shadowActivity, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=outState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=performCreate, postfix_operators=[], prefix_operators=[], qualifier=_recreatedActivity_, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getApiLevel, postfix_operators=[], prefix_operators=[], qualifier=RuntimeEnvironment, selectors=[], type_arguments=None), operandr=MemberReference(member=O_MR1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="configurationChange")], member=performStart, postfix_operators=[], prefix_operators=[], qualifier=_recreatedActivity_, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=performStart, postfix_operators=[], prefix_operators=[], qualifier=_recreatedActivity_, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=outState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=performRestoreInstanceState, postfix_operators=[], prefix_operators=[], qualifier=_recreatedActivity_, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=outState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onPostCreate, postfix_operators=[], prefix_operators=[], qualifier=_recreatedActivity_, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getApiLevel, postfix_operators=[], prefix_operators=[], qualifier=RuntimeEnvironment, selectors=[], type_arguments=None), operandr=MemberReference(member=O_MR1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="configurationChange")], member=performResume, postfix_operators=[], prefix_operators=[], qualifier=_recreatedActivity_, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=performResume, postfix_operators=[], prefix_operators=[], qualifier=_recreatedActivity_, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=onPostResume, postfix_operators=[], prefix_operators=[], qualifier=_recreatedActivity_, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Runnable, sub_type=None))]]
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ActivityController] operator[<] identifier[T] operator[>] identifier[configurationChange] operator[SEP] Keyword[final] identifier[Configuration] identifier[newConfiguration] operator[SEP] {
Keyword[final] identifier[Configuration] identifier[currentConfig] operator[=] identifier[component] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[getConfiguration] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[changedBits] operator[=] identifier[currentConfig] operator[SEP] identifier[diff] operator[SEP] identifier[newConfiguration] operator[SEP] operator[SEP] identifier[currentConfig] operator[SEP] identifier[setTo] operator[SEP] identifier[newConfiguration] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[getActivityInfo] operator[SEP] identifier[component] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[configChanges] operator[&] identifier[changedBits] operator[SEP] operator[==] identifier[changedBits] operator[SEP] {
identifier[shadowMainLooper] operator[SEP] identifier[runPaused] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[component] operator[SEP] identifier[onConfigurationChanged] operator[SEP] identifier[newConfiguration] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
Keyword[else] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[final] identifier[T] identifier[recreatedActivity] operator[=] operator[SEP] identifier[T] operator[SEP] identifier[ReflectionHelpers] operator[SEP] identifier[callConstructor] operator[SEP] identifier[component] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[_Activity_] identifier[_recreatedActivity_] operator[=] identifier[reflector] operator[SEP] identifier[_Activity_] operator[SEP] Keyword[class] , identifier[recreatedActivity] operator[SEP] operator[SEP] identifier[shadowMainLooper] operator[SEP] identifier[runPaused] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[ReflectionHelpers] operator[SEP] identifier[setField] operator[SEP] identifier[Activity] operator[SEP] Keyword[class] , identifier[component] , literal[String] , literal[boolean] operator[SEP] operator[SEP] identifier[ReflectionHelpers] operator[SEP] identifier[setField] operator[SEP] identifier[Activity] operator[SEP] Keyword[class] , identifier[component] , literal[String] , identifier[changedBits] operator[SEP] operator[SEP] Keyword[final] identifier[Bundle] identifier[outState] operator[=] Keyword[new] identifier[Bundle] operator[SEP] operator[SEP] operator[SEP] identifier[_component_] operator[SEP] identifier[performPause] operator[SEP] operator[SEP] operator[SEP] identifier[_component_] operator[SEP] identifier[performSaveInstanceState] operator[SEP] identifier[outState] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[RuntimeEnvironment] operator[SEP] identifier[getApiLevel] operator[SEP] operator[SEP] operator[<=] identifier[M] operator[SEP] {
identifier[_component_] operator[SEP] identifier[performStop] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[RuntimeEnvironment] operator[SEP] identifier[getApiLevel] operator[SEP] operator[SEP] operator[<=] identifier[O_MR1] operator[SEP] {
identifier[_component_] operator[SEP] identifier[performStop] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[_component_] operator[SEP] identifier[performStop] operator[SEP] literal[boolean] , literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Object] identifier[nonConfigInstance] operator[=] identifier[_component_] operator[SEP] identifier[retainNonConfigurationInstances] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Object] identifier[activityConfigInstance] operator[=] identifier[nonConfigInstance] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[reflector] operator[SEP] identifier[_NonConfigurationInstances_] operator[SEP] Keyword[class] , identifier[nonConfigInstance] operator[SEP] operator[SEP] identifier[getActivity] operator[SEP] operator[SEP] operator[SEP] identifier[_component_] operator[SEP] identifier[performDestroy] operator[SEP] operator[SEP] operator[SEP] identifier[ShadowContextThemeWrapper] identifier[shadowContextThemeWrapper] operator[=] identifier[Shadow] operator[SEP] identifier[extract] operator[SEP] identifier[component] operator[SEP] operator[SEP] Keyword[int] identifier[theme] operator[=] identifier[shadowContextThemeWrapper] operator[SEP] identifier[callGetThemeResId] operator[SEP] operator[SEP] operator[SEP] identifier[attached] operator[=] literal[boolean] operator[SEP] identifier[component] operator[=] identifier[recreatedActivity] operator[SEP] identifier[_component_] operator[=] identifier[_recreatedActivity_] operator[SEP] identifier[attach] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[theme] operator[!=] Other[0] operator[SEP] {
identifier[recreatedActivity] operator[SEP] identifier[setTheme] operator[SEP] identifier[theme] operator[SEP] operator[SEP]
}
identifier[_recreatedActivity_] operator[SEP] identifier[setLastNonConfigurationInstances] operator[SEP] identifier[nonConfigInstance] operator[SEP] operator[SEP] identifier[ShadowActivity] identifier[shadowActivity] operator[=] identifier[Shadow] operator[SEP] identifier[extract] operator[SEP] identifier[recreatedActivity] operator[SEP] operator[SEP] identifier[shadowActivity] operator[SEP] identifier[setLastNonConfigurationInstance] operator[SEP] identifier[activityConfigInstance] operator[SEP] operator[SEP] identifier[_recreatedActivity_] operator[SEP] identifier[performCreate] operator[SEP] identifier[outState] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[RuntimeEnvironment] operator[SEP] identifier[getApiLevel] operator[SEP] operator[SEP] operator[<=] identifier[O_MR1] operator[SEP] {
identifier[_recreatedActivity_] operator[SEP] identifier[performStart] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[_recreatedActivity_] operator[SEP] identifier[performStart] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[_recreatedActivity_] operator[SEP] identifier[performRestoreInstanceState] operator[SEP] identifier[outState] operator[SEP] operator[SEP] identifier[_recreatedActivity_] operator[SEP] identifier[onPostCreate] operator[SEP] identifier[outState] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[RuntimeEnvironment] operator[SEP] identifier[getApiLevel] operator[SEP] operator[SEP] operator[<=] identifier[O_MR1] operator[SEP] {
identifier[_recreatedActivity_] operator[SEP] identifier[performResume] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[_recreatedActivity_] operator[SEP] identifier[performResume] operator[SEP] literal[boolean] , literal[String] operator[SEP] operator[SEP]
}
identifier[_recreatedActivity_] operator[SEP] identifier[onPostResume] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public void close() throws java.sql.SQLException {
if (!this.conn.isClosed()) {
ConnectionImpl outer = this.outer;
this.conn.close();
this.outer = null;
CONNECTION_HOLDER.set(outer);
}
} | class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
if[THIS[member[None.conn]call[None.isClosed, parameter[]]]] begin[{]
local_variable[type[ConnectionImpl], outer]
THIS[member[None.conn]call[None.close, parameter[]]]
assign[THIS[member[None.outer]], literal[null]]
call[CONNECTION_HOLDER.set, parameter[member[.outer]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] Keyword[throws] identifier[java] operator[SEP] identifier[sql] operator[SEP] identifier[SQLException] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[conn] operator[SEP] identifier[isClosed] operator[SEP] operator[SEP] operator[SEP] {
identifier[ConnectionImpl] identifier[outer] operator[=] Keyword[this] operator[SEP] identifier[outer] operator[SEP] Keyword[this] operator[SEP] identifier[conn] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[outer] operator[=] Other[null] operator[SEP] identifier[CONNECTION_HOLDER] operator[SEP] identifier[set] operator[SEP] identifier[outer] operator[SEP] operator[SEP]
}
}
|
public void addUniqueField(FieldSet uniqueFieldSet) {
if (this.uniqueFields == null) {
this.uniqueFields = new HashSet<FieldSet>();
}
this.uniqueFields.add(uniqueFieldSet);
} | class class_name[name] begin[{]
method[addUniqueField, return_type[void], modifier[public], parameter[uniqueFieldSet]] begin[{]
if[binary_operation[THIS[member[None.uniqueFields]], ==, literal[null]]] begin[{]
assign[THIS[member[None.uniqueFields]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=FieldSet, sub_type=None))], dimensions=None, name=HashSet, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.uniqueFields]call[None.add, parameter[member[.uniqueFieldSet]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addUniqueField] operator[SEP] identifier[FieldSet] identifier[uniqueFieldSet] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[uniqueFields] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[uniqueFields] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[FieldSet] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[uniqueFields] operator[SEP] identifier[add] operator[SEP] identifier[uniqueFieldSet] operator[SEP] operator[SEP]
}
|
public static String getChannelName(String eventName) {
return eventName == null ? null : EVENT_PREFIX + eventName.split("\\.", 2)[0];
} | class class_name[name] begin[{]
method[getChannelName, return_type[type[String]], modifier[public static], parameter[eventName]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=eventName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=BinaryOperation(operandl=MemberReference(member=EVENT_PREFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\."), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=split, postfix_operators=[], prefix_operators=[], qualifier=eventName, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], type_arguments=None), operator=+), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getChannelName] operator[SEP] identifier[String] identifier[eventName] operator[SEP] {
Keyword[return] identifier[eventName] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[EVENT_PREFIX] operator[+] identifier[eventName] operator[SEP] identifier[split] operator[SEP] literal[String] , Other[2] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.