code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public final int getInt (int index) {
int bytes = 0;
if (order == ByteOrder.BIG_ENDIAN) {
for (int i = 0; i < 4; i++) {
bytes = bytes << 8;
bytes = bytes | (byteArray.get(index + i) & 0xFF);
}
} else {
for (int i = 3; i >= 0; i--) {
bytes = bytes << 8;
bytes = bytes | (byteArray.get(index + i) & 0xFF);
}
}
return bytes;
} | class class_name[name] begin[{]
method[getInt, return_type[type[int]], modifier[final public], parameter[index]] begin[{]
local_variable[type[int], bytes]
if[binary_operation[member[.order], ==, member[ByteOrder.BIG_ENDIAN]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=<<)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=get, postfix_operators=[], prefix_operators=[], qualifier=byteArray, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), operator=|)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=<<)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=get, postfix_operators=[], prefix_operators=[], qualifier=byteArray, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), operator=|)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
return[member[.bytes]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[int] identifier[getInt] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[int] identifier[bytes] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[order] operator[==] identifier[ByteOrder] operator[SEP] identifier[BIG_ENDIAN] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Other[4] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[bytes] operator[=] identifier[bytes] operator[<<] Other[8] operator[SEP] identifier[bytes] operator[=] identifier[bytes] operator[|] operator[SEP] identifier[byteArray] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[+] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[3] operator[SEP] identifier[i] operator[>=] Other[0] operator[SEP] identifier[i] operator[--] operator[SEP] {
identifier[bytes] operator[=] identifier[bytes] operator[<<] Other[8] operator[SEP] identifier[bytes] operator[=] identifier[bytes] operator[|] operator[SEP] identifier[byteArray] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[+] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[bytes] operator[SEP]
}
|
@SuppressWarnings("unchecked")
private void createErrorFile(Watcher watcher, WatchingException e) {
mojo.getLog().debug("Creating error file for '" + e.getMessage() + "' happening at " + e.getLine() + ":" + e
.getCharacter() + " of " + e.getFile() + ", created by watcher : " + watcher);
JSONObject obj = new JSONObject();
obj.put("message", e.getMessage());
if (watcher instanceof WatcherDelegate) {
obj.put("watcher", ((WatcherDelegate) watcher).getDelegate().getClass().getName());
} else {
obj.put("watcher", watcher.getClass().getName());
}
if (e.getFile() != null) {
obj.put("file", e.getFile().getAbsolutePath());
}
if (e.getLine() != -1) {
obj.put("line", e.getLine());
}
if (e.getCharacter() != -1) {
obj.put("character", e.getCharacter());
}
if (e.getCause() != null) {
obj.put("cause", e.getCause().getMessage());
}
if (e.getTitle() != null) {
obj.put("title", e.getTitle());
}
try {
FileUtils.writeStringToFile(getErrorFileForWatcher(watcher), obj.toJSONString(), false);
} catch (IOException e1) {
mojo.getLog().error("Cannot write the error file", e1);
}
} | class class_name[name] begin[{]
method[createErrorFile, return_type[void], modifier[private], parameter[watcher, e]] begin[{]
call[mojo.getLog, parameter[]]
local_variable[type[JSONObject], obj]
call[obj.put, parameter[literal["message"], call[e.getMessage, parameter[]]]]
if[binary_operation[member[.watcher], instanceof, type[WatcherDelegate]]] begin[{]
call[obj.put, parameter[literal["watcher"], Cast(expression=MemberReference(member=watcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=WatcherDelegate, sub_type=None))]]
else begin[{]
call[obj.put, parameter[literal["watcher"], call[watcher.getClass, parameter[]]]]
end[}]
if[binary_operation[call[e.getFile, parameter[]], !=, literal[null]]] begin[{]
call[obj.put, parameter[literal["file"], call[e.getFile, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[e.getLine, parameter[]], !=, literal[1]]] begin[{]
call[obj.put, parameter[literal["line"], call[e.getLine, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[e.getCharacter, parameter[]], !=, literal[1]]] begin[{]
call[obj.put, parameter[literal["character"], call[e.getCharacter, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[e.getCause, parameter[]], !=, literal[null]]] begin[{]
call[obj.put, parameter[literal["cause"], call[e.getCause, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[e.getTitle, parameter[]], !=, literal[null]]] begin[{]
call[obj.put, parameter[literal["title"], call[e.getTitle, parameter[]]]]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=watcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getErrorFileForWatcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=toJSONString, postfix_operators=[], prefix_operators=[], qualifier=obj, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=writeStringToFile, postfix_operators=[], prefix_operators=[], qualifier=FileUtils, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLog, postfix_operators=[], prefix_operators=[], qualifier=mojo, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot write the error file"), MemberReference(member=e1, 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)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] Keyword[void] identifier[createErrorFile] operator[SEP] identifier[Watcher] identifier[watcher] , identifier[WatchingException] identifier[e] operator[SEP] {
identifier[mojo] operator[SEP] identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getLine] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getCharacter] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[watcher] operator[SEP] operator[SEP] identifier[JSONObject] identifier[obj] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[watcher] Keyword[instanceof] identifier[WatcherDelegate] operator[SEP] {
identifier[obj] operator[SEP] identifier[put] operator[SEP] literal[String] , operator[SEP] operator[SEP] identifier[WatcherDelegate] operator[SEP] identifier[watcher] operator[SEP] operator[SEP] identifier[getDelegate] operator[SEP] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[obj] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[watcher] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[obj] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getLine] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[obj] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getLine] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getCharacter] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[obj] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getCharacter] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[obj] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[obj] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[FileUtils] operator[SEP] identifier[writeStringToFile] operator[SEP] identifier[getErrorFileForWatcher] operator[SEP] identifier[watcher] operator[SEP] , identifier[obj] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e1] operator[SEP] {
identifier[mojo] operator[SEP] identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e1] operator[SEP] operator[SEP]
}
}
|
private boolean getActivityImplicity(final ACTIVITY activity) {
if (this.activity == ACTIVITY.ALL) {
return true;
}
if ((activity == ACTIVITY.SUBSCRIBE) && (this.activity == ACTIVITY.PUBLISH)) {
return false;
} else if ((activity == ACTIVITY.PUBLISH) && (this.activity == ACTIVITY.SUBSCRIBE)) {
return false;
} else if (activity == ACTIVITY.ALL && this.getActivity() != ACTIVITY.ALL) {
return false;
}
return true;
} | class class_name[name] begin[{]
method[getActivityImplicity, return_type[type[boolean]], modifier[private], parameter[activity]] begin[{]
if[binary_operation[THIS[member[None.activity]], ==, member[ACTIVITY.ALL]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.activity], ==, member[ACTIVITY.SUBSCRIBE]], &&, binary_operation[THIS[member[None.activity]], ==, member[ACTIVITY.PUBLISH]]]] begin[{]
return[literal[false]]
else begin[{]
if[binary_operation[binary_operation[member[.activity], ==, member[ACTIVITY.PUBLISH]], &&, binary_operation[THIS[member[None.activity]], ==, member[ACTIVITY.SUBSCRIBE]]]] begin[{]
return[literal[false]]
else begin[{]
if[binary_operation[binary_operation[member[.activity], ==, member[ACTIVITY.ALL]], &&, binary_operation[THIS[call[None.getActivity, parameter[]]], !=, member[ACTIVITY.ALL]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
end[}]
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[getActivityImplicity] operator[SEP] Keyword[final] identifier[ACTIVITY] identifier[activity] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[activity] operator[==] identifier[ACTIVITY] operator[SEP] identifier[ALL] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[activity] operator[==] identifier[ACTIVITY] operator[SEP] identifier[SUBSCRIBE] operator[SEP] operator[&&] operator[SEP] Keyword[this] operator[SEP] identifier[activity] operator[==] identifier[ACTIVITY] operator[SEP] identifier[PUBLISH] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] identifier[activity] operator[==] identifier[ACTIVITY] operator[SEP] identifier[PUBLISH] operator[SEP] operator[&&] operator[SEP] Keyword[this] operator[SEP] identifier[activity] operator[==] identifier[ACTIVITY] operator[SEP] identifier[SUBSCRIBE] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[activity] operator[==] identifier[ACTIVITY] operator[SEP] identifier[ALL] operator[&&] Keyword[this] operator[SEP] identifier[getActivity] operator[SEP] operator[SEP] operator[!=] identifier[ACTIVITY] operator[SEP] identifier[ALL] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public void initialize(Subject subject, CallbackHandler callbackHandlerFromLoginContextEntry, Map<String, ?> sharedState, Map<String, ?> options) {
CallbackHandler callbackHandlerFromDD = null;
CallbackHandler callbackHandler = null;
Boolean ignoreCallbackFromDD = false;
//get option to determine whether to look for callback handler in the DD
if (options != null) {
ignoreCallbackFromDD = (Boolean) options.get(JAASClientConfigurationImpl.WAS_IGNORE_CLIENT_CONTAINER_DD);
}
if (ignoreCallbackFromDD != null && ignoreCallbackFromDD) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "CallbackHandler passed from LoginContext constructor is used because ignore option is set on the login module.");
}
callbackHandler = callbackHandlerFromLoginContextEntry;
}
else {
CallbackHandlerProvider cbhProvider = JAASClientService.getCallbackHandlerProvider();
if (cbhProvider != null) {
callbackHandlerFromDD = cbhProvider.getCallbackHandler();
}
if (callbackHandlerFromDD != null) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Client Container Deployment Descriptor's CallbackHandler is used: " + callbackHandlerFromDD);
}
callbackHandler = callbackHandlerFromDD;
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc,
"CallbackHandler passed from LoginContext constructor is used because no CallbackHanlder was specified in the Client Container Deployment Descriptor.");
}
callbackHandler = callbackHandlerFromLoginContextEntry;
}
}
super.initialize(subject, callbackHandler, sharedState, options);
} | class class_name[name] begin[{]
method[initialize, return_type[void], modifier[public], parameter[subject, callbackHandlerFromLoginContextEntry, sharedState, options]] begin[{]
local_variable[type[CallbackHandler], callbackHandlerFromDD]
local_variable[type[CallbackHandler], callbackHandler]
local_variable[type[Boolean], ignoreCallbackFromDD]
if[binary_operation[member[.options], !=, literal[null]]] begin[{]
assign[member[.ignoreCallbackFromDD], Cast(expression=MethodInvocation(arguments=[MemberReference(member=WAS_IGNORE_CLIENT_CONTAINER_DD, postfix_operators=[], prefix_operators=[], qualifier=JAASClientConfigurationImpl, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=options, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.ignoreCallbackFromDD], !=, literal[null]], &&, member[.ignoreCallbackFromDD]]] begin[{]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["CallbackHandler passed from LoginContext constructor is used because ignore option is set on the login module."]]]
else begin[{]
None
end[}]
assign[member[.callbackHandler], member[.callbackHandlerFromLoginContextEntry]]
else begin[{]
local_variable[type[CallbackHandlerProvider], cbhProvider]
if[binary_operation[member[.cbhProvider], !=, literal[null]]] begin[{]
assign[member[.callbackHandlerFromDD], call[cbhProvider.getCallbackHandler, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[member[.callbackHandlerFromDD], !=, literal[null]]] begin[{]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[literal["Client Container Deployment Descriptor's CallbackHandler is used: "], +, member[.callbackHandlerFromDD]]]]
else begin[{]
None
end[}]
assign[member[.callbackHandler], member[.callbackHandlerFromDD]]
else begin[{]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["CallbackHandler passed from LoginContext constructor is used because no CallbackHanlder was specified in the Client Container Deployment Descriptor."]]]
else begin[{]
None
end[}]
assign[member[.callbackHandler], member[.callbackHandlerFromLoginContextEntry]]
end[}]
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=subject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=callbackHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sharedState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initialize, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[initialize] operator[SEP] identifier[Subject] identifier[subject] , identifier[CallbackHandler] identifier[callbackHandlerFromLoginContextEntry] , identifier[Map] operator[<] identifier[String] , operator[?] operator[>] identifier[sharedState] , identifier[Map] operator[<] identifier[String] , operator[?] operator[>] identifier[options] operator[SEP] {
identifier[CallbackHandler] identifier[callbackHandlerFromDD] operator[=] Other[null] operator[SEP] identifier[CallbackHandler] identifier[callbackHandler] operator[=] Other[null] operator[SEP] identifier[Boolean] identifier[ignoreCallbackFromDD] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[options] operator[!=] Other[null] operator[SEP] {
identifier[ignoreCallbackFromDD] operator[=] operator[SEP] identifier[Boolean] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[JAASClientConfigurationImpl] operator[SEP] identifier[WAS_IGNORE_CLIENT_CONTAINER_DD] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ignoreCallbackFromDD] operator[!=] Other[null] operator[&&] identifier[ignoreCallbackFromDD] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
identifier[callbackHandler] operator[=] identifier[callbackHandlerFromLoginContextEntry] operator[SEP]
}
Keyword[else] {
identifier[CallbackHandlerProvider] identifier[cbhProvider] operator[=] identifier[JAASClientService] operator[SEP] identifier[getCallbackHandlerProvider] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cbhProvider] operator[!=] Other[null] operator[SEP] {
identifier[callbackHandlerFromDD] operator[=] identifier[cbhProvider] operator[SEP] identifier[getCallbackHandler] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[callbackHandlerFromDD] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[callbackHandlerFromDD] operator[SEP] operator[SEP]
}
identifier[callbackHandler] operator[=] identifier[callbackHandlerFromDD] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
identifier[callbackHandler] operator[=] identifier[callbackHandlerFromLoginContextEntry] operator[SEP]
}
}
Keyword[super] operator[SEP] identifier[initialize] operator[SEP] identifier[subject] , identifier[callbackHandler] , identifier[sharedState] , identifier[options] operator[SEP] operator[SEP]
}
|
private String readSqlFromResource(Resource resource)
{
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
new FileInputStream(
resource.
getFile()), "UTF-8"));)
{
StringBuilder sqlBuf = new StringBuilder();
for (String line = reader.readLine(); line != null; line
= reader.readLine())
{
sqlBuf.append(line).append("\n");
}
return sqlBuf.toString();
}
catch (IOException e)
{
log.error("Couldn't read SQL script from resource file.", e);
throw new FileAccessException(
"Couldn't read SQL script from resource file.", e);
}
} | class class_name[name] begin[{]
method[readSqlFromResource, return_type[type[String]], modifier[private], parameter[resource]] 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=StringBuilder, sub_type=None)), name=sqlBuf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sqlBuf, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None))]), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=sqlBuf, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Couldn't read SQL script from resource file."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Couldn't read SQL script from resource file."), 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=FileAccessException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=reader, type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None), value=ClassCreator(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getFile, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)))])
end[}]
END[}] | Keyword[private] identifier[String] identifier[readSqlFromResource] operator[SEP] identifier[Resource] identifier[resource] operator[SEP] {
Keyword[try] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[resource] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[sqlBuf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[line] operator[=] identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] identifier[line] operator[!=] Other[null] operator[SEP] identifier[line] operator[=] identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] {
identifier[sqlBuf] operator[SEP] identifier[append] operator[SEP] identifier[line] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sqlBuf] operator[SEP] identifier[toString] 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[throw] Keyword[new] identifier[FileAccessException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
protected void clearText(PageElement pageElement, CharSequence keysToSend, Object... args) throws TechnicalException, FailureException {
try {
final WebElement element = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(pageElement, args)));
element.clear();
if (keysToSend != null) {
element.sendKeys(keysToSend);
}
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_ERROR_CLEAR_ON_INPUT), pageElement, pageElement.getPage().getApplication()), true,
pageElement.getPage().getCallBack());
}
} | class class_name[name] begin[{]
method[clearText, return_type[void], modifier[protected], parameter[pageElement, keysToSend, args]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=pageElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLocator, postfix_operators=[], prefix_operators=[], qualifier=Utilities, selectors=[], type_arguments=None)], member=presenceOfElementLocated, postfix_operators=[], prefix_operators=[], qualifier=ExpectedConditions, selectors=[], type_arguments=None)], member=waitUntil, postfix_operators=[], prefix_operators=[], qualifier=Context, selectors=[], type_arguments=None), name=element)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=WebElement, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=element, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=keysToSend, 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=keysToSend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendKeys, postfix_operators=[], prefix_operators=[], qualifier=element, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=FAIL_MESSAGE_ERROR_CLEAR_ON_INPUT, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[])], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[], type_arguments=None), MemberReference(member=pageElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getPage, postfix_operators=[], prefix_operators=[], qualifier=pageElement, selectors=[MethodInvocation(arguments=[], member=getApplication, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MethodInvocation(arguments=[], member=getPage, postfix_operators=[], prefix_operators=[], qualifier=pageElement, selectors=[MethodInvocation(arguments=[], member=getCallBack, 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=Result, sub_type=ReferenceType(arguments=[], dimensions=None, name=Failure, 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[protected] Keyword[void] identifier[clearText] operator[SEP] identifier[PageElement] identifier[pageElement] , identifier[CharSequence] identifier[keysToSend] , identifier[Object] operator[...] identifier[args] operator[SEP] Keyword[throws] identifier[TechnicalException] , identifier[FailureException] {
Keyword[try] {
Keyword[final] identifier[WebElement] identifier[element] operator[=] identifier[Context] operator[SEP] identifier[waitUntil] operator[SEP] identifier[ExpectedConditions] operator[SEP] identifier[presenceOfElementLocated] operator[SEP] identifier[Utilities] operator[SEP] identifier[getLocator] operator[SEP] identifier[pageElement] , identifier[args] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[element] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[keysToSend] operator[!=] Other[null] operator[SEP] {
identifier[element] operator[SEP] identifier[sendKeys] operator[SEP] identifier[keysToSend] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[e] operator[SEP] {
Keyword[new] identifier[Result] operator[SEP] identifier[Failure] operator[<] operator[>] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[Messages] operator[SEP] identifier[format] operator[SEP] identifier[Messages] operator[SEP] identifier[getMessage] operator[SEP] identifier[Messages] operator[SEP] identifier[FAIL_MESSAGE_ERROR_CLEAR_ON_INPUT] operator[SEP] , identifier[pageElement] , identifier[pageElement] operator[SEP] identifier[getPage] operator[SEP] operator[SEP] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[SEP] , literal[boolean] , identifier[pageElement] operator[SEP] identifier[getPage] operator[SEP] operator[SEP] operator[SEP] identifier[getCallBack] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public MultipartContent setContentParts(Collection<? extends HttpContent> contentParts) {
this.parts = new ArrayList<Part>(contentParts.size());
for (HttpContent contentPart : contentParts) {
addPart(new Part(contentPart));
}
return this;
} | class class_name[name] begin[{]
method[setContentParts, return_type[type[MultipartContent]], modifier[public], parameter[contentParts]] begin[{]
assign[THIS[member[None.parts]], ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=contentParts, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Part, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=contentPart, 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=Part, sub_type=None))], member=addPart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=contentParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=contentPart)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HttpContent, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[MultipartContent] identifier[setContentParts] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[HttpContent] operator[>] identifier[contentParts] operator[SEP] {
Keyword[this] operator[SEP] identifier[parts] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Part] operator[>] operator[SEP] identifier[contentParts] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[HttpContent] identifier[contentPart] operator[:] identifier[contentParts] operator[SEP] {
identifier[addPart] operator[SEP] Keyword[new] identifier[Part] operator[SEP] identifier[contentPart] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public String tabMaker(int n) {
StringBuilder buf = new StringBuilder("");
for (int i = 1; i <= n; i++) {
buf.append(" ");
}
String tab = buf.toString();
return tab;
} | class class_name[name] begin[{]
method[tabMaker, return_type[type[String]], modifier[public], parameter[n]] begin[{]
local_variable[type[StringBuilder], buf]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[String], tab]
return[member[.tab]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[tabMaker] operator[SEP] Keyword[int] identifier[n] operator[SEP] {
identifier[StringBuilder] identifier[buf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<=] identifier[n] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[tab] operator[=] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[tab] operator[SEP]
}
|
public final EObject ruleCharacterRange() throws RecognitionException {
EObject current = null;
Token otherlv_2=null;
EObject this_Keyword_0 = null;
EObject lv_right_3_0 = null;
enterRule();
try {
// InternalXtext.g:3480:2: ( (this_Keyword_0= ruleKeyword ( () otherlv_2= '..' ( (lv_right_3_0= ruleKeyword ) ) )? ) )
// InternalXtext.g:3481:2: (this_Keyword_0= ruleKeyword ( () otherlv_2= '..' ( (lv_right_3_0= ruleKeyword ) ) )? )
{
// InternalXtext.g:3481:2: (this_Keyword_0= ruleKeyword ( () otherlv_2= '..' ( (lv_right_3_0= ruleKeyword ) ) )? )
// InternalXtext.g:3482:3: this_Keyword_0= ruleKeyword ( () otherlv_2= '..' ( (lv_right_3_0= ruleKeyword ) ) )?
{
newCompositeNode(grammarAccess.getCharacterRangeAccess().getKeywordParserRuleCall_0());
pushFollow(FollowSets000.FOLLOW_49);
this_Keyword_0=ruleKeyword();
state._fsp--;
current = this_Keyword_0;
afterParserOrEnumRuleCall();
// InternalXtext.g:3490:3: ( () otherlv_2= '..' ( (lv_right_3_0= ruleKeyword ) ) )?
int alt73=2;
int LA73_0 = input.LA(1);
if ( (LA73_0==49) ) {
alt73=1;
}
switch (alt73) {
case 1 :
// InternalXtext.g:3491:4: () otherlv_2= '..' ( (lv_right_3_0= ruleKeyword ) )
{
// InternalXtext.g:3491:4: ()
// InternalXtext.g:3492:5:
{
current = forceCreateModelElementAndSet(
grammarAccess.getCharacterRangeAccess().getCharacterRangeLeftAction_1_0(),
current);
}
otherlv_2=(Token)match(input,49,FollowSets000.FOLLOW_11);
newLeafNode(otherlv_2, grammarAccess.getCharacterRangeAccess().getFullStopFullStopKeyword_1_1());
// InternalXtext.g:3502:4: ( (lv_right_3_0= ruleKeyword ) )
// InternalXtext.g:3503:5: (lv_right_3_0= ruleKeyword )
{
// InternalXtext.g:3503:5: (lv_right_3_0= ruleKeyword )
// InternalXtext.g:3504:6: lv_right_3_0= ruleKeyword
{
newCompositeNode(grammarAccess.getCharacterRangeAccess().getRightKeywordParserRuleCall_1_2_0());
pushFollow(FollowSets000.FOLLOW_2);
lv_right_3_0=ruleKeyword();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getCharacterRangeRule());
}
set(
current,
"right",
lv_right_3_0,
"org.eclipse.xtext.Xtext.Keyword");
afterParserOrEnumRuleCall();
}
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} | class class_name[name] begin[{]
method[ruleCharacterRange, return_type[type[EObject]], modifier[final public], parameter[]] begin[{]
local_variable[type[EObject], current]
local_variable[type[Token], otherlv_2]
local_variable[type[EObject], this_Keyword_0]
local_variable[type[EObject], lv_right_3_0]
call[.enterRule, parameter[]]
TryStatement(block=[BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCharacterRangeAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getKeywordParserRuleCall_0, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=newCompositeNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_49, postfix_operators=[], prefix_operators=[], qualifier=FollowSets000, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=this_Keyword_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=ruleKeyword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=this_Keyword_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=afterParserOrEnumRuleCall, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), name=alt73)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA73_0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=LA73_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=49), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt73, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)])), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCharacterRangeAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getCharacterRangeLeftAction_1_0, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forceCreateModelElementAndSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), StatementExpression(expression=Assignment(expressionl=MemberReference(member=otherlv_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=49), MemberReference(member=FOLLOW_11, postfix_operators=[], prefix_operators=[], qualifier=FollowSets000, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Token, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=otherlv_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getCharacterRangeAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getFullStopFullStopKeyword_1_1, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=newLeafNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCharacterRangeAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getRightKeywordParserRuleCall_1_2_0, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=newCompositeNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_2, postfix_operators=[], prefix_operators=[], qualifier=FollowSets000, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lv_right_3_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=ruleKeyword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCharacterRangeRule, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[], type_arguments=None)], member=createModelElementForParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="right"), MemberReference(member=lv_right_3_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="org.eclipse.xtext.Xtext.Keyword")], member=set, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=afterParserOrEnumRuleCall, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])])]), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=alt73, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])]), StatementExpression(expression=MethodInvocation(arguments=[], member=leaveRule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=appendSkippedTokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[], label=None, resources=None)
return[member[.current]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[EObject] identifier[ruleCharacterRange] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
identifier[EObject] identifier[current] operator[=] Other[null] operator[SEP] identifier[Token] identifier[otherlv_2] operator[=] Other[null] operator[SEP] identifier[EObject] identifier[this_Keyword_0] operator[=] Other[null] operator[SEP] identifier[EObject] identifier[lv_right_3_0] operator[=] Other[null] operator[SEP] identifier[enterRule] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
{
{
identifier[newCompositeNode] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getCharacterRangeAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getKeywordParserRuleCall_0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pushFollow] operator[SEP] identifier[FollowSets000] operator[SEP] identifier[FOLLOW_49] operator[SEP] operator[SEP] identifier[this_Keyword_0] operator[=] identifier[ruleKeyword] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] identifier[current] operator[=] identifier[this_Keyword_0] operator[SEP] identifier[afterParserOrEnumRuleCall] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[alt73] operator[=] Other[2] operator[SEP] Keyword[int] identifier[LA73_0] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[LA73_0] operator[==] Other[49] operator[SEP] operator[SEP] {
identifier[alt73] operator[=] Other[1] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[alt73] operator[SEP] {
Keyword[case] Other[1] operator[:] {
{
identifier[current] operator[=] identifier[forceCreateModelElementAndSet] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getCharacterRangeAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getCharacterRangeLeftAction_1_0] operator[SEP] operator[SEP] , identifier[current] operator[SEP] operator[SEP]
}
identifier[otherlv_2] operator[=] operator[SEP] identifier[Token] operator[SEP] identifier[match] operator[SEP] identifier[input] , Other[49] , identifier[FollowSets000] operator[SEP] identifier[FOLLOW_11] operator[SEP] operator[SEP] identifier[newLeafNode] operator[SEP] identifier[otherlv_2] , identifier[grammarAccess] operator[SEP] identifier[getCharacterRangeAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getFullStopFullStopKeyword_1_1] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
{
identifier[newCompositeNode] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getCharacterRangeAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getRightKeywordParserRuleCall_1_2_0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pushFollow] operator[SEP] identifier[FollowSets000] operator[SEP] identifier[FOLLOW_2] operator[SEP] operator[SEP] identifier[lv_right_3_0] operator[=] identifier[ruleKeyword] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[current] operator[==] Other[null] operator[SEP] {
identifier[current] operator[=] identifier[createModelElementForParent] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getCharacterRangeRule] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[set] operator[SEP] identifier[current] , literal[String] , identifier[lv_right_3_0] , literal[String] operator[SEP] operator[SEP] identifier[afterParserOrEnumRuleCall] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[break] operator[SEP]
}
}
}
identifier[leaveRule] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP] identifier[appendSkippedTokens] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
}
Keyword[return] identifier[current] operator[SEP]
}
|
public static int lineEnd(ByteBuffer buffer, int maxLength) {
int primitivePosition = buffer.position();
boolean canEnd = false;
int charIndex = primitivePosition;
byte b;
while (buffer.hasRemaining()) {
b = buffer.get();
charIndex++;
if (b == StrUtil.C_CR) {
canEnd = true;
} else if (b == StrUtil.C_LF) {
return canEnd ? charIndex - 2 : charIndex - 1;
} else {
// 只有\r无法确认换行
canEnd = false;
}
if (charIndex - primitivePosition > maxLength) {
// 查找到尽头,未找到,还原位置
buffer.position(primitivePosition);
throw new IndexOutOfBoundsException(StrUtil.format("Position is out of maxLength: {}", maxLength));
}
}
// 查找到buffer尽头,未找到,还原位置
buffer.position(primitivePosition);
// 读到结束位置
return -1;
} | class class_name[name] begin[{]
method[lineEnd, return_type[type[int]], modifier[public static], parameter[buffer, maxLength]] begin[{]
local_variable[type[int], primitivePosition]
local_variable[type[boolean], canEnd]
local_variable[type[int], charIndex]
local_variable[type[byte], b]
while[call[buffer.hasRemaining, parameter[]]] begin[{]
assign[member[.b], call[buffer.get, parameter[]]]
member[.charIndex]
if[binary_operation[member[.b], ==, member[StrUtil.C_CR]]] begin[{]
assign[member[.canEnd], literal[true]]
else begin[{]
if[binary_operation[member[.b], ==, member[StrUtil.C_LF]]] begin[{]
return[TernaryExpression(condition=MemberReference(member=canEnd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=BinaryOperation(operandl=MemberReference(member=charIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), if_true=BinaryOperation(operandl=MemberReference(member=charIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-))]
else begin[{]
assign[member[.canEnd], literal[false]]
end[}]
end[}]
if[binary_operation[binary_operation[member[.charIndex], -, member[.primitivePosition]], >, member[.maxLength]]] begin[{]
call[buffer.position, parameter[member[.primitivePosition]]]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Position is out of maxLength: {}"), MemberReference(member=maxLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=StrUtil, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
call[buffer.position, parameter[member[.primitivePosition]]]
return[literal[1]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[lineEnd] operator[SEP] identifier[ByteBuffer] identifier[buffer] , Keyword[int] identifier[maxLength] operator[SEP] {
Keyword[int] identifier[primitivePosition] operator[=] identifier[buffer] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[canEnd] operator[=] literal[boolean] operator[SEP] Keyword[int] identifier[charIndex] operator[=] identifier[primitivePosition] operator[SEP] Keyword[byte] identifier[b] operator[SEP] Keyword[while] operator[SEP] identifier[buffer] operator[SEP] identifier[hasRemaining] operator[SEP] operator[SEP] operator[SEP] {
identifier[b] operator[=] identifier[buffer] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[charIndex] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[b] operator[==] identifier[StrUtil] operator[SEP] identifier[C_CR] operator[SEP] {
identifier[canEnd] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[b] operator[==] identifier[StrUtil] operator[SEP] identifier[C_LF] operator[SEP] {
Keyword[return] identifier[canEnd] operator[?] identifier[charIndex] operator[-] Other[2] operator[:] identifier[charIndex] operator[-] Other[1] operator[SEP]
}
Keyword[else] {
identifier[canEnd] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[charIndex] operator[-] identifier[primitivePosition] operator[>] identifier[maxLength] operator[SEP] {
identifier[buffer] operator[SEP] identifier[position] operator[SEP] identifier[primitivePosition] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] identifier[StrUtil] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[maxLength] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[buffer] operator[SEP] identifier[position] operator[SEP] identifier[primitivePosition] operator[SEP] operator[SEP] Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public synchronized void setInitializationMethod(String newMethodName)
{
Method newMethod = null;
if (newMethodName != null)
{
initializationMethodName = newMethodName;
try
{
// see if we have a publicly accessible method by the name
newMethod = getClassOfObject().getMethod(newMethodName, NO_PARAMS);
}
catch (NoSuchMethodException e)
{
try
{
// no publicly accessible method, see if there is a private/protected one
newMethod = getClassOfObject().getDeclaredMethod(newMethodName, NO_PARAMS);
}
catch (NoSuchMethodException e2)
{
// there is no such method available
throw new MetadataException(
"Invalid initialization method, there is not"
+ " a zero argument method named "
+ newMethodName
+ " on class "
+ getClassOfObject().getName()
+ ".");
}
}
}
setInitializationMethod(newMethod);
} | class class_name[name] begin[{]
method[setInitializationMethod, return_type[void], modifier[synchronized public], parameter[newMethodName]] begin[{]
local_variable[type[Method], newMethod]
if[binary_operation[member[.newMethodName], !=, literal[null]]] begin[{]
assign[member[.initializationMethodName], member[.newMethodName]]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getClassOfObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=newMethodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NO_PARAMS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getClassOfObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=newMethodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=NO_PARAMS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDeclaredMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid initialization method, there is not"), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" a zero argument method named "), operator=+), operandr=MemberReference(member=newMethodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" on class "), operator=+), operandr=MethodInvocation(arguments=[], member=getClassOfObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MetadataException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e2, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
call[.setInitializationMethod, parameter[member[.newMethod]]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[setInitializationMethod] operator[SEP] identifier[String] identifier[newMethodName] operator[SEP] {
identifier[Method] identifier[newMethod] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[newMethodName] operator[!=] Other[null] operator[SEP] {
identifier[initializationMethodName] operator[=] identifier[newMethodName] operator[SEP] Keyword[try] {
identifier[newMethod] operator[=] identifier[getClassOfObject] operator[SEP] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] identifier[newMethodName] , identifier[NO_PARAMS] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
Keyword[try] {
identifier[newMethod] operator[=] identifier[getClassOfObject] operator[SEP] operator[SEP] operator[SEP] identifier[getDeclaredMethod] operator[SEP] identifier[newMethodName] , identifier[NO_PARAMS] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MetadataException] operator[SEP] literal[String] operator[+] literal[String] operator[+] identifier[newMethodName] operator[+] literal[String] operator[+] identifier[getClassOfObject] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
identifier[setInitializationMethod] operator[SEP] identifier[newMethod] operator[SEP] operator[SEP]
}
|
public XML addGlobal(Class<?> aClass,Global global){
checksGlobalAbsence(aClass);
findXmlClass(aClass).global = Converter.toXmlGlobal(global);
return this;
} | class class_name[name] begin[{]
method[addGlobal, return_type[type[XML]], modifier[public], parameter[aClass, global]] begin[{]
call[.checksGlobalAbsence, parameter[member[.aClass]]]
assign[call[.findXmlClass, parameter[member[.aClass]]], call[Converter.toXmlGlobal, parameter[member[.global]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[XML] identifier[addGlobal] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[aClass] , identifier[Global] identifier[global] operator[SEP] {
identifier[checksGlobalAbsence] operator[SEP] identifier[aClass] operator[SEP] operator[SEP] identifier[findXmlClass] operator[SEP] identifier[aClass] operator[SEP] operator[SEP] identifier[global] operator[=] identifier[Converter] operator[SEP] identifier[toXmlGlobal] operator[SEP] identifier[global] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public Point3i getCellIndices(Tuple3d pt) {
Point3d p = new Point3d(pt);
this.transfToCrystal(p);
int x = (int)Math.floor(p.x);
int y = (int)Math.floor(p.y);
int z = (int)Math.floor(p.z);
return new Point3i(x,y,z);
} | class class_name[name] begin[{]
method[getCellIndices, return_type[type[Point3i]], modifier[public], parameter[pt]] begin[{]
local_variable[type[Point3d], p]
THIS[call[None.transfToCrystal, parameter[member[.p]]]]
local_variable[type[int], x]
local_variable[type[int], y]
local_variable[type[int], z]
return[ClassCreator(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=z, 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=Point3i, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Point3i] identifier[getCellIndices] operator[SEP] identifier[Tuple3d] identifier[pt] operator[SEP] {
identifier[Point3d] identifier[p] operator[=] Keyword[new] identifier[Point3d] operator[SEP] identifier[pt] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[transfToCrystal] operator[SEP] identifier[p] operator[SEP] operator[SEP] Keyword[int] identifier[x] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[floor] operator[SEP] identifier[p] operator[SEP] identifier[x] operator[SEP] operator[SEP] Keyword[int] identifier[y] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[floor] operator[SEP] identifier[p] operator[SEP] identifier[y] operator[SEP] operator[SEP] Keyword[int] identifier[z] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[floor] operator[SEP] identifier[p] operator[SEP] identifier[z] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Point3i] operator[SEP] identifier[x] , identifier[y] , identifier[z] operator[SEP] operator[SEP]
}
|
private void writeEXT(ZipEntry e) throws IOException {
writeInt(EXTSIG); // EXT header signature
writeInt(e.crc); // crc-32
if (e.csize >= ZIP64_MAGICVAL || e.size >= ZIP64_MAGICVAL) {
writeLong(e.csize);
writeLong(e.size);
} else {
writeInt(e.csize); // compressed size
writeInt(e.size); // uncompressed size
}
} | class class_name[name] begin[{]
method[writeEXT, return_type[void], modifier[private], parameter[e]] begin[{]
call[.writeInt, parameter[member[.EXTSIG]]]
call[.writeInt, parameter[member[e.crc]]]
if[binary_operation[binary_operation[member[e.csize], >=, member[.ZIP64_MAGICVAL]], ||, binary_operation[member[e.size], >=, member[.ZIP64_MAGICVAL]]]] begin[{]
call[.writeLong, parameter[member[e.csize]]]
call[.writeLong, parameter[member[e.size]]]
else begin[{]
call[.writeInt, parameter[member[e.csize]]]
call[.writeInt, parameter[member[e.size]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[writeEXT] operator[SEP] identifier[ZipEntry] identifier[e] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[writeInt] operator[SEP] identifier[EXTSIG] operator[SEP] operator[SEP] identifier[writeInt] operator[SEP] identifier[e] operator[SEP] identifier[crc] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[csize] operator[>=] identifier[ZIP64_MAGICVAL] operator[||] identifier[e] operator[SEP] identifier[size] operator[>=] identifier[ZIP64_MAGICVAL] operator[SEP] {
identifier[writeLong] operator[SEP] identifier[e] operator[SEP] identifier[csize] operator[SEP] operator[SEP] identifier[writeLong] operator[SEP] identifier[e] operator[SEP] identifier[size] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[writeInt] operator[SEP] identifier[e] operator[SEP] identifier[csize] operator[SEP] operator[SEP] identifier[writeInt] operator[SEP] identifier[e] operator[SEP] identifier[size] operator[SEP] operator[SEP]
}
}
|
public static @Type
int stringToEdgeType(String s) {
s = s.toUpperCase(Locale.ENGLISH);
if ("FALL_THROUGH".equals(s)) {
return FALL_THROUGH_EDGE;
} else if ("IFCMP".equals(s)) {
return IFCMP_EDGE;
} else if ("SWITCH".equals(s)) {
return SWITCH_EDGE;
} else if ("SWITCH_DEFAULT".equals(s)) {
return SWITCH_DEFAULT_EDGE;
} else if ("JSR".equals(s)) {
return JSR_EDGE;
} else if ("RET".equals(s)) {
return RET_EDGE;
} else if ("GOTO".equals(s)) {
return GOTO_EDGE;
} else if ("RETURN".equals(s)) {
return RETURN_EDGE;
} else if ("UNHANDLED_EXCEPTION".equals(s)) {
return UNHANDLED_EXCEPTION_EDGE;
} else if ("HANDLED_EXCEPTION".equals(s)) {
return HANDLED_EXCEPTION_EDGE;
} else if ("START".equals(s)) {
return START_EDGE;
} else if ("BACKEDGE_TARGET_EDGE".equals(s)) {
return BACKEDGE_TARGET_EDGE;
} else if ("BACKEDGE_SOURCE_EDGE".equals(s)) {
return BACKEDGE_SOURCE_EDGE;
} else if ("EXIT_EDGE".equals(s)) {
return EXIT_EDGE;
} else {
throw new IllegalArgumentException("Unknown edge type: " + s);
}
} | class class_name[name] begin[{]
method[stringToEdgeType, return_type[type[int]], modifier[public static], parameter[s]] begin[{]
assign[member[.s], call[s.toUpperCase, parameter[member[Locale.ENGLISH]]]]
if[literal["FALL_THROUGH"]] begin[{]
return[member[.FALL_THROUGH_EDGE]]
else begin[{]
if[literal["IFCMP"]] begin[{]
return[member[.IFCMP_EDGE]]
else begin[{]
if[literal["SWITCH"]] begin[{]
return[member[.SWITCH_EDGE]]
else begin[{]
if[literal["SWITCH_DEFAULT"]] begin[{]
return[member[.SWITCH_DEFAULT_EDGE]]
else begin[{]
if[literal["JSR"]] begin[{]
return[member[.JSR_EDGE]]
else begin[{]
if[literal["RET"]] begin[{]
return[member[.RET_EDGE]]
else begin[{]
if[literal["GOTO"]] begin[{]
return[member[.GOTO_EDGE]]
else begin[{]
if[literal["RETURN"]] begin[{]
return[member[.RETURN_EDGE]]
else begin[{]
if[literal["UNHANDLED_EXCEPTION"]] begin[{]
return[member[.UNHANDLED_EXCEPTION_EDGE]]
else begin[{]
if[literal["HANDLED_EXCEPTION"]] begin[{]
return[member[.HANDLED_EXCEPTION_EDGE]]
else begin[{]
if[literal["START"]] begin[{]
return[member[.START_EDGE]]
else begin[{]
if[literal["BACKEDGE_TARGET_EDGE"]] begin[{]
return[member[.BACKEDGE_TARGET_EDGE]]
else begin[{]
if[literal["BACKEDGE_SOURCE_EDGE"]] begin[{]
return[member[.BACKEDGE_SOURCE_EDGE]]
else begin[{]
if[literal["EXIT_EDGE"]] begin[{]
return[member[.EXIT_EDGE]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown edge type: "), operandr=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] annotation[@] identifier[Type] Keyword[int] identifier[stringToEdgeType] operator[SEP] identifier[String] identifier[s] operator[SEP] {
identifier[s] operator[=] identifier[s] operator[SEP] identifier[toUpperCase] operator[SEP] identifier[Locale] operator[SEP] identifier[ENGLISH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[FALL_THROUGH_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[IFCMP_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[SWITCH_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[SWITCH_DEFAULT_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[JSR_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[RET_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[GOTO_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[RETURN_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[UNHANDLED_EXCEPTION_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[HANDLED_EXCEPTION_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[START_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[BACKEDGE_TARGET_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[BACKEDGE_SOURCE_EDGE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
Keyword[return] identifier[EXIT_EDGE] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[s] operator[SEP] operator[SEP]
}
}
|
public static <R> Stream<R> of(Iterable<R> iterable) {
return new Stream<R>(iterable.iterator());
} | class class_name[name] begin[{]
method[of, return_type[type[Stream]], modifier[public static], parameter[iterable]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=iterable, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None))], dimensions=None, name=Stream, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[R] operator[>] identifier[Stream] operator[<] identifier[R] operator[>] identifier[of] operator[SEP] identifier[Iterable] operator[<] identifier[R] operator[>] identifier[iterable] operator[SEP] {
Keyword[return] Keyword[new] identifier[Stream] operator[<] identifier[R] operator[>] operator[SEP] identifier[iterable] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void triggeredJobComplete(final OperableTrigger trigger, final JobDetail jobDetail, final Trigger.CompletedExecutionInstruction triggerInstCode) {
try {
doWithLock(new LockCallbackWithoutResult() {
@Override
public Void doWithLock(JedisCommands jedis) throws JobPersistenceException {
try {
storage.triggeredJobComplete(trigger, jobDetail, triggerInstCode, jedis);
} catch (ClassNotFoundException e) {
logger.error("Could not handle job completion.", e);
}
return null;
}
});
} catch (JobPersistenceException e) {
logger.error("Could not handle job completion.", e);
}
} | class class_name[name] begin[{]
method[triggeredJobComplete, return_type[void], modifier[public], parameter[trigger, jobDetail, triggerInstCode]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=trigger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jobDetail, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=triggerInstCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jedis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=triggeredJobComplete, postfix_operators=[], prefix_operators=[], qualifier=storage, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not handle job completion."), 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=['ClassNotFoundException']))], finally_block=None, label=None, resources=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], documentation=None, modifiers={'public'}, name=doWithLock, parameters=[FormalParameter(annotations=[], modifiers=set(), name=jedis, type=ReferenceType(arguments=None, dimensions=[], name=JedisCommands, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None), throws=['JobPersistenceException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LockCallbackWithoutResult, sub_type=None))], member=doWithLock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not handle job completion."), 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=['JobPersistenceException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[triggeredJobComplete] operator[SEP] Keyword[final] identifier[OperableTrigger] identifier[trigger] , Keyword[final] identifier[JobDetail] identifier[jobDetail] , Keyword[final] identifier[Trigger] operator[SEP] identifier[CompletedExecutionInstruction] identifier[triggerInstCode] operator[SEP] {
Keyword[try] {
identifier[doWithLock] operator[SEP] Keyword[new] identifier[LockCallbackWithoutResult] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Void] identifier[doWithLock] operator[SEP] identifier[JedisCommands] identifier[jedis] operator[SEP] Keyword[throws] identifier[JobPersistenceException] {
Keyword[try] {
identifier[storage] operator[SEP] identifier[triggeredJobComplete] operator[SEP] identifier[trigger] , identifier[jobDetail] , identifier[triggerInstCode] , identifier[jedis] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JobPersistenceException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void print(@NonNull PrintStream stream) {
String horizontalBar = StringUtils.repeat("─", longestCell);
String hline = middleCMBar(horizontalBar, longestRow);
longestRow = Math.max(longestRow, header.size());
if (!StringUtils.isNullOrBlank(title)) {
stream.println(
StringUtils.center(title, (longestCell * longestRow) + longestRow + 1)
);
}
stream.printf("┌%s", horizontalBar);
for (int i = 1; i < longestRow; i++) {
stream.printf("┬%s", horizontalBar);
}
stream.println("┐");
if (header.size() > 0) {
printRow(stream, header, longestCell, longestRow);
stream.println(bar(StringUtils.repeat("═", longestCell), "╞", "╡", "╪", header.size()));
}
for (int r = 0; r < content.size(); r++) {
printRow(stream, content.get(r), longestCell, longestRow);
if (r + 1 < content.size()) {
stream.println(hline);
}
}
if (!footer.isEmpty()) {
stream.println(bar(StringUtils.repeat("═",longestCell), "╞", "╡", "╪", header.size()));
for (int r = 0; r < footer.size(); r++) {
printRow(stream, footer.get(r), longestCell, longestRow);
if (r + 1 < footer.size()) {
stream.println(hline);
}
}
}
stream.printf("└%s", horizontalBar);
for (int i = 1; i < longestRow; i++) {
stream.printf("┴%s", horizontalBar);
}
stream.println("┘");
} | class class_name[name] begin[{]
method[print, return_type[void], modifier[public], parameter[stream]] begin[{]
local_variable[type[String], horizontalBar]
local_variable[type[String], hline]
assign[member[.longestRow], call[Math.max, parameter[member[.longestRow], call[header.size, parameter[]]]]]
if[call[StringUtils.isNullOrBlank, parameter[member[.title]]]] begin[{]
call[stream.println, parameter[call[StringUtils.center, parameter[member[.title], binary_operation[binary_operation[binary_operation[member[.longestCell], *, member[.longestRow]], +, member[.longestRow]], +, literal[1]]]]]]
else begin[{]
None
end[}]
call[stream.printf, parameter[literal["┌%s"], member[.horizontalBar]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="┬%s"), MemberReference(member=horizontalBar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printf, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=longestRow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[stream.println, parameter[literal["┐"]]]
if[binary_operation[call[header.size, parameter[]], >, literal[0]]] begin[{]
call[.printRow, parameter[member[.stream], member[.header], member[.longestCell], member[.longestRow]]]
call[stream.println, parameter[call[.bar, parameter[call[StringUtils.repeat, parameter[literal["═"], member[.longestCell]]], literal["╞"], literal["╡"], literal["╪"], call[header.size, parameter[]]]]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None), MemberReference(member=longestCell, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=longestRow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printRow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=println, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=r)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=r, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[call[footer.isEmpty, parameter[]]] begin[{]
call[stream.println, parameter[call[.bar, parameter[call[StringUtils.repeat, parameter[literal["═"], member[.longestCell]]], literal["╞"], literal["╡"], literal["╪"], call[header.size, parameter[]]]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=footer, selectors=[], type_arguments=None), MemberReference(member=longestCell, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=longestRow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printRow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=footer, selectors=[], type_arguments=None), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=println, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=footer, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=r)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=r, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
call[stream.printf, parameter[literal["└%s"], member[.horizontalBar]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="┴%s"), MemberReference(member=horizontalBar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printf, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=longestRow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[stream.println, parameter[literal["┘"]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[print] operator[SEP] annotation[@] identifier[NonNull] identifier[PrintStream] identifier[stream] operator[SEP] {
identifier[String] identifier[horizontalBar] operator[=] identifier[StringUtils] operator[SEP] identifier[repeat] operator[SEP] literal[String] , identifier[longestCell] operator[SEP] operator[SEP] identifier[String] identifier[hline] operator[=] identifier[middleCMBar] operator[SEP] identifier[horizontalBar] , identifier[longestRow] operator[SEP] operator[SEP] identifier[longestRow] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[longestRow] , identifier[header] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isNullOrBlank] operator[SEP] identifier[title] operator[SEP] operator[SEP] {
identifier[stream] operator[SEP] identifier[println] operator[SEP] identifier[StringUtils] operator[SEP] identifier[center] operator[SEP] identifier[title] , operator[SEP] identifier[longestCell] operator[*] identifier[longestRow] operator[SEP] operator[+] identifier[longestRow] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
identifier[stream] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[horizontalBar] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[longestRow] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[stream] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[horizontalBar] operator[SEP] operator[SEP]
}
identifier[stream] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[header] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[printRow] operator[SEP] identifier[stream] , identifier[header] , identifier[longestCell] , identifier[longestRow] operator[SEP] operator[SEP] identifier[stream] operator[SEP] identifier[println] operator[SEP] identifier[bar] operator[SEP] identifier[StringUtils] operator[SEP] identifier[repeat] operator[SEP] literal[String] , identifier[longestCell] operator[SEP] , literal[String] , literal[String] , literal[String] , identifier[header] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[r] operator[=] Other[0] operator[SEP] identifier[r] operator[<] identifier[content] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[r] operator[++] operator[SEP] {
identifier[printRow] operator[SEP] identifier[stream] , identifier[content] operator[SEP] identifier[get] operator[SEP] identifier[r] operator[SEP] , identifier[longestCell] , identifier[longestRow] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[+] Other[1] operator[<] identifier[content] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[stream] operator[SEP] identifier[println] operator[SEP] identifier[hline] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[footer] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[stream] operator[SEP] identifier[println] operator[SEP] identifier[bar] operator[SEP] identifier[StringUtils] operator[SEP] identifier[repeat] operator[SEP] literal[String] , identifier[longestCell] operator[SEP] , literal[String] , literal[String] , literal[String] , identifier[header] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[r] operator[=] Other[0] operator[SEP] identifier[r] operator[<] identifier[footer] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[r] operator[++] operator[SEP] {
identifier[printRow] operator[SEP] identifier[stream] , identifier[footer] operator[SEP] identifier[get] operator[SEP] identifier[r] operator[SEP] , identifier[longestCell] , identifier[longestRow] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[+] Other[1] operator[<] identifier[footer] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[stream] operator[SEP] identifier[println] operator[SEP] identifier[hline] operator[SEP] operator[SEP]
}
}
}
identifier[stream] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[horizontalBar] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[longestRow] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[stream] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[horizontalBar] operator[SEP] operator[SEP]
}
identifier[stream] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public void marshall(AgeRange ageRange, ProtocolMarshaller protocolMarshaller) {
if (ageRange == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(ageRange.getLow(), LOW_BINDING);
protocolMarshaller.marshall(ageRange.getHigh(), HIGH_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[ageRange, protocolMarshaller]] begin[{]
if[binary_operation[member[.ageRange], ==, 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=getLow, postfix_operators=[], prefix_operators=[], qualifier=ageRange, selectors=[], type_arguments=None), MemberReference(member=LOW_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=getHigh, postfix_operators=[], prefix_operators=[], qualifier=ageRange, selectors=[], type_arguments=None), MemberReference(member=HIGH_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[AgeRange] identifier[ageRange] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[ageRange] 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[ageRange] operator[SEP] identifier[getLow] operator[SEP] operator[SEP] , identifier[LOW_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[ageRange] operator[SEP] identifier[getHigh] operator[SEP] operator[SEP] , identifier[HIGH_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]
}
}
|
private void writeEvaluatorInfoWebOutput(
final HttpServletResponse response, final List<String> ids) throws IOException {
for (final String id : ids) {
final EvaluatorDescriptor evaluatorDescriptor = this.reefStateManager.getEvaluators().get(id);
final PrintWriter writer = response.getWriter();
if (evaluatorDescriptor != null) {
final String nodeId = evaluatorDescriptor.getNodeDescriptor().getId();
final String nodeName = evaluatorDescriptor.getNodeDescriptor().getName();
final InetSocketAddress address =
evaluatorDescriptor.getNodeDescriptor().getInetSocketAddress();
writer.println("Evaluator Id: " + id);
writer.write("<br/>");
writer.println("Evaluator Node Id: " + nodeId);
writer.write("<br/>");
writer.println("Evaluator Node Name: " + nodeName);
writer.write("<br/>");
writer.println("Evaluator InternetAddress: " + address);
writer.write("<br/>");
writer.println("Evaluator Memory: " + evaluatorDescriptor.getMemory());
writer.write("<br/>");
writer.println("Evaluator Core: " + evaluatorDescriptor.getNumberOfCores());
writer.write("<br/>");
writer.println("Evaluator Type: " + evaluatorDescriptor.getProcess());
writer.write("<br/>");
writer.println("Evaluator Runtime Name: " + evaluatorDescriptor.getRuntimeName());
writer.write("<br/>");
} else {
writer.println("Incorrect Evaluator Id: " + id);
}
}
} | class class_name[name] begin[{]
method[writeEvaluatorInfoWebOutput, return_type[void], modifier[private], parameter[response, ids]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=reefStateManager, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getEvaluators, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=evaluatorDescriptor)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=EvaluatorDescriptor, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getWriter, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), name=writer)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=PrintWriter, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=evaluatorDescriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Incorrect Evaluator Id: "), operandr=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNodeDescriptor, postfix_operators=[], prefix_operators=[], qualifier=evaluatorDescriptor, selectors=[MethodInvocation(arguments=[], member=getId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=nodeId)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNodeDescriptor, postfix_operators=[], prefix_operators=[], qualifier=evaluatorDescriptor, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=nodeName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNodeDescriptor, postfix_operators=[], prefix_operators=[], qualifier=evaluatorDescriptor, selectors=[MethodInvocation(arguments=[], member=getInetSocketAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=address)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=InetSocketAddress, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Evaluator Id: "), operandr=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<br/>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Evaluator Node Id: "), operandr=MemberReference(member=nodeId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<br/>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Evaluator Node Name: "), operandr=MemberReference(member=nodeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<br/>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Evaluator InternetAddress: "), operandr=MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<br/>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Evaluator Memory: "), operandr=MethodInvocation(arguments=[], member=getMemory, postfix_operators=[], prefix_operators=[], qualifier=evaluatorDescriptor, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<br/>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Evaluator Core: "), operandr=MethodInvocation(arguments=[], member=getNumberOfCores, postfix_operators=[], prefix_operators=[], qualifier=evaluatorDescriptor, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<br/>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Evaluator Type: "), operandr=MethodInvocation(arguments=[], member=getProcess, postfix_operators=[], prefix_operators=[], qualifier=evaluatorDescriptor, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<br/>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Evaluator Runtime Name: "), operandr=MethodInvocation(arguments=[], member=getRuntimeName, postfix_operators=[], prefix_operators=[], qualifier=evaluatorDescriptor, selectors=[], type_arguments=None), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<br/>")], member=write, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=ids, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=id)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[writeEvaluatorInfoWebOutput] operator[SEP] Keyword[final] identifier[HttpServletResponse] identifier[response] , Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[ids] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[id] operator[:] identifier[ids] operator[SEP] {
Keyword[final] identifier[EvaluatorDescriptor] identifier[evaluatorDescriptor] operator[=] Keyword[this] operator[SEP] identifier[reefStateManager] operator[SEP] identifier[getEvaluators] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[final] identifier[PrintWriter] identifier[writer] operator[=] identifier[response] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[evaluatorDescriptor] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[String] identifier[nodeId] operator[=] identifier[evaluatorDescriptor] operator[SEP] identifier[getNodeDescriptor] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[nodeName] operator[=] identifier[evaluatorDescriptor] operator[SEP] identifier[getNodeDescriptor] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[InetSocketAddress] identifier[address] operator[=] identifier[evaluatorDescriptor] operator[SEP] identifier[getNodeDescriptor] operator[SEP] operator[SEP] operator[SEP] identifier[getInetSocketAddress] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[id] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[nodeId] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[nodeName] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[address] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[evaluatorDescriptor] operator[SEP] identifier[getMemory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[evaluatorDescriptor] operator[SEP] identifier[getNumberOfCores] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[evaluatorDescriptor] operator[SEP] identifier[getProcess] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[evaluatorDescriptor] operator[SEP] identifier[getRuntimeName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[id] operator[SEP] operator[SEP]
}
}
}
|
protected Features getFeaturesFromRequest(HttpServletRequest request, boolean versionError) throws IOException {
final String sourceMethod = "getFeaturesFromRequest"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request, versionError});
}
StringBuffer sb = request.getRequestURL();
if (sb != null && request.getQueryString() != null) {
sb.append("?").append(request.getQueryString()); //$NON-NLS-1$
}
Features defaultFeatures = getAggregator().getConfig().getDefaultFeatures(sb != null ? sb.toString() : null);
Features features = null;
if (!versionError) { // don't trust feature encoding if version changed
features = getFeaturesFromRequestEncoded(request, defaultFeatures);
}
if (features == null) {
features = new Features(defaultFeatures);
String has = getHasConditionsFromRequest(request);
if (has != null) {
for (String s : has.split("[;,*]")) { //$NON-NLS-1$
boolean value = true;
if (s.startsWith("!")) { //$NON-NLS-1$
s = s.substring(1);
value = false;
}
features.put(s, value);
}
}
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, features);
}
return features.unmodifiableFeatures();
} | class class_name[name] begin[{]
method[getFeaturesFromRequest, return_type[type[Features]], modifier[protected], parameter[request, versionError]] begin[{]
local_variable[type[String], sourceMethod]
local_variable[type[boolean], isTraceLogging]
if[member[.isTraceLogging]] begin[{]
call[log.entering, parameter[member[.sourceClass], member[.sourceMethod], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=versionError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[StringBuffer], sb]
if[binary_operation[binary_operation[member[.sb], !=, literal[null]], &&, binary_operation[call[request.getQueryString, parameter[]], !=, literal[null]]]] begin[{]
call[sb.append, parameter[literal["?"]]]
else begin[{]
None
end[}]
local_variable[type[Features], defaultFeatures]
local_variable[type[Features], features]
if[member[.versionError]] begin[{]
assign[member[.features], call[.getFeaturesFromRequestEncoded, parameter[member[.request], member[.defaultFeatures]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.features], ==, literal[null]]] begin[{]
assign[member[.features], ClassCreator(arguments=[MemberReference(member=defaultFeatures, 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=Features, sub_type=None))]
local_variable[type[String], has]
if[binary_operation[member[.has], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=value)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="!")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=features, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[;,*]")], member=split, postfix_operators=[], prefix_operators=[], qualifier=has, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[member[.isTraceLogging]] begin[{]
call[log.exiting, parameter[member[.sourceClass], member[.sourceMethod], member[.features]]]
else begin[{]
None
end[}]
return[call[features.unmodifiableFeatures, parameter[]]]
end[}]
END[}] | Keyword[protected] identifier[Features] identifier[getFeaturesFromRequest] operator[SEP] identifier[HttpServletRequest] identifier[request] , Keyword[boolean] identifier[versionError] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[String] identifier[sourceMethod] operator[=] literal[String] operator[SEP] Keyword[boolean] identifier[isTraceLogging] operator[=] identifier[log] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINER] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceLogging] operator[SEP] {
identifier[log] operator[SEP] identifier[entering] operator[SEP] identifier[sourceClass] , identifier[sourceMethod] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[request] , identifier[versionError]
} operator[SEP] operator[SEP]
}
identifier[StringBuffer] identifier[sb] operator[=] identifier[request] operator[SEP] identifier[getRequestURL] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sb] operator[!=] Other[null] operator[&&] identifier[request] operator[SEP] identifier[getQueryString] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getQueryString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Features] identifier[defaultFeatures] operator[=] identifier[getAggregator] operator[SEP] operator[SEP] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getDefaultFeatures] operator[SEP] identifier[sb] operator[!=] Other[null] operator[?] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] operator[SEP] identifier[Features] identifier[features] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[versionError] operator[SEP] {
identifier[features] operator[=] identifier[getFeaturesFromRequestEncoded] operator[SEP] identifier[request] , identifier[defaultFeatures] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[features] operator[==] Other[null] operator[SEP] {
identifier[features] operator[=] Keyword[new] identifier[Features] operator[SEP] identifier[defaultFeatures] operator[SEP] operator[SEP] identifier[String] identifier[has] operator[=] identifier[getHasConditionsFromRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[has] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[s] operator[:] identifier[has] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[value] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[s] operator[=] identifier[s] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[value] operator[=] literal[boolean] operator[SEP]
}
identifier[features] operator[SEP] identifier[put] operator[SEP] identifier[s] , identifier[value] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[isTraceLogging] operator[SEP] {
identifier[log] operator[SEP] identifier[exiting] operator[SEP] identifier[sourceClass] , identifier[sourceMethod] , identifier[features] operator[SEP] operator[SEP]
}
Keyword[return] identifier[features] operator[SEP] identifier[unmodifiableFeatures] operator[SEP] operator[SEP] operator[SEP]
}
|
private V getForNullKey() {
for (Entry<K, V> e = table[0]; e != null; e = e.next) {
if (e.key == null) return e.value;
}
return null;
} | class class_name[name] begin[{]
method[getForNullKey, return_type[type[V]], modifier[private], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), name=e)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=[], name=Entry, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[]))]), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[V] identifier[getForNullKey] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] identifier[e] operator[=] identifier[table] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[e] operator[!=] Other[null] operator[SEP] identifier[e] operator[=] identifier[e] operator[SEP] identifier[next] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[key] operator[==] Other[null] operator[SEP] Keyword[return] identifier[e] operator[SEP] identifier[value] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public JBPMMessages.ProcessInstance writeProcessInstance(MarshallerWriteContext context,
ProcessInstance processInstance) throws IOException {
WorkflowProcessInstanceImpl workFlow = (WorkflowProcessInstanceImpl) processInstance;
JBPMMessages.ProcessInstance.Builder _instance = JBPMMessages.ProcessInstance.newBuilder()
.setId( workFlow.getId() )
.setProcessId( workFlow.getProcessId() )
.setState( workFlow.getState() )
.setNodeInstanceCounter( workFlow.getNodeInstanceCounter() )
.setProcessType( workFlow.getProcess().getType() )
.setParentProcessInstanceId(workFlow.getParentProcessInstanceId())
.setSignalCompletion(workFlow.isSignalCompletion())
.setSlaCompliance(workFlow.getSlaCompliance());
if (workFlow.getProcessXml() != null) {
_instance.setProcessXml( workFlow.getProcessXml());
}
if (workFlow.getDescription() != null) {
_instance.setDescription(workFlow.getDescription());
}
if (workFlow.getDeploymentId() != null) {
_instance.setDeploymentId(workFlow.getDeploymentId());
}
_instance.addAllCompletedNodeIds(workFlow.getCompletedNodeIds());
if (workFlow.getCorrelationKey() != null) {
_instance.setCorrelationKey(workFlow.getCorrelationKey());
}
if (workFlow.getSlaDueDate() != null) {
_instance.setSlaDueDate(workFlow.getSlaDueDate().getTime());
}
if (workFlow.getSlaTimerId() != null) {
_instance.setSlaTimerId(workFlow.getSlaTimerId());
}
SwimlaneContextInstance swimlaneContextInstance = (SwimlaneContextInstance) workFlow.getContextInstance( SwimlaneContext.SWIMLANE_SCOPE );
if ( swimlaneContextInstance != null ) {
Map<String, String> swimlaneActors = swimlaneContextInstance.getSwimlaneActors();
for ( Map.Entry<String, String> entry : swimlaneActors.entrySet() ) {
_instance.addSwimlaneContext( JBPMMessages.ProcessInstance.SwimlaneContextInstance.newBuilder()
.setSwimlane( entry.getKey() )
.setActorId( entry.getValue() )
.build() );
}
}
List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>( workFlow.getNodeInstances() );
Collections.sort( nodeInstances,
new Comparator<NodeInstance>() {
public int compare(NodeInstance o1,
NodeInstance o2) {
return (int) (o1.getId() - o2.getId());
}
} );
for ( NodeInstance nodeInstance : nodeInstances ) {
_instance.addNodeInstance( writeNodeInstance( context,
nodeInstance ) );
}
List<ContextInstance> exclusiveGroupInstances =
workFlow.getContextInstances( ExclusiveGroup.EXCLUSIVE_GROUP );
if ( exclusiveGroupInstances != null ) {
for ( ContextInstance contextInstance : exclusiveGroupInstances ) {
JBPMMessages.ProcessInstance.ExclusiveGroupInstance.Builder _exclusive = JBPMMessages.ProcessInstance.ExclusiveGroupInstance.newBuilder();
ExclusiveGroupInstance exclusiveGroupInstance = (ExclusiveGroupInstance) contextInstance;
Collection<NodeInstance> groupNodeInstances = exclusiveGroupInstance.getNodeInstances();
for ( NodeInstance nodeInstance : groupNodeInstances ) {
_exclusive.addGroupNodeInstanceId( nodeInstance.getId() );
}
_instance.addExclusiveGroup( _exclusive.build() );
}
}
VariableScopeInstance variableScopeInstance = (VariableScopeInstance) workFlow.getContextInstance( VariableScope.VARIABLE_SCOPE );
List<Map.Entry<String, Object>> variables = new ArrayList<Map.Entry<String, Object>>( variableScopeInstance.getVariables().entrySet() );
Collections.sort( variables,
new Comparator<Map.Entry<String, Object>>() {
public int compare(Map.Entry<String, Object> o1,
Map.Entry<String, Object> o2) {
return o1.getKey().compareTo( o2.getKey() );
}
} );
for ( Map.Entry<String, Object> variable : variables ) {
if ( variable.getValue() != null ) {
_instance.addVariable( ProtobufProcessMarshaller.marshallVariable( context, variable.getKey(), variable.getValue() ) );
}
}
List<Map.Entry<String, Integer>> iterationlevels = new ArrayList<Map.Entry<String, Integer>>( workFlow.getIterationLevels().entrySet() );
Collections.sort( iterationlevels,
new Comparator<Map.Entry<String, Integer>>() {
public int compare(Map.Entry<String, Integer> o1,
Map.Entry<String, Integer> o2) {
return o1.getKey().compareTo( o2.getKey() );
}
} );
for ( Map.Entry<String, Integer> level : iterationlevels ) {
if ( level.getValue() != null ) {
_instance.addIterationLevels(
JBPMMessages.IterationLevel.newBuilder()
.setId(level.getKey())
.setLevel(level.getValue()) );
}
}
return _instance.build();
} | class class_name[name] begin[{]
method[writeProcessInstance, return_type[type[JBPMMessages]], modifier[public], parameter[context, processInstance]] begin[{]
local_variable[type[WorkflowProcessInstanceImpl], workFlow]
local_variable[type[JBPMMessages], _instance]
if[binary_operation[call[workFlow.getProcessXml, parameter[]], !=, literal[null]]] begin[{]
call[_instance.setProcessXml, parameter[call[workFlow.getProcessXml, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[workFlow.getDescription, parameter[]], !=, literal[null]]] begin[{]
call[_instance.setDescription, parameter[call[workFlow.getDescription, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[workFlow.getDeploymentId, parameter[]], !=, literal[null]]] begin[{]
call[_instance.setDeploymentId, parameter[call[workFlow.getDeploymentId, parameter[]]]]
else begin[{]
None
end[}]
call[_instance.addAllCompletedNodeIds, parameter[call[workFlow.getCompletedNodeIds, parameter[]]]]
if[binary_operation[call[workFlow.getCorrelationKey, parameter[]], !=, literal[null]]] begin[{]
call[_instance.setCorrelationKey, parameter[call[workFlow.getCorrelationKey, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[workFlow.getSlaDueDate, parameter[]], !=, literal[null]]] begin[{]
call[_instance.setSlaDueDate, parameter[call[workFlow.getSlaDueDate, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[workFlow.getSlaTimerId, parameter[]], !=, literal[null]]] begin[{]
call[_instance.setSlaTimerId, parameter[call[workFlow.getSlaTimerId, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[SwimlaneContextInstance], swimlaneContextInstance]
if[binary_operation[member[.swimlaneContextInstance], !=, literal[null]]] begin[{]
local_variable[type[Map], swimlaneActors]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=JBPMMessages.ProcessInstance.SwimlaneContextInstance, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=setSwimlane, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=setActorId, 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)], member=addSwimlaneContext, postfix_operators=[], prefix_operators=[], qualifier=_instance, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=swimlaneActors, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
else begin[{]
None
end[}]
local_variable[type[List], nodeInstances]
call[Collections.sort, parameter[member[.nodeInstances], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=Cast(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=o1, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=o2, selectors=[], type_arguments=None), operator=-), type=BasicType(dimensions=[], name=int)), label=None)], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers=set(), name=o1, type=ReferenceType(arguments=None, dimensions=[], name=NodeInstance, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=o2, type=ReferenceType(arguments=None, dimensions=[], name=NodeInstance, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=int), 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=NodeInstance, sub_type=None))], dimensions=None, name=Comparator, sub_type=None))]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nodeInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeNodeInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addNodeInstance, postfix_operators=[], prefix_operators=[], qualifier=_instance, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=nodeInstances, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=nodeInstance)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeInstance, sub_type=None))), label=None)
local_variable[type[List], exclusiveGroupInstances]
if[binary_operation[member[.exclusiveGroupInstances], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=JBPMMessages.ProcessInstance.ExclusiveGroupInstance, selectors=[], type_arguments=None), name=_exclusive)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JBPMMessages, sub_type=ReferenceType(arguments=None, dimensions=None, name=ProcessInstance, sub_type=ReferenceType(arguments=None, dimensions=None, name=ExclusiveGroupInstance, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None))))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=contextInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ExclusiveGroupInstance, sub_type=None)), name=exclusiveGroupInstance)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExclusiveGroupInstance, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNodeInstances, postfix_operators=[], prefix_operators=[], qualifier=exclusiveGroupInstance, selectors=[], type_arguments=None), name=groupNodeInstances)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NodeInstance, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=nodeInstance, selectors=[], type_arguments=None)], member=addGroupNodeInstanceId, postfix_operators=[], prefix_operators=[], qualifier=_exclusive, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=groupNodeInstances, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=nodeInstance)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeInstance, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=_exclusive, selectors=[], type_arguments=None)], member=addExclusiveGroup, postfix_operators=[], prefix_operators=[], qualifier=_instance, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=exclusiveGroupInstances, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=contextInstance)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ContextInstance, sub_type=None))), label=None)
else begin[{]
None
end[}]
local_variable[type[VariableScopeInstance], variableScopeInstance]
local_variable[type[List], variables]
call[Collections.sort, parameter[member[.variables], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=o1, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=o2, selectors=[], type_arguments=None)], member=compareTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers=set(), name=o1, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Entry, sub_type=None)), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=o2, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Entry, sub_type=None)), varargs=False)], return_type=BasicType(dimensions=[], name=int), 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=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))], dimensions=None, name=Comparator, sub_type=None))]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=variable, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=variable, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=variable, selectors=[], type_arguments=None)], member=marshallVariable, postfix_operators=[], prefix_operators=[], qualifier=ProtobufProcessMarshaller, selectors=[], type_arguments=None)], member=addVariable, postfix_operators=[], prefix_operators=[], qualifier=_instance, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=variables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=variable)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
local_variable[type[List], iterationlevels]
call[Collections.sort, parameter[member[.iterationlevels], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=o1, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=o2, selectors=[], type_arguments=None)], member=compareTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers=set(), name=o1, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=None, name=Entry, sub_type=None)), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=o2, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=None, name=Entry, sub_type=None)), varargs=False)], return_type=BasicType(dimensions=[], name=int), 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=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))], dimensions=None, name=Comparator, sub_type=None))]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=level, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=JBPMMessages.IterationLevel, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=level, selectors=[], type_arguments=None)], member=setId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=level, selectors=[], type_arguments=None)], member=setLevel, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=addIterationLevels, postfix_operators=[], prefix_operators=[], qualifier=_instance, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=iterationlevels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=level)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[call[_instance.build, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[JBPMMessages] operator[SEP] identifier[ProcessInstance] identifier[writeProcessInstance] operator[SEP] identifier[MarshallerWriteContext] identifier[context] , identifier[ProcessInstance] identifier[processInstance] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[WorkflowProcessInstanceImpl] identifier[workFlow] operator[=] operator[SEP] identifier[WorkflowProcessInstanceImpl] operator[SEP] identifier[processInstance] operator[SEP] identifier[JBPMMessages] operator[SEP] identifier[ProcessInstance] operator[SEP] identifier[Builder] identifier[_instance] operator[=] identifier[JBPMMessages] operator[SEP] identifier[ProcessInstance] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setId] operator[SEP] identifier[workFlow] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setProcessId] operator[SEP] identifier[workFlow] operator[SEP] identifier[getProcessId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setState] operator[SEP] identifier[workFlow] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setNodeInstanceCounter] operator[SEP] identifier[workFlow] operator[SEP] identifier[getNodeInstanceCounter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setProcessType] operator[SEP] identifier[workFlow] operator[SEP] identifier[getProcess] operator[SEP] operator[SEP] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setParentProcessInstanceId] operator[SEP] identifier[workFlow] operator[SEP] identifier[getParentProcessInstanceId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setSignalCompletion] operator[SEP] identifier[workFlow] operator[SEP] identifier[isSignalCompletion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setSlaCompliance] operator[SEP] identifier[workFlow] operator[SEP] identifier[getSlaCompliance] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[workFlow] operator[SEP] identifier[getProcessXml] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[_instance] operator[SEP] identifier[setProcessXml] operator[SEP] identifier[workFlow] operator[SEP] identifier[getProcessXml] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[workFlow] operator[SEP] identifier[getDescription] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[_instance] operator[SEP] identifier[setDescription] operator[SEP] identifier[workFlow] operator[SEP] identifier[getDescription] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[workFlow] operator[SEP] identifier[getDeploymentId] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[_instance] operator[SEP] identifier[setDeploymentId] operator[SEP] identifier[workFlow] operator[SEP] identifier[getDeploymentId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[_instance] operator[SEP] identifier[addAllCompletedNodeIds] operator[SEP] identifier[workFlow] operator[SEP] identifier[getCompletedNodeIds] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[workFlow] operator[SEP] identifier[getCorrelationKey] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[_instance] operator[SEP] identifier[setCorrelationKey] operator[SEP] identifier[workFlow] operator[SEP] identifier[getCorrelationKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[workFlow] operator[SEP] identifier[getSlaDueDate] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[_instance] operator[SEP] identifier[setSlaDueDate] operator[SEP] identifier[workFlow] operator[SEP] identifier[getSlaDueDate] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[workFlow] operator[SEP] identifier[getSlaTimerId] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[_instance] operator[SEP] identifier[setSlaTimerId] operator[SEP] identifier[workFlow] operator[SEP] identifier[getSlaTimerId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[SwimlaneContextInstance] identifier[swimlaneContextInstance] operator[=] operator[SEP] identifier[SwimlaneContextInstance] operator[SEP] identifier[workFlow] operator[SEP] identifier[getContextInstance] operator[SEP] identifier[SwimlaneContext] operator[SEP] identifier[SWIMLANE_SCOPE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[swimlaneContextInstance] operator[!=] Other[null] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[swimlaneActors] operator[=] identifier[swimlaneContextInstance] operator[SEP] identifier[getSwimlaneActors] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[>] identifier[entry] operator[:] identifier[swimlaneActors] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[_instance] operator[SEP] identifier[addSwimlaneContext] operator[SEP] identifier[JBPMMessages] operator[SEP] identifier[ProcessInstance] operator[SEP] identifier[SwimlaneContextInstance] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setSwimlane] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setActorId] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[NodeInstance] operator[>] identifier[nodeInstances] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[NodeInstance] operator[>] operator[SEP] identifier[workFlow] operator[SEP] identifier[getNodeInstances] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[nodeInstances] , Keyword[new] identifier[Comparator] operator[<] identifier[NodeInstance] operator[>] operator[SEP] operator[SEP] {
Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[NodeInstance] identifier[o1] , identifier[NodeInstance] identifier[o2] operator[SEP] {
Keyword[return] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[o1] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[-] identifier[o2] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[NodeInstance] identifier[nodeInstance] operator[:] identifier[nodeInstances] operator[SEP] {
identifier[_instance] operator[SEP] identifier[addNodeInstance] operator[SEP] identifier[writeNodeInstance] operator[SEP] identifier[context] , identifier[nodeInstance] operator[SEP] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[ContextInstance] operator[>] identifier[exclusiveGroupInstances] operator[=] identifier[workFlow] operator[SEP] identifier[getContextInstances] operator[SEP] identifier[ExclusiveGroup] operator[SEP] identifier[EXCLUSIVE_GROUP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[exclusiveGroupInstances] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[ContextInstance] identifier[contextInstance] operator[:] identifier[exclusiveGroupInstances] operator[SEP] {
identifier[JBPMMessages] operator[SEP] identifier[ProcessInstance] operator[SEP] identifier[ExclusiveGroupInstance] operator[SEP] identifier[Builder] identifier[_exclusive] operator[=] identifier[JBPMMessages] operator[SEP] identifier[ProcessInstance] operator[SEP] identifier[ExclusiveGroupInstance] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[ExclusiveGroupInstance] identifier[exclusiveGroupInstance] operator[=] operator[SEP] identifier[ExclusiveGroupInstance] operator[SEP] identifier[contextInstance] operator[SEP] identifier[Collection] operator[<] identifier[NodeInstance] operator[>] identifier[groupNodeInstances] operator[=] identifier[exclusiveGroupInstance] operator[SEP] identifier[getNodeInstances] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[NodeInstance] identifier[nodeInstance] operator[:] identifier[groupNodeInstances] operator[SEP] {
identifier[_exclusive] operator[SEP] identifier[addGroupNodeInstanceId] operator[SEP] identifier[nodeInstance] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[_instance] operator[SEP] identifier[addExclusiveGroup] operator[SEP] identifier[_exclusive] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[VariableScopeInstance] identifier[variableScopeInstance] operator[=] operator[SEP] identifier[VariableScopeInstance] operator[SEP] identifier[workFlow] operator[SEP] identifier[getContextInstance] operator[SEP] identifier[VariableScope] operator[SEP] identifier[VARIABLE_SCOPE] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[variables] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] operator[SEP] identifier[variableScopeInstance] operator[SEP] identifier[getVariables] operator[SEP] operator[SEP] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[variables] , Keyword[new] identifier[Comparator] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] operator[SEP] operator[SEP] {
Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[o1] , identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[o2] operator[SEP] {
Keyword[return] identifier[o1] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[o2] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[variable] operator[:] identifier[variables] operator[SEP] {
Keyword[if] operator[SEP] identifier[variable] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[_instance] operator[SEP] identifier[addVariable] operator[SEP] identifier[ProtobufProcessMarshaller] operator[SEP] identifier[marshallVariable] operator[SEP] identifier[context] , identifier[variable] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[variable] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Integer] operator[>] operator[>] identifier[iterationlevels] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Integer] operator[>] operator[>] operator[SEP] identifier[workFlow] operator[SEP] identifier[getIterationLevels] operator[SEP] operator[SEP] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[iterationlevels] , Keyword[new] identifier[Comparator] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Integer] operator[>] operator[>] operator[SEP] operator[SEP] {
Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Integer] operator[>] identifier[o1] , identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Integer] operator[>] identifier[o2] operator[SEP] {
Keyword[return] identifier[o1] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[o2] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Integer] operator[>] identifier[level] operator[:] identifier[iterationlevels] operator[SEP] {
Keyword[if] operator[SEP] identifier[level] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[_instance] operator[SEP] identifier[addIterationLevels] operator[SEP] identifier[JBPMMessages] operator[SEP] identifier[IterationLevel] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setId] operator[SEP] identifier[level] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setLevel] operator[SEP] identifier[level] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[_instance] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public Matrix4f rotateY(float ang, Matrix4f dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.rotationY(ang);
float cos, sin;
sin = (float) Math.sin(ang);
cos = (float) Math.cosFromSin(sin, ang);
float rm00 = cos;
float rm02 = -sin;
float rm20 = sin;
float rm22 = cos;
// add temporaries for dependent values
float nm00 = m00 * rm00 + m20 * rm02;
float nm01 = m01 * rm00 + m21 * rm02;
float nm02 = m02 * rm00 + m22 * rm02;
float nm03 = m03 * rm00 + m23 * rm02;
// set non-dependent values directly
dest._m20(m00 * rm20 + m20 * rm22);
dest._m21(m01 * rm20 + m21 * rm22);
dest._m22(m02 * rm20 + m22 * rm22);
dest._m23(m03 * rm20 + m23 * rm22);
// set other values
dest._m00(nm00);
dest._m01(nm01);
dest._m02(nm02);
dest._m03(nm03);
dest._m10(m10);
dest._m11(m11);
dest._m12(m12);
dest._m13(m13);
dest._m30(m30);
dest._m31(m31);
dest._m32(m32);
dest._m33(m33);
dest._properties(properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION));
return dest;
} | class class_name[name] begin[{]
method[rotateY, return_type[type[Matrix4f]], modifier[public], parameter[ang, dest]] begin[{]
if[binary_operation[binary_operation[member[.properties], &, member[.PROPERTY_IDENTITY]], !=, literal[0]]] begin[{]
return[call[dest.rotationY, parameter[member[.ang]]]]
else begin[{]
None
end[}]
local_variable[type[float], cos]
assign[member[.sin], Cast(expression=MethodInvocation(arguments=[MemberReference(member=ang, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sin, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=float))]
assign[member[.cos], Cast(expression=MethodInvocation(arguments=[MemberReference(member=sin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ang, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cosFromSin, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=float))]
local_variable[type[float], rm00]
local_variable[type[float], rm02]
local_variable[type[float], rm20]
local_variable[type[float], rm22]
local_variable[type[float], nm00]
local_variable[type[float], nm01]
local_variable[type[float], nm02]
local_variable[type[float], nm03]
call[dest._m20, parameter[binary_operation[binary_operation[member[.m00], *, member[.rm20]], +, binary_operation[member[.m20], *, member[.rm22]]]]]
call[dest._m21, parameter[binary_operation[binary_operation[member[.m01], *, member[.rm20]], +, binary_operation[member[.m21], *, member[.rm22]]]]]
call[dest._m22, parameter[binary_operation[binary_operation[member[.m02], *, member[.rm20]], +, binary_operation[member[.m22], *, member[.rm22]]]]]
call[dest._m23, parameter[binary_operation[binary_operation[member[.m03], *, member[.rm20]], +, binary_operation[member[.m23], *, member[.rm22]]]]]
call[dest._m00, parameter[member[.nm00]]]
call[dest._m01, parameter[member[.nm01]]]
call[dest._m02, parameter[member[.nm02]]]
call[dest._m03, parameter[member[.nm03]]]
call[dest._m10, parameter[member[.m10]]]
call[dest._m11, parameter[member[.m11]]]
call[dest._m12, parameter[member[.m12]]]
call[dest._m13, parameter[member[.m13]]]
call[dest._m30, parameter[member[.m30]]]
call[dest._m31, parameter[member[.m31]]]
call[dest._m32, parameter[member[.m32]]]
call[dest._m33, parameter[member[.m33]]]
call[dest._properties, parameter[binary_operation[member[.properties], &, binary_operation[binary_operation[member[.PROPERTY_PERSPECTIVE], |, member[.PROPERTY_IDENTITY]], |, member[.PROPERTY_TRANSLATION]]]]]
return[member[.dest]]
end[}]
END[}] | Keyword[public] identifier[Matrix4f] identifier[rotateY] operator[SEP] Keyword[float] identifier[ang] , identifier[Matrix4f] identifier[dest] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[properties] operator[&] identifier[PROPERTY_IDENTITY] operator[SEP] operator[!=] Other[0] operator[SEP] Keyword[return] identifier[dest] operator[SEP] identifier[rotationY] operator[SEP] identifier[ang] operator[SEP] operator[SEP] Keyword[float] identifier[cos] , identifier[sin] operator[SEP] identifier[sin] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[ang] operator[SEP] operator[SEP] identifier[cos] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[cosFromSin] operator[SEP] identifier[sin] , identifier[ang] operator[SEP] operator[SEP] Keyword[float] identifier[rm00] operator[=] identifier[cos] operator[SEP] Keyword[float] identifier[rm02] operator[=] operator[-] identifier[sin] operator[SEP] Keyword[float] identifier[rm20] operator[=] identifier[sin] operator[SEP] Keyword[float] identifier[rm22] operator[=] identifier[cos] operator[SEP] Keyword[float] identifier[nm00] operator[=] identifier[m00] operator[*] identifier[rm00] operator[+] identifier[m20] operator[*] identifier[rm02] operator[SEP] Keyword[float] identifier[nm01] operator[=] identifier[m01] operator[*] identifier[rm00] operator[+] identifier[m21] operator[*] identifier[rm02] operator[SEP] Keyword[float] identifier[nm02] operator[=] identifier[m02] operator[*] identifier[rm00] operator[+] identifier[m22] operator[*] identifier[rm02] operator[SEP] Keyword[float] identifier[nm03] operator[=] identifier[m03] operator[*] identifier[rm00] operator[+] identifier[m23] operator[*] identifier[rm02] operator[SEP] identifier[dest] operator[SEP] identifier[_m20] operator[SEP] identifier[m00] operator[*] identifier[rm20] operator[+] identifier[m20] operator[*] identifier[rm22] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m21] operator[SEP] identifier[m01] operator[*] identifier[rm20] operator[+] identifier[m21] operator[*] identifier[rm22] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m22] operator[SEP] identifier[m02] operator[*] identifier[rm20] operator[+] identifier[m22] operator[*] identifier[rm22] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m23] operator[SEP] identifier[m03] operator[*] identifier[rm20] operator[+] identifier[m23] operator[*] identifier[rm22] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m00] operator[SEP] identifier[nm00] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m01] operator[SEP] identifier[nm01] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m02] operator[SEP] identifier[nm02] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m03] operator[SEP] identifier[nm03] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m10] operator[SEP] identifier[m10] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m11] operator[SEP] identifier[m11] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m12] operator[SEP] identifier[m12] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m13] operator[SEP] identifier[m13] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m30] operator[SEP] identifier[m30] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m31] operator[SEP] identifier[m31] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m32] operator[SEP] identifier[m32] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_m33] operator[SEP] identifier[m33] operator[SEP] operator[SEP] identifier[dest] operator[SEP] identifier[_properties] operator[SEP] identifier[properties] operator[&] operator[~] operator[SEP] identifier[PROPERTY_PERSPECTIVE] operator[|] identifier[PROPERTY_IDENTITY] operator[|] identifier[PROPERTY_TRANSLATION] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[dest] operator[SEP]
}
|
public static double[] intersection(double[] kb1, double[] kb2) {
double[] interp = new double[2];
if (kb1[0] == 1) {
interp[0] = kb1[1];
interp[1] = kb2[1] * interp[0] + kb2[2];
} else if (kb2[0] == 1) {
interp[0] = kb2[1];
interp[1] = kb1[1] * interp[0] + kb1[2];
} else {
interp[0] = (kb2[2] - kb1[2]) / (kb1[1] - kb2[1]);
interp[1] = kb1[1] * interp[0] + kb1[2];
}
return interp;
} | class class_name[name] begin[{]
method[intersection, return_type[type[double]], modifier[public static], parameter[kb1, kb2]] begin[{]
local_variable[type[double], interp]
if[binary_operation[member[.kb1], ==, literal[1]]] begin[{]
assign[member[.interp], member[.kb1]]
assign[member[.interp], binary_operation[binary_operation[member[.kb2], *, member[.interp]], +, member[.kb2]]]
else begin[{]
if[binary_operation[member[.kb2], ==, literal[1]]] begin[{]
assign[member[.interp], member[.kb2]]
assign[member[.interp], binary_operation[binary_operation[member[.kb1], *, member[.interp]], +, member[.kb1]]]
else begin[{]
assign[member[.interp], binary_operation[binary_operation[member[.kb2], -, member[.kb1]], /, binary_operation[member[.kb1], -, member[.kb2]]]]
assign[member[.interp], binary_operation[binary_operation[member[.kb1], *, member[.interp]], +, member[.kb1]]]
end[}]
end[}]
return[member[.interp]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] operator[SEP] operator[SEP] identifier[intersection] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[kb1] , Keyword[double] operator[SEP] operator[SEP] identifier[kb2] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] identifier[interp] operator[=] Keyword[new] Keyword[double] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[kb1] operator[SEP] Other[0] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[interp] operator[SEP] Other[0] operator[SEP] operator[=] identifier[kb1] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[interp] operator[SEP] Other[1] operator[SEP] operator[=] identifier[kb2] operator[SEP] Other[1] operator[SEP] operator[*] identifier[interp] operator[SEP] Other[0] operator[SEP] operator[+] identifier[kb2] operator[SEP] Other[2] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[kb2] operator[SEP] Other[0] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[interp] operator[SEP] Other[0] operator[SEP] operator[=] identifier[kb2] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[interp] operator[SEP] Other[1] operator[SEP] operator[=] identifier[kb1] operator[SEP] Other[1] operator[SEP] operator[*] identifier[interp] operator[SEP] Other[0] operator[SEP] operator[+] identifier[kb1] operator[SEP] Other[2] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[interp] operator[SEP] Other[0] operator[SEP] operator[=] operator[SEP] identifier[kb2] operator[SEP] Other[2] operator[SEP] operator[-] identifier[kb1] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[/] operator[SEP] identifier[kb1] operator[SEP] Other[1] operator[SEP] operator[-] identifier[kb2] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[interp] operator[SEP] Other[1] operator[SEP] operator[=] identifier[kb1] operator[SEP] Other[1] operator[SEP] operator[*] identifier[interp] operator[SEP] Other[0] operator[SEP] operator[+] identifier[kb1] operator[SEP] Other[2] operator[SEP] operator[SEP]
}
Keyword[return] identifier[interp] operator[SEP]
}
|
private Context translateReturn(WyilFile.Stmt.Return stmt, Context context) {
//
Tuple<WyilFile.Expr> returns = stmt.getReturns();
//
if (returns.size() > 0) {
// There is at least one return value. Therefore, we need to check
// any preconditions for those return expressions and, potentially,
// ensure any postconditions of the cnlosing function/method are
// met.
Pair<Expr[], Context> p = translateExpressionsWithChecks(returns, context);
Expr[] exprs = p.first();
context = p.second();
//
generateReturnTypeInvariantCheck(stmt, exprs, context);
generatePostconditionChecks(stmt, exprs, context);
}
// Return null to signal that execution does not continue after this
// return statement.
return null;
} | class class_name[name] begin[{]
method[translateReturn, return_type[type[Context]], modifier[private], parameter[stmt, context]] begin[{]
local_variable[type[Tuple], returns]
if[binary_operation[call[returns.size, parameter[]], >, literal[0]]] begin[{]
local_variable[type[Pair], p]
local_variable[type[Expr], exprs]
assign[member[.context], call[p.second, parameter[]]]
call[.generateReturnTypeInvariantCheck, parameter[member[.stmt], member[.exprs], member[.context]]]
call[.generatePostconditionChecks, parameter[member[.stmt], member[.exprs], member[.context]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[Context] identifier[translateReturn] operator[SEP] identifier[WyilFile] operator[SEP] identifier[Stmt] operator[SEP] identifier[Return] identifier[stmt] , identifier[Context] identifier[context] operator[SEP] {
identifier[Tuple] operator[<] identifier[WyilFile] operator[SEP] identifier[Expr] operator[>] identifier[returns] operator[=] identifier[stmt] operator[SEP] identifier[getReturns] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[returns] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[Pair] operator[<] identifier[Expr] operator[SEP] operator[SEP] , identifier[Context] operator[>] identifier[p] operator[=] identifier[translateExpressionsWithChecks] operator[SEP] identifier[returns] , identifier[context] operator[SEP] operator[SEP] identifier[Expr] operator[SEP] operator[SEP] identifier[exprs] operator[=] identifier[p] operator[SEP] identifier[first] operator[SEP] operator[SEP] operator[SEP] identifier[context] operator[=] identifier[p] operator[SEP] identifier[second] operator[SEP] operator[SEP] operator[SEP] identifier[generateReturnTypeInvariantCheck] operator[SEP] identifier[stmt] , identifier[exprs] , identifier[context] operator[SEP] operator[SEP] identifier[generatePostconditionChecks] operator[SEP] identifier[stmt] , identifier[exprs] , identifier[context] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public OvhOrder dedicated_server_serviceName_bandwidth_duration_GET(String serviceName, String duration, OvhBandwidthOrderEnum bandwidth, OvhBandwidthOrderTypeEnum type) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/bandwidth/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
query(sb, "bandwidth", bandwidth);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | class class_name[name] begin[{]
method[dedicated_server_serviceName_bandwidth_duration_GET, return_type[type[OvhOrder]], modifier[public], parameter[serviceName, duration, bandwidth, type]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
call[.query, parameter[member[.sb], literal["bandwidth"], member[.bandwidth]]]
call[.query, parameter[member[.sb], literal["type"], member[.type]]]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhOrder, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[OvhOrder] identifier[dedicated_server_serviceName_bandwidth_duration_GET] operator[SEP] identifier[String] identifier[serviceName] , identifier[String] identifier[duration] , identifier[OvhBandwidthOrderEnum] identifier[bandwidth] , identifier[OvhBandwidthOrderTypeEnum] identifier[type] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[serviceName] , identifier[duration] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[sb] , literal[String] , identifier[bandwidth] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[sb] , literal[String] , identifier[type] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhOrder] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static String soundex(String str) {
return new org.apache.commons.codec.language.Soundex().soundex(str);
} | class class_name[name] begin[{]
method[soundex, return_type[type[String]], modifier[public static], parameter[str]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=soundex, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=org, sub_type=ReferenceType(arguments=None, dimensions=None, name=apache, sub_type=ReferenceType(arguments=None, dimensions=None, name=commons, sub_type=ReferenceType(arguments=None, dimensions=None, name=codec, sub_type=ReferenceType(arguments=None, dimensions=None, name=language, sub_type=ReferenceType(arguments=None, dimensions=None, name=Soundex, sub_type=None)))))))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[soundex] operator[SEP] identifier[String] identifier[str] operator[SEP] {
Keyword[return] Keyword[new] identifier[org] operator[SEP] identifier[apache] operator[SEP] identifier[commons] operator[SEP] identifier[codec] operator[SEP] identifier[language] operator[SEP] identifier[Soundex] operator[SEP] operator[SEP] operator[SEP] identifier[soundex] operator[SEP] identifier[str] operator[SEP] operator[SEP]
}
|
@Override
public void removeByG_A_C(long groupId, boolean active,
long commerceCountryId) {
for (CommerceWarehouse commerceWarehouse : findByG_A_C(groupId, active,
commerceCountryId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceWarehouse);
}
} | class class_name[name] begin[{]
method[removeByG_A_C, return_type[void], modifier[public], parameter[groupId, active, commerceCountryId]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=commerceWarehouse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=groupId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=active, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=commerceCountryId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ALL_POS, postfix_operators=[], prefix_operators=[], qualifier=QueryUtil, selectors=[]), MemberReference(member=ALL_POS, postfix_operators=[], prefix_operators=[], qualifier=QueryUtil, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=findByG_A_C, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=commerceWarehouse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CommerceWarehouse, sub_type=None))), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[removeByG_A_C] operator[SEP] Keyword[long] identifier[groupId] , Keyword[boolean] identifier[active] , Keyword[long] identifier[commerceCountryId] operator[SEP] {
Keyword[for] operator[SEP] identifier[CommerceWarehouse] identifier[commerceWarehouse] operator[:] identifier[findByG_A_C] operator[SEP] identifier[groupId] , identifier[active] , identifier[commerceCountryId] , identifier[QueryUtil] operator[SEP] identifier[ALL_POS] , identifier[QueryUtil] operator[SEP] identifier[ALL_POS] , Other[null] operator[SEP] operator[SEP] {
identifier[remove] operator[SEP] identifier[commerceWarehouse] operator[SEP] operator[SEP]
}
}
|
@Bean
public DaoConfig daoConfig() {
DaoConfig retVal = new DaoConfig();
retVal.setAllowMultipleDelete(true);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK);
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL);
retVal.setSubscriptionMatchingEnabled(true);
return retVal;
} | class class_name[name] begin[{]
method[daoConfig, return_type[type[DaoConfig]], modifier[public], parameter[]] begin[{]
local_variable[type[DaoConfig], retVal]
call[retVal.setAllowMultipleDelete, parameter[literal[true]]]
call[retVal.addSupportedSubscriptionType, parameter[member[Subscription.SubscriptionChannelType.WEBSOCKET]]]
call[retVal.addSupportedSubscriptionType, parameter[member[Subscription.SubscriptionChannelType.RESTHOOK]]]
call[retVal.addSupportedSubscriptionType, parameter[member[Subscription.SubscriptionChannelType.EMAIL]]]
call[retVal.setSubscriptionMatchingEnabled, parameter[literal[true]]]
return[member[.retVal]]
end[}]
END[}] | annotation[@] identifier[Bean] Keyword[public] identifier[DaoConfig] identifier[daoConfig] operator[SEP] operator[SEP] {
identifier[DaoConfig] identifier[retVal] operator[=] Keyword[new] identifier[DaoConfig] operator[SEP] operator[SEP] operator[SEP] identifier[retVal] operator[SEP] identifier[setAllowMultipleDelete] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[retVal] operator[SEP] identifier[addSupportedSubscriptionType] operator[SEP] identifier[Subscription] operator[SEP] identifier[SubscriptionChannelType] operator[SEP] identifier[WEBSOCKET] operator[SEP] operator[SEP] identifier[retVal] operator[SEP] identifier[addSupportedSubscriptionType] operator[SEP] identifier[Subscription] operator[SEP] identifier[SubscriptionChannelType] operator[SEP] identifier[RESTHOOK] operator[SEP] operator[SEP] identifier[retVal] operator[SEP] identifier[addSupportedSubscriptionType] operator[SEP] identifier[Subscription] operator[SEP] identifier[SubscriptionChannelType] operator[SEP] identifier[EMAIL] operator[SEP] operator[SEP] identifier[retVal] operator[SEP] identifier[setSubscriptionMatchingEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[retVal] operator[SEP]
}
|
@NotNull
public static File backup(@NotNull final Backupable source, @NotNull final File backupRoot,
@Nullable final String backupNamePrefix, final boolean zip) throws Exception {
if (!backupRoot.exists() && !backupRoot.mkdirs()) {
throw new IOException("Failed to create " + backupRoot.getAbsolutePath());
}
final String fileName;
if (zip) {
fileName = getTimeStampedZipFileName();
} else {
fileName = getTimeStampedTarGzFileName();
}
final File backupFile = new File(backupRoot, backupNamePrefix == null ? fileName : backupNamePrefix + fileName);
return backup(source, backupFile, zip);
} | class class_name[name] begin[{]
method[backup, return_type[type[File]], modifier[public static], parameter[source, backupRoot, backupNamePrefix, zip]] begin[{]
if[binary_operation[call[backupRoot.exists, parameter[]], &&, call[backupRoot.mkdirs, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to create "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=backupRoot, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], fileName]
if[member[.zip]] begin[{]
assign[member[.fileName], call[.getTimeStampedZipFileName, parameter[]]]
else begin[{]
assign[member[.fileName], call[.getTimeStampedTarGzFileName, parameter[]]]
end[}]
local_variable[type[File], backupFile]
return[call[.backup, parameter[member[.source], member[.backupFile], member[.zip]]]]
end[}]
END[}] | annotation[@] identifier[NotNull] Keyword[public] Keyword[static] identifier[File] identifier[backup] operator[SEP] annotation[@] identifier[NotNull] Keyword[final] identifier[Backupable] identifier[source] , annotation[@] identifier[NotNull] Keyword[final] identifier[File] identifier[backupRoot] , annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[backupNamePrefix] , Keyword[final] Keyword[boolean] identifier[zip] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] operator[!] identifier[backupRoot] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[backupRoot] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[backupRoot] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[fileName] operator[SEP] Keyword[if] operator[SEP] identifier[zip] operator[SEP] {
identifier[fileName] operator[=] identifier[getTimeStampedZipFileName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[fileName] operator[=] identifier[getTimeStampedTarGzFileName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[File] identifier[backupFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[backupRoot] , identifier[backupNamePrefix] operator[==] Other[null] operator[?] identifier[fileName] operator[:] identifier[backupNamePrefix] operator[+] identifier[fileName] operator[SEP] operator[SEP] Keyword[return] identifier[backup] operator[SEP] identifier[source] , identifier[backupFile] , identifier[zip] operator[SEP] operator[SEP]
}
|
public static void decode(final Map<String, String> map, final String data) {
//String[] keyValues = StringUtil.split(data, '&');
StringUtil.split(data, '&', keyValue -> {
final int indexOfSeperator = keyValue.indexOf('=');
if (indexOfSeperator > -1) {
if (indexOfSeperator == keyValue.length() - 1) { // The '=' is at the end of the string - this counts as an unsigned value
map.put(URLCodec.decode(keyValue.substring(0, indexOfSeperator), StandardCharsets.UTF_8), "");
} else {
final String first = keyValue.substring(0, indexOfSeperator),
second = keyValue.substring(indexOfSeperator + 1);
map.put(URLCodec.decode(first, StandardCharsets.UTF_8), URLCodec.decode(second, StandardCharsets.UTF_8));
}
}
});
} | class class_name[name] begin[{]
method[decode, return_type[void], modifier[public static], parameter[map, data]] begin[{]
call[StringUtil.split, parameter[member[.data], literal['&'], LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='=')], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=keyValue, selectors=[], type_arguments=None), name=indexOfSeperator)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=indexOfSeperator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=indexOfSeperator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=keyValue, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=indexOfSeperator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=keyValue, selectors=[], type_arguments=None), name=first), VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=indexOfSeperator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=keyValue, selectors=[], type_arguments=None), name=second)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=StandardCharsets, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLCodec, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=StandardCharsets, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLCodec, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=indexOfSeperator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=keyValue, selectors=[], type_arguments=None), MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=StandardCharsets, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLCodec, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=put, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None)]))]))], parameters=[MemberReference(member=keyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[decode] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[map] , Keyword[final] identifier[String] identifier[data] operator[SEP] {
identifier[StringUtil] operator[SEP] identifier[split] operator[SEP] identifier[data] , literal[String] , identifier[keyValue] operator[->] {
Keyword[final] Keyword[int] identifier[indexOfSeperator] operator[=] identifier[keyValue] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[indexOfSeperator] operator[>] operator[-] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[indexOfSeperator] operator[==] identifier[keyValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] {
identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[URLCodec] operator[SEP] identifier[decode] operator[SEP] identifier[keyValue] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[indexOfSeperator] operator[SEP] , identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[String] identifier[first] operator[=] identifier[keyValue] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[indexOfSeperator] operator[SEP] , identifier[second] operator[=] identifier[keyValue] operator[SEP] identifier[substring] operator[SEP] identifier[indexOfSeperator] operator[+] Other[1] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[URLCodec] operator[SEP] identifier[decode] operator[SEP] identifier[first] , identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] , identifier[URLCodec] operator[SEP] identifier[decode] operator[SEP] identifier[second] , identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
@SuppressWarnings({ "rawtypes", "unchecked" })
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Observable<T> switchOnNext(ObservableSource<? extends ObservableSource<? extends T>> sources, int bufferSize) {
ObjectHelper.requireNonNull(sources, "sources is null");
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
return RxJavaPlugins.onAssembly(new ObservableSwitchMap(sources, Functions.identity(), bufferSize, false));
} | class class_name[name] begin[{]
method[switchOnNext, return_type[type[Observable]], modifier[public static], parameter[sources, bufferSize]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.sources], literal["sources is null"]]]
call[ObjectHelper.verifyPositive, parameter[member[.bufferSize], literal["bufferSize"]]]
return[call[RxJavaPlugins.onAssembly, parameter[ClassCreator(arguments=[MemberReference(member=sources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=identity, postfix_operators=[], prefix_operators=[], qualifier=Functions, selectors=[], type_arguments=None), MemberReference(member=bufferSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ObservableSwitchMap, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] annotation[@] identifier[CheckReturnValue] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Observable] operator[<] identifier[T] operator[>] identifier[switchOnNext] operator[SEP] identifier[ObservableSource] operator[<] operator[?] Keyword[extends] identifier[ObservableSource] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] operator[>] identifier[sources] , Keyword[int] identifier[bufferSize] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[sources] , literal[String] operator[SEP] operator[SEP] identifier[ObjectHelper] operator[SEP] identifier[verifyPositive] operator[SEP] identifier[bufferSize] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[RxJavaPlugins] operator[SEP] identifier[onAssembly] operator[SEP] Keyword[new] identifier[ObservableSwitchMap] operator[SEP] identifier[sources] , identifier[Functions] operator[SEP] identifier[identity] operator[SEP] operator[SEP] , identifier[bufferSize] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
|
public static PolicyConfigurationFactory getPolicyConfigurationFactory() throws ClassNotFoundException,
PolicyContextException
{
// Validate the caller permission
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new SecurityPermission("setPolicy"));
synchronized (PolicyConfigurationFactory.class)
{
if (factory == null)
{
String factoryName = null;
Class<?> clazz = null;
try
{
LoadAction action = new LoadAction();
try
{
clazz = AccessController.doPrivileged(action);
factoryName = action.getName();
}
catch (PrivilegedActionException ex)
{
factoryName = action.getName();
Exception e = ex.getException();
if (e instanceof ClassNotFoundException)
throw (ClassNotFoundException) e;
else
throw new PolicyContextException("Failure during load of class: " + factoryName, e);
}
factory = (PolicyConfigurationFactory) clazz.newInstance();
}
catch (ClassNotFoundException e)
{
String msg = "Failed to find PolicyConfigurationFactory : " + factoryName;
throw new ClassNotFoundException(msg, e);
}
catch (IllegalAccessException e)
{
String msg = "Unable to access class : " + factoryName;
throw new PolicyContextException(msg, e);
}
catch (InstantiationException e)
{
String msg = "Failed to create instance of: " + factoryName;
throw new PolicyContextException(msg, e);
}
catch (ClassCastException e)
{
StringBuffer msg = new StringBuffer(factoryName + " Is not a PolicyConfigurationFactory, ");
msg.append("PCF.class.CL: " + PolicyConfigurationFactory.class.getClassLoader());
msg.append("\nPCF.class.CS: " + PolicyConfigurationFactory.class.getProtectionDomain().getCodeSource());
msg.append("\nPCF.class.hash: " + System.identityHashCode(PolicyConfigurationFactory.class));
msg.append("\nclazz.CL: " + clazz.getClassLoader());
msg.append("\nclazz.CS: " + clazz.getProtectionDomain().getCodeSource());
msg.append("\nclazz.super.CL: " + clazz.getSuperclass().getClassLoader());
msg.append("\nclazz.super.CS: " + clazz.getSuperclass().getProtectionDomain().getCodeSource());
msg.append("\nclazz.super.hash: " + System.identityHashCode(clazz.getSuperclass()));
ClassCastException cce = new ClassCastException(msg.toString());
cce.initCause(e);
throw cce;
}
}
}
return factory;
} | class class_name[name] begin[{]
method[getPolicyConfigurationFactory, return_type[type[PolicyConfigurationFactory]], modifier[public static], parameter[]] begin[{]
local_variable[type[SecurityManager], sm]
if[binary_operation[member[.sm], !=, literal[null]]] begin[{]
call[sm.checkPermission, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="setPolicy")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SecurityPermission, sub_type=None))]]
else begin[{]
None
end[}]
SYNCHRONIZED[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PolicyConfigurationFactory, sub_type=None))] BEGIN[{]
if[binary_operation[member[.factory], ==, literal[null]]] begin[{]
local_variable[type[String], factoryName]
local_variable[type[Class], clazz]
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=LoadAction, sub_type=None)), name=action)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LoadAction, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=action, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doPrivileged, postfix_operators=[], prefix_operators=[], qualifier=AccessController, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=factoryName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=factoryName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getException, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Exception, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ClassNotFoundException, sub_type=None), operator=instanceof), else_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failure during load of class: "), operandr=MemberReference(member=factoryName, 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=PolicyContextException, sub_type=None)), label=None), label=None, then_statement=ThrowStatement(expression=Cast(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ClassNotFoundException, sub_type=None)), label=None))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['PrivilegedActionException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=factory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=PolicyConfigurationFactory, sub_type=None))), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to find PolicyConfigurationFactory : "), operandr=MemberReference(member=factoryName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassNotFoundException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to access class : "), operandr=MemberReference(member=factoryName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PolicyContextException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalAccessException'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to create instance of: "), operandr=MemberReference(member=factoryName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PolicyContextException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InstantiationException'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=factoryName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" Is not a PolicyConfigurationFactory, "), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuffer, sub_type=None)), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuffer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PCF.class.CL: "), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PolicyConfigurationFactory, sub_type=None)), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nPCF.class.CS: "), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getProtectionDomain, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getCodeSource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PolicyConfigurationFactory, sub_type=None)), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nPCF.class.hash: "), operandr=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PolicyConfigurationFactory, sub_type=None))], member=identityHashCode, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nclazz.CL: "), operandr=MethodInvocation(arguments=[], member=getClassLoader, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nclazz.CS: "), operandr=MethodInvocation(arguments=[], member=getProtectionDomain, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[MethodInvocation(arguments=[], member=getCodeSource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nclazz.super.CL: "), operandr=MethodInvocation(arguments=[], member=getSuperclass, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[MethodInvocation(arguments=[], member=getClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nclazz.super.CS: "), operandr=MethodInvocation(arguments=[], member=getSuperclass, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[MethodInvocation(arguments=[], member=getProtectionDomain, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getCodeSource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nclazz.super.hash: "), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSuperclass, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None)], member=identityHashCode, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassCastException, sub_type=None)), name=cce)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ClassCastException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initCause, postfix_operators=[], prefix_operators=[], qualifier=cce, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=cce, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassCastException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
END[}]
return[member[.factory]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PolicyConfigurationFactory] identifier[getPolicyConfigurationFactory] operator[SEP] operator[SEP] Keyword[throws] identifier[ClassNotFoundException] , identifier[PolicyContextException] {
identifier[SecurityManager] identifier[sm] operator[=] identifier[System] operator[SEP] identifier[getSecurityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sm] operator[!=] Other[null] operator[SEP] identifier[sm] operator[SEP] identifier[checkPermission] operator[SEP] Keyword[new] identifier[SecurityPermission] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[PolicyConfigurationFactory] operator[SEP] Keyword[class] operator[SEP] {
Keyword[if] operator[SEP] identifier[factory] operator[==] Other[null] operator[SEP] {
identifier[String] identifier[factoryName] operator[=] Other[null] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[LoadAction] identifier[action] operator[=] Keyword[new] identifier[LoadAction] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[clazz] operator[=] identifier[AccessController] operator[SEP] identifier[doPrivileged] operator[SEP] identifier[action] operator[SEP] operator[SEP] identifier[factoryName] operator[=] identifier[action] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[PrivilegedActionException] identifier[ex] operator[SEP] {
identifier[factoryName] operator[=] identifier[action] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[Exception] identifier[e] operator[=] identifier[ex] operator[SEP] identifier[getException] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] Keyword[instanceof] identifier[ClassNotFoundException] operator[SEP] Keyword[throw] operator[SEP] identifier[ClassNotFoundException] operator[SEP] identifier[e] operator[SEP] Keyword[else] Keyword[throw] Keyword[new] identifier[PolicyContextException] operator[SEP] literal[String] operator[+] identifier[factoryName] , identifier[e] operator[SEP] operator[SEP]
}
identifier[factory] operator[=] operator[SEP] identifier[PolicyConfigurationFactory] operator[SEP] identifier[clazz] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[factoryName] operator[SEP] Keyword[throw] Keyword[new] identifier[ClassNotFoundException] operator[SEP] identifier[msg] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] identifier[e] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[factoryName] operator[SEP] Keyword[throw] Keyword[new] identifier[PolicyContextException] operator[SEP] identifier[msg] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InstantiationException] identifier[e] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[factoryName] operator[SEP] Keyword[throw] Keyword[new] identifier[PolicyContextException] operator[SEP] identifier[msg] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassCastException] identifier[e] operator[SEP] {
identifier[StringBuffer] identifier[msg] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] identifier[factoryName] operator[+] literal[String] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[PolicyConfigurationFactory] operator[SEP] Keyword[class] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[PolicyConfigurationFactory] operator[SEP] Keyword[class] operator[SEP] identifier[getProtectionDomain] operator[SEP] operator[SEP] operator[SEP] identifier[getCodeSource] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[System] operator[SEP] identifier[identityHashCode] operator[SEP] identifier[PolicyConfigurationFactory] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[clazz] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[clazz] operator[SEP] identifier[getProtectionDomain] operator[SEP] operator[SEP] operator[SEP] identifier[getCodeSource] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[clazz] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[clazz] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] identifier[getProtectionDomain] operator[SEP] operator[SEP] operator[SEP] identifier[getCodeSource] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[System] operator[SEP] identifier[identityHashCode] operator[SEP] identifier[clazz] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ClassCastException] identifier[cce] operator[=] Keyword[new] identifier[ClassCastException] operator[SEP] identifier[msg] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cce] operator[SEP] identifier[initCause] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[cce] operator[SEP]
}
}
}
Keyword[return] identifier[factory] operator[SEP]
}
|
public byte[] build(BuilderMode builderMode) {
try {
final Mac digest = Mac.getInstance(Validator.notNull(algorithm, "algorithm not null"));
SecretKeySpec secretKey = new SecretKeySpec(apiSecret, algorithm);
digest.init(secretKey);
switch (builderMode) {
case FULL:
updateFullBuildDigest(digest);
break;
case ONLY_HEADER:
updateOnlyHeaderBuildDigest(digest);
break;
default:
System.err.println(String.format("不支持的参数类型: {}", builderMode));
return null;
}
final byte[] signatureBytes = digest.doFinal();
digest.reset();
return signatureBytes;
} catch (Throwable e) {
System.err.println(e.getMessage());
return null;
}
} | class class_name[name] begin[{]
method[build, return_type[type[byte]], modifier[public], parameter[builderMode]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=algorithm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="algorithm not null")], member=notNull, postfix_operators=[], prefix_operators=[], qualifier=Validator, selectors=[], type_arguments=None)], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=Mac, selectors=[], type_arguments=None), name=digest)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Mac, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=apiSecret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=algorithm, 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=SecretKeySpec, sub_type=None)), name=secretKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SecretKeySpec, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=secretKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=digest, selectors=[], type_arguments=None), label=None), SwitchStatement(cases=[SwitchStatementCase(case=['FULL'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=digest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=updateFullBuildDigest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['ONLY_HEADER'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=digest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=updateOnlyHeaderBuildDigest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="不支持的参数类型: {}"), MemberReference(member=builderMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)])], expression=MemberReference(member=builderMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=doFinal, postfix_operators=[], prefix_operators=[], qualifier=digest, selectors=[], type_arguments=None), name=signatureBytes)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=MethodInvocation(arguments=[], member=reset, postfix_operators=[], prefix_operators=[], qualifier=digest, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=signatureBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[build] operator[SEP] identifier[BuilderMode] identifier[builderMode] operator[SEP] {
Keyword[try] {
Keyword[final] identifier[Mac] identifier[digest] operator[=] identifier[Mac] operator[SEP] identifier[getInstance] operator[SEP] identifier[Validator] operator[SEP] identifier[notNull] operator[SEP] identifier[algorithm] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[SecretKeySpec] identifier[secretKey] operator[=] Keyword[new] identifier[SecretKeySpec] operator[SEP] identifier[apiSecret] , identifier[algorithm] operator[SEP] operator[SEP] identifier[digest] operator[SEP] identifier[init] operator[SEP] identifier[secretKey] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[builderMode] operator[SEP] {
Keyword[case] identifier[FULL] operator[:] identifier[updateFullBuildDigest] operator[SEP] identifier[digest] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[ONLY_HEADER] operator[:] identifier[updateOnlyHeaderBuildDigest] operator[SEP] identifier[digest] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[builderMode] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[signatureBytes] operator[=] identifier[digest] operator[SEP] identifier[doFinal] operator[SEP] operator[SEP] operator[SEP] identifier[digest] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[signatureBytes] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
private int bytesPerPixel() {
long fileSize = data.getFile().length();
long pixelMax = getXPixels() * (long) getYPixels();
// ceil result, because it is a maximum that we use to divide
return (int) Math.ceil(fileSize / (double) pixelMax);
} | class class_name[name] begin[{]
method[bytesPerPixel, return_type[type[int]], modifier[private], parameter[]] begin[{]
local_variable[type[long], fileSize]
local_variable[type[long], pixelMax]
return[Cast(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=fileSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Cast(expression=MemberReference(member=pixelMax, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=double)), operator=/)], member=ceil, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[bytesPerPixel] operator[SEP] operator[SEP] {
Keyword[long] identifier[fileSize] operator[=] identifier[data] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[pixelMax] operator[=] identifier[getXPixels] operator[SEP] operator[SEP] operator[*] operator[SEP] Keyword[long] operator[SEP] identifier[getYPixels] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[ceil] operator[SEP] identifier[fileSize] operator[/] operator[SEP] Keyword[double] operator[SEP] identifier[pixelMax] operator[SEP] operator[SEP]
}
|
public void remove() {
SyncState oldState = this.syncState;
if (this.syncState == SyncState.NEW || this.syncState == SyncState.NEW_REMOVED)
this.syncState = SyncState.NEW_REMOVED;
else
this.syncState = SyncState.REMOVED;
if (oldState != this.syncState)
fireChanged(oldState, this.syncState);
} | class class_name[name] begin[{]
method[remove, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[SyncState], oldState]
if[binary_operation[binary_operation[THIS[member[None.syncState]], ==, member[SyncState.NEW]], ||, binary_operation[THIS[member[None.syncState]], ==, member[SyncState.NEW_REMOVED]]]] begin[{]
assign[THIS[member[None.syncState]], member[SyncState.NEW_REMOVED]]
else begin[{]
assign[THIS[member[None.syncState]], member[SyncState.REMOVED]]
end[}]
if[binary_operation[member[.oldState], !=, THIS[member[None.syncState]]]] begin[{]
call[.fireChanged, parameter[member[.oldState], THIS[member[None.syncState]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[remove] operator[SEP] operator[SEP] {
identifier[SyncState] identifier[oldState] operator[=] Keyword[this] operator[SEP] identifier[syncState] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[syncState] operator[==] identifier[SyncState] operator[SEP] identifier[NEW] operator[||] Keyword[this] operator[SEP] identifier[syncState] operator[==] identifier[SyncState] operator[SEP] identifier[NEW_REMOVED] operator[SEP] Keyword[this] operator[SEP] identifier[syncState] operator[=] identifier[SyncState] operator[SEP] identifier[NEW_REMOVED] operator[SEP] Keyword[else] Keyword[this] operator[SEP] identifier[syncState] operator[=] identifier[SyncState] operator[SEP] identifier[REMOVED] operator[SEP] Keyword[if] operator[SEP] identifier[oldState] operator[!=] Keyword[this] operator[SEP] identifier[syncState] operator[SEP] identifier[fireChanged] operator[SEP] identifier[oldState] , Keyword[this] operator[SEP] identifier[syncState] operator[SEP] operator[SEP]
}
|
public int getIndexWithinSections(int listPosition) {
boolean isSection = false;
int numPrecedingSections = 0;
for (Integer sectionPosition : mSections.keySet()) {
if (listPosition > sectionPosition)
numPrecedingSections++;
else if (listPosition == sectionPosition)
isSection = true;
else
break;
}
return isSection ? numPrecedingSections : Math.max(numPrecedingSections - 1, 0);
} | class class_name[name] begin[{]
method[getIndexWithinSections, return_type[type[int]], modifier[public], parameter[listPosition]] begin[{]
local_variable[type[boolean], isSection]
local_variable[type[int], numPrecedingSections]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=listPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=sectionPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=listPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=sectionPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=BreakStatement(goto=None, label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)), label=None, then_statement=StatementExpression(expression=MemberReference(member=numPrecedingSections, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=mSections, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=sectionPosition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))), label=None)
return[TernaryExpression(condition=MemberReference(member=isSection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=numPrecedingSections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=max, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), if_true=MemberReference(member=numPrecedingSections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getIndexWithinSections] operator[SEP] Keyword[int] identifier[listPosition] operator[SEP] {
Keyword[boolean] identifier[isSection] operator[=] literal[boolean] operator[SEP] Keyword[int] identifier[numPrecedingSections] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Integer] identifier[sectionPosition] operator[:] identifier[mSections] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[listPosition] operator[>] identifier[sectionPosition] operator[SEP] identifier[numPrecedingSections] operator[++] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[listPosition] operator[==] identifier[sectionPosition] operator[SEP] identifier[isSection] operator[=] literal[boolean] operator[SEP] Keyword[else] Keyword[break] operator[SEP]
}
Keyword[return] identifier[isSection] operator[?] identifier[numPrecedingSections] operator[:] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[numPrecedingSections] operator[-] Other[1] , Other[0] operator[SEP] operator[SEP]
}
|
public static boolean equalsIgnoreCaseOrValueIsWildcard(final String value, final String toCheck) {
if (value == null && toCheck == null) {
return true;
}
if (value != null && StringUtil.WILDCARD.equals(value)) {
return true;
}
if (value != null && toCheck != null) {
return value.equalsIgnoreCase(toCheck);
}
return false;
} | class class_name[name] begin[{]
method[equalsIgnoreCaseOrValueIsWildcard, return_type[type[boolean]], modifier[public static], parameter[value, toCheck]] begin[{]
if[binary_operation[binary_operation[member[.value], ==, literal[null]], &&, binary_operation[member[.toCheck], ==, literal[null]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.value], !=, literal[null]], &&, call[StringUtil.WILDCARD.equals, parameter[member[.value]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.value], !=, literal[null]], &&, binary_operation[member[.toCheck], !=, literal[null]]]] begin[{]
return[call[value.equalsIgnoreCase, parameter[member[.toCheck]]]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[equalsIgnoreCaseOrValueIsWildcard] operator[SEP] Keyword[final] identifier[String] identifier[value] , Keyword[final] identifier[String] identifier[toCheck] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[&&] identifier[toCheck] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] identifier[StringUtil] operator[SEP] identifier[WILDCARD] operator[SEP] identifier[equals] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] identifier[toCheck] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[value] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[toCheck] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public SecurityContext loadContext(PortletRequestResponseHolder requestResponseHolder) {
final PortletRequest request = requestResponseHolder.getRequest();
final PortletSession portletSession = request.getPortletSession(false);
SecurityContext context = readSecurityContextFromSession(portletSession);
if (context == null) {
if (logger.isDebugEnabled()) {
logger.debug("No SecurityContext was available from the PortletSession: " + portletSession +". " +
"A new one will be created.");
}
context = generateNewContext();
}
//Capture pre-request state
requestResponseHolder.setAuthBeforeExecution(context.getAuthentication());
requestResponseHolder.setContextBeforeExecution(context);
requestResponseHolder.setPortletSessionExistedAtStartOfRequest(portletSession != null);
return context;
} | class class_name[name] begin[{]
method[loadContext, return_type[type[SecurityContext]], modifier[public], parameter[requestResponseHolder]] begin[{]
local_variable[type[PortletRequest], request]
local_variable[type[PortletSession], portletSession]
local_variable[type[SecurityContext], context]
if[binary_operation[member[.context], ==, literal[null]]] begin[{]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
call[logger.debug, parameter[binary_operation[binary_operation[binary_operation[literal["No SecurityContext was available from the PortletSession: "], +, member[.portletSession]], +, literal[". "]], +, literal["A new one will be created."]]]]
else begin[{]
None
end[}]
assign[member[.context], call[.generateNewContext, parameter[]]]
else begin[{]
None
end[}]
call[requestResponseHolder.setAuthBeforeExecution, parameter[call[context.getAuthentication, parameter[]]]]
call[requestResponseHolder.setContextBeforeExecution, parameter[member[.context]]]
call[requestResponseHolder.setPortletSessionExistedAtStartOfRequest, parameter[binary_operation[member[.portletSession], !=, literal[null]]]]
return[member[.context]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[SecurityContext] identifier[loadContext] operator[SEP] identifier[PortletRequestResponseHolder] identifier[requestResponseHolder] operator[SEP] {
Keyword[final] identifier[PortletRequest] identifier[request] operator[=] identifier[requestResponseHolder] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[PortletSession] identifier[portletSession] operator[=] identifier[request] operator[SEP] identifier[getPortletSession] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[SecurityContext] identifier[context] operator[=] identifier[readSecurityContextFromSession] operator[SEP] identifier[portletSession] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[context] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[portletSession] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[context] operator[=] identifier[generateNewContext] operator[SEP] operator[SEP] operator[SEP]
}
identifier[requestResponseHolder] operator[SEP] identifier[setAuthBeforeExecution] operator[SEP] identifier[context] operator[SEP] identifier[getAuthentication] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[requestResponseHolder] operator[SEP] identifier[setContextBeforeExecution] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[requestResponseHolder] operator[SEP] identifier[setPortletSessionExistedAtStartOfRequest] operator[SEP] identifier[portletSession] operator[!=] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[context] operator[SEP]
}
|
public Tag get(Class handlerClass) throws JspException {
PerThreadData ptd=(PerThreadData)perThread.get();
if( ptd!=null && ptd.current >=0 ) {
return ptd.handlers[ptd.current--];
} else {
try {
return (Tag) handlerClass.newInstance();
} catch (Exception e) {
throw new JspException(e.getMessage(), e);
}
}
} | class class_name[name] begin[{]
method[get, return_type[type[Tag]], modifier[public], parameter[handlerClass]] begin[{]
local_variable[type[PerThreadData], ptd]
if[binary_operation[binary_operation[member[.ptd], !=, literal[null]], &&, binary_operation[member[ptd.current], >=, literal[0]]]] begin[{]
return[member[ptd.handlers]]
else begin[{]
TryStatement(block=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=handlerClass, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Tag, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), 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=JspException, 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[}]
END[}] | Keyword[public] identifier[Tag] identifier[get] operator[SEP] identifier[Class] identifier[handlerClass] operator[SEP] Keyword[throws] identifier[JspException] {
identifier[PerThreadData] identifier[ptd] operator[=] operator[SEP] identifier[PerThreadData] operator[SEP] identifier[perThread] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ptd] operator[!=] Other[null] operator[&&] identifier[ptd] operator[SEP] identifier[current] operator[>=] Other[0] operator[SEP] {
Keyword[return] identifier[ptd] operator[SEP] identifier[handlers] operator[SEP] identifier[ptd] operator[SEP] identifier[current] operator[--] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[try] {
Keyword[return] operator[SEP] identifier[Tag] operator[SEP] identifier[handlerClass] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JspException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public ListPresetsResult withPresets(Preset... presets) {
if (this.presets == null) {
setPresets(new java.util.ArrayList<Preset>(presets.length));
}
for (Preset ele : presets) {
this.presets.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withPresets, return_type[type[ListPresetsResult]], modifier[public], parameter[presets]] begin[{]
if[binary_operation[THIS[member[None.presets]], ==, literal[null]]] begin[{]
call[.setPresets, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=presets, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Preset, sub_type=None))], dimensions=None, name=ArrayList, 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=presets, 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=presets, 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=Preset, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ListPresetsResult] identifier[withPresets] operator[SEP] identifier[Preset] operator[...] identifier[presets] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[presets] operator[==] Other[null] operator[SEP] {
identifier[setPresets] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[Preset] operator[>] operator[SEP] identifier[presets] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Preset] identifier[ele] operator[:] identifier[presets] operator[SEP] {
Keyword[this] operator[SEP] identifier[presets] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public void writeKey(Destination dst, int level, byte[] key)
throws KNXTimeoutException, KNXDisconnectException, KNXRemoteException,
KNXLinkClosedException
{
// level 255 is free access
if (level < 0 || level > 254 || key.length != 4)
throw new KNXIllegalArgumentException(
"level out of range or key length not 4 bytes");
if (dst.isConnectionOriented())
tl.connect(dst);
else
logger.error("doing write key in connectionless mode, " + dst.toString());
final byte[] apdu =
sendWait(dst, priority, DataUnitBuilder.createAPDU(KEY_WRITE, new byte[] {
(byte) level, key[0], key[1], key[2], key[3] }), KEY_RESPONSE, 1, 1);
if ((apdu[1] & 0xFF) == 0xFF)
throw new KNXRemoteException(
"access denied: current access level > write level");
} | class class_name[name] begin[{]
method[writeKey, return_type[void], modifier[public], parameter[dst, level, key]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.level], <, literal[0]], ||, binary_operation[member[.level], >, literal[254]]], ||, binary_operation[member[key.length], !=, literal[4]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="level out of range or key length not 4 bytes")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KNXIllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[dst.isConnectionOriented, parameter[]]] begin[{]
call[tl.connect, parameter[member[.dst]]]
else begin[{]
call[logger.error, parameter[binary_operation[literal["doing write key in connectionless mode, "], +, call[dst.toString, parameter[]]]]]
end[}]
local_variable[type[byte], apdu]
if[binary_operation[binary_operation[member[.apdu], &, literal[0xFF]], ==, literal[0xFF]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="access denied: current access level > write level")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KNXRemoteException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[writeKey] operator[SEP] identifier[Destination] identifier[dst] , Keyword[int] identifier[level] , Keyword[byte] operator[SEP] operator[SEP] identifier[key] operator[SEP] Keyword[throws] identifier[KNXTimeoutException] , identifier[KNXDisconnectException] , identifier[KNXRemoteException] , identifier[KNXLinkClosedException] {
Keyword[if] operator[SEP] identifier[level] operator[<] Other[0] operator[||] identifier[level] operator[>] Other[254] operator[||] identifier[key] operator[SEP] identifier[length] operator[!=] Other[4] operator[SEP] Keyword[throw] Keyword[new] identifier[KNXIllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dst] operator[SEP] identifier[isConnectionOriented] operator[SEP] operator[SEP] operator[SEP] identifier[tl] operator[SEP] identifier[connect] operator[SEP] identifier[dst] operator[SEP] operator[SEP] Keyword[else] identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[dst] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[apdu] operator[=] identifier[sendWait] operator[SEP] identifier[dst] , identifier[priority] , identifier[DataUnitBuilder] operator[SEP] identifier[createAPDU] operator[SEP] identifier[KEY_WRITE] , Keyword[new] Keyword[byte] operator[SEP] operator[SEP] {
operator[SEP] Keyword[byte] operator[SEP] identifier[level] , identifier[key] operator[SEP] Other[0] operator[SEP] , identifier[key] operator[SEP] Other[1] operator[SEP] , identifier[key] operator[SEP] Other[2] operator[SEP] , identifier[key] operator[SEP] Other[3] operator[SEP]
} operator[SEP] , identifier[KEY_RESPONSE] , Other[1] , Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[apdu] operator[SEP] Other[1] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[==] literal[Integer] operator[SEP] Keyword[throw] Keyword[new] identifier[KNXRemoteException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@Override
public String toCpe23FS() {
return String.format("cpe:2.3:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s",
Convert.wellFormedToFS(part),
Convert.wellFormedToFS(vendor),
Convert.wellFormedToFS(product),
Convert.wellFormedToFS(version),
Convert.wellFormedToFS(update),
Convert.wellFormedToFS(edition),
Convert.wellFormedToFS(language),
Convert.wellFormedToFS(swEdition),
Convert.wellFormedToFS(targetSw),
Convert.wellFormedToFS(targetHw),
Convert.wellFormedToFS(other));
} | class class_name[name] begin[{]
method[toCpe23FS, return_type[type[String]], modifier[public], parameter[]] begin[{]
return[call[String.format, parameter[literal["cpe:2.3:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s"], call[Convert.wellFormedToFS, parameter[member[.part]]], call[Convert.wellFormedToFS, parameter[member[.vendor]]], call[Convert.wellFormedToFS, parameter[member[.product]]], call[Convert.wellFormedToFS, parameter[member[.version]]], call[Convert.wellFormedToFS, parameter[member[.update]]], call[Convert.wellFormedToFS, parameter[member[.edition]]], call[Convert.wellFormedToFS, parameter[member[.language]]], call[Convert.wellFormedToFS, parameter[member[.swEdition]]], call[Convert.wellFormedToFS, parameter[member[.targetSw]]], call[Convert.wellFormedToFS, parameter[member[.targetHw]]], call[Convert.wellFormedToFS, parameter[member[.other]]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[toCpe23FS] operator[SEP] operator[SEP] {
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[part] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[vendor] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[product] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[version] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[update] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[edition] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[language] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[swEdition] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[targetSw] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[targetHw] operator[SEP] , identifier[Convert] operator[SEP] identifier[wellFormedToFS] operator[SEP] identifier[other] operator[SEP] operator[SEP] operator[SEP]
}
|
private E fetchObject()
{
try
{
String previousSkip = "&skip=" + (skipCounter - 1);
String currentSkip = "&skip=" + skipCounter;
int indexOf = q.indexOf(previousSkip);
if (indexOf > 0)
{
q.replace(indexOf, indexOf + previousSkip.length(), currentSkip);
}
else if (skipCounter > 0)
{
q.append(currentSkip);
}
client.executeQueryAndGetResults(q, _id, m, results, interpreter);
skipCounter++;
}
catch (Exception e)
{
logger.error("Error while executing query, caused by {}.", e);
throw new KunderaException("Error while executing query, caused by : " + e);
}
if (results != null && !results.isEmpty())
{
Object object = results.get(0);
results = new ArrayList();
if (!m.isRelationViaJoinTable() && (m.getRelationNames() == null || (m.getRelationNames().isEmpty())))
{
return (E) object;
}
else
{
return setRelationEntities(object, client, m);
}
}
return null;
} | class class_name[name] begin[{]
method[fetchObject, return_type[type[E]], modifier[private], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="&skip="), operandr=BinaryOperation(operandl=MemberReference(member=skipCounter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=+), name=previousSkip)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="&skip="), operandr=MemberReference(member=skipCounter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=currentSkip)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=previousSkip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), name=indexOf)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=skipCounter, 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=currentSkip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=previousSkip, selectors=[], type_arguments=None), operator=+), MemberReference(member=currentSkip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=replace, postfix_operators=[], prefix_operators=[], qualifier=q, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=_id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=interpreter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=executeQueryAndGetResults, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=skipCounter, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while executing query, caused by {}."), 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=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while executing query, caused by : "), operandr=MemberReference(member=e, 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=KunderaException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
if[binary_operation[binary_operation[member[.results], !=, literal[null]], &&, call[results.isEmpty, parameter[]]]] begin[{]
local_variable[type[Object], object]
assign[member[.results], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArrayList, sub_type=None))]
if[binary_operation[call[m.isRelationViaJoinTable, parameter[]], &&, binary_operation[binary_operation[call[m.getRelationNames, parameter[]], ==, literal[null]], ||, call[m.getRelationNames, parameter[]]]]] begin[{]
return[Cast(expression=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))]
else begin[{]
return[call[.setRelationEntities, parameter[member[.object], member[.client], member[.m]]]]
end[}]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[E] identifier[fetchObject] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[String] identifier[previousSkip] operator[=] literal[String] operator[+] operator[SEP] identifier[skipCounter] operator[-] Other[1] operator[SEP] operator[SEP] identifier[String] identifier[currentSkip] operator[=] literal[String] operator[+] identifier[skipCounter] operator[SEP] Keyword[int] identifier[indexOf] operator[=] identifier[q] operator[SEP] identifier[indexOf] operator[SEP] identifier[previousSkip] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[indexOf] operator[>] Other[0] operator[SEP] {
identifier[q] operator[SEP] identifier[replace] operator[SEP] identifier[indexOf] , identifier[indexOf] operator[+] identifier[previousSkip] operator[SEP] identifier[length] operator[SEP] operator[SEP] , identifier[currentSkip] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[skipCounter] operator[>] Other[0] operator[SEP] {
identifier[q] operator[SEP] identifier[append] operator[SEP] identifier[currentSkip] operator[SEP] operator[SEP]
}
identifier[client] operator[SEP] identifier[executeQueryAndGetResults] operator[SEP] identifier[q] , identifier[_id] , identifier[m] , identifier[results] , identifier[interpreter] operator[SEP] operator[SEP] identifier[skipCounter] operator[++] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] 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[KunderaException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[results] operator[!=] Other[null] operator[&&] operator[!] identifier[results] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[object] operator[=] identifier[results] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[results] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[m] operator[SEP] identifier[isRelationViaJoinTable] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[m] operator[SEP] identifier[getRelationNames] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] operator[SEP] identifier[m] operator[SEP] identifier[getRelationNames] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[E] operator[SEP] identifier[object] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[setRelationEntities] operator[SEP] identifier[object] , identifier[client] , identifier[m] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public Map<RaftGroupId, ICompletableFuture<Object>> shutdown() {
lock.writeLock().lock();
try {
Map<RaftGroupId, ICompletableFuture<Object>> futures = new HashMap<RaftGroupId, ICompletableFuture<Object>>();
for (Entry<RaftGroupId, SessionState> e : sessions.entrySet()) {
RaftGroupId groupId = e.getKey();
long sessionId = e.getValue().id;
ICompletableFuture<Object> f = closeSession(groupId, sessionId);
futures.put(groupId, f);
}
sessions.clear();
running = false;
return futures;
} finally {
lock.writeLock().unlock();
}
} | class class_name[name] begin[{]
method[shutdown, return_type[type[Map]], modifier[public], parameter[]] begin[{]
call[lock.writeLock, parameter[]]
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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RaftGroupId, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=ICompletableFuture, sub_type=None))], dimensions=None, name=HashMap, sub_type=None)), name=futures)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RaftGroupId, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=ICompletableFuture, sub_type=None))], dimensions=[], name=Map, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), name=groupId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RaftGroupId, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[MemberReference(member=id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), name=sessionId)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=groupId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=closeSession, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=f)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=ICompletableFuture, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=groupId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=futures, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=sessions, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RaftGroupId, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SessionState, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=sessions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=running, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), ReturnStatement(expression=MemberReference(member=futures, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeLock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Map] operator[<] identifier[RaftGroupId] , identifier[ICompletableFuture] operator[<] identifier[Object] operator[>] operator[>] identifier[shutdown] operator[SEP] operator[SEP] {
identifier[lock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Map] operator[<] identifier[RaftGroupId] , identifier[ICompletableFuture] operator[<] identifier[Object] operator[>] operator[>] identifier[futures] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[RaftGroupId] , identifier[ICompletableFuture] operator[<] identifier[Object] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[RaftGroupId] , identifier[SessionState] operator[>] identifier[e] operator[:] identifier[sessions] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[RaftGroupId] identifier[groupId] operator[=] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[sessionId] operator[=] identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] identifier[ICompletableFuture] operator[<] identifier[Object] operator[>] identifier[f] operator[=] identifier[closeSession] operator[SEP] identifier[groupId] , identifier[sessionId] operator[SEP] operator[SEP] identifier[futures] operator[SEP] identifier[put] operator[SEP] identifier[groupId] , identifier[f] operator[SEP] operator[SEP]
}
identifier[sessions] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[running] operator[=] literal[boolean] operator[SEP] Keyword[return] identifier[futures] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private Set<MethodIdentifier> findUnhandledProjectMethodIdentifiers(final List<Instruction> instructions, final Set<ProjectMethod> projectMethods) {
// find own methods
return instructions.stream().filter(i -> i.getType() == Instruction.InstructionType.INVOKE || i.getType() == Instruction.InstructionType.METHOD_HANDLE)
.map(i -> (InvokeInstruction) i).filter(this::isProjectMethod).map(InvokeInstruction::getIdentifier)
.filter(i -> projectMethods.stream().noneMatch(m -> m.matches(i)))
.collect(Collectors.toSet());
} | class class_name[name] begin[{]
method[findUnhandledProjectMethodIdentifiers, return_type[type[Set]], modifier[private], parameter[instructions, projectMethods]] begin[{]
return[call[instructions.stream, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[Set] operator[<] identifier[MethodIdentifier] operator[>] identifier[findUnhandledProjectMethodIdentifiers] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Instruction] operator[>] identifier[instructions] , Keyword[final] identifier[Set] operator[<] identifier[ProjectMethod] operator[>] identifier[projectMethods] operator[SEP] {
Keyword[return] identifier[instructions] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[i] operator[->] identifier[i] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[Instruction] operator[SEP] identifier[InstructionType] operator[SEP] identifier[INVOKE] operator[||] identifier[i] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[Instruction] operator[SEP] identifier[InstructionType] operator[SEP] identifier[METHOD_HANDLE] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[i] operator[->] operator[SEP] identifier[InvokeInstruction] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[filter] operator[SEP] Keyword[this] operator[::] identifier[isProjectMethod] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[InvokeInstruction] operator[::] identifier[getIdentifier] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[i] operator[->] identifier[projectMethods] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[noneMatch] operator[SEP] identifier[m] operator[->] identifier[m] operator[SEP] identifier[matches] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toSet] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void dumpCookies(Map<String, Cookie> cookiesMap, String maskKey) {
cookiesMap.forEach((key, cookie) -> {
if(!config.getRequestFilteredCookies().contains(cookie.getName())) {
List<Map<String, String>> cookieInfoList = new ArrayList<>();
//mask cookieValue
String cookieValue = config.isMaskEnabled() ? Mask.maskRegex(cookie.getValue(), maskKey, cookie.getName()) : cookie.getValue();
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_VALUE, cookieValue);}});
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_DOMAIN, cookie.getDomain());}});
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_PATH, cookie.getPath());}});
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_EXPIRES, cookie.getExpires() == null ? "" : cookie.getExpires().toString());}});
this.cookieMap.put(key, cookieInfoList);
}
});
} | class class_name[name] begin[{]
method[dumpCookies, return_type[void], modifier[private], parameter[cookiesMap, maskKey]] begin[{]
call[cookiesMap.forEach, parameter[LambdaExpression(body=[IfStatement(condition=MethodInvocation(arguments=[], member=getRequestFilteredCookies, postfix_operators=[], prefix_operators=['!'], qualifier=config, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[], type_arguments=None)], member=contains, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), name=cookieInfoList)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MethodInvocation(arguments=[], member=isMaskEnabled, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[], type_arguments=None), MemberReference(member=maskKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[], type_arguments=None)], member=maskRegex, postfix_operators=[], prefix_operators=[], qualifier=Mask, selectors=[], type_arguments=None)), name=cookieValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=COOKIE_VALUE, postfix_operators=[], prefix_operators=[], qualifier=DumpConstants, selectors=[]), MemberReference(member=cookieValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=cookieInfoList, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=COOKIE_DOMAIN, postfix_operators=[], prefix_operators=[], qualifier=DumpConstants, selectors=[]), MethodInvocation(arguments=[], member=getDomain, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=cookieInfoList, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=COOKIE_PATH, postfix_operators=[], prefix_operators=[], qualifier=DumpConstants, selectors=[]), MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=cookieInfoList, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=COOKIE_EXPIRES, postfix_operators=[], prefix_operators=[], qualifier=DumpConstants, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getExpires, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getExpires, postfix_operators=[], prefix_operators=[], qualifier=cookie, selectors=[MethodInvocation(arguments=[], member=toString, 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=""))], member=put, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=cookieInfoList, selectors=[], type_arguments=None), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=cookieMap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cookieInfoList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]))], parameters=[InferredFormalParameter(name=key), InferredFormalParameter(name=cookie)])]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[dumpCookies] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Cookie] operator[>] identifier[cookiesMap] , identifier[String] identifier[maskKey] operator[SEP] {
identifier[cookiesMap] operator[SEP] identifier[forEach] operator[SEP] operator[SEP] identifier[key] , identifier[cookie] operator[SEP] operator[->] {
Keyword[if] operator[SEP] operator[!] identifier[config] operator[SEP] identifier[getRequestFilteredCookies] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[cookie] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[cookieInfoList] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[cookieValue] operator[=] identifier[config] operator[SEP] identifier[isMaskEnabled] operator[SEP] operator[SEP] operator[?] identifier[Mask] operator[SEP] identifier[maskRegex] operator[SEP] identifier[cookie] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[maskKey] , identifier[cookie] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[cookie] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[cookieInfoList] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] {
{
identifier[put] operator[SEP] identifier[DumpConstants] operator[SEP] identifier[COOKIE_VALUE] , identifier[cookieValue] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[cookieInfoList] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] {
{
identifier[put] operator[SEP] identifier[DumpConstants] operator[SEP] identifier[COOKIE_DOMAIN] , identifier[cookie] operator[SEP] identifier[getDomain] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[cookieInfoList] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] {
{
identifier[put] operator[SEP] identifier[DumpConstants] operator[SEP] identifier[COOKIE_PATH] , identifier[cookie] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[cookieInfoList] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] {
{
identifier[put] operator[SEP] identifier[DumpConstants] operator[SEP] identifier[COOKIE_EXPIRES] , identifier[cookie] operator[SEP] identifier[getExpires] operator[SEP] operator[SEP] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[cookie] operator[SEP] identifier[getExpires] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[cookieMap] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[cookieInfoList] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static <B extends ConnectionConfiguration.Builder<B,?>> B setSSLv3AndTLSOnly(B builder) {
builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1, PROTO_SSL3 });
return builder;
} | class class_name[name] begin[{]
method[setSSLv3AndTLSOnly, return_type[type[B]], modifier[public static], parameter[builder]] begin[{]
call[builder.setEnabledSSLProtocols, parameter[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=PROTO_TLSV1_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PROTO_TLSV1_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PROTO_TLSV1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PROTO_SSL3, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]
return[member[.builder]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[B] Keyword[extends] identifier[ConnectionConfiguration] operator[SEP] identifier[Builder] operator[<] identifier[B] , operator[?] operator[>] operator[>] identifier[B] identifier[setSSLv3AndTLSOnly] operator[SEP] identifier[B] identifier[builder] operator[SEP] {
identifier[builder] operator[SEP] identifier[setEnabledSSLProtocols] operator[SEP] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[PROTO_TLSV1_2] , identifier[PROTO_TLSV1_1] , identifier[PROTO_TLSV1] , identifier[PROTO_SSL3]
} operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP]
}
|
@Override
public double rand() {
double out, x, y, r, z;
if (boxMuller != null) {
out = boxMuller.doubleValue();
boxMuller = null;
} else {
do {
x = Math.random(-1, 1);
y = Math.random(-1, 1);
r = x * x + y * y;
} while (r >= 1.0);
z = Math.sqrt(-2.0 * Math.log(r) / r);
boxMuller = new Double(x * z);
out = y * z;
}
return mu + sigma * out;
} | class class_name[name] begin[{]
method[rand, return_type[type[double]], modifier[public], parameter[]] begin[{]
local_variable[type[double], out]
if[binary_operation[member[.boxMuller], !=, literal[null]]] begin[{]
assign[member[.out], call[boxMuller.doubleValue, parameter[]]]
assign[member[.boxMuller], literal[null]]
else begin[{]
do[binary_operation[member[.r], >=, literal[1.0]]] begin[{]
assign[member[.x], call[Math.random, parameter[literal[1], literal[1]]]]
assign[member[.y], call[Math.random, parameter[literal[1], literal[1]]]]
assign[member[.r], binary_operation[binary_operation[member[.x], *, member[.x]], +, binary_operation[member[.y], *, member[.y]]]]
end[}]
assign[member[.z], call[Math.sqrt, parameter[binary_operation[binary_operation[literal[2.0], *, call[Math.log, parameter[member[.r]]]], /, member[.r]]]]]
assign[member[.boxMuller], ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=z, 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=Double, sub_type=None))]
assign[member[.out], binary_operation[member[.y], *, member[.z]]]
end[}]
return[binary_operation[member[.mu], +, binary_operation[member[.sigma], *, member[.out]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[rand] operator[SEP] operator[SEP] {
Keyword[double] identifier[out] , identifier[x] , identifier[y] , identifier[r] , identifier[z] operator[SEP] Keyword[if] operator[SEP] identifier[boxMuller] operator[!=] Other[null] operator[SEP] {
identifier[out] operator[=] identifier[boxMuller] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] identifier[boxMuller] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[do] {
identifier[x] operator[=] identifier[Math] operator[SEP] identifier[random] operator[SEP] operator[-] Other[1] , Other[1] operator[SEP] operator[SEP] identifier[y] operator[=] identifier[Math] operator[SEP] identifier[random] operator[SEP] operator[-] Other[1] , Other[1] operator[SEP] operator[SEP] identifier[r] operator[=] identifier[x] operator[*] identifier[x] operator[+] identifier[y] operator[*] identifier[y] operator[SEP]
}
Keyword[while] operator[SEP] identifier[r] operator[>=] literal[Float] operator[SEP] operator[SEP] identifier[z] operator[=] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] operator[-] literal[Float] operator[*] identifier[Math] operator[SEP] identifier[log] operator[SEP] identifier[r] operator[SEP] operator[/] identifier[r] operator[SEP] operator[SEP] identifier[boxMuller] operator[=] Keyword[new] identifier[Double] operator[SEP] identifier[x] operator[*] identifier[z] operator[SEP] operator[SEP] identifier[out] operator[=] identifier[y] operator[*] identifier[z] operator[SEP]
}
Keyword[return] identifier[mu] operator[+] identifier[sigma] operator[*] identifier[out] operator[SEP]
}
|
private void maybeEvictFilesInCacheDir() throws IOException {
synchronized (mLock) {
boolean calculatedRightNow = maybeUpdateFileCacheSize();
// Update the size limit (mCacheSizeLimit)
updateFileCacheSizeLimit();
long cacheSize = mCacheStats.getSize();
// If we are going to evict force a recalculation of the size
// (except if it was already calculated!)
if (cacheSize > mCacheSizeLimit && !calculatedRightNow) {
mCacheStats.reset();
maybeUpdateFileCacheSize();
}
// If size has exceeded the size limit, evict some files
if (cacheSize > mCacheSizeLimit) {
evictAboveSize(
mCacheSizeLimit * 9 / 10,
CacheEventListener.EvictionReason.CACHE_FULL); // 90%
}
}
} | class class_name[name] begin[{]
method[maybeEvictFilesInCacheDir, return_type[void], modifier[private], parameter[]] begin[{]
SYNCHRONIZED[member[.mLock]] BEGIN[{]
local_variable[type[boolean], calculatedRightNow]
call[.updateFileCacheSizeLimit, parameter[]]
local_variable[type[long], cacheSize]
if[binary_operation[binary_operation[member[.cacheSize], >, member[.mCacheSizeLimit]], &&, member[.calculatedRightNow]]] begin[{]
call[mCacheStats.reset, parameter[]]
call[.maybeUpdateFileCacheSize, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.cacheSize], >, member[.mCacheSizeLimit]]] begin[{]
call[.evictAboveSize, parameter[binary_operation[binary_operation[member[.mCacheSizeLimit], *, literal[9]], /, literal[10]], member[CacheEventListener.EvictionReason.CACHE_FULL]]]
else begin[{]
None
end[}]
END[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[maybeEvictFilesInCacheDir] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[synchronized] operator[SEP] identifier[mLock] operator[SEP] {
Keyword[boolean] identifier[calculatedRightNow] operator[=] identifier[maybeUpdateFileCacheSize] operator[SEP] operator[SEP] operator[SEP] identifier[updateFileCacheSizeLimit] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[cacheSize] operator[=] identifier[mCacheStats] operator[SEP] identifier[getSize] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cacheSize] operator[>] identifier[mCacheSizeLimit] operator[&&] operator[!] identifier[calculatedRightNow] operator[SEP] {
identifier[mCacheStats] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[maybeUpdateFileCacheSize] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[cacheSize] operator[>] identifier[mCacheSizeLimit] operator[SEP] {
identifier[evictAboveSize] operator[SEP] identifier[mCacheSizeLimit] operator[*] Other[9] operator[/] Other[10] , identifier[CacheEventListener] operator[SEP] identifier[EvictionReason] operator[SEP] identifier[CACHE_FULL] operator[SEP] operator[SEP]
}
}
}
|
@Override
public boolean contains(final String path) throws IllegalArgumentException {
Validate.notNull(path, "Path must be specified");
return this.contains(ArchivePaths.create(path));
} | class class_name[name] begin[{]
method[contains, return_type[type[boolean]], modifier[public], parameter[path]] begin[{]
call[Validate.notNull, parameter[member[.path], literal["Path must be specified"]]]
return[THIS[call[None.contains, parameter[call[ArchivePaths.create, parameter[member[.path]]]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[contains] operator[SEP] Keyword[final] identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[path] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[contains] operator[SEP] identifier[ArchivePaths] operator[SEP] identifier[create] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public MemoryWorkspace getAndActivateWorkspace(@NonNull WorkspaceConfiguration configuration, @NonNull String id) {
return getWorkspaceForCurrentThread(configuration, id).notifyScopeEntered();
} | class class_name[name] begin[{]
method[getAndActivateWorkspace, return_type[type[MemoryWorkspace]], modifier[public], parameter[configuration, id]] begin[{]
return[call[.getWorkspaceForCurrentThread, parameter[member[.configuration], member[.id]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[MemoryWorkspace] identifier[getAndActivateWorkspace] operator[SEP] annotation[@] identifier[NonNull] identifier[WorkspaceConfiguration] identifier[configuration] , annotation[@] identifier[NonNull] identifier[String] identifier[id] operator[SEP] {
Keyword[return] identifier[getWorkspaceForCurrentThread] operator[SEP] identifier[configuration] , identifier[id] operator[SEP] operator[SEP] identifier[notifyScopeEntered] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<String> getValueList() {
if (tokensList == null) {
return null;
}
if (tokensList.isEmpty()) {
return new ArrayList<>();
} else {
List<String> list = new ArrayList<>(tokensList.size());
for (Token[] tokens : tokensList) {
list.add(TokenParser.toString(tokens));
}
return list;
}
} | class class_name[name] begin[{]
method[getValueList, return_type[type[List]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.tokensList], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[call[tokensList.isEmpty, parameter[]]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
local_variable[type[List], list]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=tokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=TokenParser, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=tokensList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tokens)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Token, sub_type=None))), label=None)
return[member[.list]]
end[}]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getValueList] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tokensList] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[tokensList] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[List] operator[<] identifier[String] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[tokensList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Token] operator[SEP] operator[SEP] identifier[tokens] operator[:] identifier[tokensList] operator[SEP] {
identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[TokenParser] operator[SEP] identifier[toString] operator[SEP] identifier[tokens] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
}
|
public static double[] normalize(final double[] values) {
final double sum = 1.0/DoubleAdder.sum(values);
for (int i = values.length; --i >= 0;) {
values[i] = values[i]*sum;
}
return values;
} | class class_name[name] begin[{]
method[normalize, return_type[type[double]], modifier[public static], parameter[values]] begin[{]
local_variable[type[double], sum]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=None), label=None)
return[member[.values]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] operator[SEP] operator[SEP] identifier[normalize] operator[SEP] Keyword[final] Keyword[double] operator[SEP] operator[SEP] identifier[values] operator[SEP] {
Keyword[final] Keyword[double] identifier[sum] operator[=] literal[Float] operator[/] identifier[DoubleAdder] operator[SEP] identifier[sum] operator[SEP] identifier[values] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[values] operator[SEP] identifier[length] operator[SEP] operator[--] identifier[i] operator[>=] Other[0] operator[SEP] operator[SEP] {
identifier[values] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[*] identifier[sum] operator[SEP]
}
Keyword[return] identifier[values] operator[SEP]
}
|
public IndexOutOfBoundsException asJDKException() {
IndexOutOfBoundsException e = new IndexOutOfBoundsException(getMessage()) {
@Override
public synchronized Throwable fillInStackTrace() {
return this;
}
};
e.setStackTrace(getStackTrace());
return e;
} | class class_name[name] begin[{]
method[asJDKException, return_type[type[IndexOutOfBoundsException]], modifier[public], parameter[]] begin[{]
local_variable[type[IndexOutOfBoundsException], e]
call[e.setStackTrace, parameter[call[.getStackTrace, parameter[]]]]
return[member[.e]]
end[}]
END[}] | Keyword[public] identifier[IndexOutOfBoundsException] identifier[asJDKException] operator[SEP] operator[SEP] {
identifier[IndexOutOfBoundsException] identifier[e] operator[=] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] identifier[Throwable] identifier[fillInStackTrace] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
} operator[SEP] identifier[e] operator[SEP] identifier[setStackTrace] operator[SEP] identifier[getStackTrace] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP]
}
|
public static double copySign(double magnitude, double sign) {
return Double.longBitsToDouble((Double.doubleToRawLongBits(sign) &
(DoubleConsts.SIGN_BIT_MASK)) |
(Double.doubleToRawLongBits(magnitude) &
(DoubleConsts.EXP_BIT_MASK |
DoubleConsts.SIGNIF_BIT_MASK)));
} | class class_name[name] begin[{]
method[copySign, return_type[type[double]], modifier[public static], parameter[magnitude, sign]] begin[{]
return[call[Double.longBitsToDouble, parameter[binary_operation[binary_operation[call[Double.doubleToRawLongBits, parameter[member[.sign]]], &, member[DoubleConsts.SIGN_BIT_MASK]], |, binary_operation[call[Double.doubleToRawLongBits, parameter[member[.magnitude]]], &, binary_operation[member[DoubleConsts.EXP_BIT_MASK], |, member[DoubleConsts.SIGNIF_BIT_MASK]]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[copySign] operator[SEP] Keyword[double] identifier[magnitude] , Keyword[double] identifier[sign] operator[SEP] {
Keyword[return] identifier[Double] operator[SEP] identifier[longBitsToDouble] operator[SEP] operator[SEP] identifier[Double] operator[SEP] identifier[doubleToRawLongBits] operator[SEP] identifier[sign] operator[SEP] operator[&] operator[SEP] identifier[DoubleConsts] operator[SEP] identifier[SIGN_BIT_MASK] operator[SEP] operator[SEP] operator[|] operator[SEP] identifier[Double] operator[SEP] identifier[doubleToRawLongBits] operator[SEP] identifier[magnitude] operator[SEP] operator[&] operator[SEP] identifier[DoubleConsts] operator[SEP] identifier[EXP_BIT_MASK] operator[|] identifier[DoubleConsts] operator[SEP] identifier[SIGNIF_BIT_MASK] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean resetLimit(String key) {
IMap<Object, Object> map = hz.getMap(key);
if (map == null || map.isEmpty()) {
return false;
}
map.clear();
map.destroy();
return true;
} | class class_name[name] begin[{]
method[resetLimit, return_type[type[boolean]], modifier[public], parameter[key]] begin[{]
local_variable[type[IMap], map]
if[binary_operation[binary_operation[member[.map], ==, literal[null]], ||, call[map.isEmpty, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
call[map.clear, parameter[]]
call[map.destroy, parameter[]]
return[literal[true]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[resetLimit] operator[SEP] identifier[String] identifier[key] operator[SEP] {
identifier[IMap] operator[<] identifier[Object] , identifier[Object] operator[>] identifier[map] operator[=] identifier[hz] operator[SEP] identifier[getMap] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[map] operator[==] Other[null] operator[||] identifier[map] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[map] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
@Pure
<CT extends RoadConnection> CT getEndPoint(Class<CT> connectionClass) {
final StandardRoadConnection connection = this.lastConnection;
if (connection == null) {
return null;
}
if (connectionClass.isAssignableFrom(StandardRoadConnection.class)) {
return connectionClass.cast(connection);
}
if (connectionClass.isAssignableFrom(RoadConnectionWithArrivalSegment.class)) {
return connectionClass.cast(new RoadConnectionWithArrivalSegment(connection, this, false));
}
throw new IllegalArgumentException("unsupported RoadConnection class"); //$NON-NLS-1$
} | class class_name[name] begin[{]
method[getEndPoint, return_type[type[CT]], modifier[default], parameter[connectionClass]] begin[{]
local_variable[type[StandardRoadConnection], connection]
if[binary_operation[member[.connection], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[call[connectionClass.isAssignableFrom, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StandardRoadConnection, sub_type=None))]]] begin[{]
return[call[connectionClass.cast, parameter[member[.connection]]]]
else begin[{]
None
end[}]
if[call[connectionClass.isAssignableFrom, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RoadConnectionWithArrivalSegment, sub_type=None))]]] begin[{]
return[call[connectionClass.cast, parameter[ClassCreator(arguments=[MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RoadConnectionWithArrivalSegment, sub_type=None))]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unsupported RoadConnection class")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
END[}] | annotation[@] identifier[Pure] operator[<] identifier[CT] Keyword[extends] identifier[RoadConnection] operator[>] identifier[CT] identifier[getEndPoint] operator[SEP] identifier[Class] operator[<] identifier[CT] operator[>] identifier[connectionClass] operator[SEP] {
Keyword[final] identifier[StandardRoadConnection] identifier[connection] operator[=] Keyword[this] operator[SEP] identifier[lastConnection] operator[SEP] Keyword[if] operator[SEP] identifier[connection] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[connectionClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[StandardRoadConnection] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
Keyword[return] identifier[connectionClass] operator[SEP] identifier[cast] operator[SEP] identifier[connection] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[connectionClass] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[RoadConnectionWithArrivalSegment] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
Keyword[return] identifier[connectionClass] operator[SEP] identifier[cast] operator[SEP] Keyword[new] identifier[RoadConnectionWithArrivalSegment] operator[SEP] identifier[connection] , Keyword[this] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@Override
public InitiateDeviceClaimResult initiateDeviceClaim(InitiateDeviceClaimRequest request) {
request = beforeClientExecution(request);
return executeInitiateDeviceClaim(request);
} | class class_name[name] begin[{]
method[initiateDeviceClaim, return_type[type[InitiateDeviceClaimResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeInitiateDeviceClaim, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[InitiateDeviceClaimResult] identifier[initiateDeviceClaim] operator[SEP] identifier[InitiateDeviceClaimRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeInitiateDeviceClaim] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected ActionMapping createActionMapping(ComponentDef actionDef) {
final String actionName = buildActionName(actionDef);
verifyPackageConvention(actionDef, actionName);
final ActionMapping mapping = newActionMapping(actionDef, actionName, comeOnAdjustmentProvider());
setupMethod(mapping);
return mapping;
} | class class_name[name] begin[{]
method[createActionMapping, return_type[type[ActionMapping]], modifier[protected], parameter[actionDef]] begin[{]
local_variable[type[String], actionName]
call[.verifyPackageConvention, parameter[member[.actionDef], member[.actionName]]]
local_variable[type[ActionMapping], mapping]
call[.setupMethod, parameter[member[.mapping]]]
return[member[.mapping]]
end[}]
END[}] | Keyword[protected] identifier[ActionMapping] identifier[createActionMapping] operator[SEP] identifier[ComponentDef] identifier[actionDef] operator[SEP] {
Keyword[final] identifier[String] identifier[actionName] operator[=] identifier[buildActionName] operator[SEP] identifier[actionDef] operator[SEP] operator[SEP] identifier[verifyPackageConvention] operator[SEP] identifier[actionDef] , identifier[actionName] operator[SEP] operator[SEP] Keyword[final] identifier[ActionMapping] identifier[mapping] operator[=] identifier[newActionMapping] operator[SEP] identifier[actionDef] , identifier[actionName] , identifier[comeOnAdjustmentProvider] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setupMethod] operator[SEP] identifier[mapping] operator[SEP] operator[SEP] Keyword[return] identifier[mapping] operator[SEP]
}
|
final void putAttributes(
final SymbolTable symbolTable,
final byte[] code,
final int codeLength,
final int maxStack,
final int maxLocals,
final ByteVector output) {
final ClassWriter classWriter = symbolTable.classWriter;
Attribute attribute = this;
while (attribute != null) {
ByteVector attributeContent =
attribute.write(classWriter, code, codeLength, maxStack, maxLocals);
// Put attribute_name_index and attribute_length.
output.putShort(symbolTable.addConstantUtf8(attribute.type)).putInt(attributeContent.length);
output.putByteArray(attributeContent.data, 0, attributeContent.length);
attribute = attribute.nextAttribute;
}
} | class class_name[name] begin[{]
method[putAttributes, return_type[void], modifier[final], parameter[symbolTable, code, codeLength, maxStack, maxLocals, output]] begin[{]
local_variable[type[ClassWriter], classWriter]
local_variable[type[Attribute], attribute]
while[binary_operation[member[.attribute], !=, literal[null]]] begin[{]
local_variable[type[ByteVector], attributeContent]
call[output.putShort, parameter[call[symbolTable.addConstantUtf8, parameter[member[attribute.type]]]]]
call[output.putByteArray, parameter[member[attributeContent.data], literal[0], member[attributeContent.length]]]
assign[member[.attribute], member[attribute.nextAttribute]]
end[}]
end[}]
END[}] | Keyword[final] Keyword[void] identifier[putAttributes] operator[SEP] Keyword[final] identifier[SymbolTable] identifier[symbolTable] , Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[code] , Keyword[final] Keyword[int] identifier[codeLength] , Keyword[final] Keyword[int] identifier[maxStack] , Keyword[final] Keyword[int] identifier[maxLocals] , Keyword[final] identifier[ByteVector] identifier[output] operator[SEP] {
Keyword[final] identifier[ClassWriter] identifier[classWriter] operator[=] identifier[symbolTable] operator[SEP] identifier[classWriter] operator[SEP] identifier[Attribute] identifier[attribute] operator[=] Keyword[this] operator[SEP] Keyword[while] operator[SEP] identifier[attribute] operator[!=] Other[null] operator[SEP] {
identifier[ByteVector] identifier[attributeContent] operator[=] identifier[attribute] operator[SEP] identifier[write] operator[SEP] identifier[classWriter] , identifier[code] , identifier[codeLength] , identifier[maxStack] , identifier[maxLocals] operator[SEP] operator[SEP] identifier[output] operator[SEP] identifier[putShort] operator[SEP] identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[attribute] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] identifier[putInt] operator[SEP] identifier[attributeContent] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[output] operator[SEP] identifier[putByteArray] operator[SEP] identifier[attributeContent] operator[SEP] identifier[data] , Other[0] , identifier[attributeContent] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[attribute] operator[=] identifier[attribute] operator[SEP] identifier[nextAttribute] operator[SEP]
}
}
|
public final void mLESSER() throws RecognitionException {
try {
int _type = LESSER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/riemann/Query.g:12:8: ( '<' )
// src/riemann/Query.g:12:10: '<'
{
match('<');
}
state.type = _type;
state.channel = _channel;
}
finally {
}
} | class class_name[name] begin[{]
method[mLESSER, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=LESSER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_type)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=DEFAULT_TOKEN_CHANNEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_channel)], modifiers=set(), type=BasicType(dimensions=[], name=int)), BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='<')], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=None, finally_block=[], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[mLESSER] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[try] {
Keyword[int] identifier[_type] operator[=] identifier[LESSER] operator[SEP] Keyword[int] identifier[_channel] operator[=] identifier[DEFAULT_TOKEN_CHANNEL] operator[SEP] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[state] operator[SEP] identifier[type] operator[=] identifier[_type] operator[SEP] identifier[state] operator[SEP] identifier[channel] operator[=] identifier[_channel] operator[SEP]
}
Keyword[finally] {
}
}
|
public void set(T value, int m, int n)
{
if ( isComplex() )
{
throw new IllegalStateException("Cannot use this method for Complex matrices");
}
setReal(value, m, n);
} | class class_name[name] begin[{]
method[set, return_type[void], modifier[public], parameter[value, m, n]] begin[{]
if[call[.isComplex, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot use this method for Complex matrices")], 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[.setReal, parameter[member[.value], member[.m], member[.n]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[set] operator[SEP] identifier[T] identifier[value] , Keyword[int] identifier[m] , Keyword[int] identifier[n] operator[SEP] {
Keyword[if] operator[SEP] identifier[isComplex] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[setReal] operator[SEP] identifier[value] , identifier[m] , identifier[n] operator[SEP] operator[SEP]
}
|
protected void readDirTabs(FontFileReader in) throws IOException {
in.skip(4); // TTF_FIXED_SIZE
int ntabs = in.readTTFUShort();
in.skip(6); // 3xTTF_USHORT_SIZE
dirTabs = new java.util.HashMap();
TTFDirTabEntry[] pd = new TTFDirTabEntry[ntabs];
log.debug("Reading " + ntabs + " dir tables");
for (int i = 0; i < ntabs; i++) {
pd[i] = new TTFDirTabEntry();
dirTabs.put(pd[i].read(in), pd[i]);
}
log.debug("dir tables: " + dirTabs.keySet());
} | class class_name[name] begin[{]
method[readDirTabs, return_type[void], modifier[protected], parameter[in]] begin[{]
call[in.skip, parameter[literal[4]]]
local_variable[type[int], ntabs]
call[in.skip, parameter[literal[6]]]
assign[member[.dirTabs], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=None, dimensions=None, name=HashMap, sub_type=None))))]
local_variable[type[TTFDirTabEntry], pd]
call[log.debug, parameter[binary_operation[binary_operation[literal["Reading "], +, member[.ntabs]], +, literal[" dir tables"]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=pd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TTFDirTabEntry, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), MemberReference(member=pd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=put, postfix_operators=[], prefix_operators=[], qualifier=dirTabs, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ntabs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[log.debug, parameter[binary_operation[literal["dir tables: "], +, call[dirTabs.keySet, parameter[]]]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[readDirTabs] operator[SEP] identifier[FontFileReader] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[in] operator[SEP] identifier[skip] operator[SEP] Other[4] operator[SEP] operator[SEP] Keyword[int] identifier[ntabs] operator[=] identifier[in] operator[SEP] identifier[readTTFUShort] operator[SEP] operator[SEP] operator[SEP] identifier[in] operator[SEP] identifier[skip] operator[SEP] Other[6] operator[SEP] operator[SEP] identifier[dirTabs] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[HashMap] operator[SEP] operator[SEP] operator[SEP] identifier[TTFDirTabEntry] operator[SEP] operator[SEP] identifier[pd] operator[=] Keyword[new] identifier[TTFDirTabEntry] operator[SEP] identifier[ntabs] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[ntabs] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[ntabs] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[pd] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[TTFDirTabEntry] operator[SEP] operator[SEP] operator[SEP] identifier[dirTabs] operator[SEP] identifier[put] operator[SEP] identifier[pd] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[read] operator[SEP] identifier[in] operator[SEP] , identifier[pd] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[dirTabs] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void engage(final String vendor, final String interaction, final String interactionId, final String eventName, final String data, final Map<String, Object> customData, final ExtendedData... extendedData) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
return EngagementModule.engage(getActivity(), conversation, vendor, interaction, interactionId, eventName, data, customData, extendedData);
}
}, "engage");
} | class class_name[name] begin[{]
method[engage, return_type[void], modifier[public], parameter[vendor, interaction, interactionId, eventName, data, customData, extendedData]] begin[{]
call[.dispatchConversationTask, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getActivity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=conversation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=vendor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=interaction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=interactionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=eventName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=customData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=extendedData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=engage, postfix_operators=[], prefix_operators=[], qualifier=EngagementModule, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'protected'}, name=execute, parameters=[FormalParameter(annotations=[], modifiers=set(), name=conversation, type=ReferenceType(arguments=None, dimensions=[], name=Conversation, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConversationDispatchTask, sub_type=None)), literal["engage"]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[engage] operator[SEP] Keyword[final] identifier[String] identifier[vendor] , Keyword[final] identifier[String] identifier[interaction] , Keyword[final] identifier[String] identifier[interactionId] , Keyword[final] identifier[String] identifier[eventName] , Keyword[final] identifier[String] identifier[data] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[customData] , Keyword[final] identifier[ExtendedData] operator[...] identifier[extendedData] operator[SEP] {
identifier[dispatchConversationTask] operator[SEP] Keyword[new] identifier[ConversationDispatchTask] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] Keyword[boolean] identifier[execute] operator[SEP] identifier[Conversation] identifier[conversation] operator[SEP] {
Keyword[return] identifier[EngagementModule] operator[SEP] identifier[engage] operator[SEP] identifier[getActivity] operator[SEP] operator[SEP] , identifier[conversation] , identifier[vendor] , identifier[interaction] , identifier[interactionId] , identifier[eventName] , identifier[data] , identifier[customData] , identifier[extendedData] operator[SEP] operator[SEP]
}
} , literal[String] operator[SEP] operator[SEP]
}
|
public String toTempFile() throws IOException {
File file = File.createTempFile(UUID.randomUUID().toString(), ".binary.tmp");
file.deleteOnExit();
toFile(file);
return file.getAbsolutePath();
} | class class_name[name] begin[{]
method[toTempFile, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[File], file]
call[file.deleteOnExit, parameter[]]
call[.toFile, parameter[member[.file]]]
return[call[file.getAbsolutePath, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[toTempFile] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[File] identifier[file] operator[=] identifier[File] operator[SEP] identifier[createTempFile] operator[SEP] identifier[UUID] operator[SEP] identifier[randomUUID] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[file] operator[SEP] identifier[deleteOnExit] operator[SEP] operator[SEP] operator[SEP] identifier[toFile] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[return] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP]
}
|
@Nullable
public static Class <?> getImplementationClassOfLocalName (@Nullable final String sLocalName)
{
final EUBLTRDocumentType eDocType = getDocumentTypeOfLocalName (sLocalName);
return eDocType == null ? null : eDocType.getImplementationClass ();
} | class class_name[name] begin[{]
method[getImplementationClassOfLocalName, return_type[type[Class]], modifier[public static], parameter[sLocalName]] begin[{]
local_variable[type[EUBLTRDocumentType], eDocType]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=eDocType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getImplementationClass, postfix_operators=[], prefix_operators=[], qualifier=eDocType, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[Class] operator[<] operator[?] operator[>] identifier[getImplementationClassOfLocalName] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[sLocalName] operator[SEP] {
Keyword[final] identifier[EUBLTRDocumentType] identifier[eDocType] operator[=] identifier[getDocumentTypeOfLocalName] operator[SEP] identifier[sLocalName] operator[SEP] operator[SEP] Keyword[return] identifier[eDocType] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[eDocType] operator[SEP] identifier[getImplementationClass] operator[SEP] operator[SEP] operator[SEP]
}
|
public ReadDocumentResponse readDocument(ReadDocumentRequest request) {
checkNotNull(request, "request should not be null.");
checkNotNull(request.getDocumentId(), "documentId should not be null.");
InternalRequest internalRequest = this.createRequest(
HttpMethodName.GET, request, DOC, request.getDocumentId());
internalRequest.addParameter("read", null);
ReadDocumentResponse response;
try {
response = this.invokeHttpClient(internalRequest, ReadDocumentResponse.class);
} finally {
try {
internalRequest.getContent().close();
} catch (Exception e) {
// ignore exception
}
}
return response;
} | class class_name[name] begin[{]
method[readDocument, return_type[type[ReadDocumentResponse]], modifier[public], parameter[request]] begin[{]
call[.checkNotNull, parameter[member[.request], literal["request should not be null."]]]
call[.checkNotNull, parameter[call[request.getDocumentId, parameter[]], literal["documentId should not be null."]]]
local_variable[type[InternalRequest], internalRequest]
call[internalRequest.addParameter, parameter[literal["read"], literal[null]]]
local_variable[type[ReadDocumentResponse], response]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=internalRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ReadDocumentResponse, sub_type=None))], member=invokeHttpClient, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)], catches=None, finally_block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getContent, postfix_operators=[], prefix_operators=[], qualifier=internalRequest, selectors=[MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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)], label=None, resources=None)
return[member[.response]]
end[}]
END[}] | Keyword[public] identifier[ReadDocumentResponse] identifier[readDocument] operator[SEP] identifier[ReadDocumentRequest] identifier[request] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[request] , literal[String] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[request] operator[SEP] identifier[getDocumentId] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[InternalRequest] identifier[internalRequest] operator[=] Keyword[this] operator[SEP] identifier[createRequest] operator[SEP] identifier[HttpMethodName] operator[SEP] identifier[GET] , identifier[request] , identifier[DOC] , identifier[request] operator[SEP] identifier[getDocumentId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , Other[null] operator[SEP] operator[SEP] identifier[ReadDocumentResponse] identifier[response] operator[SEP] Keyword[try] {
identifier[response] operator[=] Keyword[this] operator[SEP] identifier[invokeHttpClient] operator[SEP] identifier[internalRequest] , identifier[ReadDocumentResponse] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
identifier[internalRequest] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
Keyword[return] identifier[response] operator[SEP]
}
|
public static Constraint moreControllerThanParticipant()
{
return new ConstraintAdapter(1)
{
PathAccessor partConv = new PathAccessor("PhysicalEntity/participantOf:Conversion");
PathAccessor partCompAss = new PathAccessor("PhysicalEntity/participantOf:ComplexAssembly");
PathAccessor effects = new PathAccessor("PhysicalEntity/controllerOf/controlled*:Conversion");
@Override
public boolean satisfies(Match match, int... ind)
{
PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]);
int partCnvCnt = partConv.getValueFromBean(pe).size();
int partCACnt = partCompAss.getValueFromBean(pe).size();
int effCnt = effects.getValueFromBean(pe).size();
return (partCnvCnt - partCACnt) <= effCnt;
}
};
} | class class_name[name] begin[{]
method[moreControllerThanParticipant, return_type[type[Constraint]], modifier[public static], parameter[]] begin[{]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PhysicalEntity/participantOf:Conversion")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PathAccessor, sub_type=None)), name=partConv)], documentation=None, modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PathAccessor, sub_type=None)), FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PhysicalEntity/participantOf:ComplexAssembly")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PathAccessor, sub_type=None)), name=partCompAss)], documentation=None, modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PathAccessor, sub_type=None)), FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PhysicalEntity/controllerOf/controlled*:Conversion")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PathAccessor, sub_type=None)), name=effects)], documentation=None, modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PathAccessor, sub_type=None)), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=ind, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], member=get, postfix_operators=[], prefix_operators=[], qualifier=match, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=PhysicalEntity, sub_type=None)), name=pe)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PhysicalEntity, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=pe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getValueFromBean, postfix_operators=[], prefix_operators=[], qualifier=partConv, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=partCnvCnt)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=pe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getValueFromBean, postfix_operators=[], prefix_operators=[], qualifier=partCompAss, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=partCACnt)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=pe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getValueFromBean, postfix_operators=[], prefix_operators=[], qualifier=effects, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=effCnt)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=partCnvCnt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=partCACnt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=effCnt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), label=None)], documentation=None, modifiers={'public'}, name=satisfies, parameters=[FormalParameter(annotations=[], modifiers=set(), name=match, type=ReferenceType(arguments=None, dimensions=[], name=Match, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=ind, type=BasicType(dimensions=[], name=int), varargs=True)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstraintAdapter, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Constraint] identifier[moreControllerThanParticipant] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[ConstraintAdapter] operator[SEP] Other[1] operator[SEP] {
identifier[PathAccessor] identifier[partConv] operator[=] Keyword[new] identifier[PathAccessor] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[PathAccessor] identifier[partCompAss] operator[=] Keyword[new] identifier[PathAccessor] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[PathAccessor] identifier[effects] operator[=] Keyword[new] identifier[PathAccessor] operator[SEP] literal[String] operator[SEP] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[satisfies] operator[SEP] identifier[Match] identifier[match] , Keyword[int] operator[...] identifier[ind] operator[SEP] {
identifier[PhysicalEntity] identifier[pe] operator[=] operator[SEP] identifier[PhysicalEntity] operator[SEP] identifier[match] operator[SEP] identifier[get] operator[SEP] identifier[ind] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[partCnvCnt] operator[=] identifier[partConv] operator[SEP] identifier[getValueFromBean] operator[SEP] identifier[pe] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[partCACnt] operator[=] identifier[partCompAss] operator[SEP] identifier[getValueFromBean] operator[SEP] identifier[pe] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[effCnt] operator[=] identifier[effects] operator[SEP] identifier[getValueFromBean] operator[SEP] identifier[pe] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[partCnvCnt] operator[-] identifier[partCACnt] operator[SEP] operator[<=] identifier[effCnt] operator[SEP]
}
} operator[SEP]
}
|
public ProcessorConfiguration createConfiguration(final CCTask task, final LinkType linkType,
final ProcessorDef baseDef, final TargetDef targetPlatform, final VersionInfo versionInfo) {
if (isReference()) {
return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).createConfiguration(task, linkType,
baseDef, targetPlatform, versionInfo);
}
final ProcessorDef[] defaultProviders = getDefaultProviders(baseDef);
final Processor proc = getProcessor(linkType);
return proc.createConfiguration(task, linkType, defaultProviders, this, targetPlatform, versionInfo);
} | class class_name[name] begin[{]
method[createConfiguration, return_type[type[ProcessorConfiguration]], modifier[public], parameter[task, linkType, baseDef, targetPlatform, versionInfo]] begin[{]
if[call[.isReference, parameter[]]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ProcessorDef, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ProcessorDef")], member=getCheckedRef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ProcessorDef, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[ProcessorDef], defaultProviders]
local_variable[type[Processor], proc]
return[call[proc.createConfiguration, parameter[member[.task], member[.linkType], member[.defaultProviders], THIS[], member[.targetPlatform], member[.versionInfo]]]]
end[}]
END[}] | Keyword[public] identifier[ProcessorConfiguration] identifier[createConfiguration] operator[SEP] Keyword[final] identifier[CCTask] identifier[task] , Keyword[final] identifier[LinkType] identifier[linkType] , Keyword[final] identifier[ProcessorDef] identifier[baseDef] , Keyword[final] identifier[TargetDef] identifier[targetPlatform] , Keyword[final] identifier[VersionInfo] identifier[versionInfo] operator[SEP] {
Keyword[if] operator[SEP] identifier[isReference] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[ProcessorDef] operator[SEP] identifier[getCheckedRef] operator[SEP] identifier[ProcessorDef] operator[SEP] Keyword[class] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[createConfiguration] operator[SEP] identifier[task] , identifier[linkType] , identifier[baseDef] , identifier[targetPlatform] , identifier[versionInfo] operator[SEP] operator[SEP]
}
Keyword[final] identifier[ProcessorDef] operator[SEP] operator[SEP] identifier[defaultProviders] operator[=] identifier[getDefaultProviders] operator[SEP] identifier[baseDef] operator[SEP] operator[SEP] Keyword[final] identifier[Processor] identifier[proc] operator[=] identifier[getProcessor] operator[SEP] identifier[linkType] operator[SEP] operator[SEP] Keyword[return] identifier[proc] operator[SEP] identifier[createConfiguration] operator[SEP] identifier[task] , identifier[linkType] , identifier[defaultProviders] , Keyword[this] , identifier[targetPlatform] , identifier[versionInfo] operator[SEP] operator[SEP]
}
|
protected static int createHardLinkMult(File parentDir,
String[] fileBaseNames, File linkDir, int maxLength)
throws IOException {
if (parentDir == null) {
throw new IOException(
"invalid arguments to createHardLinkMult: parent directory is null");
}
if (linkDir == null) {
throw new IOException(
"invalid arguments to createHardLinkMult: link directory is null");
}
if (fileBaseNames == null) {
throw new IOException(
"invalid arguments to createHardLinkMult: "
+ "filename list can be empty but not null");
}
if (fileBaseNames.length == 0) {
//the OS cmds can't handle empty list of filenames,
//but it's legal, so just return.
return 0;
}
if (!linkDir.exists()) {
throw new FileNotFoundException(linkDir + " not found.");
}
//if the list is too long, split into multiple invocations
int callCount = 0;
if (getLinkMultArgLength(parentDir, fileBaseNames, linkDir) > maxLength
&& fileBaseNames.length > 1) {
String[] list1 = Arrays.copyOf(fileBaseNames, fileBaseNames.length/2);
callCount += createHardLinkMult(parentDir, list1, linkDir, maxLength);
String[] list2 = Arrays.copyOfRange(fileBaseNames, fileBaseNames.length/2,
fileBaseNames.length);
callCount += createHardLinkMult(parentDir, list2, linkDir, maxLength);
return callCount;
} else {
callCount = 1;
}
// construct and execute shell command
String[] hardLinkCommand = getHardLinkCommand.linkMult(fileBaseNames,
linkDir);
Process process = Runtime.getRuntime().exec(hardLinkCommand, null,
parentDir);
try {
if (process.waitFor() != 0) {
String errMsg = new BufferedReader(new InputStreamReader(
process.getInputStream())).readLine();
if (errMsg == null) errMsg = "";
String inpMsg = new BufferedReader(new InputStreamReader(
process.getErrorStream())).readLine();
if (inpMsg == null) inpMsg = "";
throw new IOException(errMsg + inpMsg);
}
} catch (InterruptedException e) {
throw new IOException(e);
} finally {
process.destroy();
}
return callCount;
} | class class_name[name] begin[{]
method[createHardLinkMult, return_type[type[int]], modifier[static protected], parameter[parentDir, fileBaseNames, linkDir, maxLength]] begin[{]
if[binary_operation[member[.parentDir], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid arguments to createHardLinkMult: parent directory is null")], 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[}]
if[binary_operation[member[.linkDir], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid arguments to createHardLinkMult: link directory is null")], 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[}]
if[binary_operation[member[.fileBaseNames], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid arguments to createHardLinkMult: "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="filename list can be empty but not null"), 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[}]
if[binary_operation[member[fileBaseNames.length], ==, literal[0]]] begin[{]
return[literal[0]]
else begin[{]
None
end[}]
if[call[linkDir.exists, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=linkDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" not found."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileNotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], callCount]
if[binary_operation[binary_operation[call[.getLinkMultArgLength, parameter[member[.parentDir], member[.fileBaseNames], member[.linkDir]]], >, member[.maxLength]], &&, binary_operation[member[fileBaseNames.length], >, literal[1]]]] begin[{]
local_variable[type[String], list1]
assign[member[.callCount], call[.createHardLinkMult, parameter[member[.parentDir], member[.list1], member[.linkDir], member[.maxLength]]]]
local_variable[type[String], list2]
assign[member[.callCount], call[.createHardLinkMult, parameter[member[.parentDir], member[.list2], member[.linkDir], member[.maxLength]]]]
return[member[.callCount]]
else begin[{]
assign[member[.callCount], literal[1]]
end[}]
local_variable[type[String], hardLinkCommand]
local_variable[type[Process], process]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=waitFor, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=readLine, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)), name=errMsg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=errMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=errMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getErrorStream, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=readLine, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)), name=inpMsg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=inpMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=inpMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")), label=None)), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=errMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=inpMsg, 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)]))], 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=destroy, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.callCount]]
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[int] identifier[createHardLinkMult] operator[SEP] identifier[File] identifier[parentDir] , identifier[String] operator[SEP] operator[SEP] identifier[fileBaseNames] , identifier[File] identifier[linkDir] , Keyword[int] identifier[maxLength] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[parentDir] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[linkDir] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[fileBaseNames] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[fileBaseNames] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[0] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[linkDir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FileNotFoundException] operator[SEP] identifier[linkDir] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[int] identifier[callCount] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[getLinkMultArgLength] operator[SEP] identifier[parentDir] , identifier[fileBaseNames] , identifier[linkDir] operator[SEP] operator[>] identifier[maxLength] operator[&&] identifier[fileBaseNames] operator[SEP] identifier[length] operator[>] Other[1] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[list1] operator[=] identifier[Arrays] operator[SEP] identifier[copyOf] operator[SEP] identifier[fileBaseNames] , identifier[fileBaseNames] operator[SEP] identifier[length] operator[/] Other[2] operator[SEP] operator[SEP] identifier[callCount] operator[+=] identifier[createHardLinkMult] operator[SEP] identifier[parentDir] , identifier[list1] , identifier[linkDir] , identifier[maxLength] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[list2] operator[=] identifier[Arrays] operator[SEP] identifier[copyOfRange] operator[SEP] identifier[fileBaseNames] , identifier[fileBaseNames] operator[SEP] identifier[length] operator[/] Other[2] , identifier[fileBaseNames] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[callCount] operator[+=] identifier[createHardLinkMult] operator[SEP] identifier[parentDir] , identifier[list2] , identifier[linkDir] , identifier[maxLength] operator[SEP] operator[SEP] Keyword[return] identifier[callCount] operator[SEP]
}
Keyword[else] {
identifier[callCount] operator[=] Other[1] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[hardLinkCommand] operator[=] identifier[getHardLinkCommand] operator[SEP] identifier[linkMult] operator[SEP] identifier[fileBaseNames] , identifier[linkDir] operator[SEP] operator[SEP] identifier[Process] identifier[process] operator[=] identifier[Runtime] operator[SEP] identifier[getRuntime] operator[SEP] operator[SEP] operator[SEP] identifier[exec] operator[SEP] identifier[hardLinkCommand] , Other[null] , identifier[parentDir] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[process] operator[SEP] identifier[waitFor] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[String] identifier[errMsg] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[process] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[errMsg] operator[==] Other[null] operator[SEP] identifier[errMsg] operator[=] literal[String] operator[SEP] identifier[String] identifier[inpMsg] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[process] operator[SEP] identifier[getErrorStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[inpMsg] operator[==] Other[null] operator[SEP] identifier[inpMsg] operator[=] literal[String] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[errMsg] operator[+] identifier[inpMsg] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[process] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[callCount] operator[SEP]
}
|
public final ValueWithPos<String> formatUrl(final ValueWithPos<String> pphoneNumber) {
return valueWithPosDefaults(this.formatUrlWithPos(this.parsePhoneNumber(pphoneNumber)),
pphoneNumber);
} | class class_name[name] begin[{]
method[formatUrl, return_type[type[ValueWithPos]], modifier[final public], parameter[pphoneNumber]] begin[{]
return[call[.valueWithPosDefaults, parameter[THIS[call[None.formatUrlWithPos, parameter[THIS[call[None.parsePhoneNumber, parameter[member[.pphoneNumber]]]]]]], member[.pphoneNumber]]]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[ValueWithPos] operator[<] identifier[String] operator[>] identifier[formatUrl] operator[SEP] Keyword[final] identifier[ValueWithPos] operator[<] identifier[String] operator[>] identifier[pphoneNumber] operator[SEP] {
Keyword[return] identifier[valueWithPosDefaults] operator[SEP] Keyword[this] operator[SEP] identifier[formatUrlWithPos] operator[SEP] Keyword[this] operator[SEP] identifier[parsePhoneNumber] operator[SEP] identifier[pphoneNumber] operator[SEP] operator[SEP] , identifier[pphoneNumber] operator[SEP] operator[SEP]
}
|
public static final void commit(final Connection connection) {
if (connection == null) {
return;
}
try {
connection.commit();
} catch (Exception e) {
if (LOG.isWarnEnabled()) LOG.warn("Error committing Connection: " + connection, e);
}
} | class class_name[name] begin[{]
method[commit, return_type[void], modifier[final public static], parameter[connection]] begin[{]
if[binary_operation[member[.connection], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=commit, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isWarnEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error committing Connection: "), operandr=MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] Keyword[void] identifier[commit] operator[SEP] Keyword[final] identifier[Connection] identifier[connection] operator[SEP] {
Keyword[if] operator[SEP] identifier[connection] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[try] {
identifier[connection] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isWarnEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[connection] , identifier[e] operator[SEP] operator[SEP]
}
}
|
private static BigDecimal divideAndRound(long ldividend, long ldivisor, int scale, int roundingMode,
int preferredScale) {
int qsign; // quotient sign
long q = ldividend / ldivisor; // store quotient in long
if (roundingMode == ROUND_DOWN && scale == preferredScale)
return valueOf(q, scale);
long r = ldividend % ldivisor; // store remainder in long
qsign = ((ldividend < 0) == (ldivisor < 0)) ? 1 : -1;
if (r != 0) {
boolean increment = needIncrement(ldivisor, roundingMode, qsign, q, r);
return valueOf((increment ? q + qsign : q), scale);
} else {
if (preferredScale != scale)
return createAndStripZerosToMatchScale(q, scale, preferredScale);
else
return valueOf(q, scale);
}
} | class class_name[name] begin[{]
method[divideAndRound, return_type[type[BigDecimal]], modifier[private static], parameter[ldividend, ldivisor, scale, roundingMode, preferredScale]] begin[{]
local_variable[type[int], qsign]
local_variable[type[long], q]
if[binary_operation[binary_operation[member[.roundingMode], ==, member[.ROUND_DOWN]], &&, binary_operation[member[.scale], ==, member[.preferredScale]]]] begin[{]
return[call[.valueOf, parameter[member[.q], member[.scale]]]]
else begin[{]
None
end[}]
local_variable[type[long], r]
assign[member[.qsign], TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ldividend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=ldivisor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), operator===), if_false=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]
if[binary_operation[member[.r], !=, literal[0]]] begin[{]
local_variable[type[boolean], increment]
return[call[.valueOf, parameter[TernaryExpression(condition=MemberReference(member=increment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=BinaryOperation(operandl=MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=qsign, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), member[.scale]]]]
else begin[{]
if[binary_operation[member[.preferredScale], !=, member[.scale]]] begin[{]
return[call[.createAndStripZerosToMatchScale, parameter[member[.q], member[.scale], member[.preferredScale]]]]
else begin[{]
return[call[.valueOf, parameter[member[.q], member[.scale]]]]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[BigDecimal] identifier[divideAndRound] operator[SEP] Keyword[long] identifier[ldividend] , Keyword[long] identifier[ldivisor] , Keyword[int] identifier[scale] , Keyword[int] identifier[roundingMode] , Keyword[int] identifier[preferredScale] operator[SEP] {
Keyword[int] identifier[qsign] operator[SEP] Keyword[long] identifier[q] operator[=] identifier[ldividend] operator[/] identifier[ldivisor] operator[SEP] Keyword[if] operator[SEP] identifier[roundingMode] operator[==] identifier[ROUND_DOWN] operator[&&] identifier[scale] operator[==] identifier[preferredScale] operator[SEP] Keyword[return] identifier[valueOf] operator[SEP] identifier[q] , identifier[scale] operator[SEP] operator[SEP] Keyword[long] identifier[r] operator[=] identifier[ldividend] operator[%] identifier[ldivisor] operator[SEP] identifier[qsign] operator[=] operator[SEP] operator[SEP] identifier[ldividend] operator[<] Other[0] operator[SEP] operator[==] operator[SEP] identifier[ldivisor] operator[<] Other[0] operator[SEP] operator[SEP] operator[?] Other[1] operator[:] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[!=] Other[0] operator[SEP] {
Keyword[boolean] identifier[increment] operator[=] identifier[needIncrement] operator[SEP] identifier[ldivisor] , identifier[roundingMode] , identifier[qsign] , identifier[q] , identifier[r] operator[SEP] operator[SEP] Keyword[return] identifier[valueOf] operator[SEP] operator[SEP] identifier[increment] operator[?] identifier[q] operator[+] identifier[qsign] operator[:] identifier[q] operator[SEP] , identifier[scale] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[preferredScale] operator[!=] identifier[scale] operator[SEP] Keyword[return] identifier[createAndStripZerosToMatchScale] operator[SEP] identifier[q] , identifier[scale] , identifier[preferredScale] operator[SEP] operator[SEP] Keyword[else] Keyword[return] identifier[valueOf] operator[SEP] identifier[q] , identifier[scale] operator[SEP] operator[SEP]
}
}
|
public static GetSnapshotListTaskResult deserialize(String taskResult) {
JaxbJsonSerializer<GetSnapshotListTaskResult> serializer =
new JaxbJsonSerializer<>(GetSnapshotListTaskResult.class);
try {
return serializer.deserialize(taskResult);
} catch (IOException e) {
throw new SnapshotDataException(
"Unable to create task result due to: " + e.getMessage());
}
} | class class_name[name] begin[{]
method[deserialize, return_type[type[GetSnapshotListTaskResult]], modifier[public static], parameter[taskResult]] begin[{]
local_variable[type[JaxbJsonSerializer], serializer]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=taskResult, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=deserialize, postfix_operators=[], prefix_operators=[], qualifier=serializer, 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 create task result due to: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, 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=SnapshotDataException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[GetSnapshotListTaskResult] identifier[deserialize] operator[SEP] identifier[String] identifier[taskResult] operator[SEP] {
identifier[JaxbJsonSerializer] operator[<] identifier[GetSnapshotListTaskResult] operator[>] identifier[serializer] operator[=] Keyword[new] identifier[JaxbJsonSerializer] operator[<] operator[>] operator[SEP] identifier[GetSnapshotListTaskResult] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[serializer] operator[SEP] identifier[deserialize] operator[SEP] identifier[taskResult] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SnapshotDataException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public String getSFieldProperty(String strFieldName)
{
String strValue = super.getSFieldProperty(strFieldName);
if (strValue == null)
if (this.getParentScreen() != null)
if (DBConstants.SUBMIT.equalsIgnoreCase(this.getParentScreen().getProperty(DBParams.COMMAND)))
strValue = DBConstants.NO; // If you submit a checkbox that is off, the param is not passed (null) so I need a No.
return strValue;
} | class class_name[name] begin[{]
method[getSFieldProperty, return_type[type[String]], modifier[public], parameter[strFieldName]] begin[{]
local_variable[type[String], strValue]
if[binary_operation[member[.strValue], ==, literal[null]]] begin[{]
if[binary_operation[THIS[call[None.getParentScreen, parameter[]]], !=, literal[null]]] begin[{]
if[call[DBConstants.SUBMIT.equalsIgnoreCase, parameter[THIS[call[None.getParentScreen, parameter[]]call[None.getProperty, parameter[member[DBParams.COMMAND]]]]]]] begin[{]
assign[member[.strValue], member[DBConstants.NO]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.strValue]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getSFieldProperty] operator[SEP] identifier[String] identifier[strFieldName] operator[SEP] {
identifier[String] identifier[strValue] operator[=] Keyword[super] operator[SEP] identifier[getSFieldProperty] operator[SEP] identifier[strFieldName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strValue] operator[==] Other[null] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getParentScreen] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[DBConstants] operator[SEP] identifier[SUBMIT] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] Keyword[this] operator[SEP] identifier[getParentScreen] operator[SEP] operator[SEP] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBParams] operator[SEP] identifier[COMMAND] operator[SEP] operator[SEP] operator[SEP] identifier[strValue] operator[=] identifier[DBConstants] operator[SEP] identifier[NO] operator[SEP] Keyword[return] identifier[strValue] operator[SEP]
}
|
public FormInputValidator valueLesserThan (VisValidatableTextField field, String errorMsg, float value, boolean validIfEqualsValue) {
ValidatorWrapper wrapper = new ValidatorWrapper(errorMsg, new LesserThanValidator(value, validIfEqualsValue));
field.addValidator(wrapper);
add(field);
return wrapper;
} | class class_name[name] begin[{]
method[valueLesserThan, return_type[type[FormInputValidator]], modifier[public], parameter[field, errorMsg, value, validIfEqualsValue]] begin[{]
local_variable[type[ValidatorWrapper], wrapper]
call[field.addValidator, parameter[member[.wrapper]]]
call[.add, parameter[member[.field]]]
return[member[.wrapper]]
end[}]
END[}] | Keyword[public] identifier[FormInputValidator] identifier[valueLesserThan] operator[SEP] identifier[VisValidatableTextField] identifier[field] , identifier[String] identifier[errorMsg] , Keyword[float] identifier[value] , Keyword[boolean] identifier[validIfEqualsValue] operator[SEP] {
identifier[ValidatorWrapper] identifier[wrapper] operator[=] Keyword[new] identifier[ValidatorWrapper] operator[SEP] identifier[errorMsg] , Keyword[new] identifier[LesserThanValidator] operator[SEP] identifier[value] , identifier[validIfEqualsValue] operator[SEP] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[addValidator] operator[SEP] identifier[wrapper] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP] Keyword[return] identifier[wrapper] operator[SEP]
}
|
public void setThingGroupsToRemove(java.util.Collection<String> thingGroupsToRemove) {
if (thingGroupsToRemove == null) {
this.thingGroupsToRemove = null;
return;
}
this.thingGroupsToRemove = new java.util.ArrayList<String>(thingGroupsToRemove);
} | class class_name[name] begin[{]
method[setThingGroupsToRemove, return_type[void], modifier[public], parameter[thingGroupsToRemove]] begin[{]
if[binary_operation[member[.thingGroupsToRemove], ==, literal[null]]] begin[{]
assign[THIS[member[None.thingGroupsToRemove]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.thingGroupsToRemove]], ClassCreator(arguments=[MemberReference(member=thingGroupsToRemove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setThingGroupsToRemove] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[thingGroupsToRemove] operator[SEP] {
Keyword[if] operator[SEP] identifier[thingGroupsToRemove] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[thingGroupsToRemove] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[thingGroupsToRemove] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[thingGroupsToRemove] operator[SEP] operator[SEP]
}
|
private String getBlankResponseXml() {
Map<String, Object> data = new HashMap<String, Object>();
data.put("requestID", UUID.randomUUID().toString());
String ret = null;
try {
ret = TemplateUtils.get(BLANK_RESPONSE_TEMPLATE, data);
} catch (AwsMockException e) {
log.error("fatal exception caught: {}", e.getMessage());
e.printStackTrace();
}
return ret;
} | class class_name[name] begin[{]
method[getBlankResponseXml, return_type[type[String]], modifier[private], parameter[]] begin[{]
local_variable[type[Map], data]
call[data.put, parameter[literal["requestID"], call[UUID.randomUUID, parameter[]]]]
local_variable[type[String], ret]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=BLANK_RESPONSE_TEMPLATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=TemplateUtils, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="fatal exception caught: {}"), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['AwsMockException']))], finally_block=None, label=None, resources=None)
return[member[.ret]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[getBlankResponseXml] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[data] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[UUID] operator[SEP] identifier[randomUUID] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[ret] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[ret] operator[=] identifier[TemplateUtils] operator[SEP] identifier[get] operator[SEP] identifier[BLANK_RESPONSE_TEMPLATE] , identifier[data] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AwsMockException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public void marshall(ListAssociatedFleetsRequest listAssociatedFleetsRequest, ProtocolMarshaller protocolMarshaller) {
if (listAssociatedFleetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listAssociatedFleetsRequest.getStackName(), STACKNAME_BINDING);
protocolMarshaller.marshall(listAssociatedFleetsRequest.getNextToken(), NEXTTOKEN_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[listAssociatedFleetsRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.listAssociatedFleetsRequest], ==, 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=getStackName, postfix_operators=[], prefix_operators=[], qualifier=listAssociatedFleetsRequest, selectors=[], type_arguments=None), MemberReference(member=STACKNAME_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=getNextToken, postfix_operators=[], prefix_operators=[], qualifier=listAssociatedFleetsRequest, selectors=[], type_arguments=None), MemberReference(member=NEXTTOKEN_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[ListAssociatedFleetsRequest] identifier[listAssociatedFleetsRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[listAssociatedFleetsRequest] 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[listAssociatedFleetsRequest] operator[SEP] identifier[getStackName] operator[SEP] operator[SEP] , identifier[STACKNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listAssociatedFleetsRequest] operator[SEP] identifier[getNextToken] operator[SEP] operator[SEP] , identifier[NEXTTOKEN_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static void monitor(MeterRegistry registry, DataSource dataSource, String dataSourceName, String tableName, Iterable<Tag> tags) {
new DatabaseTableMetrics(dataSource, dataSourceName, tableName, tags).bindTo(registry);
} | class class_name[name] begin[{]
method[monitor, return_type[void], modifier[public static], parameter[registry, dataSource, dataSourceName, tableName, tags]] begin[{]
ClassCreator(arguments=[MemberReference(member=dataSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataSourceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=registry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=bindTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DatabaseTableMetrics, sub_type=None))
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[monitor] operator[SEP] identifier[MeterRegistry] identifier[registry] , identifier[DataSource] identifier[dataSource] , identifier[String] identifier[dataSourceName] , identifier[String] identifier[tableName] , identifier[Iterable] operator[<] identifier[Tag] operator[>] identifier[tags] operator[SEP] {
Keyword[new] identifier[DatabaseTableMetrics] operator[SEP] identifier[dataSource] , identifier[dataSourceName] , identifier[tableName] , identifier[tags] operator[SEP] operator[SEP] identifier[bindTo] operator[SEP] identifier[registry] operator[SEP] operator[SEP]
}
|
public byte[] getOrCreateId(final String name) throws HBaseException {
try {
return getIdAsync(name).joinUninterruptibly();
} catch (NoSuchUniqueName e) {
if (tsdb != null && tsdb.getUidFilter() != null &&
tsdb.getUidFilter().fillterUIDAssignments()) {
try {
if (!tsdb.getUidFilter().allowUIDAssignment(type, name, null, null)
.join()) {
rejected_assignments++;
throw new FailedToAssignUniqueIdException(new String(kind), name, 0,
"Blocked by UID filter.");
}
} catch (FailedToAssignUniqueIdException e1) {
throw e1;
} catch (InterruptedException e1) {
LOG.error("Interrupted", e1);
Thread.currentThread().interrupt();
} catch (Exception e1) {
throw new RuntimeException("Should never be here", e1);
}
}
Deferred<byte[]> assignment = null;
boolean pending = false;
synchronized (pending_assignments) {
assignment = pending_assignments.get(name);
if (assignment == null) {
// to prevent UID leaks that can be caused when multiple time
// series for the same metric or tags arrive, we need to write a
// deferred to the pending map as quickly as possible. Then we can
// start the assignment process after we've stashed the deferred
// and released the lock
assignment = new Deferred<byte[]>();
pending_assignments.put(name, assignment);
} else {
pending = true;
}
}
if (pending) {
LOG.info("Already waiting for UID assignment: " + name);
try {
return assignment.joinUninterruptibly();
} catch (Exception e1) {
throw new RuntimeException("Should never be here", e1);
}
}
// start the assignment dance after stashing the deferred
byte[] uid = null;
try {
uid = new UniqueIdAllocator(name, assignment).tryAllocate().joinUninterruptibly();
} catch (RuntimeException e1) {
throw e1;
} catch (Exception e1) {
throw new RuntimeException("Should never be here", e);
} finally {
synchronized (pending_assignments) {
if (pending_assignments.remove(name) != null) {
LOG.info("Completed pending assignment for: " + name);
}
}
}
return uid;
} catch (Exception e) {
throw new RuntimeException("Should never be here", e);
}
} | class class_name[name] begin[{]
method[getOrCreateId, return_type[type[byte]], modifier[public], parameter[name]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIdAsync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=joinUninterruptibly, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=tsdb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getUidFilter, postfix_operators=[], prefix_operators=[], qualifier=tsdb, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), operandr=MethodInvocation(arguments=[], member=getUidFilter, postfix_operators=[], prefix_operators=[], qualifier=tsdb, selectors=[MethodInvocation(arguments=[], member=fillterUIDAssignments, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=getUidFilter, postfix_operators=[], prefix_operators=['!'], qualifier=tsdb, selectors=[MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, 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)], member=allowUIDAssignment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=join, 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=[StatementExpression(expression=MemberReference(member=rejected_assignments, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), ThrowStatement(expression=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=kind, 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=String, sub_type=None)), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Blocked by UID filter.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FailedToAssignUniqueIdException, sub_type=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['FailedToAssignUniqueIdException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Interrupted"), MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[], member=interrupt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['InterruptedException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Should never be here"), MemberReference(member=e1, 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=e1, types=['Exception']))], finally_block=None, label=None, resources=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=assignment)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte))], dimensions=[], name=Deferred, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=pending)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), SynchronizedStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=assignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=pending_assignments, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=assignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=pending, 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=Assignment(expressionl=MemberReference(member=assignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte))], dimensions=None, name=Deferred, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=assignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=pending_assignments, selectors=[], type_arguments=None), label=None)]))], label=None, lock=MemberReference(member=pending_assignments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), IfStatement(condition=MemberReference(member=pending, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Already waiting for UID assignment: "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=joinUninterruptibly, postfix_operators=[], prefix_operators=[], qualifier=assignment, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Should never be here"), MemberReference(member=e1, 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=e1, types=['Exception']))], finally_block=None, label=None, resources=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=uid)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=uid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=assignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=tryAllocate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=joinUninterruptibly, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=UniqueIdAllocator, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['RuntimeException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Should never be here"), 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=e1, types=['Exception']))], finally_block=[SynchronizedStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=pending_assignments, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Completed pending assignment for: "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))], label=None, lock=MemberReference(member=pending_assignments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], label=None, resources=None), ReturnStatement(expression=MemberReference(member=uid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchUniqueName'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Should never be here"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[getOrCreateId] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[HBaseException] {
Keyword[try] {
Keyword[return] identifier[getIdAsync] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[joinUninterruptibly] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchUniqueName] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[tsdb] operator[!=] Other[null] operator[&&] identifier[tsdb] operator[SEP] identifier[getUidFilter] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[tsdb] operator[SEP] identifier[getUidFilter] operator[SEP] operator[SEP] operator[SEP] identifier[fillterUIDAssignments] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[tsdb] operator[SEP] identifier[getUidFilter] operator[SEP] operator[SEP] operator[SEP] identifier[allowUIDAssignment] operator[SEP] identifier[type] , identifier[name] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[join] operator[SEP] operator[SEP] operator[SEP] {
identifier[rejected_assignments] operator[++] operator[SEP] Keyword[throw] Keyword[new] identifier[FailedToAssignUniqueIdException] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[kind] operator[SEP] , identifier[name] , Other[0] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[FailedToAssignUniqueIdException] identifier[e1] operator[SEP] {
Keyword[throw] identifier[e1] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e1] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e1] operator[SEP] operator[SEP] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e1] operator[SEP] operator[SEP]
}
}
identifier[Deferred] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[assignment] operator[=] Other[null] operator[SEP] Keyword[boolean] identifier[pending] operator[=] literal[boolean] operator[SEP] Keyword[synchronized] operator[SEP] identifier[pending_assignments] operator[SEP] {
identifier[assignment] operator[=] identifier[pending_assignments] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[assignment] operator[==] Other[null] operator[SEP] {
identifier[assignment] operator[=] Keyword[new] identifier[Deferred] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[pending_assignments] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[assignment] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[pending] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[pending] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[assignment] operator[SEP] identifier[joinUninterruptibly] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e1] operator[SEP] operator[SEP]
}
}
Keyword[byte] operator[SEP] operator[SEP] identifier[uid] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[uid] operator[=] Keyword[new] identifier[UniqueIdAllocator] operator[SEP] identifier[name] , identifier[assignment] operator[SEP] operator[SEP] identifier[tryAllocate] operator[SEP] operator[SEP] operator[SEP] identifier[joinUninterruptibly] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[e1] operator[SEP] {
Keyword[throw] identifier[e1] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[synchronized] operator[SEP] identifier[pending_assignments] operator[SEP] {
Keyword[if] operator[SEP] identifier[pending_assignments] operator[SEP] identifier[remove] operator[SEP] identifier[name] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[uid] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Override
public void login(String username, String password)
throws ServletException {
this._getHttpServletRequest().login(username,password);
} | class class_name[name] begin[{]
method[login, return_type[void], modifier[public], parameter[username, password]] begin[{]
THIS[call[None._getHttpServletRequest, parameter[]]call[None.login, parameter[member[.username], member[.password]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[login] operator[SEP] identifier[String] identifier[username] , identifier[String] identifier[password] operator[SEP] Keyword[throws] identifier[ServletException] {
Keyword[this] operator[SEP] identifier[_getHttpServletRequest] operator[SEP] operator[SEP] operator[SEP] identifier[login] operator[SEP] identifier[username] , identifier[password] operator[SEP] operator[SEP]
}
|
public Table create(String tableId, TableDefinition definition, TableOption... options) {
TableInfo tableInfo =
TableInfo.of(TableId.of(getDatasetId().getDataset(), tableId), definition);
return bigquery.create(tableInfo, options);
} | class class_name[name] begin[{]
method[create, return_type[type[Table]], modifier[public], parameter[tableId, definition, options]] begin[{]
local_variable[type[TableInfo], tableInfo]
return[call[bigquery.create, parameter[member[.tableInfo], member[.options]]]]
end[}]
END[}] | Keyword[public] identifier[Table] identifier[create] operator[SEP] identifier[String] identifier[tableId] , identifier[TableDefinition] identifier[definition] , identifier[TableOption] operator[...] identifier[options] operator[SEP] {
identifier[TableInfo] identifier[tableInfo] operator[=] identifier[TableInfo] operator[SEP] identifier[of] operator[SEP] identifier[TableId] operator[SEP] identifier[of] operator[SEP] identifier[getDatasetId] operator[SEP] operator[SEP] operator[SEP] identifier[getDataset] operator[SEP] operator[SEP] , identifier[tableId] operator[SEP] , identifier[definition] operator[SEP] operator[SEP] Keyword[return] identifier[bigquery] operator[SEP] identifier[create] operator[SEP] identifier[tableInfo] , identifier[options] operator[SEP] operator[SEP]
}
|
public static boolean showInstallPrompt(@NonNull Activity activity, int requestCode) {
String installReferrerString = "";
if (Branch.getInstance() != null) {
JSONObject latestReferringParams = Branch.getInstance().getLatestReferringParams();
String referringLinkKey = "~" + Defines.Jsonkey.ReferringLink.getKey();
if (latestReferringParams != null && latestReferringParams.has(referringLinkKey)) {
String referringLink = "";
try {
referringLink = latestReferringParams.getString(referringLinkKey);
// Considering the case that url may contain query params with `=` and `&` with it and may cause issue when parsing play store referrer
referringLink = URLEncoder.encode(referringLink, "UTF-8");
} catch (JSONException | UnsupportedEncodingException e) {
e.printStackTrace();
}
if (!TextUtils.isEmpty(referringLink)) {
installReferrerString = Defines.Jsonkey.IsFullAppConv.getKey() + "=true&" + Defines.Jsonkey.ReferringLink.getKey() + "=" + referringLink;
}
}
}
return InstantAppUtil.doShowInstallPrompt(activity, requestCode, installReferrerString);
} | class class_name[name] begin[{]
method[showInstallPrompt, return_type[type[boolean]], modifier[public static], parameter[activity, requestCode]] begin[{]
local_variable[type[String], installReferrerString]
if[binary_operation[call[Branch.getInstance, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[JSONObject], latestReferringParams]
local_variable[type[String], referringLinkKey]
if[binary_operation[binary_operation[member[.latestReferringParams], !=, literal[null]], &&, call[latestReferringParams.has, parameter[member[.referringLinkKey]]]]] begin[{]
local_variable[type[String], referringLink]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=referringLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=referringLinkKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=latestReferringParams, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=referringLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=referringLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=encode, postfix_operators=[], prefix_operators=[], qualifier=URLEncoder, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JSONException', 'UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
if[call[TextUtils.isEmpty, parameter[member[.referringLink]]]] begin[{]
assign[member[.installReferrerString], binary_operation[binary_operation[binary_operation[binary_operation[call[Defines.Jsonkey.IsFullAppConv.getKey, parameter[]], +, literal["=true&"]], +, call[Defines.Jsonkey.ReferringLink.getKey, parameter[]]], +, literal["="]], +, member[.referringLink]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[call[InstantAppUtil.doShowInstallPrompt, parameter[member[.activity], member[.requestCode], member[.installReferrerString]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[showInstallPrompt] operator[SEP] annotation[@] identifier[NonNull] identifier[Activity] identifier[activity] , Keyword[int] identifier[requestCode] operator[SEP] {
identifier[String] identifier[installReferrerString] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[Branch] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[JSONObject] identifier[latestReferringParams] operator[=] identifier[Branch] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getLatestReferringParams] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[referringLinkKey] operator[=] literal[String] operator[+] identifier[Defines] operator[SEP] identifier[Jsonkey] operator[SEP] identifier[ReferringLink] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[latestReferringParams] operator[!=] Other[null] operator[&&] identifier[latestReferringParams] operator[SEP] identifier[has] operator[SEP] identifier[referringLinkKey] operator[SEP] operator[SEP] {
identifier[String] identifier[referringLink] operator[=] literal[String] operator[SEP] Keyword[try] {
identifier[referringLink] operator[=] identifier[latestReferringParams] operator[SEP] identifier[getString] operator[SEP] identifier[referringLinkKey] operator[SEP] operator[SEP] identifier[referringLink] operator[=] identifier[URLEncoder] operator[SEP] identifier[encode] operator[SEP] identifier[referringLink] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JSONException] operator[|] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[TextUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[referringLink] operator[SEP] operator[SEP] {
identifier[installReferrerString] operator[=] identifier[Defines] operator[SEP] identifier[Jsonkey] operator[SEP] identifier[IsFullAppConv] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[Defines] operator[SEP] identifier[Jsonkey] operator[SEP] identifier[ReferringLink] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[referringLink] operator[SEP]
}
}
}
Keyword[return] identifier[InstantAppUtil] operator[SEP] identifier[doShowInstallPrompt] operator[SEP] identifier[activity] , identifier[requestCode] , identifier[installReferrerString] operator[SEP] operator[SEP]
}
|
public void clearFieldReference()
{
RecordReferenceField field = m_field;
m_field = null; // This keeps this from being called twice
if (field != null)
field.setReferenceRecord(null); // Just in case a converter was used (removes converter, leaves field!)
} | class class_name[name] begin[{]
method[clearFieldReference, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[RecordReferenceField], field]
assign[member[.m_field], literal[null]]
if[binary_operation[member[.field], !=, literal[null]]] begin[{]
call[field.setReferenceRecord, parameter[literal[null]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[clearFieldReference] operator[SEP] operator[SEP] {
identifier[RecordReferenceField] identifier[field] operator[=] identifier[m_field] operator[SEP] identifier[m_field] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[field] operator[!=] Other[null] operator[SEP] identifier[field] operator[SEP] identifier[setReferenceRecord] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
|
@Override
public void recordTaskDescriptionChange(String taskId, String description) {
if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) {
HistoricTaskInstanceEntity historicTaskInstance = getHistoricTaskInstanceEntityManager().findById(taskId);
if (historicTaskInstance != null) {
historicTaskInstance.setDescription(description);
}
}
} | class class_name[name] begin[{]
method[recordTaskDescriptionChange, return_type[void], modifier[public], parameter[taskId, description]] begin[{]
if[call[.isHistoryLevelAtLeast, parameter[member[HistoryLevel.AUDIT]]]] begin[{]
local_variable[type[HistoricTaskInstanceEntity], historicTaskInstance]
if[binary_operation[member[.historicTaskInstance], !=, literal[null]]] begin[{]
call[historicTaskInstance.setDescription, parameter[member[.description]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[recordTaskDescriptionChange] operator[SEP] identifier[String] identifier[taskId] , identifier[String] identifier[description] operator[SEP] {
Keyword[if] operator[SEP] identifier[isHistoryLevelAtLeast] operator[SEP] identifier[HistoryLevel] operator[SEP] identifier[AUDIT] operator[SEP] operator[SEP] {
identifier[HistoricTaskInstanceEntity] identifier[historicTaskInstance] operator[=] identifier[getHistoricTaskInstanceEntityManager] operator[SEP] operator[SEP] operator[SEP] identifier[findById] operator[SEP] identifier[taskId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[historicTaskInstance] operator[!=] Other[null] operator[SEP] {
identifier[historicTaskInstance] operator[SEP] identifier[setDescription] operator[SEP] identifier[description] operator[SEP] operator[SEP]
}
}
}
|
@NotNull
public OptionalDouble average() {
long count = 0;
double sum = 0d;
while (iterator.hasNext()) {
sum += iterator.nextDouble();
count++;
}
if (count == 0) return OptionalDouble.empty();
return OptionalDouble.of(sum / (double) count);
} | class class_name[name] begin[{]
method[average, return_type[type[OptionalDouble]], modifier[public], parameter[]] begin[{]
local_variable[type[long], count]
local_variable[type[double], sum]
while[call[iterator.hasNext, parameter[]]] begin[{]
assign[member[.sum], call[iterator.nextDouble, parameter[]]]
member[.count]
end[}]
if[binary_operation[member[.count], ==, literal[0]]] begin[{]
return[call[OptionalDouble.empty, parameter[]]]
else begin[{]
None
end[}]
return[call[OptionalDouble.of, parameter[binary_operation[member[.sum], /, Cast(expression=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=double))]]]]
end[}]
END[}] | annotation[@] identifier[NotNull] Keyword[public] identifier[OptionalDouble] identifier[average] operator[SEP] operator[SEP] {
Keyword[long] identifier[count] operator[=] Other[0] operator[SEP] Keyword[double] identifier[sum] operator[=] literal[Float] operator[SEP] Keyword[while] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[sum] operator[+=] identifier[iterator] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[SEP] identifier[count] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] identifier[count] operator[==] Other[0] operator[SEP] Keyword[return] identifier[OptionalDouble] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[OptionalDouble] operator[SEP] identifier[of] operator[SEP] identifier[sum] operator[/] operator[SEP] Keyword[double] operator[SEP] identifier[count] operator[SEP] operator[SEP]
}
|
@Override
public List<NodeData> getChildNodesData(NodeData nodeData) throws RepositoryException
{
return Collections.unmodifiableList(super.getChildNodesData(nodeData));
} | class class_name[name] begin[{]
method[getChildNodesData, return_type[type[List]], modifier[public], parameter[nodeData]] begin[{]
return[call[Collections.unmodifiableList, parameter[SuperMethodInvocation(arguments=[MemberReference(member=nodeData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getChildNodesData, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[NodeData] operator[>] identifier[getChildNodesData] operator[SEP] identifier[NodeData] identifier[nodeData] operator[SEP] Keyword[throws] identifier[RepositoryException] {
Keyword[return] identifier[Collections] operator[SEP] identifier[unmodifiableList] operator[SEP] Keyword[super] operator[SEP] identifier[getChildNodesData] operator[SEP] identifier[nodeData] operator[SEP] operator[SEP] operator[SEP]
}
|
@CheckReturnValue
@NonNull
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> sorted(Comparator<? super T> sortFunction) {
ObjectHelper.requireNonNull(sortFunction, "sortFunction");
return toList().toFlowable().map(Functions.listSorter(sortFunction)).flatMapIterable(Functions.<List<T>>identity());
} | class class_name[name] begin[{]
method[sorted, return_type[type[Flowable]], modifier[final public], parameter[sortFunction]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.sortFunction], literal["sortFunction"]]]
return[call[.toList, parameter[]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] annotation[@] identifier[NonNull] annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[FULL] operator[SEP] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[final] identifier[Flowable] operator[<] identifier[T] operator[>] identifier[sorted] operator[SEP] identifier[Comparator] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[sortFunction] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[sortFunction] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[toList] operator[SEP] operator[SEP] operator[SEP] identifier[toFlowable] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[Functions] operator[SEP] identifier[listSorter] operator[SEP] identifier[sortFunction] operator[SEP] operator[SEP] operator[SEP] identifier[flatMapIterable] operator[SEP] identifier[Functions] operator[SEP] operator[<] identifier[List] operator[<] identifier[T] operator[>] operator[>] identifier[identity] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void initializeManagedObjectFactoryOrConstructor(BeanMetaData bmd) throws EJBConfigurationException {
if (bmd.isManagedBean()) {
bmd.ivEnterpriseBeanFactory = getManagedBeanManagedObjectFactory(bmd, bmd.enterpriseBeanClass);
// If the managed object factroy and the managed object instances will perform all injection
// and interceptor processing, then save that indication and reset all of the methodinfos so
// that AroundInvoke is not handled by the EJB Container. Injection, PostConstruct, and
// PreDestroy will also be skipped.
if (bmd.ivEnterpriseBeanFactory != null && bmd.ivEnterpriseBeanFactory.managesInjectionAndInterceptors()) {
bmd.managedObjectManagesInjectionAndInterceptors = true;
if (bmd.ivInterceptorMetaData != null && bmd.localMethodInfos != null) {
for (EJBMethodInfoImpl mbMethod : bmd.localMethodInfos) {
mbMethod.setAroundInterceptorProxies(null);
}
}
}
} else {
bmd.ivEnterpriseBeanFactory = getEJBManagedObjectFactory(bmd, bmd.enterpriseBeanClass);
}
if (bmd.ivEnterpriseBeanFactory == null) {
try {
bmd.ivEnterpriseBeanClassConstructor = bmd.enterpriseBeanClass.getConstructor((Class<?>[]) null);
} catch (NoSuchMethodException e) {
Tr.error(tc, "JIT_NO_DEFAULT_CTOR_CNTR5007E",
new Object[] { bmd.enterpriseBeanClassName, bmd.enterpriseBeanName });
throw new EJBConfigurationException("CNTR5007E: The " + bmd.enterpriseBeanClassName + " bean class for the " + bmd.enterpriseBeanName +
" bean does not have a public constructor that does not take parameters.");
}
}
// Removed else clause that calls bmd.ivEnterpriseBeanFactory.getConstructor() because this method
// is called before cdiMMD.setWebBeansContext(webBeansContext) in LibertySingletonServer. If we call
// getConstructor before setting the webBeansContext, we default to a constructor that may not be correct.
// eg. returning no-arg constructor when multi-arg constructor injection should be invoked.
} | class class_name[name] begin[{]
method[initializeManagedObjectFactoryOrConstructor, return_type[void], modifier[private], parameter[bmd]] begin[{]
if[call[bmd.isManagedBean, parameter[]]] begin[{]
assign[member[bmd.ivEnterpriseBeanFactory], call[.getManagedBeanManagedObjectFactory, parameter[member[.bmd], member[bmd.enterpriseBeanClass]]]]
if[binary_operation[binary_operation[member[bmd.ivEnterpriseBeanFactory], !=, literal[null]], &&, call[bmd.ivEnterpriseBeanFactory.managesInjectionAndInterceptors, parameter[]]]] begin[{]
assign[member[bmd.managedObjectManagesInjectionAndInterceptors], literal[true]]
if[binary_operation[binary_operation[member[bmd.ivInterceptorMetaData], !=, literal[null]], &&, binary_operation[member[bmd.localMethodInfos], !=, literal[null]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setAroundInterceptorProxies, postfix_operators=[], prefix_operators=[], qualifier=mbMethod, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=localMethodInfos, postfix_operators=[], prefix_operators=[], qualifier=bmd, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mbMethod)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EJBMethodInfoImpl, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
assign[member[bmd.ivEnterpriseBeanFactory], call[.getEJBManagedObjectFactory, parameter[member[.bmd], member[bmd.enterpriseBeanClass]]]]
end[}]
if[binary_operation[member[bmd.ivEnterpriseBeanFactory], ==, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ivEnterpriseBeanClassConstructor, postfix_operators=[], prefix_operators=[], qualifier=bmd, selectors=[]), type==, value=MethodInvocation(arguments=[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[None], name=Class, sub_type=None))], member=getConstructor, postfix_operators=[], prefix_operators=[], qualifier=bmd.enterpriseBeanClass, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="JIT_NO_DEFAULT_CTOR_CNTR5007E"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=enterpriseBeanClassName, postfix_operators=[], prefix_operators=[], qualifier=bmd, selectors=[]), MemberReference(member=enterpriseBeanName, postfix_operators=[], prefix_operators=[], qualifier=bmd, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=error, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CNTR5007E: The "), operandr=MemberReference(member=enterpriseBeanClassName, postfix_operators=[], prefix_operators=[], qualifier=bmd, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" bean class for the "), operator=+), operandr=MemberReference(member=enterpriseBeanName, postfix_operators=[], prefix_operators=[], qualifier=bmd, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" bean does not have a public constructor that does not take parameters."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EJBConfigurationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[initializeManagedObjectFactoryOrConstructor] operator[SEP] identifier[BeanMetaData] identifier[bmd] operator[SEP] Keyword[throws] identifier[EJBConfigurationException] {
Keyword[if] operator[SEP] identifier[bmd] operator[SEP] identifier[isManagedBean] operator[SEP] operator[SEP] operator[SEP] {
identifier[bmd] operator[SEP] identifier[ivEnterpriseBeanFactory] operator[=] identifier[getManagedBeanManagedObjectFactory] operator[SEP] identifier[bmd] , identifier[bmd] operator[SEP] identifier[enterpriseBeanClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bmd] operator[SEP] identifier[ivEnterpriseBeanFactory] operator[!=] Other[null] operator[&&] identifier[bmd] operator[SEP] identifier[ivEnterpriseBeanFactory] operator[SEP] identifier[managesInjectionAndInterceptors] operator[SEP] operator[SEP] operator[SEP] {
identifier[bmd] operator[SEP] identifier[managedObjectManagesInjectionAndInterceptors] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[bmd] operator[SEP] identifier[ivInterceptorMetaData] operator[!=] Other[null] operator[&&] identifier[bmd] operator[SEP] identifier[localMethodInfos] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[EJBMethodInfoImpl] identifier[mbMethod] operator[:] identifier[bmd] operator[SEP] identifier[localMethodInfos] operator[SEP] {
identifier[mbMethod] operator[SEP] identifier[setAroundInterceptorProxies] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
}
}
}
Keyword[else] {
identifier[bmd] operator[SEP] identifier[ivEnterpriseBeanFactory] operator[=] identifier[getEJBManagedObjectFactory] operator[SEP] identifier[bmd] , identifier[bmd] operator[SEP] identifier[enterpriseBeanClass] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[bmd] operator[SEP] identifier[ivEnterpriseBeanFactory] operator[==] Other[null] operator[SEP] {
Keyword[try] {
identifier[bmd] operator[SEP] identifier[ivEnterpriseBeanClassConstructor] operator[=] identifier[bmd] operator[SEP] identifier[enterpriseBeanClass] operator[SEP] identifier[getConstructor] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[bmd] operator[SEP] identifier[enterpriseBeanClassName] , identifier[bmd] operator[SEP] identifier[enterpriseBeanName]
} operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[EJBConfigurationException] operator[SEP] literal[String] operator[+] identifier[bmd] operator[SEP] identifier[enterpriseBeanClassName] operator[+] literal[String] operator[+] identifier[bmd] operator[SEP] identifier[enterpriseBeanName] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
|
private String acceptBuilder(String version) {
String acceptValue = "application/json";
if(version == "2.1") acceptValue += ";version=" + version;
return acceptValue;
} | class class_name[name] begin[{]
method[acceptBuilder, return_type[type[String]], modifier[private], parameter[version]] begin[{]
local_variable[type[String], acceptValue]
if[binary_operation[member[.version], ==, literal["2.1"]]] begin[{]
assign[member[.acceptValue], binary_operation[literal[";version="], +, member[.version]]]
else begin[{]
None
end[}]
return[member[.acceptValue]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[acceptBuilder] operator[SEP] identifier[String] identifier[version] operator[SEP] {
identifier[String] identifier[acceptValue] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[version] operator[==] literal[String] operator[SEP] identifier[acceptValue] operator[+=] literal[String] operator[+] identifier[version] operator[SEP] Keyword[return] identifier[acceptValue] operator[SEP]
}
|
@Override
public void set(String key, String value) {
if("dn".equals(key)) {
this.dn = value;
} else if (value != null
&& !value.isEmpty()
&& key != null
&& !key.isEmpty()) {
addAttribute(new BasicAttribute(key, value, true));
}
} | class class_name[name] begin[{]
method[set, return_type[void], modifier[public], parameter[key, value]] begin[{]
if[literal["dn"]] begin[{]
assign[THIS[member[None.dn]], member[.value]]
else begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.value], !=, literal[null]], &&, call[value.isEmpty, parameter[]]], &&, binary_operation[member[.key], !=, literal[null]]], &&, call[key.isEmpty, parameter[]]]] begin[{]
call[.addAttribute, parameter[ClassCreator(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicAttribute, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[set] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[dn] operator[=] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] operator[!] identifier[value] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] identifier[key] operator[!=] Other[null] operator[&&] operator[!] identifier[key] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[addAttribute] operator[SEP] Keyword[new] identifier[BasicAttribute] operator[SEP] identifier[key] , identifier[value] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void marshall(FailedCreateAssociation failedCreateAssociation, ProtocolMarshaller protocolMarshaller) {
if (failedCreateAssociation == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(failedCreateAssociation.getEntry(), ENTRY_BINDING);
protocolMarshaller.marshall(failedCreateAssociation.getMessage(), MESSAGE_BINDING);
protocolMarshaller.marshall(failedCreateAssociation.getFault(), FAULT_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[failedCreateAssociation, protocolMarshaller]] begin[{]
if[binary_operation[member[.failedCreateAssociation], ==, 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=getEntry, postfix_operators=[], prefix_operators=[], qualifier=failedCreateAssociation, selectors=[], type_arguments=None), MemberReference(member=ENTRY_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=getMessage, postfix_operators=[], prefix_operators=[], qualifier=failedCreateAssociation, selectors=[], type_arguments=None), MemberReference(member=MESSAGE_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=getFault, postfix_operators=[], prefix_operators=[], qualifier=failedCreateAssociation, selectors=[], type_arguments=None), MemberReference(member=FAULT_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[FailedCreateAssociation] identifier[failedCreateAssociation] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[failedCreateAssociation] 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[failedCreateAssociation] operator[SEP] identifier[getEntry] operator[SEP] operator[SEP] , identifier[ENTRY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[failedCreateAssociation] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[MESSAGE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[failedCreateAssociation] operator[SEP] identifier[getFault] operator[SEP] operator[SEP] , identifier[FAULT_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static double colemanLiauIndex(String strText) {
strText = cleanText(strText);
int intWordCount = wordCount(strText);
return PHPMethods.round( ( (5.89 * (letterCount(strText) / (double)intWordCount)) - (0.3 * (sentenceCount(strText) / (double)intWordCount)) - 15.8 ), 1);
} | class class_name[name] begin[{]
method[colemanLiauIndex, return_type[type[double]], modifier[public static], parameter[strText]] begin[{]
assign[member[.strText], call[.cleanText, parameter[member[.strText]]]]
local_variable[type[int], intWordCount]
return[call[PHPMethods.round, parameter[binary_operation[binary_operation[binary_operation[literal[5.89], *, binary_operation[call[.letterCount, parameter[member[.strText]]], /, Cast(expression=MemberReference(member=intWordCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=double))]], -, binary_operation[literal[0.3], *, binary_operation[call[.sentenceCount, parameter[member[.strText]]], /, Cast(expression=MemberReference(member=intWordCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=double))]]], -, literal[15.8]], literal[1]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[colemanLiauIndex] operator[SEP] identifier[String] identifier[strText] operator[SEP] {
identifier[strText] operator[=] identifier[cleanText] operator[SEP] identifier[strText] operator[SEP] operator[SEP] Keyword[int] identifier[intWordCount] operator[=] identifier[wordCount] operator[SEP] identifier[strText] operator[SEP] operator[SEP] Keyword[return] identifier[PHPMethods] operator[SEP] identifier[round] operator[SEP] operator[SEP] operator[SEP] literal[Float] operator[*] operator[SEP] identifier[letterCount] operator[SEP] identifier[strText] operator[SEP] operator[/] operator[SEP] Keyword[double] operator[SEP] identifier[intWordCount] operator[SEP] operator[SEP] operator[-] operator[SEP] literal[Float] operator[*] operator[SEP] identifier[sentenceCount] operator[SEP] identifier[strText] operator[SEP] operator[/] operator[SEP] Keyword[double] operator[SEP] identifier[intWordCount] operator[SEP] operator[SEP] operator[-] literal[Float] operator[SEP] , Other[1] operator[SEP] operator[SEP]
}
|
public Graph links(Link... values) {
if (values == null || values.length == 0) {
return this;
}
this.links().addAll(Arrays.asList(values));
return this;
} | class class_name[name] begin[{]
method[links, return_type[type[Graph]], modifier[public], parameter[values]] begin[{]
if[binary_operation[binary_operation[member[.values], ==, literal[null]], ||, binary_operation[member[values.length], ==, literal[0]]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
THIS[call[None.links, parameter[]]call[None.addAll, parameter[call[Arrays.asList, parameter[member[.values]]]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Graph] identifier[links] operator[SEP] identifier[Link] operator[...] identifier[values] operator[SEP] {
Keyword[if] operator[SEP] identifier[values] operator[==] Other[null] operator[||] identifier[values] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[this] operator[SEP] identifier[links] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private int endCheckLabel()
{
int rv = END_UNREACHED;
rv = next.endCheck();
rv |= getIntProp(CONTROL_BLOCK_PROP, END_UNREACHED);
return rv;
} | class class_name[name] begin[{]
method[endCheckLabel, return_type[type[int]], modifier[private], parameter[]] begin[{]
local_variable[type[int], rv]
assign[member[.rv], call[next.endCheck, parameter[]]]
assign[member[.rv], call[.getIntProp, parameter[member[.CONTROL_BLOCK_PROP], member[.END_UNREACHED]]]]
return[member[.rv]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[endCheckLabel] operator[SEP] operator[SEP] {
Keyword[int] identifier[rv] operator[=] identifier[END_UNREACHED] operator[SEP] identifier[rv] operator[=] identifier[next] operator[SEP] identifier[endCheck] operator[SEP] operator[SEP] operator[SEP] identifier[rv] operator[|=] identifier[getIntProp] operator[SEP] identifier[CONTROL_BLOCK_PROP] , identifier[END_UNREACHED] operator[SEP] operator[SEP] Keyword[return] identifier[rv] operator[SEP]
}
|
public XmlConfig declareNamespaces(Map<String, String> namespacesToDeclare) {
final boolean shouldBeNamespaceAware = namespacesToDeclare == null ? namespaceAware : !namespacesToDeclare.isEmpty();
return new XmlConfig(features, namespacesToDeclare, properties, validating, shouldBeNamespaceAware, allowDocTypeDeclaration, true);
} | class class_name[name] begin[{]
method[declareNamespaces, return_type[type[XmlConfig]], modifier[public], parameter[namespacesToDeclare]] begin[{]
local_variable[type[boolean], shouldBeNamespaceAware]
return[ClassCreator(arguments=[MemberReference(member=features, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=namespacesToDeclare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=validating, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=shouldBeNamespaceAware, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=allowDocTypeDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XmlConfig, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[XmlConfig] identifier[declareNamespaces] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[namespacesToDeclare] operator[SEP] {
Keyword[final] Keyword[boolean] identifier[shouldBeNamespaceAware] operator[=] identifier[namespacesToDeclare] operator[==] Other[null] operator[?] identifier[namespaceAware] operator[:] operator[!] identifier[namespacesToDeclare] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[XmlConfig] operator[SEP] identifier[features] , identifier[namespacesToDeclare] , identifier[properties] , identifier[validating] , identifier[shouldBeNamespaceAware] , identifier[allowDocTypeDeclaration] , literal[boolean] operator[SEP] operator[SEP]
}
|
public static List<String> topologicalSort(List<String> moduleNames, String rfsAbsPath)
throws CmsConfigurationException {
List<String> modules = new ArrayList<String>(moduleNames);
List<String> retList = new ArrayList<String>();
Map<String, List<String>> moduleDependencies = buildDepsForModulelist(moduleNames, rfsAbsPath, true);
boolean finished = false;
while (!finished) {
finished = true;
Iterator<String> itMods = modules.iterator();
while (itMods.hasNext()) {
String moduleName = itMods.next();
List<String> deps = moduleDependencies.get(moduleName);
if ((deps == null) || deps.isEmpty()) {
retList.add(moduleName);
Iterator<List<String>> itDeps = moduleDependencies.values().iterator();
while (itDeps.hasNext()) {
List<String> dependencies = itDeps.next();
dependencies.remove(moduleName);
}
finished = false;
itMods.remove();
}
}
}
if (!modules.isEmpty()) {
throw new CmsIllegalStateException(
Messages.get().container(Messages.ERR_MODULE_DEPENDENCY_CYCLE_1, modules.toString()));
}
Collections.reverse(retList);
return retList;
} | class class_name[name] begin[{]
method[topologicalSort, return_type[type[List]], modifier[public static], parameter[moduleNames, rfsAbsPath]] begin[{]
local_variable[type[List], modules]
local_variable[type[List], retList]
local_variable[type[Map], moduleDependencies]
local_variable[type[boolean], finished]
while[member[.finished]] begin[{]
assign[member[.finished], literal[true]]
local_variable[type[Iterator], itMods]
while[call[itMods.hasNext, parameter[]]] begin[{]
local_variable[type[String], moduleName]
local_variable[type[List], deps]
if[binary_operation[binary_operation[member[.deps], ==, literal[null]], ||, call[deps.isEmpty, parameter[]]]] begin[{]
call[retList.add, parameter[member[.moduleName]]]
local_variable[type[Iterator], itDeps]
while[call[itDeps.hasNext, parameter[]]] begin[{]
local_variable[type[List], dependencies]
call[dependencies.remove, parameter[member[.moduleName]]]
end[}]
assign[member[.finished], literal[false]]
call[itMods.remove, parameter[]]
else begin[{]
None
end[}]
end[}]
end[}]
if[call[modules.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=ERR_MODULE_DEPENDENCY_CYCLE_1, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=modules, selectors=[], type_arguments=None)], member=container, 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=CmsIllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[Collections.reverse, parameter[member[.retList]]]
return[member[.retList]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[topologicalSort] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[moduleNames] , identifier[String] identifier[rfsAbsPath] operator[SEP] Keyword[throws] identifier[CmsConfigurationException] {
identifier[List] operator[<] identifier[String] operator[>] identifier[modules] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[moduleNames] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[retList] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[moduleDependencies] operator[=] identifier[buildDepsForModulelist] operator[SEP] identifier[moduleNames] , identifier[rfsAbsPath] , literal[boolean] operator[SEP] operator[SEP] Keyword[boolean] identifier[finished] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[finished] operator[SEP] {
identifier[finished] operator[=] literal[boolean] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[itMods] operator[=] identifier[modules] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itMods] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[moduleName] operator[=] identifier[itMods] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[deps] operator[=] identifier[moduleDependencies] operator[SEP] identifier[get] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[deps] operator[==] Other[null] operator[SEP] operator[||] identifier[deps] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[retList] operator[SEP] identifier[add] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[itDeps] operator[=] identifier[moduleDependencies] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itDeps] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[dependencies] operator[=] identifier[itDeps] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[dependencies] operator[SEP] identifier[remove] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP]
}
identifier[finished] operator[=] literal[boolean] operator[SEP] identifier[itMods] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] operator[!] identifier[modules] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CmsIllegalStateException] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_MODULE_DEPENDENCY_CYCLE_1] , identifier[modules] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Collections] operator[SEP] identifier[reverse] operator[SEP] identifier[retList] operator[SEP] operator[SEP] Keyword[return] identifier[retList] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.