code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static Node getNodeBySpaceAndId(String nameSpace, String zealotId) {
String filePath = XmlContext.INSTANCE.getXmlPathMap().get(nameSpace);
Document doc = XmlNodeHelper.getDocument(filePath);
return doc == null ? null : XmlNodeHelper.getZealotNodeById(doc, zealotId);
}
|
class class_name[name] begin[{]
method[getNodeBySpaceAndId, return_type[type[Node]], modifier[public static], parameter[nameSpace, zealotId]] begin[{]
local_variable[type[String], filePath]
local_variable[type[Document], doc]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=zealotId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getZealotNodeById, postfix_operators=[], prefix_operators=[], qualifier=XmlNodeHelper, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Node] identifier[getNodeBySpaceAndId] operator[SEP] identifier[String] identifier[nameSpace] , identifier[String] identifier[zealotId] operator[SEP] {
identifier[String] identifier[filePath] operator[=] identifier[XmlContext] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getXmlPathMap] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nameSpace] operator[SEP] operator[SEP] identifier[Document] identifier[doc] operator[=] identifier[XmlNodeHelper] operator[SEP] identifier[getDocument] operator[SEP] identifier[filePath] operator[SEP] operator[SEP] Keyword[return] identifier[doc] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[XmlNodeHelper] operator[SEP] identifier[getZealotNodeById] operator[SEP] identifier[doc] , identifier[zealotId] operator[SEP] operator[SEP]
}
|
protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty)
{
_metamgr.paintMedia(gfx, layer, dirty);
}
|
class class_name[name] begin[{]
method[paintBits, return_type[void], modifier[protected], parameter[gfx, layer, dirty]] begin[{]
call[_metamgr.paintMedia, parameter[member[.gfx], member[.layer], member[.dirty]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[paintBits] operator[SEP] identifier[Graphics2D] identifier[gfx] , Keyword[int] identifier[layer] , identifier[Rectangle] identifier[dirty] operator[SEP] {
identifier[_metamgr] operator[SEP] identifier[paintMedia] operator[SEP] identifier[gfx] , identifier[layer] , identifier[dirty] operator[SEP] operator[SEP]
}
|
public static base_responses delete(nitro_service client, ntpserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
ntpserver deleteresources[] = new ntpserver[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new ntpserver();
deleteresources[i].serverip = resources[i].serverip;
deleteresources[i].servername = resources[i].servername;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
}
|
class class_name[name] begin[{]
method[delete, return_type[type[base_responses]], modifier[public static], parameter[client, resources]] begin[{]
local_variable[type[base_responses], result]
if[binary_operation[binary_operation[member[.resources], !=, literal[null]], &&, binary_operation[member[resources.length], >, literal[0]]]] begin[{]
local_variable[type[ntpserver], deleteresources]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, 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=ntpserver, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=serverip, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=serverip, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=servername, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=servername, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=resources, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.result], call[.delete_bulk_request, parameter[member[.client], member[.deleteresources]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[base_responses] identifier[delete] operator[SEP] identifier[nitro_service] identifier[client] , identifier[ntpserver] identifier[resources] operator[SEP] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[base_responses] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[resources] operator[!=] Other[null] operator[&&] identifier[resources] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[ntpserver] identifier[deleteresources] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[ntpserver] operator[SEP] identifier[resources] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[resources] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[ntpserver] operator[SEP] operator[SEP] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[serverip] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[serverip] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[servername] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[servername] operator[SEP]
}
identifier[result] operator[=] identifier[delete_bulk_request] operator[SEP] identifier[client] , identifier[deleteresources] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
private static void changeScene(@NonNull Scene scene, @Nullable Transition transition) {
final ViewGroup sceneRoot = scene.getSceneRoot();
if (!sPendingTransitions.contains(sceneRoot)) {
Transition transitionClone = null;
if (isTransitionsAllowed()) {
sPendingTransitions.add(sceneRoot);
if (transition != null) {
transitionClone = transition.clone();
transitionClone.setSceneRoot(sceneRoot);
}
Scene oldScene = Scene.getCurrentScene(sceneRoot);
if (oldScene != null && transitionClone != null &&
oldScene.isCreatedFromLayoutResource()) {
transitionClone.setCanRemoveViews(true);
}
}
sceneChangeSetup(sceneRoot, transitionClone);
scene.enter();
sceneChangeRunTransition(sceneRoot, transitionClone);
}
}
|
class class_name[name] begin[{]
method[changeScene, return_type[void], modifier[private static], parameter[scene, transition]] begin[{]
local_variable[type[ViewGroup], sceneRoot]
if[call[sPendingTransitions.contains, parameter[member[.sceneRoot]]]] begin[{]
local_variable[type[Transition], transitionClone]
if[call[.isTransitionsAllowed, parameter[]]] begin[{]
call[sPendingTransitions.add, parameter[member[.sceneRoot]]]
if[binary_operation[member[.transition], !=, literal[null]]] begin[{]
assign[member[.transitionClone], call[transition.clone, parameter[]]]
call[transitionClone.setSceneRoot, parameter[member[.sceneRoot]]]
else begin[{]
None
end[}]
local_variable[type[Scene], oldScene]
if[binary_operation[binary_operation[binary_operation[member[.oldScene], !=, literal[null]], &&, binary_operation[member[.transitionClone], !=, literal[null]]], &&, call[oldScene.isCreatedFromLayoutResource, parameter[]]]] begin[{]
call[transitionClone.setCanRemoveViews, parameter[literal[true]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[.sceneChangeSetup, parameter[member[.sceneRoot], member[.transitionClone]]]
call[scene.enter, parameter[]]
call[.sceneChangeRunTransition, parameter[member[.sceneRoot], member[.transitionClone]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[changeScene] operator[SEP] annotation[@] identifier[NonNull] identifier[Scene] identifier[scene] , annotation[@] identifier[Nullable] identifier[Transition] identifier[transition] operator[SEP] {
Keyword[final] identifier[ViewGroup] identifier[sceneRoot] operator[=] identifier[scene] operator[SEP] identifier[getSceneRoot] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[sPendingTransitions] operator[SEP] identifier[contains] operator[SEP] identifier[sceneRoot] operator[SEP] operator[SEP] {
identifier[Transition] identifier[transitionClone] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[isTransitionsAllowed] operator[SEP] operator[SEP] operator[SEP] {
identifier[sPendingTransitions] operator[SEP] identifier[add] operator[SEP] identifier[sceneRoot] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[transition] operator[!=] Other[null] operator[SEP] {
identifier[transitionClone] operator[=] identifier[transition] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[transitionClone] operator[SEP] identifier[setSceneRoot] operator[SEP] identifier[sceneRoot] operator[SEP] operator[SEP]
}
identifier[Scene] identifier[oldScene] operator[=] identifier[Scene] operator[SEP] identifier[getCurrentScene] operator[SEP] identifier[sceneRoot] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[oldScene] operator[!=] Other[null] operator[&&] identifier[transitionClone] operator[!=] Other[null] operator[&&] identifier[oldScene] operator[SEP] identifier[isCreatedFromLayoutResource] operator[SEP] operator[SEP] operator[SEP] {
identifier[transitionClone] operator[SEP] identifier[setCanRemoveViews] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
identifier[sceneChangeSetup] operator[SEP] identifier[sceneRoot] , identifier[transitionClone] operator[SEP] operator[SEP] identifier[scene] operator[SEP] identifier[enter] operator[SEP] operator[SEP] operator[SEP] identifier[sceneChangeRunTransition] operator[SEP] identifier[sceneRoot] , identifier[transitionClone] operator[SEP] operator[SEP]
}
}
|
public long getTotalBytesOnTiersOrThrow(
java.lang.String key) {
if (key == null) { throw new java.lang.NullPointerException(); }
java.util.Map<java.lang.String, java.lang.Long> map =
internalGetTotalBytesOnTiers().getMap();
if (!map.containsKey(key)) {
throw new java.lang.IllegalArgumentException();
}
return map.get(key);
}
|
class class_name[name] begin[{]
method[getTotalBytesOnTiersOrThrow, return_type[type[long]], modifier[public], parameter[key]] begin[{]
if[binary_operation[member[.key], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=lang, sub_type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)))), label=None)
else begin[{]
None
end[}]
local_variable[type[java], map]
if[call[map.containsKey, parameter[member[.key]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=lang, sub_type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)))), label=None)
else begin[{]
None
end[}]
return[call[map.get, parameter[member[.key]]]]
end[}]
END[}]
|
Keyword[public] Keyword[long] identifier[getTotalBytesOnTiersOrThrow] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] , identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[Long] operator[>] identifier[map] operator[=] identifier[internalGetTotalBytesOnTiers] operator[SEP] operator[SEP] operator[SEP] identifier[getMap] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[map] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
|
private void doUndeploy(final Message<JsonObject> message) {
// If we're undeploying a network then it needs to be handled differently by
// selecting the node on which the network is deployed.
String type = message.body().getString("type");
if (type.equals("network")) {
doUndeployNetwork(message);
return;
}
final String deploymentID = message.body().getString("id");
if (deploymentID == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "No deployment ID specified."));
} else {
findDeploymentAddress(deploymentID, new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
} else if (result.result() == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "Invalid deployment " + deploymentID));
} else {
vertx.eventBus().sendWithTimeout(result.result(), message.body(), 30000, new Handler<AsyncResult<Message<JsonObject>>>() {
@Override
public void handle(AsyncResult<Message<JsonObject>> result) {
if (result.failed()) {
message.fail(((ReplyException) result.cause()).failureCode(), result.cause().getMessage());
} else {
message.reply(result.result().body());
}
}
});
}
}
});
}
}
|
class class_name[name] begin[{]
method[doUndeploy, return_type[void], modifier[private], parameter[message]] begin[{]
local_variable[type[String], type]
if[call[type.equals, parameter[literal["network"]]]] begin[{]
call[.doUndeployNetwork, parameter[member[.message]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[String], deploymentID]
if[binary_operation[member[.deploymentID], ==, literal[null]]] begin[{]
call[message.reply, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="status"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="error")], member=putString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="message"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No deployment ID specified.")], member=putString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JsonObject, sub_type=None))]]
else begin[{]
call[.findDeploymentAddress, parameter[member[.deploymentID], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[], member=failed, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=result, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=eventBus, postfix_operators=[], prefix_operators=[], qualifier=vertx, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=result, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=body, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=30000), ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[], member=failed, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=result, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[MethodInvocation(arguments=[], member=body, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=reply, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[], member=cause, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ReplyException, sub_type=None)), MethodInvocation(arguments=[], member=cause, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=fail, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=handle, parameters=[FormalParameter(annotations=[], modifiers=set(), name=result, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None))], dimensions=[], name=Message, sub_type=None))], dimensions=[], name=AsyncResult, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None))], dimensions=[], name=Message, sub_type=None))], dimensions=[], name=AsyncResult, sub_type=None))], dimensions=None, name=Handler, sub_type=None))], member=sendWithTimeout, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="status"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="error")], member=putString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="message"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid deployment "), operandr=MemberReference(member=deploymentID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=putString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JsonObject, sub_type=None))], member=reply, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="status"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="error")], member=putString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="message"), MethodInvocation(arguments=[], member=cause, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=putString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JsonObject, sub_type=None))], member=reply, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=handle, parameters=[FormalParameter(annotations=[], modifiers=set(), name=result, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=AsyncResult, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=AsyncResult, sub_type=None))], dimensions=None, name=Handler, sub_type=None))]]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[doUndeploy] operator[SEP] Keyword[final] identifier[Message] operator[<] identifier[JsonObject] operator[>] identifier[message] operator[SEP] {
identifier[String] identifier[type] operator[=] identifier[message] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[doUndeployNetwork] operator[SEP] identifier[message] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[final] identifier[String] identifier[deploymentID] operator[=] identifier[message] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[deploymentID] operator[==] Other[null] operator[SEP] {
identifier[message] operator[SEP] identifier[reply] operator[SEP] Keyword[new] identifier[JsonObject] operator[SEP] operator[SEP] operator[SEP] identifier[putString] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[putString] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[findDeploymentAddress] operator[SEP] identifier[deploymentID] , Keyword[new] identifier[Handler] operator[<] identifier[AsyncResult] operator[<] identifier[String] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handle] operator[SEP] identifier[AsyncResult] operator[<] identifier[String] operator[>] identifier[result] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[failed] operator[SEP] operator[SEP] operator[SEP] {
identifier[message] operator[SEP] identifier[reply] operator[SEP] Keyword[new] identifier[JsonObject] operator[SEP] operator[SEP] operator[SEP] identifier[putString] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[putString] operator[SEP] literal[String] , identifier[result] operator[SEP] identifier[cause] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[result] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[message] operator[SEP] identifier[reply] operator[SEP] Keyword[new] identifier[JsonObject] operator[SEP] operator[SEP] operator[SEP] identifier[putString] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[putString] operator[SEP] literal[String] , literal[String] operator[+] identifier[deploymentID] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[vertx] operator[SEP] identifier[eventBus] operator[SEP] operator[SEP] operator[SEP] identifier[sendWithTimeout] operator[SEP] identifier[result] operator[SEP] identifier[result] operator[SEP] operator[SEP] , identifier[message] operator[SEP] identifier[body] operator[SEP] operator[SEP] , Other[30000] , Keyword[new] identifier[Handler] operator[<] identifier[AsyncResult] operator[<] identifier[Message] operator[<] identifier[JsonObject] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handle] operator[SEP] identifier[AsyncResult] operator[<] identifier[Message] operator[<] identifier[JsonObject] operator[>] operator[>] identifier[result] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[failed] operator[SEP] operator[SEP] operator[SEP] {
identifier[message] operator[SEP] identifier[fail] operator[SEP] operator[SEP] operator[SEP] identifier[ReplyException] operator[SEP] identifier[result] operator[SEP] identifier[cause] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[failureCode] operator[SEP] operator[SEP] , identifier[result] operator[SEP] identifier[cause] operator[SEP] operator[SEP] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[message] operator[SEP] identifier[reply] operator[SEP] identifier[result] operator[SEP] identifier[result] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
}
|
public static void appendEpochMillis(StringBuilder buf, long timeMillis) {
buf.append(dateTimeFormatter.format(Instant.ofEpochMilli(timeMillis)))
.append('(').append(timeMillis).append(')');
}
|
class class_name[name] begin[{]
method[appendEpochMillis, return_type[void], modifier[public static], parameter[buf, timeMillis]] begin[{]
call[buf.append, parameter[call[dateTimeFormatter.format, parameter[call[Instant.ofEpochMilli, parameter[member[.timeMillis]]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[appendEpochMillis] operator[SEP] identifier[StringBuilder] identifier[buf] , Keyword[long] identifier[timeMillis] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[dateTimeFormatter] operator[SEP] identifier[format] operator[SEP] identifier[Instant] operator[SEP] identifier[ofEpochMilli] operator[SEP] identifier[timeMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[timeMillis] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public static BasicCredentials parse(String input)
{
if (input == null)
{
return null;
}
Matcher matcher = CHALLENGE_PATTERN.matcher(input);
if (matcher.matches() == false)
{
return new BasicCredentials(null, null);
}
// "userid:password" encoded in Base64.
String encoded = matcher.group(1);
// Decode the base64 string.
byte[] decoded = Base64.decodeBase64(encoded);
// Convert the byte array to String.
String value = createString(decoded);
// Split "userid:password" into "userid" and "password".
String[] credentials = value.split(":", 2);
// User ID and Password.
String userId = null;
String password = null;
switch (credentials.length)
{
case 2:
// Password
password = credentials[1];
// FALLTHROUGH
case 1:
// User ID
userId = credentials[0];
}
return new BasicCredentials(userId, password);
}
|
class class_name[name] begin[{]
method[parse, return_type[type[BasicCredentials]], modifier[public static], parameter[input]] begin[{]
if[binary_operation[member[.input], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Matcher], matcher]
if[binary_operation[call[matcher.matches, parameter[]], ==, literal[false]]] begin[{]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicCredentials, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], encoded]
local_variable[type[byte], decoded]
local_variable[type[String], value]
local_variable[type[String], credentials]
local_variable[type[String], userId]
local_variable[type[String], password]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=credentials, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=userId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=credentials, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])), label=None)])], expression=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=credentials, selectors=[]), label=None)
return[ClassCreator(arguments=[MemberReference(member=userId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=password, 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=BasicCredentials, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BasicCredentials] identifier[parse] operator[SEP] identifier[String] identifier[input] operator[SEP] {
Keyword[if] operator[SEP] identifier[input] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Matcher] identifier[matcher] operator[=] identifier[CHALLENGE_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[matcher] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[==] literal[boolean] operator[SEP] {
Keyword[return] Keyword[new] identifier[BasicCredentials] operator[SEP] Other[null] , Other[null] operator[SEP] operator[SEP]
}
identifier[String] identifier[encoded] operator[=] identifier[matcher] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[decoded] operator[=] identifier[Base64] operator[SEP] identifier[decodeBase64] operator[SEP] identifier[encoded] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] identifier[createString] operator[SEP] identifier[decoded] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[credentials] operator[=] identifier[value] operator[SEP] identifier[split] operator[SEP] literal[String] , Other[2] operator[SEP] operator[SEP] identifier[String] identifier[userId] operator[=] Other[null] operator[SEP] identifier[String] identifier[password] operator[=] Other[null] operator[SEP] Keyword[switch] operator[SEP] identifier[credentials] operator[SEP] identifier[length] operator[SEP] {
Keyword[case] Other[2] operator[:] identifier[password] operator[=] identifier[credentials] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[case] Other[1] operator[:] identifier[userId] operator[=] identifier[credentials] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[BasicCredentials] operator[SEP] identifier[userId] , identifier[password] operator[SEP] operator[SEP]
}
|
public List<Pair<Integer, Integer>> commonPrefixSearch(byte[] key,
int offset,
int maxResults)
{
ArrayList<Pair<Integer, Integer>> result = new ArrayList<Pair<Integer, Integer>>();
int unit = _array[0];
int nodePos = 0;
// nodePos ^= unit.offset();
nodePos ^= ((unit >>> 10) << ((unit & (1 << 9)) >>> 6));
for (int i = offset; i < key.length; ++i)
{
byte b = key[i];
nodePos ^= (b & 0xff);
unit = _array[nodePos];
// if (unit.label() != b) {
if ((unit & ((1 << 31) | 0xFF)) != (b & 0xff))
{
return result;
}
// nodePos ^= unit.offset();
nodePos ^= ((unit >>> 10) << ((unit & (1 << 9)) >>> 6));
// if (unit.has_leaf()) {
if (((unit >>> 8) & 1) == 1)
{
if (result.size() < maxResults)
{
// result.add(new Pair<i, _array[nodePos].value());
result.add(new Pair<Integer, Integer>(i + 1, _array[nodePos] & ((1 << 31) - 1)));
}
}
}
return result;
}
|
class class_name[name] begin[{]
method[commonPrefixSearch, return_type[type[List]], modifier[public], parameter[key, offset, maxResults]] begin[{]
local_variable[type[ArrayList], result]
local_variable[type[int], unit]
local_variable[type[int], nodePos]
assign[member[.nodePos], binary_operation[binary_operation[member[.unit], >>>, literal[10]], <<, binary_operation[binary_operation[member[.unit], &, binary_operation[literal[1], <<, literal[9]]], >>>, literal[6]]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=b)], modifiers=set(), type=BasicType(dimensions=[], name=byte)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=nodePos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=^=, value=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=_array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=nodePos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=31), operator=<<), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=|), operator=&), operandr=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=nodePos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=^=, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), operator=>>>), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=9), operator=<<), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6), operator=>>>), operator=<<)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=&), 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=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), operandr=MemberReference(member=maxResults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), BinaryOperation(operandl=MemberReference(member=_array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=nodePos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=31), operator=<<), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=&)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=None, name=Pair, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[Pair] operator[<] identifier[Integer] , identifier[Integer] operator[>] operator[>] identifier[commonPrefixSearch] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[key] , Keyword[int] identifier[offset] , Keyword[int] identifier[maxResults] operator[SEP] {
identifier[ArrayList] operator[<] identifier[Pair] operator[<] identifier[Integer] , identifier[Integer] operator[>] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Pair] operator[<] identifier[Integer] , identifier[Integer] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[unit] operator[=] identifier[_array] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] identifier[nodePos] operator[=] Other[0] operator[SEP] identifier[nodePos] operator[^=] operator[SEP] operator[SEP] identifier[unit] operator[>] operator[>] operator[>] Other[10] operator[SEP] operator[<<] operator[SEP] operator[SEP] identifier[unit] operator[&] operator[SEP] Other[1] operator[<<] Other[9] operator[SEP] operator[SEP] operator[>] operator[>] operator[>] Other[6] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[offset] operator[SEP] identifier[i] operator[<] identifier[key] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[byte] identifier[b] operator[=] identifier[key] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[nodePos] operator[^=] operator[SEP] identifier[b] operator[&] literal[Integer] operator[SEP] operator[SEP] identifier[unit] operator[=] identifier[_array] operator[SEP] identifier[nodePos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[unit] operator[&] operator[SEP] operator[SEP] Other[1] operator[<<] Other[31] operator[SEP] operator[|] literal[Integer] operator[SEP] operator[SEP] operator[!=] operator[SEP] identifier[b] operator[&] literal[Integer] operator[SEP] operator[SEP] {
Keyword[return] identifier[result] operator[SEP]
}
identifier[nodePos] operator[^=] operator[SEP] operator[SEP] identifier[unit] operator[>] operator[>] operator[>] Other[10] operator[SEP] operator[<<] operator[SEP] operator[SEP] identifier[unit] operator[&] operator[SEP] Other[1] operator[<<] Other[9] operator[SEP] operator[SEP] operator[>] operator[>] operator[>] Other[6] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[unit] operator[>] operator[>] operator[>] Other[8] operator[SEP] operator[&] Other[1] operator[SEP] operator[==] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] identifier[maxResults] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Pair] operator[<] identifier[Integer] , identifier[Integer] operator[>] operator[SEP] identifier[i] operator[+] Other[1] , identifier[_array] operator[SEP] identifier[nodePos] operator[SEP] operator[&] operator[SEP] operator[SEP] Other[1] operator[<<] Other[31] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static String stringFor(int n)
{
switch (n)
{
case CUBLAS_GEMM_DEFAULT: return "CUBLAS_GEMM_DEFAULT";
case CUBLAS_GEMM_ALGO0: return "CUBLAS_GEMM_ALGO0";
case CUBLAS_GEMM_ALGO1: return "CUBLAS_GEMM_ALGO1";
case CUBLAS_GEMM_ALGO2: return "CUBLAS_GEMM_ALGO2";
case CUBLAS_GEMM_ALGO3: return "CUBLAS_GEMM_ALGO3";
case CUBLAS_GEMM_ALGO4: return "CUBLAS_GEMM_ALGO4";
case CUBLAS_GEMM_ALGO5: return "CUBLAS_GEMM_ALGO5";
case CUBLAS_GEMM_ALGO6: return "CUBLAS_GEMM_ALGO6";
case CUBLAS_GEMM_ALGO7: return "CUBLAS_GEMM_ALGO7";
case CUBLAS_GEMM_ALGO8: return "CUBLAS_GEMM_ALGO8";
case CUBLAS_GEMM_ALGO9: return "CUBLAS_GEMM_ALGO9";
case CUBLAS_GEMM_ALGO10: return "CUBLAS_GEMM_ALGO10";
case CUBLAS_GEMM_ALGO11: return "CUBLAS_GEMM_ALGO11";
case CUBLAS_GEMM_ALGO12: return "CUBLAS_GEMM_ALGO12";
case CUBLAS_GEMM_ALGO13: return "CUBLAS_GEMM_ALGO13";
case CUBLAS_GEMM_ALGO14: return "CUBLAS_GEMM_ALGO14";
case CUBLAS_GEMM_ALGO15: return "CUBLAS_GEMM_ALGO15";
case CUBLAS_GEMM_ALGO16: return "CUBLAS_GEMM_ALGO16";
case CUBLAS_GEMM_ALGO17: return "CUBLAS_GEMM_ALGO17";
case CUBLAS_GEMM_ALGO18: return "CUBLAS_GEMM_ALGO18";
case CUBLAS_GEMM_ALGO19: return "CUBLAS_GEMM_ALGO19";
case CUBLAS_GEMM_ALGO20: return "CUBLAS_GEMM_ALGO20";
case CUBLAS_GEMM_ALGO21: return "CUBLAS_GEMM_ALGO21";
case CUBLAS_GEMM_ALGO22: return "CUBLAS_GEMM_ALGO22";
case CUBLAS_GEMM_ALGO23: return "CUBLAS_GEMM_ALGO23";
case CUBLAS_GEMM_DEFAULT_TENSOR_OP: return "CUBLAS_GEMM_DEFAULT_TENSOR_OP";
case CUBLAS_GEMM_ALGO0_TENSOR_OP: return "CUBLAS_GEMM_ALGO0_TENSOR_OP";
case CUBLAS_GEMM_ALGO1_TENSOR_OP: return "CUBLAS_GEMM_ALGO1_TENSOR_OP";
case CUBLAS_GEMM_ALGO2_TENSOR_OP: return "CUBLAS_GEMM_ALGO2_TENSOR_OP";
case CUBLAS_GEMM_ALGO3_TENSOR_OP: return "CUBLAS_GEMM_ALGO3_TENSOR_OP";
case CUBLAS_GEMM_ALGO4_TENSOR_OP: return "CUBLAS_GEMM_ALGO4_TENSOR_OP";
case CUBLAS_GEMM_ALGO5_TENSOR_OP: return "CUBLAS_GEMM_ALGO5_TENSOR_OP";
case CUBLAS_GEMM_ALGO6_TENSOR_OP: return "CUBLAS_GEMM_ALGO6_TENSOR_OP";
case CUBLAS_GEMM_ALGO7_TENSOR_OP: return "CUBLAS_GEMM_ALGO7_TENSOR_OP";
case CUBLAS_GEMM_ALGO8_TENSOR_OP: return "CUBLAS_GEMM_ALGO8_TENSOR_OP";
case CUBLAS_GEMM_ALGO9_TENSOR_OP: return "CUBLAS_GEMM_ALGO9_TENSOR_OP";
case CUBLAS_GEMM_ALGO10_TENSOR_OP: return "CUBLAS_GEMM_ALGO10_TENSOR_OP";
case CUBLAS_GEMM_ALGO11_TENSOR_OP: return "CUBLAS_GEMM_ALGO11_TENSOR_OP";
case CUBLAS_GEMM_ALGO12_TENSOR_OP: return "CUBLAS_GEMM_ALGO12_TENSOR_OP";
case CUBLAS_GEMM_ALGO13_TENSOR_OP: return "CUBLAS_GEMM_ALGO13_TENSOR_OP";
case CUBLAS_GEMM_ALGO14_TENSOR_OP: return "CUBLAS_GEMM_ALGO14_TENSOR_OP";
}
return "INVALID cublasGemmAlgo: "+n;
}
|
class class_name[name] begin[{]
method[stringFor, return_type[type[String]], modifier[public static], parameter[n]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['CUBLAS_GEMM_DEFAULT'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_DEFAULT"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO0'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO0"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO1'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO1"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO2'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO2"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO3'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO3"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO4'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO4"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO5'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO5"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO6'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO6"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO7'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO7"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO8'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO8"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO9'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO9"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO10'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO10"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO11'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO11"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO12'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO12"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO13'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO13"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO14'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO14"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO15'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO15"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO16'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO16"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO17'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO17"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO18'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO18"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO19'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO19"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO20'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO20"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO21'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO21"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO22'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO22"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO23'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO23"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_DEFAULT_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_DEFAULT_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO0_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO0_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO1_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO1_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO2_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO2_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO3_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO3_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO4_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO4_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO5_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO5_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO6_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO6_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO7_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO7_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO8_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO8_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO9_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO9_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO10_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO10_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO11_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO11_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO12_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO12_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO13_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO13_TENSOR_OP"), label=None)]), SwitchStatementCase(case=['CUBLAS_GEMM_ALGO14_TENSOR_OP'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CUBLAS_GEMM_ALGO14_TENSOR_OP"), label=None)])], expression=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[binary_operation[literal["INVALID cublasGemmAlgo: "], +, member[.n]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[stringFor] operator[SEP] Keyword[int] identifier[n] operator[SEP] {
Keyword[switch] operator[SEP] identifier[n] operator[SEP] {
Keyword[case] identifier[CUBLAS_GEMM_DEFAULT] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO0] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO1] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO2] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO3] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO4] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO5] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO6] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO7] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO8] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO9] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO10] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO11] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO12] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO13] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO14] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO15] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO16] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO17] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO18] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO19] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO20] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO21] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO22] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO23] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_DEFAULT_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO0_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO1_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO2_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO3_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO4_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO5_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO6_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO7_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO8_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO9_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO10_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO11_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO12_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO13_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CUBLAS_GEMM_ALGO14_TENSOR_OP] operator[:] Keyword[return] literal[String] operator[SEP]
}
Keyword[return] literal[String] operator[+] identifier[n] operator[SEP]
}
|
public static List<BeanMappingObject> parseMapping(Class src, Class target) throws BeanMappingException {
List<BeanMappingObject> result = new ArrayList<BeanMappingObject>(2);
PropertyDescriptor[] targetPds = ReflectionHelper.getPropertyDescriptors(target);
PropertyDescriptor[] srcPds = ReflectionHelper.getPropertyDescriptors(src);
BeanMappingObject object = new BeanMappingObject();
object.setSrcClass(src);
object.setTargetClass(target);
object.setBatch(true);
BeanMappingBehavior globalBehavior = BeanMappingConfigHelper.getInstance().getGlobalBehavior();
List<BeanMappingField> fields = new ArrayList<BeanMappingField>();
for (PropertyDescriptor targetPd : targetPds) {
String property = targetPd.getName();
PropertyDescriptor srcPd = getMatchPropertyDescriptor(srcPds, property);
if (srcPd == null) {// 没有匹配属性
continue;
}
if (targetPd.getWriteMethod() != null && srcPd.getReadMethod() != null) {
BeanMappingField field = new BeanMappingField();
BeanMappingFieldAttributes srcFieldAttribute = new BeanMappingFieldAttributes();
srcFieldAttribute.setName(property);
srcFieldAttribute.setClazz(srcPd.getPropertyType());
BeanMappingFieldAttributes targetFieldAttribute = new BeanMappingFieldAttributes();
targetFieldAttribute.setName(property);
targetFieldAttribute.setClazz(targetPd.getPropertyType());
// 添加记录
field.setSrcField(srcFieldAttribute);
field.setTargetField(targetFieldAttribute);
field.setBehavior(globalBehavior);
fields.add(field);
}
}
object.setBeanFields(fields);
object.setBehavior(globalBehavior);// 设置为global
result.add(object);
if (object.isReversable()) {
BeanMappingObject reverseObject = reverse(object);
if (reverseObject != null) {
result.add(reverseObject);
}
}
return result;
}
|
class class_name[name] begin[{]
method[parseMapping, return_type[type[List]], modifier[public static], parameter[src, target]] begin[{]
local_variable[type[List], result]
local_variable[type[PropertyDescriptor], targetPds]
local_variable[type[PropertyDescriptor], srcPds]
local_variable[type[BeanMappingObject], object]
call[object.setSrcClass, parameter[member[.src]]]
call[object.setTargetClass, parameter[member[.target]]]
call[object.setBatch, parameter[literal[true]]]
local_variable[type[BeanMappingBehavior], globalBehavior]
local_variable[type[List], fields]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=targetPd, selectors=[], type_arguments=None), name=property)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=srcPds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=property, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMatchPropertyDescriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=srcPd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PropertyDescriptor, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=srcPd, 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=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getWriteMethod, postfix_operators=[], prefix_operators=[], qualifier=targetPd, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getReadMethod, postfix_operators=[], prefix_operators=[], qualifier=srcPd, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BeanMappingField, sub_type=None)), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BeanMappingField, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BeanMappingFieldAttributes, sub_type=None)), name=srcFieldAttribute)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BeanMappingFieldAttributes, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=property, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setName, postfix_operators=[], prefix_operators=[], qualifier=srcFieldAttribute, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPropertyType, postfix_operators=[], prefix_operators=[], qualifier=srcPd, selectors=[], type_arguments=None)], member=setClazz, postfix_operators=[], prefix_operators=[], qualifier=srcFieldAttribute, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BeanMappingFieldAttributes, sub_type=None)), name=targetFieldAttribute)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BeanMappingFieldAttributes, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=property, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setName, postfix_operators=[], prefix_operators=[], qualifier=targetFieldAttribute, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPropertyType, postfix_operators=[], prefix_operators=[], qualifier=targetPd, selectors=[], type_arguments=None)], member=setClazz, postfix_operators=[], prefix_operators=[], qualifier=targetFieldAttribute, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=srcFieldAttribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSrcField, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=targetFieldAttribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTargetField, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=globalBehavior, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setBehavior, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=targetPds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=targetPd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PropertyDescriptor, sub_type=None))), label=None)
call[object.setBeanFields, parameter[member[.fields]]]
call[object.setBehavior, parameter[member[.globalBehavior]]]
call[result.add, parameter[member[.object]]]
if[call[object.isReversable, parameter[]]] begin[{]
local_variable[type[BeanMappingObject], reverseObject]
if[binary_operation[member[.reverseObject], !=, literal[null]]] begin[{]
call[result.add, parameter[member[.reverseObject]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[BeanMappingObject] operator[>] identifier[parseMapping] operator[SEP] identifier[Class] identifier[src] , identifier[Class] identifier[target] operator[SEP] Keyword[throws] identifier[BeanMappingException] {
identifier[List] operator[<] identifier[BeanMappingObject] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[BeanMappingObject] operator[>] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[PropertyDescriptor] operator[SEP] operator[SEP] identifier[targetPds] operator[=] identifier[ReflectionHelper] operator[SEP] identifier[getPropertyDescriptors] operator[SEP] identifier[target] operator[SEP] operator[SEP] identifier[PropertyDescriptor] operator[SEP] operator[SEP] identifier[srcPds] operator[=] identifier[ReflectionHelper] operator[SEP] identifier[getPropertyDescriptors] operator[SEP] identifier[src] operator[SEP] operator[SEP] identifier[BeanMappingObject] identifier[object] operator[=] Keyword[new] identifier[BeanMappingObject] operator[SEP] operator[SEP] operator[SEP] identifier[object] operator[SEP] identifier[setSrcClass] operator[SEP] identifier[src] operator[SEP] operator[SEP] identifier[object] operator[SEP] identifier[setTargetClass] operator[SEP] identifier[target] operator[SEP] operator[SEP] identifier[object] operator[SEP] identifier[setBatch] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[BeanMappingBehavior] identifier[globalBehavior] operator[=] identifier[BeanMappingConfigHelper] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getGlobalBehavior] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[BeanMappingField] operator[>] identifier[fields] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[BeanMappingField] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[PropertyDescriptor] identifier[targetPd] operator[:] identifier[targetPds] operator[SEP] {
identifier[String] identifier[property] operator[=] identifier[targetPd] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[PropertyDescriptor] identifier[srcPd] operator[=] identifier[getMatchPropertyDescriptor] operator[SEP] identifier[srcPds] , identifier[property] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[srcPd] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[targetPd] operator[SEP] identifier[getWriteMethod] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[srcPd] operator[SEP] identifier[getReadMethod] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[BeanMappingField] identifier[field] operator[=] Keyword[new] identifier[BeanMappingField] operator[SEP] operator[SEP] operator[SEP] identifier[BeanMappingFieldAttributes] identifier[srcFieldAttribute] operator[=] Keyword[new] identifier[BeanMappingFieldAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[srcFieldAttribute] operator[SEP] identifier[setName] operator[SEP] identifier[property] operator[SEP] operator[SEP] identifier[srcFieldAttribute] operator[SEP] identifier[setClazz] operator[SEP] identifier[srcPd] operator[SEP] identifier[getPropertyType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[BeanMappingFieldAttributes] identifier[targetFieldAttribute] operator[=] Keyword[new] identifier[BeanMappingFieldAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[targetFieldAttribute] operator[SEP] identifier[setName] operator[SEP] identifier[property] operator[SEP] operator[SEP] identifier[targetFieldAttribute] operator[SEP] identifier[setClazz] operator[SEP] identifier[targetPd] operator[SEP] identifier[getPropertyType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setSrcField] operator[SEP] identifier[srcFieldAttribute] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setTargetField] operator[SEP] identifier[targetFieldAttribute] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setBehavior] operator[SEP] identifier[globalBehavior] operator[SEP] operator[SEP] identifier[fields] operator[SEP] identifier[add] operator[SEP] identifier[field] operator[SEP] operator[SEP]
}
}
identifier[object] operator[SEP] identifier[setBeanFields] operator[SEP] identifier[fields] operator[SEP] operator[SEP] identifier[object] operator[SEP] identifier[setBehavior] operator[SEP] identifier[globalBehavior] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[object] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[object] operator[SEP] identifier[isReversable] operator[SEP] operator[SEP] operator[SEP] {
identifier[BeanMappingObject] identifier[reverseObject] operator[=] identifier[reverse] operator[SEP] identifier[object] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reverseObject] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[reverseObject] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
Bitmap generateGradient() {
int[][] pixels = new int[1080][1920];
for (int y = 0; y < 1080; y++) {
for (int x = 0; x < 1920; x++) {
int r = (int) (y / 1080f * 255);
int g = (int) (x / 1920f * 255);
int b = (int) ((Math.hypot(x, y) / Math.hypot(1080, 1920)) * 255);
pixels[y][x] = r << 16 | g << 8 | b;
}
}
return new Bitmap(pixels);
}
|
class class_name[name] begin[{]
method[generateGradient, return_type[type[Bitmap]], modifier[default], parameter[]] begin[{]
local_variable[type[int], pixels]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1080f), operator=/), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=255), operator=*), type=BasicType(dimensions=[], name=int)), name=r)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1920f), operator=/), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=255), operator=*), type=BasicType(dimensions=[], name=int)), name=g)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hypot, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1080), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1920)], member=hypot, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operator=/), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=255), operator=*), type=BasicType(dimensions=[], name=int)), name=b)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pixels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=<<), operandr=BinaryOperation(operandl=MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=<<), operator=|), operandr=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=|)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1920), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=x)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=x, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1080), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=y)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=y, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=pixels, 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=Bitmap, sub_type=None))]
end[}]
END[}]
|
identifier[Bitmap] identifier[generateGradient] operator[SEP] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pixels] operator[=] Keyword[new] Keyword[int] operator[SEP] Other[1080] operator[SEP] operator[SEP] Other[1920] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[y] operator[=] Other[0] operator[SEP] identifier[y] operator[<] Other[1080] operator[SEP] identifier[y] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[x] operator[=] Other[0] operator[SEP] identifier[x] operator[<] Other[1920] operator[SEP] identifier[x] operator[++] operator[SEP] {
Keyword[int] identifier[r] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[y] operator[/] literal[Float] operator[*] Other[255] operator[SEP] operator[SEP] Keyword[int] identifier[g] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[x] operator[/] literal[Float] operator[*] Other[255] operator[SEP] operator[SEP] Keyword[int] identifier[b] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] identifier[Math] operator[SEP] identifier[hypot] operator[SEP] identifier[x] , identifier[y] operator[SEP] operator[/] identifier[Math] operator[SEP] identifier[hypot] operator[SEP] Other[1080] , Other[1920] operator[SEP] operator[SEP] operator[*] Other[255] operator[SEP] operator[SEP] identifier[pixels] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[x] operator[SEP] operator[=] identifier[r] operator[<<] Other[16] operator[|] identifier[g] operator[<<] Other[8] operator[|] identifier[b] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[Bitmap] operator[SEP] identifier[pixels] operator[SEP] operator[SEP]
}
|
@Override
public WSStepThreadExecutionAggregate getStepExecutionAggregateFromJobExecutionNumberAndStepName(long jobInstanceId,
short jobExecNum,
String stepName) throws NoSuchJobExecutionException, JobSecurityException {
if (authService != null) {
authService.authorizedInstanceRead(jobInstanceId);
}
return persistenceManagerService.getStepExecutionAggregateFromJobExecutionNumberAndStepName(jobInstanceId,
jobExecNum, stepName);
}
|
class class_name[name] begin[{]
method[getStepExecutionAggregateFromJobExecutionNumberAndStepName, return_type[type[WSStepThreadExecutionAggregate]], modifier[public], parameter[jobInstanceId, jobExecNum, stepName]] begin[{]
if[binary_operation[member[.authService], !=, literal[null]]] begin[{]
call[authService.authorizedInstanceRead, parameter[member[.jobInstanceId]]]
else begin[{]
None
end[}]
return[call[persistenceManagerService.getStepExecutionAggregateFromJobExecutionNumberAndStepName, parameter[member[.jobInstanceId], member[.jobExecNum], member[.stepName]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[WSStepThreadExecutionAggregate] identifier[getStepExecutionAggregateFromJobExecutionNumberAndStepName] operator[SEP] Keyword[long] identifier[jobInstanceId] , Keyword[short] identifier[jobExecNum] , identifier[String] identifier[stepName] operator[SEP] Keyword[throws] identifier[NoSuchJobExecutionException] , identifier[JobSecurityException] {
Keyword[if] operator[SEP] identifier[authService] operator[!=] Other[null] operator[SEP] {
identifier[authService] operator[SEP] identifier[authorizedInstanceRead] operator[SEP] identifier[jobInstanceId] operator[SEP] operator[SEP]
}
Keyword[return] identifier[persistenceManagerService] operator[SEP] identifier[getStepExecutionAggregateFromJobExecutionNumberAndStepName] operator[SEP] identifier[jobInstanceId] , identifier[jobExecNum] , identifier[stepName] operator[SEP] operator[SEP]
}
|
public static boolean isUptodate( PlexusIoResource source, long destinationDate )
{
final long s = source.getLastModified();
if ( s == PlexusIoResource.UNKNOWN_MODIFICATION_DATE )
{
return false;
}
if ( destinationDate == 0 )
{
return false;
}
return destinationDate > s;
}
|
class class_name[name] begin[{]
method[isUptodate, return_type[type[boolean]], modifier[public static], parameter[source, destinationDate]] begin[{]
local_variable[type[long], s]
if[binary_operation[member[.s], ==, member[PlexusIoResource.UNKNOWN_MODIFICATION_DATE]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.destinationDate], ==, literal[0]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[member[.destinationDate], >, member[.s]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[isUptodate] operator[SEP] identifier[PlexusIoResource] identifier[source] , Keyword[long] identifier[destinationDate] operator[SEP] {
Keyword[final] Keyword[long] identifier[s] operator[=] identifier[source] operator[SEP] identifier[getLastModified] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s] operator[==] identifier[PlexusIoResource] operator[SEP] identifier[UNKNOWN_MODIFICATION_DATE] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[destinationDate] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[destinationDate] operator[>] identifier[s] operator[SEP]
}
|
private void action(int d) throws IOException, JSMinException {
switch (d) {
case 1:
write(theA);
if ((theY == '\n' || theY == ' ') && (theA == '+' || theA == '-' || theA == '*' || theA == '/')
&& (theB == '+' || theB == '-' || theB == '*' || theB == '/')) {
write(theY);
}
case 2:
theA = theB;
if (theA == '\'' || theA == '"' || theA == '`') {
for (;;) {
write(theA);
theA = get(true);
if (theA == theB) {
break;
}
if (theA == '\\') {
write(theA);
theA = get(true);
}
if (theA == EOF) {
throw new UnterminatedStringLiteralException(currentByteIndex, line, column);
}
}
}
case 3:
theB = next();
if (theB == '/' && (theA == '(' || theA == ',' || theA == '=' || theA == ':' || theA == '[' || theA == '!'
|| theA == '&' || theA == '|' || theA == '?' || theA == '+' || theA == '-' || theA == '~'
|| theA == '*' || theA == '/' || theA == '{' || theA == '\n')) {
write(theA);
if (theA == '/' || theA == '*') {
write(' ');
}
write(theB);
for (;;) {
theA = get();
if (theA == '[') {
for (;;) {
write(theA);
theA = get();
if (theA == ']') {
break;
}
if (theA == '\\') {
write(theA);
theA = get();
}
if (theA == EOF) {
throw new UnterminatedRegExpLiteralException( // Unterminated
// set
// in
// Regular
// Expression
// literal.
currentByteIndex, line, column);
}
}
} else if (theA == '/') {
switch (peek()) {
case '/':
case '*':
throw new UnterminatedRegExpLiteralException(// Unterminated
// set
// in
// Regular
// Expression
// literal.
currentByteIndex, line, column);
}
break;
} else if (theA == '\\') {
write(theA);
theA = get();
}
if (theA == EOF) {
throw new UnterminatedRegExpLiteralException(currentByteIndex, line, column);
}
write(theA);
}
theB = next();
}
}
}
|
class class_name[name] begin[{]
method[action, return_type[void], modifier[private], parameter[d]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=theY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=theY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator===), operator=||), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='+'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), operator===), operator=||), operator=&&), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='+'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), operator===), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\''), operator===), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='`'), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\'), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=EOF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=currentByteIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=column, 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=UnterminatedStringLiteralException, sub_type=None)), label=None)]))]), control=ForControl(condition=None, init=None, update=None), label=None)]))]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), operator===), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='('), operator===), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=','), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='='), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=':'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='['), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='!'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='&'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='|'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='?'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='+'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='~'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='{'), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n'), operator===), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='['), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\'), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*')], statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=currentByteIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=column, 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=UnterminatedRegExpLiteralException, sub_type=None)), label=None)])], expression=MethodInvocation(arguments=[], member=peek, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=']'), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\'), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=EOF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=currentByteIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=column, 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=UnterminatedRegExpLiteralException, sub_type=None)), label=None)]))]), control=ForControl(condition=None, init=None, update=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=EOF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=currentByteIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=column, 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=UnterminatedRegExpLiteralException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=theA, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=None, init=None, update=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=theB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]))])], expression=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[action] operator[SEP] Keyword[int] identifier[d] operator[SEP] Keyword[throws] identifier[IOException] , identifier[JSMinException] {
Keyword[switch] operator[SEP] identifier[d] operator[SEP] {
Keyword[case] Other[1] operator[:] identifier[write] operator[SEP] identifier[theA] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[theY] operator[==] literal[String] operator[||] identifier[theY] operator[==] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[theB] operator[==] literal[String] operator[||] identifier[theB] operator[==] literal[String] operator[||] identifier[theB] operator[==] literal[String] operator[||] identifier[theB] operator[==] literal[String] operator[SEP] operator[SEP] {
identifier[write] operator[SEP] identifier[theY] operator[SEP] operator[SEP]
}
Keyword[case] Other[2] operator[:] identifier[theA] operator[=] identifier[theB] operator[SEP] Keyword[if] operator[SEP] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[SEP] {
Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[write] operator[SEP] identifier[theA] operator[SEP] operator[SEP] identifier[theA] operator[=] identifier[get] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[theA] operator[==] identifier[theB] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[theA] operator[==] literal[String] operator[SEP] {
identifier[write] operator[SEP] identifier[theA] operator[SEP] operator[SEP] identifier[theA] operator[=] identifier[get] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[theA] operator[==] identifier[EOF] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnterminatedStringLiteralException] operator[SEP] identifier[currentByteIndex] , identifier[line] , identifier[column] operator[SEP] operator[SEP]
}
}
}
Keyword[case] Other[3] operator[:] identifier[theB] operator[=] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[theB] operator[==] literal[String] operator[&&] operator[SEP] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[SEP] operator[SEP] {
identifier[write] operator[SEP] identifier[theA] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[theA] operator[==] literal[String] operator[||] identifier[theA] operator[==] literal[String] operator[SEP] {
identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[write] operator[SEP] identifier[theB] operator[SEP] operator[SEP] Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[theA] operator[=] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[theA] operator[==] literal[String] operator[SEP] {
Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[write] operator[SEP] identifier[theA] operator[SEP] operator[SEP] identifier[theA] operator[=] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[theA] operator[==] literal[String] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[theA] operator[==] literal[String] operator[SEP] {
identifier[write] operator[SEP] identifier[theA] operator[SEP] operator[SEP] identifier[theA] operator[=] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[theA] operator[==] identifier[EOF] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnterminatedRegExpLiteralException] operator[SEP] identifier[currentByteIndex] , identifier[line] , identifier[column] operator[SEP] operator[SEP]
}
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[theA] operator[==] literal[String] operator[SEP] {
Keyword[switch] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[throw] Keyword[new] identifier[UnterminatedRegExpLiteralException] operator[SEP] identifier[currentByteIndex] , identifier[line] , identifier[column] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[theA] operator[==] literal[String] operator[SEP] {
identifier[write] operator[SEP] identifier[theA] operator[SEP] operator[SEP] identifier[theA] operator[=] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[theA] operator[==] identifier[EOF] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnterminatedRegExpLiteralException] operator[SEP] identifier[currentByteIndex] , identifier[line] , identifier[column] operator[SEP] operator[SEP]
}
identifier[write] operator[SEP] identifier[theA] operator[SEP] operator[SEP]
}
identifier[theB] operator[=] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static Optional<Optional<byte[]>> readMaybeOptRangedBytes(ByteBuf bf) {
Optional<Integer> l = readMaybeSignedInt(bf);
if (l.isPresent()) {
int length = l.get();
if (length < 0) {
return Optional.of(Optional.empty());
} else {
Optional<byte[]> rb = readMaybeRangedBytes(bf, length);
if (rb.isPresent()) {
return Optional.of(rb);
} else {
return Optional.empty();
}
}
} else {
return Optional.empty();
}
}
|
class class_name[name] begin[{]
method[readMaybeOptRangedBytes, return_type[type[Optional]], modifier[public static], parameter[bf]] begin[{]
local_variable[type[Optional], l]
if[call[l.isPresent, parameter[]]] begin[{]
local_variable[type[int], length]
if[binary_operation[member[.length], <, literal[0]]] begin[{]
return[call[Optional.of, parameter[call[Optional.empty, parameter[]]]]]
else begin[{]
local_variable[type[Optional], rb]
if[call[rb.isPresent, parameter[]]] begin[{]
return[call[Optional.of, parameter[member[.rb]]]]
else begin[{]
return[call[Optional.empty, parameter[]]]
end[}]
end[}]
else begin[{]
return[call[Optional.empty, parameter[]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Optional] operator[<] identifier[Optional] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] operator[>] identifier[readMaybeOptRangedBytes] operator[SEP] identifier[ByteBuf] identifier[bf] operator[SEP] {
identifier[Optional] operator[<] identifier[Integer] operator[>] identifier[l] operator[=] identifier[readMaybeSignedInt] operator[SEP] identifier[bf] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[l] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[length] operator[=] identifier[l] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[length] operator[<] Other[0] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Optional] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[rb] operator[=] identifier[readMaybeRangedBytes] operator[SEP] identifier[bf] , identifier[length] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rb] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[rb] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
}
|
void translate() {
make.at(pos.getStartPosition());
JCClassDecl owner = classDef((ClassSymbol)mapVar.owner);
// synthetic static final int[] $SwitchMap$Color = new int[Color.values().length];
MethodSymbol valuesMethod = lookupMethod(pos,
names.values,
forEnum.type,
List.nil());
JCExpression size = make // Color.values().length
.Select(make.App(make.QualIdent(valuesMethod)),
syms.lengthVar);
JCExpression mapVarInit = make
.NewArray(make.Type(syms.intType), List.of(size), null)
.setType(new ArrayType(syms.intType, syms.arrayClass));
// try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {}
ListBuffer<JCStatement> stmts = new ListBuffer<>();
Symbol ordinalMethod = lookupMethod(pos,
names.ordinal,
forEnum.type,
List.nil());
List<JCCatch> catcher = List.<JCCatch>nil()
.prepend(make.Catch(make.VarDef(new VarSymbol(PARAMETER, names.ex,
syms.noSuchFieldErrorType,
syms.noSymbol),
null),
make.Block(0, List.nil())));
for (Map.Entry<VarSymbol,Integer> e : values.entrySet()) {
VarSymbol enumerator = e.getKey();
Integer mappedValue = e.getValue();
JCExpression assign = make
.Assign(make.Indexed(mapVar,
make.App(make.Select(make.QualIdent(enumerator),
ordinalMethod))),
make.Literal(mappedValue))
.setType(syms.intType);
JCStatement exec = make.Exec(assign);
JCStatement _try = make.Try(make.Block(0, List.of(exec)), catcher, null);
stmts.append(_try);
}
owner.defs = owner.defs
.prepend(make.Block(STATIC, stmts.toList()))
.prepend(make.VarDef(mapVar, mapVarInit));
}
|
class class_name[name] begin[{]
method[translate, return_type[void], modifier[default], parameter[]] begin[{]
call[make.at, parameter[call[pos.getStartPosition, parameter[]]]]
local_variable[type[JCClassDecl], owner]
local_variable[type[MethodSymbol], valuesMethod]
local_variable[type[JCExpression], size]
local_variable[type[JCExpression], mapVarInit]
local_variable[type[ListBuffer], stmts]
local_variable[type[Symbol], ordinalMethod]
local_variable[type[List], catcher]
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=enumerator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VarSymbol, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), name=mappedValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=mapVar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=enumerator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=QualIdent, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None), MemberReference(member=ordinalMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=Select, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None)], member=App, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None)], member=Indexed, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=mappedValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=Literal, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None)], member=Assign, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[MethodInvocation(arguments=[MemberReference(member=intType, postfix_operators=[], prefix_operators=[], qualifier=syms, selectors=[])], member=setType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=assign)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCExpression, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=assign, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=Exec, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None), name=exec)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCStatement, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MethodInvocation(arguments=[MemberReference(member=exec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=List, selectors=[], type_arguments=None)], member=Block, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None), MemberReference(member=catcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=Try, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None), name=_try)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCStatement, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=_try, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=stmts, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=VarSymbol, 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)
assign[member[owner.defs], call[owner.defs.prepend, parameter[call[make.Block, parameter[member[.STATIC], call[stmts.toList, parameter[]]]]]]]
end[}]
END[}]
|
Keyword[void] identifier[translate] operator[SEP] operator[SEP] {
identifier[make] operator[SEP] identifier[at] operator[SEP] identifier[pos] operator[SEP] identifier[getStartPosition] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[JCClassDecl] identifier[owner] operator[=] identifier[classDef] operator[SEP] operator[SEP] identifier[ClassSymbol] operator[SEP] identifier[mapVar] operator[SEP] identifier[owner] operator[SEP] operator[SEP] identifier[MethodSymbol] identifier[valuesMethod] operator[=] identifier[lookupMethod] operator[SEP] identifier[pos] , identifier[names] operator[SEP] identifier[values] , identifier[forEnum] operator[SEP] identifier[type] , identifier[List] operator[SEP] identifier[nil] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[JCExpression] identifier[size] operator[=] identifier[make] operator[SEP] identifier[Select] operator[SEP] identifier[make] operator[SEP] identifier[App] operator[SEP] identifier[make] operator[SEP] identifier[QualIdent] operator[SEP] identifier[valuesMethod] operator[SEP] operator[SEP] , identifier[syms] operator[SEP] identifier[lengthVar] operator[SEP] operator[SEP] identifier[JCExpression] identifier[mapVarInit] operator[=] identifier[make] operator[SEP] identifier[NewArray] operator[SEP] identifier[make] operator[SEP] identifier[Type] operator[SEP] identifier[syms] operator[SEP] identifier[intType] operator[SEP] , identifier[List] operator[SEP] identifier[of] operator[SEP] identifier[size] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[setType] operator[SEP] Keyword[new] identifier[ArrayType] operator[SEP] identifier[syms] operator[SEP] identifier[intType] , identifier[syms] operator[SEP] identifier[arrayClass] operator[SEP] operator[SEP] operator[SEP] identifier[ListBuffer] operator[<] identifier[JCStatement] operator[>] identifier[stmts] operator[=] Keyword[new] identifier[ListBuffer] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Symbol] identifier[ordinalMethod] operator[=] identifier[lookupMethod] operator[SEP] identifier[pos] , identifier[names] operator[SEP] identifier[ordinal] , identifier[forEnum] operator[SEP] identifier[type] , identifier[List] operator[SEP] identifier[nil] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[JCCatch] operator[>] identifier[catcher] operator[=] identifier[List] operator[SEP] operator[<] identifier[JCCatch] operator[>] identifier[nil] operator[SEP] operator[SEP] operator[SEP] identifier[prepend] operator[SEP] identifier[make] operator[SEP] identifier[Catch] operator[SEP] identifier[make] operator[SEP] identifier[VarDef] operator[SEP] Keyword[new] identifier[VarSymbol] operator[SEP] identifier[PARAMETER] , identifier[names] operator[SEP] identifier[ex] , identifier[syms] operator[SEP] identifier[noSuchFieldErrorType] , identifier[syms] operator[SEP] identifier[noSymbol] operator[SEP] , Other[null] operator[SEP] , identifier[make] operator[SEP] identifier[Block] operator[SEP] Other[0] , identifier[List] operator[SEP] identifier[nil] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[VarSymbol] , identifier[Integer] operator[>] identifier[e] operator[:] identifier[values] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[VarSymbol] identifier[enumerator] operator[=] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[Integer] identifier[mappedValue] operator[=] identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[JCExpression] identifier[assign] operator[=] identifier[make] operator[SEP] identifier[Assign] operator[SEP] identifier[make] operator[SEP] identifier[Indexed] operator[SEP] identifier[mapVar] , identifier[make] operator[SEP] identifier[App] operator[SEP] identifier[make] operator[SEP] identifier[Select] operator[SEP] identifier[make] operator[SEP] identifier[QualIdent] operator[SEP] identifier[enumerator] operator[SEP] , identifier[ordinalMethod] operator[SEP] operator[SEP] operator[SEP] , identifier[make] operator[SEP] identifier[Literal] operator[SEP] identifier[mappedValue] operator[SEP] operator[SEP] operator[SEP] identifier[setType] operator[SEP] identifier[syms] operator[SEP] identifier[intType] operator[SEP] operator[SEP] identifier[JCStatement] identifier[exec] operator[=] identifier[make] operator[SEP] identifier[Exec] operator[SEP] identifier[assign] operator[SEP] operator[SEP] identifier[JCStatement] identifier[_try] operator[=] identifier[make] operator[SEP] identifier[Try] operator[SEP] identifier[make] operator[SEP] identifier[Block] operator[SEP] Other[0] , identifier[List] operator[SEP] identifier[of] operator[SEP] identifier[exec] operator[SEP] operator[SEP] , identifier[catcher] , Other[null] operator[SEP] operator[SEP] identifier[stmts] operator[SEP] identifier[append] operator[SEP] identifier[_try] operator[SEP] operator[SEP]
}
identifier[owner] operator[SEP] identifier[defs] operator[=] identifier[owner] operator[SEP] identifier[defs] operator[SEP] identifier[prepend] operator[SEP] identifier[make] operator[SEP] identifier[Block] operator[SEP] identifier[STATIC] , identifier[stmts] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[prepend] operator[SEP] identifier[make] operator[SEP] identifier[VarDef] operator[SEP] identifier[mapVar] , identifier[mapVarInit] operator[SEP] operator[SEP] operator[SEP]
}
|
public static ZonedDateTime of(
int year, int month, int dayOfMonth,
int hour, int minute, int second, int nanoOfSecond, ZoneId zone) {
LocalDateTime dt = LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond);
return ofLocal(dt, zone, null);
}
|
class class_name[name] begin[{]
method[of, return_type[type[ZonedDateTime]], modifier[public static], parameter[year, month, dayOfMonth, hour, minute, second, nanoOfSecond, zone]] begin[{]
local_variable[type[LocalDateTime], dt]
return[call[.ofLocal, parameter[member[.dt], member[.zone], literal[null]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ZonedDateTime] identifier[of] operator[SEP] Keyword[int] identifier[year] , Keyword[int] identifier[month] , Keyword[int] identifier[dayOfMonth] , Keyword[int] identifier[hour] , Keyword[int] identifier[minute] , Keyword[int] identifier[second] , Keyword[int] identifier[nanoOfSecond] , identifier[ZoneId] identifier[zone] operator[SEP] {
identifier[LocalDateTime] identifier[dt] operator[=] identifier[LocalDateTime] operator[SEP] identifier[of] operator[SEP] identifier[year] , identifier[month] , identifier[dayOfMonth] , identifier[hour] , identifier[minute] , identifier[second] , identifier[nanoOfSecond] operator[SEP] operator[SEP] Keyword[return] identifier[ofLocal] operator[SEP] identifier[dt] , identifier[zone] , Other[null] operator[SEP] operator[SEP]
}
|
@Override
public UniversalIdIntQueueMessage fromBytes(byte[] data) {
try {
UniversalIdIntQueueMessage other = BaseUniversalQueueMessage.fromBytes(data,
UniversalIdIntQueueMessage.class);
fromMap(other.toMap());
return this;
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
|
class class_name[name] begin[{]
method[fromBytes, return_type[type[UniversalIdIntQueueMessage]], modifier[public], parameter[data]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UniversalIdIntQueueMessage, sub_type=None))], member=fromBytes, postfix_operators=[], prefix_operators=[], qualifier=BaseUniversalQueueMessage, selectors=[], type_arguments=None), name=other)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=UniversalIdIntQueueMessage, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toMap, postfix_operators=[], prefix_operators=[], qualifier=other, selectors=[], type_arguments=None)], member=fromMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InstantiationException', 'IllegalAccessException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[UniversalIdIntQueueMessage] identifier[fromBytes] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[SEP] {
Keyword[try] {
identifier[UniversalIdIntQueueMessage] identifier[other] operator[=] identifier[BaseUniversalQueueMessage] operator[SEP] identifier[fromBytes] operator[SEP] identifier[data] , identifier[UniversalIdIntQueueMessage] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[fromMap] operator[SEP] identifier[other] operator[SEP] identifier[toMap] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InstantiationException] operator[|] identifier[IllegalAccessException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static TranslatableComponent of(final @NonNull String key, final @Nullable TextColor color) {
return builder(key)
.color(color)
.build();
}
|
class class_name[name] begin[{]
method[of, return_type[type[TranslatableComponent]], modifier[public static], parameter[key, color]] begin[{]
return[call[.builder, parameter[member[.key]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[TranslatableComponent] identifier[of] operator[SEP] Keyword[final] annotation[@] identifier[NonNull] identifier[String] identifier[key] , Keyword[final] annotation[@] identifier[Nullable] identifier[TextColor] identifier[color] operator[SEP] {
Keyword[return] identifier[builder] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[color] operator[SEP] identifier[color] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public void process( D derivX , D derivY , GrayU8 binaryEdges )
{
InputSanityCheck.checkSameShape(derivX,derivY,binaryEdges);
int w = derivX.width-regionSize+1;
int h = derivY.height-regionSize+1;
foundLines.reshape(derivX.width / regionSize, derivX.height / regionSize);
foundLines.reset();
// avoid partial regions/other image edge conditions by being at least the region's radius away
for( int y = 0; y < h; y += regionSize) {
int gridY = y/regionSize;
// index of the top left pixel in the region being considered
// possible over optimization
int index = binaryEdges.startIndex + y*binaryEdges.stride;
for( int x = 0; x < w; x+= regionSize , index += regionSize) {
int gridX = x/regionSize;
// detects edgels inside the region
detectEdgels(index,x,y,derivX,derivY,binaryEdges);
// find lines inside the region using RANSAC
findLinesInRegion(foundLines.get(gridX,gridY));
}
}
}
|
class class_name[name] begin[{]
method[process, return_type[void], modifier[public], parameter[derivX, derivY, binaryEdges]] begin[{]
call[InputSanityCheck.checkSameShape, parameter[member[.derivX], member[.derivY], member[.binaryEdges]]]
local_variable[type[int], w]
local_variable[type[int], h]
call[foundLines.reshape, parameter[binary_operation[member[derivX.width], /, member[.regionSize]], binary_operation[member[derivX.height], /, member[.regionSize]]]]
call[foundLines.reset, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=regionSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), name=gridY)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=startIndex, postfix_operators=[], prefix_operators=[], qualifier=binaryEdges, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=stride, postfix_operators=[], prefix_operators=[], qualifier=binaryEdges, selectors=[]), operator=*), operator=+), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=regionSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), name=gridX)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=derivX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=derivY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=binaryEdges, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=detectEdgels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=gridX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=gridY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=foundLines, selectors=[], type_arguments=None)], member=findLinesInRegion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=w, 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=x)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=regionSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=regionSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=h, 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=y)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=regionSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[process] operator[SEP] identifier[D] identifier[derivX] , identifier[D] identifier[derivY] , identifier[GrayU8] identifier[binaryEdges] operator[SEP] {
identifier[InputSanityCheck] operator[SEP] identifier[checkSameShape] operator[SEP] identifier[derivX] , identifier[derivY] , identifier[binaryEdges] operator[SEP] operator[SEP] Keyword[int] identifier[w] operator[=] identifier[derivX] operator[SEP] identifier[width] operator[-] identifier[regionSize] operator[+] Other[1] operator[SEP] Keyword[int] identifier[h] operator[=] identifier[derivY] operator[SEP] identifier[height] operator[-] identifier[regionSize] operator[+] Other[1] operator[SEP] identifier[foundLines] operator[SEP] identifier[reshape] operator[SEP] identifier[derivX] operator[SEP] identifier[width] operator[/] identifier[regionSize] , identifier[derivX] operator[SEP] identifier[height] operator[/] identifier[regionSize] operator[SEP] operator[SEP] identifier[foundLines] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[y] operator[=] Other[0] operator[SEP] identifier[y] operator[<] identifier[h] operator[SEP] identifier[y] operator[+=] identifier[regionSize] operator[SEP] {
Keyword[int] identifier[gridY] operator[=] identifier[y] operator[/] identifier[regionSize] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[binaryEdges] operator[SEP] identifier[startIndex] operator[+] identifier[y] operator[*] identifier[binaryEdges] operator[SEP] identifier[stride] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[x] operator[=] Other[0] operator[SEP] identifier[x] operator[<] identifier[w] operator[SEP] identifier[x] operator[+=] identifier[regionSize] , identifier[index] operator[+=] identifier[regionSize] operator[SEP] {
Keyword[int] identifier[gridX] operator[=] identifier[x] operator[/] identifier[regionSize] operator[SEP] identifier[detectEdgels] operator[SEP] identifier[index] , identifier[x] , identifier[y] , identifier[derivX] , identifier[derivY] , identifier[binaryEdges] operator[SEP] operator[SEP] identifier[findLinesInRegion] operator[SEP] identifier[foundLines] operator[SEP] identifier[get] operator[SEP] identifier[gridX] , identifier[gridY] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static BufferedImage toBuffered(RenderedImage pOriginal, int pType) {
// Don't convert if it already is BufferedImage and correct type
if ((pOriginal instanceof BufferedImage) && ((BufferedImage) pOriginal).getType() == pType) {
return (BufferedImage) pOriginal;
}
if (pOriginal == null) {
throw new IllegalArgumentException("original == null");
}
// Create a buffered image
BufferedImage image = createBuffered(pOriginal.getWidth(),
pOriginal.getHeight(),
pType, Transparency.TRANSLUCENT);
// Draw the image onto the buffer
// NOTE: This is faster than doing a raster conversion in most cases
Graphics2D g = image.createGraphics();
try {
g.setComposite(AlphaComposite.Src);
g.drawRenderedImage(pOriginal, IDENTITY_TRANSFORM);
}
finally {
g.dispose();
}
return image;
}
|
class class_name[name] begin[{]
method[toBuffered, return_type[type[BufferedImage]], modifier[public static], parameter[pOriginal, pType]] begin[{]
if[binary_operation[binary_operation[member[.pOriginal], instanceof, type[BufferedImage]], &&, binary_operation[Cast(expression=MemberReference(member=pOriginal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BufferedImage, sub_type=None)), ==, member[.pType]]]] begin[{]
return[Cast(expression=MemberReference(member=pOriginal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=BufferedImage, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.pOriginal], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="original == null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[BufferedImage], image]
local_variable[type[Graphics2D], g]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=Src, postfix_operators=[], prefix_operators=[], qualifier=AlphaComposite, selectors=[])], member=setComposite, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pOriginal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=IDENTITY_TRANSFORM, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=drawRenderedImage, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=dispose, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.image]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BufferedImage] identifier[toBuffered] operator[SEP] identifier[RenderedImage] identifier[pOriginal] , Keyword[int] identifier[pType] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[pOriginal] Keyword[instanceof] identifier[BufferedImage] operator[SEP] operator[&&] operator[SEP] operator[SEP] identifier[BufferedImage] operator[SEP] identifier[pOriginal] operator[SEP] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[pType] operator[SEP] {
Keyword[return] operator[SEP] identifier[BufferedImage] operator[SEP] identifier[pOriginal] operator[SEP]
}
Keyword[if] operator[SEP] identifier[pOriginal] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[BufferedImage] identifier[image] operator[=] identifier[createBuffered] operator[SEP] identifier[pOriginal] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] , identifier[pOriginal] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] , identifier[pType] , identifier[Transparency] operator[SEP] identifier[TRANSLUCENT] operator[SEP] operator[SEP] identifier[Graphics2D] identifier[g] operator[=] identifier[image] operator[SEP] identifier[createGraphics] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[g] operator[SEP] identifier[setComposite] operator[SEP] identifier[AlphaComposite] operator[SEP] identifier[Src] operator[SEP] operator[SEP] identifier[g] operator[SEP] identifier[drawRenderedImage] operator[SEP] identifier[pOriginal] , identifier[IDENTITY_TRANSFORM] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[g] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[image] operator[SEP]
}
|
public void assignIDsToRigidPoints() {
// return if it has already been assigned
if( lookupRigid != null )
return;
// Assign a unique ID to each point belonging to a rigid object
// at the same time create a look up table that allows for the object that a point belongs to be quickly found
lookupRigid = new int[ getTotalRigidPoints() ];
int pointID = 0;
for (int i = 0; i < rigids.length; i++) {
Rigid r = rigids[i];
r.indexFirst = pointID;
for (int j = 0; j < r.points.length; j++, pointID++) {
lookupRigid[pointID] = i;
}
}
}
|
class class_name[name] begin[{]
method[assignIDsToRigidPoints, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.lookupRigid], !=, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[.lookupRigid], ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=getTotalRigidPoints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))]
local_variable[type[int], pointID]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=rigids, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Rigid, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=indexFirst, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[]), type==, value=MemberReference(member=pointID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lookupRigid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pointID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=r.points, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pointID, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=rigids, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[assignIDsToRigidPoints] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[lookupRigid] operator[!=] Other[null] operator[SEP] Keyword[return] operator[SEP] identifier[lookupRigid] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[getTotalRigidPoints] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[pointID] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[rigids] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Rigid] identifier[r] operator[=] identifier[rigids] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[r] operator[SEP] identifier[indexFirst] operator[=] identifier[pointID] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[r] operator[SEP] identifier[points] operator[SEP] identifier[length] operator[SEP] identifier[j] operator[++] , identifier[pointID] operator[++] operator[SEP] {
identifier[lookupRigid] operator[SEP] identifier[pointID] operator[SEP] operator[=] identifier[i] operator[SEP]
}
}
}
|
public boolean doesNotContainContinueOrBreak(Instruction _start, Instruction _extent) {
boolean ok = true;
boolean breakOrContinue = false;
for (Instruction i = _start; i != null; i = i.getNextExpr()) {
if (i.isBranch()) {
if (i.asBranch().isForwardUnconditional() && i.asBranch().getTarget().isAfter(_extent)) {
breakOrContinue = true;
} else {
ok = false;
break;
}
}
}
if (ok) {
if (breakOrContinue) {
for (Instruction i = _start; i != null; i = i.getNextExpr()) {
if (i.isBranch() && i.asBranch().isForwardUnconditional() && i.asBranch().getTarget().isAfter(_extent)) {
i.asBranch().setBreakOrContinue(true);
}
}
}
}
return (ok);
}
|
class class_name[name] begin[{]
method[doesNotContainContinueOrBreak, return_type[type[boolean]], modifier[public], parameter[_start, _extent]] begin[{]
local_variable[type[boolean], ok]
local_variable[type[boolean], breakOrContinue]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isBranch, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=asBranch, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[MethodInvocation(arguments=[], member=isForwardUnconditional, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=asBranch, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[MethodInvocation(arguments=[], member=getTarget, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=_extent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAfter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ok, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), BreakStatement(goto=None, label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=breakOrContinue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=_start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Instruction, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getNextExpr, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None))]), label=None)
if[member[.ok]] begin[{]
if[member[.breakOrContinue]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isBranch, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=asBranch, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[MethodInvocation(arguments=[], member=isForwardUnconditional, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), operandr=MethodInvocation(arguments=[], member=asBranch, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[MethodInvocation(arguments=[], member=getTarget, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=_extent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAfter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=asBranch, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setBreakOrContinue, 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=i, 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=_start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Instruction, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getNextExpr, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None))]), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.ok]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[doesNotContainContinueOrBreak] operator[SEP] identifier[Instruction] identifier[_start] , identifier[Instruction] identifier[_extent] operator[SEP] {
Keyword[boolean] identifier[ok] operator[=] literal[boolean] operator[SEP] Keyword[boolean] identifier[breakOrContinue] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Instruction] identifier[i] operator[=] identifier[_start] operator[SEP] identifier[i] operator[!=] Other[null] operator[SEP] identifier[i] operator[=] identifier[i] operator[SEP] identifier[getNextExpr] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[SEP] identifier[isBranch] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[SEP] identifier[asBranch] operator[SEP] operator[SEP] operator[SEP] identifier[isForwardUnconditional] operator[SEP] operator[SEP] operator[&&] identifier[i] operator[SEP] identifier[asBranch] operator[SEP] operator[SEP] operator[SEP] identifier[getTarget] operator[SEP] operator[SEP] operator[SEP] identifier[isAfter] operator[SEP] identifier[_extent] operator[SEP] operator[SEP] {
identifier[breakOrContinue] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[ok] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[ok] operator[SEP] {
Keyword[if] operator[SEP] identifier[breakOrContinue] operator[SEP] {
Keyword[for] operator[SEP] identifier[Instruction] identifier[i] operator[=] identifier[_start] operator[SEP] identifier[i] operator[!=] Other[null] operator[SEP] identifier[i] operator[=] identifier[i] operator[SEP] identifier[getNextExpr] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[SEP] identifier[isBranch] operator[SEP] operator[SEP] operator[&&] identifier[i] operator[SEP] identifier[asBranch] operator[SEP] operator[SEP] operator[SEP] identifier[isForwardUnconditional] operator[SEP] operator[SEP] operator[&&] identifier[i] operator[SEP] identifier[asBranch] operator[SEP] operator[SEP] operator[SEP] identifier[getTarget] operator[SEP] operator[SEP] operator[SEP] identifier[isAfter] operator[SEP] identifier[_extent] operator[SEP] operator[SEP] {
identifier[i] operator[SEP] identifier[asBranch] operator[SEP] operator[SEP] operator[SEP] identifier[setBreakOrContinue] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
}
}
Keyword[return] operator[SEP] identifier[ok] operator[SEP] operator[SEP]
}
|
protected boolean removeSegment(int segmentIndex) {
if ((this.values == null) || (segmentIndex < 0)
|| (segmentIndex >= this.values.length - 1)) {
return false;
}
if (this.values.length == 2) {
this.values = null;
this.size = 0;
} else {
final int count = this.values[segmentIndex + 1] - this.values[segmentIndex] + 1;
final int[] newTab = new int[this.values.length - 2];
System.arraycopy(this.values, 0, newTab, 0, segmentIndex);
System.arraycopy(this.values, segmentIndex + 2, newTab, segmentIndex, this.values.length - segmentIndex);
this.values = newTab;
this.size -= count;
}
return true;
}
|
class class_name[name] begin[{]
method[removeSegment, return_type[type[boolean]], modifier[protected], parameter[segmentIndex]] begin[{]
if[binary_operation[binary_operation[binary_operation[THIS[member[None.values]], ==, literal[null]], ||, binary_operation[member[.segmentIndex], <, literal[0]]], ||, binary_operation[member[.segmentIndex], >=, binary_operation[THIS[member[None.values]member[None.length]], -, literal[1]]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.values]member[None.length]], ==, literal[2]]] begin[{]
assign[THIS[member[None.values]], literal[null]]
assign[THIS[member[None.size]], literal[0]]
else begin[{]
local_variable[type[int], count]
local_variable[type[int], newTab]
call[System.arraycopy, parameter[THIS[member[None.values]], literal[0], member[.newTab], literal[0], member[.segmentIndex]]]
call[System.arraycopy, parameter[THIS[member[None.values]], binary_operation[member[.segmentIndex], +, literal[2]], member[.newTab], member[.segmentIndex], binary_operation[THIS[member[None.values]member[None.length]], -, member[.segmentIndex]]]]
assign[THIS[member[None.values]], member[.newTab]]
assign[THIS[member[None.size]], member[.count]]
end[}]
return[literal[true]]
end[}]
END[}]
|
Keyword[protected] Keyword[boolean] identifier[removeSegment] operator[SEP] Keyword[int] identifier[segmentIndex] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[values] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[segmentIndex] operator[<] Other[0] operator[SEP] operator[||] operator[SEP] identifier[segmentIndex] operator[>=] Keyword[this] operator[SEP] identifier[values] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[values] operator[SEP] identifier[length] operator[==] Other[2] operator[SEP] {
Keyword[this] operator[SEP] identifier[values] operator[=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[size] operator[=] Other[0] operator[SEP]
}
Keyword[else] {
Keyword[final] Keyword[int] identifier[count] operator[=] Keyword[this] operator[SEP] identifier[values] operator[SEP] identifier[segmentIndex] operator[+] Other[1] operator[SEP] operator[-] Keyword[this] operator[SEP] identifier[values] operator[SEP] identifier[segmentIndex] operator[SEP] operator[+] Other[1] operator[SEP] Keyword[final] Keyword[int] operator[SEP] operator[SEP] identifier[newTab] operator[=] Keyword[new] Keyword[int] operator[SEP] Keyword[this] operator[SEP] identifier[values] operator[SEP] identifier[length] operator[-] Other[2] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] Keyword[this] operator[SEP] identifier[values] , Other[0] , identifier[newTab] , Other[0] , identifier[segmentIndex] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] Keyword[this] operator[SEP] identifier[values] , identifier[segmentIndex] operator[+] Other[2] , identifier[newTab] , identifier[segmentIndex] , Keyword[this] operator[SEP] identifier[values] operator[SEP] identifier[length] operator[-] identifier[segmentIndex] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[values] operator[=] identifier[newTab] operator[SEP] Keyword[this] operator[SEP] identifier[size] operator[-=] identifier[count] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static DecoratedKey getMinimalKey(DecoratedKey key)
{
return key.getKey().position() > 0 || key.getKey().hasRemaining() || !key.getKey().hasArray()
? new BufferDecoratedKey(key.getToken(), HeapAllocator.instance.clone(key.getKey()))
: key;
}
|
class class_name[name] begin[{]
method[getMinimalKey, return_type[type[DecoratedKey]], modifier[public static], parameter[key]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[MethodInvocation(arguments=[], member=position, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[MethodInvocation(arguments=[], member=hasRemaining, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=['!'], qualifier=key, selectors=[MethodInvocation(arguments=[], member=hasArray, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), if_false=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getToken, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None)], member=clone, postfix_operators=[], prefix_operators=[], qualifier=HeapAllocator.instance, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferDecoratedKey, sub_type=None)))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DecoratedKey] identifier[getMinimalKey] operator[SEP] identifier[DecoratedKey] identifier[key] operator[SEP] {
Keyword[return] identifier[key] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[>] Other[0] operator[||] identifier[key] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[hasRemaining] operator[SEP] operator[SEP] operator[||] operator[!] identifier[key] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[hasArray] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[BufferDecoratedKey] operator[SEP] identifier[key] operator[SEP] identifier[getToken] operator[SEP] operator[SEP] , identifier[HeapAllocator] operator[SEP] identifier[instance] operator[SEP] identifier[clone] operator[SEP] identifier[key] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[key] operator[SEP]
}
|
public static String xor(String string, String key) {
return xor(string, CryptUtils.stringToKey(string));
}
|
class class_name[name] begin[{]
method[xor, return_type[type[String]], modifier[public static], parameter[string, key]] begin[{]
return[call[.xor, parameter[member[.string], call[CryptUtils.stringToKey, parameter[member[.string]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[xor] operator[SEP] identifier[String] identifier[string] , identifier[String] identifier[key] operator[SEP] {
Keyword[return] identifier[xor] operator[SEP] identifier[string] , identifier[CryptUtils] operator[SEP] identifier[stringToKey] operator[SEP] identifier[string] operator[SEP] operator[SEP] operator[SEP]
}
|
void toggleSelectOU() {
boolean create = m_fieldCreateOU.getValue().booleanValue();
m_fieldSelectOU.setEnabled(!create);
m_fieldSelectParentOU.setEnabled(create);
m_fieldSelectOU.select("/");
}
|
class class_name[name] begin[{]
method[toggleSelectOU, return_type[void], modifier[default], parameter[]] begin[{]
local_variable[type[boolean], create]
call[m_fieldSelectOU.setEnabled, parameter[member[.create]]]
call[m_fieldSelectParentOU.setEnabled, parameter[member[.create]]]
call[m_fieldSelectOU.select, parameter[literal["/"]]]
end[}]
END[}]
|
Keyword[void] identifier[toggleSelectOU] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[create] operator[=] identifier[m_fieldCreateOU] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[SEP] identifier[m_fieldSelectOU] operator[SEP] identifier[setEnabled] operator[SEP] operator[!] identifier[create] operator[SEP] operator[SEP] identifier[m_fieldSelectParentOU] operator[SEP] identifier[setEnabled] operator[SEP] identifier[create] operator[SEP] operator[SEP] identifier[m_fieldSelectOU] operator[SEP] identifier[select] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public WindowsFileSystemConfiguration withMaintenanceOperationsInProgress(String... maintenanceOperationsInProgress) {
if (this.maintenanceOperationsInProgress == null) {
setMaintenanceOperationsInProgress(new java.util.ArrayList<String>(maintenanceOperationsInProgress.length));
}
for (String ele : maintenanceOperationsInProgress) {
this.maintenanceOperationsInProgress.add(ele);
}
return this;
}
|
class class_name[name] begin[{]
method[withMaintenanceOperationsInProgress, return_type[type[WindowsFileSystemConfiguration]], modifier[public], parameter[maintenanceOperationsInProgress]] begin[{]
if[binary_operation[THIS[member[None.maintenanceOperationsInProgress]], ==, literal[null]]] begin[{]
call[.setMaintenanceOperationsInProgress, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=maintenanceOperationsInProgress, 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))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=maintenanceOperationsInProgress, 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=maintenanceOperationsInProgress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[WindowsFileSystemConfiguration] identifier[withMaintenanceOperationsInProgress] operator[SEP] identifier[String] operator[...] identifier[maintenanceOperationsInProgress] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[maintenanceOperationsInProgress] operator[==] Other[null] operator[SEP] {
identifier[setMaintenanceOperationsInProgress] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[maintenanceOperationsInProgress] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[maintenanceOperationsInProgress] operator[SEP] {
Keyword[this] operator[SEP] identifier[maintenanceOperationsInProgress] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public void setAlgorithm(SecretKeyFactoryAlgorithm secretKeyFactoryAlgorithm) {
if (secretKeyFactoryAlgorithm == null) {
throw new IllegalArgumentException("secretKeyFactoryAlgorithm cannot be null");
}
String algorithmName = secretKeyFactoryAlgorithm.name();
try {
SecretKeyFactory.getInstance(algorithmName);
}
catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("Invalid algorithm '" + algorithmName + "'.", e);
}
this.algorithm = algorithmName;
}
|
class class_name[name] begin[{]
method[setAlgorithm, return_type[void], modifier[public], parameter[secretKeyFactoryAlgorithm]] begin[{]
if[binary_operation[member[.secretKeyFactoryAlgorithm], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="secretKeyFactoryAlgorithm cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], algorithmName]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=algorithmName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=SecretKeyFactory, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid algorithm '"), operandr=MemberReference(member=algorithmName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'."), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchAlgorithmException']))], finally_block=None, label=None, resources=None)
assign[THIS[member[None.algorithm]], member[.algorithmName]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setAlgorithm] operator[SEP] identifier[SecretKeyFactoryAlgorithm] identifier[secretKeyFactoryAlgorithm] operator[SEP] {
Keyword[if] operator[SEP] identifier[secretKeyFactoryAlgorithm] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[algorithmName] operator[=] identifier[secretKeyFactoryAlgorithm] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[SecretKeyFactory] operator[SEP] identifier[getInstance] operator[SEP] identifier[algorithmName] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchAlgorithmException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[algorithmName] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[algorithm] operator[=] identifier[algorithmName] operator[SEP]
}
|
@Override
public void declineCheckpoint(DeclineCheckpoint decline) {
final CheckpointCoordinator checkpointCoordinator = executionGraph.getCheckpointCoordinator();
if (checkpointCoordinator != null) {
getRpcService().execute(() -> {
try {
checkpointCoordinator.receiveDeclineMessage(decline);
} catch (Exception e) {
log.error("Error in CheckpointCoordinator while processing {}", decline, e);
}
});
} else {
String errorMessage = "Received DeclineCheckpoint message for job {} with no CheckpointCoordinator";
if (executionGraph.getState() == JobStatus.RUNNING) {
log.error(errorMessage, jobGraph.getJobID());
} else {
log.debug(errorMessage, jobGraph.getJobID());
}
}
}
|
class class_name[name] begin[{]
method[declineCheckpoint, return_type[void], modifier[public], parameter[decline]] begin[{]
local_variable[type[CheckpointCoordinator], checkpointCoordinator]
if[binary_operation[member[.checkpointCoordinator], !=, literal[null]]] begin[{]
call[.getRpcService, parameter[]]
else begin[{]
local_variable[type[String], errorMessage]
if[binary_operation[call[executionGraph.getState, parameter[]], ==, member[JobStatus.RUNNING]]] begin[{]
call[log.error, parameter[member[.errorMessage], call[jobGraph.getJobID, parameter[]]]]
else begin[{]
call[log.debug, parameter[member[.errorMessage], call[jobGraph.getJobID, parameter[]]]]
end[}]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[declineCheckpoint] operator[SEP] identifier[DeclineCheckpoint] identifier[decline] operator[SEP] {
Keyword[final] identifier[CheckpointCoordinator] identifier[checkpointCoordinator] operator[=] identifier[executionGraph] operator[SEP] identifier[getCheckpointCoordinator] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[checkpointCoordinator] operator[!=] Other[null] operator[SEP] {
identifier[getRpcService] operator[SEP] operator[SEP] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] operator[->] {
Keyword[try] {
identifier[checkpointCoordinator] operator[SEP] identifier[receiveDeclineMessage] operator[SEP] identifier[decline] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[decline] , identifier[e] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[errorMessage] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[executionGraph] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[==] identifier[JobStatus] operator[SEP] identifier[RUNNING] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[errorMessage] , identifier[jobGraph] operator[SEP] identifier[getJobID] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] identifier[errorMessage] , identifier[jobGraph] operator[SEP] identifier[getJobID] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public Binder prepend(Class<?> type, Object value) {
return new Binder(this, new Insert(0, new Class[]{type}, value));
}
|
class class_name[name] begin[{]
method[prepend, return_type[type[Binder]], modifier[public], parameter[type, value]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Class, sub_type=None)), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Insert, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Binder, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[Binder] identifier[prepend] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] , identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[Binder] operator[SEP] Keyword[this] , Keyword[new] identifier[Insert] operator[SEP] Other[0] , Keyword[new] identifier[Class] operator[SEP] operator[SEP] {
identifier[type]
} , identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public int compare(final ParentStep p1, final ParentStep p2) {
return p1.getParent().getLine().compareTo(p2.getParent().getLine());
}
|
class class_name[name] begin[{]
method[compare, return_type[type[int]], modifier[public], parameter[p1, p2]] begin[{]
return[call[p1.getParent, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[compare] operator[SEP] Keyword[final] identifier[ParentStep] identifier[p1] , Keyword[final] identifier[ParentStep] identifier[p2] operator[SEP] {
Keyword[return] identifier[p1] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getLine] operator[SEP] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[p2] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getLine] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Object[] cast(Class<?> type, Object arrayObj) throws NullPointerException, IllegalArgumentException {
if (null == arrayObj) {
throw new NullPointerException("Argument [arrayObj] is null !");
}
if (false == arrayObj.getClass().isArray()) {
throw new IllegalArgumentException("Argument [arrayObj] is not array !");
}
if (null == type) {
return (Object[]) arrayObj;
}
final Class<?> componentType = type.isArray() ? type.getComponentType() : type;
final Object[] array = (Object[]) arrayObj;
final Object[] result = ArrayUtil.newArray(componentType, array.length);
System.arraycopy(array, 0, result, 0, array.length);
return result;
}
|
class class_name[name] begin[{]
method[cast, return_type[type[Object]], modifier[public static], parameter[type, arrayObj]] begin[{]
if[binary_operation[literal[null], ==, member[.arrayObj]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Argument [arrayObj] is null !")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[literal[false], ==, call[arrayObj.getClass, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Argument [arrayObj] is not array !")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[literal[null], ==, member[.type]]] begin[{]
return[Cast(expression=MemberReference(member=arrayObj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[Class], componentType]
local_variable[type[Object], array]
local_variable[type[Object], result]
call[System.arraycopy, parameter[member[.array], literal[0], member[.result], literal[0], member[array.length]]]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Object] operator[SEP] operator[SEP] identifier[cast] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] , identifier[Object] identifier[arrayObj] operator[SEP] Keyword[throws] identifier[NullPointerException] , identifier[IllegalArgumentException] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[arrayObj] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] literal[boolean] operator[==] identifier[arrayObj] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Other[null] operator[==] identifier[type] operator[SEP] {
Keyword[return] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[arrayObj] operator[SEP]
}
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[componentType] operator[=] identifier[type] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[?] identifier[type] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] operator[:] identifier[type] operator[SEP] Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[array] operator[=] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[arrayObj] operator[SEP] Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[ArrayUtil] operator[SEP] identifier[newArray] operator[SEP] identifier[componentType] , identifier[array] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[array] , Other[0] , identifier[result] , Other[0] , identifier[array] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public static base_response renumber(nitro_service client) throws Exception {
nsacls renumberresource = new nsacls();
return renumberresource.perform_operation(client,"renumber");
}
|
class class_name[name] begin[{]
method[renumber, return_type[type[base_response]], modifier[public static], parameter[client]] begin[{]
local_variable[type[nsacls], renumberresource]
return[call[renumberresource.perform_operation, parameter[member[.client], literal["renumber"]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[base_response] identifier[renumber] operator[SEP] identifier[nitro_service] identifier[client] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[nsacls] identifier[renumberresource] operator[=] Keyword[new] identifier[nsacls] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[renumberresource] operator[SEP] identifier[perform_operation] operator[SEP] identifier[client] , literal[String] operator[SEP] operator[SEP]
}
|
protected void createFlattenedDependencies( Model effectiveModel, List<Dependency> flattenedDependencies )
{
getLog().debug( "Resolving dependencies of " + effectiveModel.getId() );
// this.project.getDependencies() already contains the inherited dependencies but also those from profiles
// List<Dependency> projectDependencies = currentProject.getOriginalModel().getDependencies();
List<Dependency> projectDependencies = effectiveModel.getDependencies();
for ( Dependency projectDependency : projectDependencies )
{
Dependency flattenedDependency = createFlattenedDependency( projectDependency );
if ( flattenedDependency != null )
{
flattenedDependencies.add( flattenedDependency );
}
}
}
|
class class_name[name] begin[{]
method[createFlattenedDependencies, return_type[void], modifier[protected], parameter[effectiveModel, flattenedDependencies]] begin[{]
call[.getLog, parameter[]]
local_variable[type[List], projectDependencies]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=projectDependency, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createFlattenedDependency, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=flattenedDependency)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Dependency, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=flattenedDependency, 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=flattenedDependency, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=flattenedDependencies, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=projectDependencies, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=projectDependency)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Dependency, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[createFlattenedDependencies] operator[SEP] identifier[Model] identifier[effectiveModel] , identifier[List] operator[<] identifier[Dependency] operator[>] identifier[flattenedDependencies] operator[SEP] {
identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[effectiveModel] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Dependency] operator[>] identifier[projectDependencies] operator[=] identifier[effectiveModel] operator[SEP] identifier[getDependencies] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Dependency] identifier[projectDependency] operator[:] identifier[projectDependencies] operator[SEP] {
identifier[Dependency] identifier[flattenedDependency] operator[=] identifier[createFlattenedDependency] operator[SEP] identifier[projectDependency] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[flattenedDependency] operator[!=] Other[null] operator[SEP] {
identifier[flattenedDependencies] operator[SEP] identifier[add] operator[SEP] identifier[flattenedDependency] operator[SEP] operator[SEP]
}
}
}
|
protected boolean match(final URI uri) {
final String methodName = "match";
final String uriStr = prepareUri(uri);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName, this, uriStr, ignoreCase, wildcard);
}
if (this.matcher == null) {
if (ignoreCase) {
if (pattern.equalsIgnoreCase(uriStr)) {
return true;
}
if (wildcard && uriStr.toLowerCase().startsWith(pattern)) {
return true;
}
} else {
if (pattern.equals(uriStr)) {
return true;
}
if (wildcard && uriStr.startsWith(pattern)) {
return true;
}
}
} else {
return this.matcher.matcher(uriStr).matches();
}
return false;
}
|
class class_name[name] begin[{]
method[match, return_type[type[boolean]], modifier[protected], parameter[uri]] begin[{]
local_variable[type[String], methodName]
local_variable[type[String], uriStr]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], member[.methodName], THIS[], member[.uriStr], member[.ignoreCase], member[.wildcard]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.matcher]], ==, literal[null]]] begin[{]
if[member[.ignoreCase]] begin[{]
if[call[pattern.equalsIgnoreCase, parameter[member[.uriStr]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.wildcard], &&, call[uriStr.toLowerCase, parameter[]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
if[call[pattern.equals, parameter[member[.uriStr]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.wildcard], &&, call[uriStr.startsWith, parameter[member[.pattern]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
end[}]
else begin[{]
return[THIS[member[None.matcher]call[None.matcher, parameter[member[.uriStr]]]call[None.matches, parameter[]]]]
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[protected] Keyword[boolean] identifier[match] operator[SEP] Keyword[final] identifier[URI] identifier[uri] operator[SEP] {
Keyword[final] identifier[String] identifier[methodName] operator[=] literal[String] operator[SEP] Keyword[final] identifier[String] identifier[uriStr] operator[=] identifier[prepareUri] operator[SEP] identifier[uri] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , identifier[methodName] , Keyword[this] , identifier[uriStr] , identifier[ignoreCase] , identifier[wildcard] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[matcher] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[ignoreCase] operator[SEP] {
Keyword[if] operator[SEP] identifier[pattern] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[uriStr] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[wildcard] operator[&&] identifier[uriStr] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] identifier[pattern] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[pattern] operator[SEP] identifier[equals] operator[SEP] identifier[uriStr] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[wildcard] operator[&&] identifier[uriStr] operator[SEP] identifier[startsWith] operator[SEP] identifier[pattern] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[else] {
Keyword[return] Keyword[this] operator[SEP] identifier[matcher] operator[SEP] identifier[matcher] operator[SEP] identifier[uriStr] operator[SEP] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static double pointsDistance(Point a, Point b) {
int dx = b.x - a.x;
int dy = b.y - a.y;
return Math.sqrt(dx * dx + dy * dy);
}
|
class class_name[name] begin[{]
method[pointsDistance, return_type[type[double]], modifier[private static], parameter[a, b]] begin[{]
local_variable[type[int], dx]
local_variable[type[int], dy]
return[call[Math.sqrt, parameter[binary_operation[binary_operation[member[.dx], *, member[.dx]], +, binary_operation[member[.dy], *, member[.dy]]]]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[double] identifier[pointsDistance] operator[SEP] identifier[Point] identifier[a] , identifier[Point] identifier[b] operator[SEP] {
Keyword[int] identifier[dx] operator[=] identifier[b] operator[SEP] identifier[x] operator[-] identifier[a] operator[SEP] identifier[x] operator[SEP] Keyword[int] identifier[dy] operator[=] identifier[b] operator[SEP] identifier[y] operator[-] identifier[a] operator[SEP] identifier[y] operator[SEP] Keyword[return] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[dx] operator[*] identifier[dx] operator[+] identifier[dy] operator[*] identifier[dy] operator[SEP] operator[SEP]
}
|
@SafeVarargs
public final RandomICAutomatonGenerator<SP, TP> withTransitionProperties(TP... possibleTps) {
if (possibleTps.length == 0) {
return withTransitionProperties(r -> null);
}
return withTransitionProperties(Arrays.asList(possibleTps));
}
|
class class_name[name] begin[{]
method[withTransitionProperties, return_type[type[RandomICAutomatonGenerator]], modifier[final public], parameter[possibleTps]] begin[{]
if[binary_operation[member[possibleTps.length], ==, literal[0]]] begin[{]
return[call[.withTransitionProperties, parameter[LambdaExpression(body=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), parameters=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
else begin[{]
None
end[}]
return[call[.withTransitionProperties, parameter[call[Arrays.asList, parameter[member[.possibleTps]]]]]]
end[}]
END[}]
|
annotation[@] identifier[SafeVarargs] Keyword[public] Keyword[final] identifier[RandomICAutomatonGenerator] operator[<] identifier[SP] , identifier[TP] operator[>] identifier[withTransitionProperties] operator[SEP] identifier[TP] operator[...] identifier[possibleTps] operator[SEP] {
Keyword[if] operator[SEP] identifier[possibleTps] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[withTransitionProperties] operator[SEP] identifier[r] operator[->] Other[null] operator[SEP] operator[SEP]
}
Keyword[return] identifier[withTransitionProperties] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[possibleTps] operator[SEP] operator[SEP] operator[SEP]
}
|
private static List<Fragment> planForConjunction(ConjunctionQuery query, TransactionOLTP tx) {
// a query plan is an ordered list of fragments
final List<Fragment> plan = new ArrayList<>();
// flatten all the possible fragments from the conjunction query (these become edges in the query graph)
final Set<Fragment> allFragments = query.getEquivalentFragmentSets().stream()
.flatMap(EquivalentFragmentSet::stream).collect(Collectors.toSet());
// if role players' types are known, we can infer the types of the relation, adding label & isa fragments
Set<Fragment> inferredFragments = inferRelationTypes(tx, allFragments);
allFragments.addAll(inferredFragments);
// convert fragments into nodes - some fragments create virtual middle nodes to ensure the Janus edge is traversed
ImmutableMap<NodeId, Node> queryGraphNodes = buildNodesWithDependencies(allFragments);
// it's possible that some (or all) fragments are disconnected, e.g. $x isa person; $y isa dog;
Collection<Set<Fragment>> connectedFragmentSets = getConnectedFragmentSets(allFragments);
// build a query plan for each query subgraph separately
for (Set<Fragment> connectedFragments : connectedFragmentSets) {
// one of two cases - either we have a connected graph > 1 node, which is used to compute a MST, OR exactly 1 node
Arborescence<Node> subgraphArborescence = computeArborescence(connectedFragments, queryGraphNodes, tx);
if (subgraphArborescence != null) {
// collect the mapping from directed edge back to fragments -- inverse operation of creating virtual middle nodes
Map<Node, Map<Node, Fragment>> middleNodeFragmentMapping = virtualMiddleNodeToFragmentMapping(connectedFragments, queryGraphNodes);
List<Fragment> subplan = GreedyTreeTraversal.greedyTraversal(subgraphArborescence, queryGraphNodes, middleNodeFragmentMapping);
plan.addAll(subplan);
} else {
// find and include all the nodes not touched in the MST in the plan
Set<Node> unhandledNodes = connectedFragments.stream()
.flatMap(fragment -> fragment.getNodes().stream())
.map(node -> queryGraphNodes.get(node.getNodeId()))
.collect(Collectors.toSet());
if (unhandledNodes.size() != 1) {
throw GraknServerException.create("Query planner exception - expected one unhandled node, found " + unhandledNodes.size());
}
plan.addAll(nodeToPlanFragments(Iterators.getOnlyElement(unhandledNodes.iterator()), queryGraphNodes, false));
}
}
// this shouldn't be necessary, but we keep it just in case of an edge case that we haven't thought of
List<Fragment> remainingFragments = fragmentsForUnvisitedNodes(queryGraphNodes, queryGraphNodes.values());
if (remainingFragments.size() > 0) {
LOG.warn("Expected all fragments to be handled, but found these: " + remainingFragments);
plan.addAll(remainingFragments);
}
LOG.trace("Greedy Plan = {}", plan);
return plan;
}
|
class class_name[name] begin[{]
method[planForConjunction, return_type[type[List]], modifier[private static], parameter[query, tx]] begin[{]
local_variable[type[List], plan]
local_variable[type[Set], allFragments]
local_variable[type[Set], inferredFragments]
call[allFragments.addAll, parameter[member[.inferredFragments]]]
local_variable[type[ImmutableMap], queryGraphNodes]
local_variable[type[Collection], connectedFragmentSets]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=connectedFragments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=queryGraphNodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=computeArborescence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=subgraphArborescence)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))], dimensions=[], name=Arborescence, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=subgraphArborescence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=stream, postfix_operators=[], prefix_operators=[], qualifier=connectedFragments, selectors=[MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[], member=getNodes, postfix_operators=[], prefix_operators=[], qualifier=fragment, selectors=[MethodInvocation(arguments=[], member=stream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[MemberReference(member=fragment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=flatMap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNodeId, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=queryGraphNodes, selectors=[], type_arguments=None), parameters=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=map, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toSet, postfix_operators=[], prefix_operators=[], qualifier=Collectors, selectors=[], type_arguments=None)], member=collect, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=unhandledNodes)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))], dimensions=[], name=Set, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=unhandledNodes, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Query planner exception - expected one unhandled node, found "), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=unhandledNodes, selectors=[], type_arguments=None), operator=+)], member=create, postfix_operators=[], prefix_operators=[], qualifier=GraknServerException, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=unhandledNodes, selectors=[], type_arguments=None)], member=getOnlyElement, postfix_operators=[], prefix_operators=[], qualifier=Iterators, selectors=[], type_arguments=None), MemberReference(member=queryGraphNodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=nodeToPlanFragments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=plan, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=connectedFragments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=queryGraphNodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=virtualMiddleNodeToFragmentMapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=middleNodeFragmentMapping)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Fragment, sub_type=None))], dimensions=[], name=Map, sub_type=None))], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=subgraphArborescence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=queryGraphNodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=middleNodeFragmentMapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=greedyTraversal, postfix_operators=[], prefix_operators=[], qualifier=GreedyTreeTraversal, selectors=[], type_arguments=None), name=subplan)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Fragment, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=subplan, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=plan, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=connectedFragmentSets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=connectedFragments)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Fragment, sub_type=None))], dimensions=[], name=Set, sub_type=None))), label=None)
local_variable[type[List], remainingFragments]
if[binary_operation[call[remainingFragments.size, parameter[]], >, literal[0]]] begin[{]
call[LOG.warn, parameter[binary_operation[literal["Expected all fragments to be handled, but found these: "], +, member[.remainingFragments]]]]
call[plan.addAll, parameter[member[.remainingFragments]]]
else begin[{]
None
end[}]
call[LOG.trace, parameter[literal["Greedy Plan = {}"], member[.plan]]]
return[member[.plan]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[List] operator[<] identifier[Fragment] operator[>] identifier[planForConjunction] operator[SEP] identifier[ConjunctionQuery] identifier[query] , identifier[TransactionOLTP] identifier[tx] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[Fragment] operator[>] identifier[plan] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[Fragment] operator[>] identifier[allFragments] operator[=] identifier[query] operator[SEP] identifier[getEquivalentFragmentSets] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] identifier[EquivalentFragmentSet] operator[::] identifier[stream] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toSet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[Fragment] operator[>] identifier[inferredFragments] operator[=] identifier[inferRelationTypes] operator[SEP] identifier[tx] , identifier[allFragments] operator[SEP] operator[SEP] identifier[allFragments] operator[SEP] identifier[addAll] operator[SEP] identifier[inferredFragments] operator[SEP] operator[SEP] identifier[ImmutableMap] operator[<] identifier[NodeId] , identifier[Node] operator[>] identifier[queryGraphNodes] operator[=] identifier[buildNodesWithDependencies] operator[SEP] identifier[allFragments] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[Set] operator[<] identifier[Fragment] operator[>] operator[>] identifier[connectedFragmentSets] operator[=] identifier[getConnectedFragmentSets] operator[SEP] identifier[allFragments] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Set] operator[<] identifier[Fragment] operator[>] identifier[connectedFragments] operator[:] identifier[connectedFragmentSets] operator[SEP] {
identifier[Arborescence] operator[<] identifier[Node] operator[>] identifier[subgraphArborescence] operator[=] identifier[computeArborescence] operator[SEP] identifier[connectedFragments] , identifier[queryGraphNodes] , identifier[tx] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[subgraphArborescence] operator[!=] Other[null] operator[SEP] {
identifier[Map] operator[<] identifier[Node] , identifier[Map] operator[<] identifier[Node] , identifier[Fragment] operator[>] operator[>] identifier[middleNodeFragmentMapping] operator[=] identifier[virtualMiddleNodeToFragmentMapping] operator[SEP] identifier[connectedFragments] , identifier[queryGraphNodes] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Fragment] operator[>] identifier[subplan] operator[=] identifier[GreedyTreeTraversal] operator[SEP] identifier[greedyTraversal] operator[SEP] identifier[subgraphArborescence] , identifier[queryGraphNodes] , identifier[middleNodeFragmentMapping] operator[SEP] operator[SEP] identifier[plan] operator[SEP] identifier[addAll] operator[SEP] identifier[subplan] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Set] operator[<] identifier[Node] operator[>] identifier[unhandledNodes] operator[=] identifier[connectedFragments] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] identifier[fragment] operator[->] identifier[fragment] operator[SEP] identifier[getNodes] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[node] operator[->] identifier[queryGraphNodes] operator[SEP] identifier[get] operator[SEP] identifier[node] operator[SEP] identifier[getNodeId] operator[SEP] 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] Keyword[if] operator[SEP] identifier[unhandledNodes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] Other[1] operator[SEP] {
Keyword[throw] identifier[GraknServerException] operator[SEP] identifier[create] operator[SEP] literal[String] operator[+] identifier[unhandledNodes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[plan] operator[SEP] identifier[addAll] operator[SEP] identifier[nodeToPlanFragments] operator[SEP] identifier[Iterators] operator[SEP] identifier[getOnlyElement] operator[SEP] identifier[unhandledNodes] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] , identifier[queryGraphNodes] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[Fragment] operator[>] identifier[remainingFragments] operator[=] identifier[fragmentsForUnvisitedNodes] operator[SEP] identifier[queryGraphNodes] , identifier[queryGraphNodes] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[remainingFragments] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[remainingFragments] operator[SEP] operator[SEP] identifier[plan] operator[SEP] identifier[addAll] operator[SEP] identifier[remainingFragments] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[plan] operator[SEP] operator[SEP] Keyword[return] identifier[plan] operator[SEP]
}
|
protected String getIndexName(String indexPrefix, long timestamp) {
return new StringBuilder(indexPrefix).append('-')
.append(fastDateFormat.format(timestamp)).toString();
}
|
class class_name[name] begin[{]
method[getIndexName, return_type[type[String]], modifier[protected], parameter[indexPrefix, timestamp]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=indexPrefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-')], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=timestamp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=fastDateFormat, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None))]
end[}]
END[}]
|
Keyword[protected] identifier[String] identifier[getIndexName] operator[SEP] identifier[String] identifier[indexPrefix] , Keyword[long] identifier[timestamp] operator[SEP] {
Keyword[return] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[indexPrefix] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fastDateFormat] operator[SEP] identifier[format] operator[SEP] identifier[timestamp] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public Pager<Label> getLabels(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException {
return (new Pager<Label>(this, Label.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "labels"));
}
|
class class_name[name] begin[{]
method[getLabels, return_type[type[Pager]], modifier[public], parameter[projectIdOrPath, itemsPerPage]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Label, sub_type=None)), MemberReference(member=itemsPerPage, 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="projects"), MethodInvocation(arguments=[MemberReference(member=projectIdOrPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProjectIdOrPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="labels")], 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=Label, sub_type=None))], dimensions=None, name=Pager, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[Pager] operator[<] identifier[Label] operator[>] identifier[getLabels] operator[SEP] identifier[Object] identifier[projectIdOrPath] , Keyword[int] identifier[itemsPerPage] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[return] operator[SEP] Keyword[new] identifier[Pager] operator[<] identifier[Label] operator[>] operator[SEP] Keyword[this] , identifier[Label] operator[SEP] Keyword[class] , identifier[itemsPerPage] , Other[null] , literal[String] , identifier[getProjectIdOrPath] operator[SEP] identifier[projectIdOrPath] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public int readLine(byte b[], int off, int len) throws IOException {
int result, left = totalExpected - totalRead;
if (left <= 0) {
return -1;
} else {
result = ((ServletInputStream)in).readLine(b, off, Math.min(left, len));
}
if (result > 0) {
totalRead += result;
}
return result;
}
|
class class_name[name] begin[{]
method[readLine, return_type[type[int]], modifier[public], parameter[b, off, len]] begin[{]
local_variable[type[int], result]
if[binary_operation[member[.left], <=, literal[0]]] begin[{]
return[literal[1]]
else begin[{]
assign[member[.result], Cast(expression=MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ServletInputStream, sub_type=None))]
end[}]
if[binary_operation[member[.result], >, literal[0]]] begin[{]
assign[member[.totalRead], member[.result]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[readLine] operator[SEP] Keyword[byte] identifier[b] operator[SEP] operator[SEP] , Keyword[int] identifier[off] , Keyword[int] identifier[len] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[result] , identifier[left] operator[=] identifier[totalExpected] operator[-] identifier[totalRead] operator[SEP] Keyword[if] operator[SEP] identifier[left] operator[<=] Other[0] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[else] {
identifier[result] operator[=] operator[SEP] operator[SEP] identifier[ServletInputStream] operator[SEP] identifier[in] operator[SEP] operator[SEP] identifier[readLine] operator[SEP] identifier[b] , identifier[off] , identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[left] , identifier[len] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[result] operator[>] Other[0] operator[SEP] {
identifier[totalRead] operator[+=] identifier[result] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
TouchPipeline getBasePipeline() {
if (basePipeline == null) {
basePipeline = new TouchPipeline();
String[] touchFilterNames = AccessController.doPrivileged(
(PrivilegedAction<String>) () -> System.getProperty(
"monocle.input.touchFilters",
"SmallMove")
).split(",");
if (touchFilterNames != null) {
for (String touchFilterName : touchFilterNames) {
basePipeline.addNamedFilter(touchFilterName.trim());
}
}
}
return basePipeline;
}
|
class class_name[name] begin[{]
method[getBasePipeline, return_type[type[TouchPipeline]], modifier[default], parameter[]] begin[{]
if[binary_operation[member[.basePipeline], ==, literal[null]]] begin[{]
assign[member[.basePipeline], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TouchPipeline, sub_type=None))]
local_variable[type[String], touchFilterNames]
if[binary_operation[member[.touchFilterNames], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=touchFilterName, selectors=[], type_arguments=None)], member=addNamedFilter, postfix_operators=[], prefix_operators=[], qualifier=basePipeline, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=touchFilterNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=touchFilterName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.basePipeline]]
end[}]
END[}]
|
identifier[TouchPipeline] identifier[getBasePipeline] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[basePipeline] operator[==] Other[null] operator[SEP] {
identifier[basePipeline] operator[=] Keyword[new] identifier[TouchPipeline] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[touchFilterNames] operator[=] identifier[AccessController] operator[SEP] identifier[doPrivileged] operator[SEP] operator[SEP] identifier[PrivilegedAction] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[touchFilterNames] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[touchFilterName] operator[:] identifier[touchFilterNames] operator[SEP] {
identifier[basePipeline] operator[SEP] identifier[addNamedFilter] operator[SEP] identifier[touchFilterName] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[basePipeline] operator[SEP]
}
|
public static Locale locale(ITemplate template) {
if (null != template) {
return template.__curLocale();
}
Locale retval;
RythmEngine engine = RythmEngine.get();
if (null != engine) {
retval = engine.conf().locale();
} else {
retval = RythmConfigurationKey.I18N_LOCALE.getDefaultConfiguration();
}
return retval;
}
|
class class_name[name] begin[{]
method[locale, return_type[type[Locale]], modifier[public static], parameter[template]] begin[{]
if[binary_operation[literal[null], !=, member[.template]]] begin[{]
return[call[template.__curLocale, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[Locale], retval]
local_variable[type[RythmEngine], engine]
if[binary_operation[literal[null], !=, member[.engine]]] begin[{]
assign[member[.retval], call[engine.conf, parameter[]]]
else begin[{]
assign[member[.retval], call[RythmConfigurationKey.I18N_LOCALE.getDefaultConfiguration, parameter[]]]
end[}]
return[member[.retval]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Locale] identifier[locale] operator[SEP] identifier[ITemplate] identifier[template] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[template] operator[SEP] {
Keyword[return] identifier[template] operator[SEP] identifier[__curLocale] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Locale] identifier[retval] operator[SEP] identifier[RythmEngine] identifier[engine] operator[=] identifier[RythmEngine] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[engine] operator[SEP] {
identifier[retval] operator[=] identifier[engine] operator[SEP] identifier[conf] operator[SEP] operator[SEP] operator[SEP] identifier[locale] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[retval] operator[=] identifier[RythmConfigurationKey] operator[SEP] identifier[I18N_LOCALE] operator[SEP] identifier[getDefaultConfiguration] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[retval] operator[SEP]
}
|
public MergeRequest cancelMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
if (mergeRequestIid == null) {
throw new RuntimeException("mergeRequestIid cannot be null");
}
Response response = put(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "cancel_merge_when_pipeline_succeeds");
return (response.readEntity(MergeRequest.class));
}
|
class class_name[name] begin[{]
method[cancelMergeRequest, return_type[type[MergeRequest]], modifier[public], parameter[projectIdOrPath, mergeRequestIid]] begin[{]
if[binary_operation[member[.mergeRequestIid], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="mergeRequestIid cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Response], response]
return[call[response.readEntity, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MergeRequest, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[MergeRequest] identifier[cancelMergeRequest] operator[SEP] identifier[Object] identifier[projectIdOrPath] , identifier[Integer] identifier[mergeRequestIid] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[if] operator[SEP] identifier[mergeRequestIid] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Response] identifier[response] operator[=] identifier[put] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[OK] , Other[null] , literal[String] , identifier[getProjectIdOrPath] operator[SEP] identifier[projectIdOrPath] operator[SEP] , literal[String] , identifier[mergeRequestIid] , literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[response] operator[SEP] identifier[readEntity] operator[SEP] identifier[MergeRequest] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public int doEndTag() throws JspException {
/*
* Use the SQL statement specified by the sql attribute, if any,
* otherwise use the body as the statement.
*/
String sqlStatement = null;
if (sql != null) {
sqlStatement = sql;
} else if (bodyContent != null) {
sqlStatement = bodyContent.getString();
}
if (sqlStatement == null || sqlStatement.trim().length() == 0) {
throw new JspTagException(
Resources.getMessage("SQL_NO_STATEMENT"));
}
int result = 0;
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sqlStatement);
setParameters(ps, parameters);
result = ps.executeUpdate();
}
catch (Throwable e) {
throw new JspException(sqlStatement + ": " + e.getMessage(), e);
} finally {
if (ps != null) {
try {
ps.close();
} catch (SQLException sqe) {
throw new JspException(sqe.getMessage(), sqe);
}
}
}
if (var != null) {
pageContext.setAttribute(var, new Integer(result), scope);
}
return EVAL_PAGE;
}
|
class class_name[name] begin[{]
method[doEndTag, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[String], sqlStatement]
if[binary_operation[member[.sql], !=, literal[null]]] begin[{]
assign[member[.sqlStatement], member[.sql]]
else begin[{]
if[binary_operation[member[.bodyContent], !=, literal[null]]] begin[{]
assign[member[.sqlStatement], call[bodyContent.getString, parameter[]]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[binary_operation[member[.sqlStatement], ==, literal[null]], ||, binary_operation[call[sqlStatement.trim, parameter[]], ==, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SQL_NO_STATEMENT")], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=Resources, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JspTagException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], result]
local_variable[type[PreparedStatement], ps]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=sqlStatement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setParameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=executeUpdate, postfix_operators=[], prefix_operators=[], qualifier=ps, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=sqlStatement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), 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=JspException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ps, 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=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=ps, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=sqe, selectors=[], type_arguments=None), MemberReference(member=sqe, 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=sqe, types=['SQLException']))], finally_block=None, label=None, resources=None)]))], label=None, resources=None)
if[binary_operation[member[.var], !=, literal[null]]] begin[{]
call[pageContext.setAttribute, parameter[member[.var], ClassCreator(arguments=[MemberReference(member=result, 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=Integer, sub_type=None)), member[.scope]]]
else begin[{]
None
end[}]
return[member[.EVAL_PAGE]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[doEndTag] operator[SEP] operator[SEP] Keyword[throws] identifier[JspException] {
identifier[String] identifier[sqlStatement] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[sql] operator[!=] Other[null] operator[SEP] {
identifier[sqlStatement] operator[=] identifier[sql] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[bodyContent] operator[!=] Other[null] operator[SEP] {
identifier[sqlStatement] operator[=] identifier[bodyContent] operator[SEP] identifier[getString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[sqlStatement] operator[==] Other[null] operator[||] identifier[sqlStatement] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JspTagException] operator[SEP] identifier[Resources] operator[SEP] identifier[getMessage] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[result] operator[=] Other[0] operator[SEP] identifier[PreparedStatement] identifier[ps] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[ps] operator[=] identifier[conn] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[sqlStatement] operator[SEP] operator[SEP] identifier[setParameters] operator[SEP] identifier[ps] , identifier[parameters] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[ps] operator[SEP] identifier[executeUpdate] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JspException] operator[SEP] identifier[sqlStatement] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[ps] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[ps] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[sqe] operator[SEP] {
Keyword[throw] Keyword[new] identifier[JspException] operator[SEP] identifier[sqe] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[sqe] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[var] operator[!=] Other[null] operator[SEP] {
identifier[pageContext] operator[SEP] identifier[setAttribute] operator[SEP] identifier[var] , Keyword[new] identifier[Integer] operator[SEP] identifier[result] operator[SEP] , identifier[scope] operator[SEP] operator[SEP]
}
Keyword[return] identifier[EVAL_PAGE] operator[SEP]
}
|
public void setName(final CompilerEnum name) throws BuildException {
if (isReference()) {
throw tooManyAttributes();
}
final Compiler compiler = name.getCompiler();
setProcessor(compiler);
}
|
class class_name[name] begin[{]
method[setName, return_type[void], modifier[public], parameter[name]] begin[{]
if[call[.isReference, parameter[]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[], member=tooManyAttributes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
local_variable[type[Compiler], compiler]
call[.setProcessor, parameter[member[.compiler]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setName] operator[SEP] Keyword[final] identifier[CompilerEnum] identifier[name] operator[SEP] Keyword[throws] identifier[BuildException] {
Keyword[if] operator[SEP] identifier[isReference] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] identifier[tooManyAttributes] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Compiler] identifier[compiler] operator[=] identifier[name] operator[SEP] identifier[getCompiler] operator[SEP] operator[SEP] operator[SEP] identifier[setProcessor] operator[SEP] identifier[compiler] operator[SEP] operator[SEP]
}
|
protected void reopenCameraAtResolution(int cameraWidth, int cameraHeight) {
if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
throw new RuntimeException("Attempted to reopenCameraAtResolution main looper thread!");
}
boolean releaseLock = true;
open.mLock.lock();
try {
if (verbose)
Log.i(TAG, "Reopening camera is null == " + (open.mCameraDevice == null)+" state="+open.state+
" activity="+getClass().getSimpleName());
if( open.state != CameraState.OPEN )
throw new RuntimeException("BUG! Attempted to re-open camera when not open");
if (null == open. mCameraDevice) {
throw new RuntimeException("Can't re-open a closed camera");
}
closePreviewSession();
open.mCameraSize = null;
firstFrame = true;
CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
if (manager == null)
throw new RuntimeException("Null camera manager");
try {
open.mPreviewReader = ImageReader.newInstance(
cameraWidth, cameraHeight,
ImageFormat.YUV_420_888, 2);
// Do the processing inside the the handler thread instead of the looper thread to avoid
// grinding the UI to a halt
open.mPreviewReader.setOnImageAvailableListener(onAvailableListener, mBackgroundHandler);
configureTransform(viewWidth, viewHeight);
manager.openCamera(open.cameraId, mStateCallback, null);
releaseLock = false;
} catch (IllegalArgumentException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
finish();
} catch (CameraAccessException e) {
e.printStackTrace();
}
} finally {
if(releaseLock)
open.mLock.unlock();
}
}
|
class class_name[name] begin[{]
method[reopenCameraAtResolution, return_type[void], modifier[protected], parameter[cameraWidth, cameraHeight]] begin[{]
if[binary_operation[call[Looper.getMainLooper, parameter[]], !=, call[Thread.currentThread, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Attempted to reopenCameraAtResolution main looper thread!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[boolean], releaseLock]
call[open.mLock.lock, parameter[]]
TryStatement(block=[IfStatement(condition=MemberReference(member=verbose, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Reopening camera is null == "), operandr=BinaryOperation(operandl=MemberReference(member=mCameraDevice, postfix_operators=[], prefix_operators=[], qualifier=open, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" state="), operator=+), operandr=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=open, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" activity="), operator=+), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], member=i, postfix_operators=[], prefix_operators=[], qualifier=Log, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=open, selectors=[]), operandr=MemberReference(member=OPEN, postfix_operators=[], prefix_operators=[], qualifier=CameraState, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BUG! Attempted to re-open camera when not open")], 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)), IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=mCameraDevice, postfix_operators=[], prefix_operators=[], qualifier=open, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can't re-open a closed camera")], 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)])), StatementExpression(expression=MethodInvocation(arguments=[], member=closePreviewSession, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mCameraSize, postfix_operators=[], prefix_operators=[], qualifier=open, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=firstFrame, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=CAMERA_SERVICE, postfix_operators=[], prefix_operators=[], qualifier=Context, selectors=[])], member=getSystemService, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=CameraManager, sub_type=None)), name=manager)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CameraManager, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=manager, 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=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Null camera manager")], 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)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mPreviewReader, postfix_operators=[], prefix_operators=[], qualifier=open, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=cameraWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cameraHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=YUV_420_888, postfix_operators=[], prefix_operators=[], qualifier=ImageFormat, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=ImageReader, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=onAvailableListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mBackgroundHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setOnImageAvailableListener, postfix_operators=[], prefix_operators=[], qualifier=open.mPreviewReader, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=viewWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=viewHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=configureTransform, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cameraId, postfix_operators=[], prefix_operators=[], qualifier=open, selectors=[]), MemberReference(member=mStateCallback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=openCamera, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=releaseLock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=LENGTH_LONG, postfix_operators=[], prefix_operators=[], qualifier=Toast, selectors=[])], member=makeText, postfix_operators=[], prefix_operators=[], qualifier=Toast, selectors=[MethodInvocation(arguments=[], member=show, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=finish, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalArgumentException'])), 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=['CameraAccessException']))], finally_block=None, label=None, resources=None)], catches=None, finally_block=[IfStatement(condition=MemberReference(member=releaseLock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=open.mLock, selectors=[], type_arguments=None), label=None))], label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[reopenCameraAtResolution] operator[SEP] Keyword[int] identifier[cameraWidth] , Keyword[int] identifier[cameraHeight] operator[SEP] {
Keyword[if] operator[SEP] identifier[Looper] operator[SEP] identifier[getMainLooper] operator[SEP] operator[SEP] operator[SEP] identifier[getThread] operator[SEP] operator[SEP] operator[!=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[releaseLock] operator[=] literal[boolean] operator[SEP] identifier[open] operator[SEP] identifier[mLock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[verbose] operator[SEP] identifier[Log] operator[SEP] identifier[i] operator[SEP] identifier[TAG] , literal[String] operator[+] operator[SEP] identifier[open] operator[SEP] identifier[mCameraDevice] operator[==] Other[null] operator[SEP] operator[+] literal[String] operator[+] identifier[open] operator[SEP] identifier[state] operator[+] literal[String] operator[+] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[open] operator[SEP] identifier[state] operator[!=] identifier[CameraState] operator[SEP] identifier[OPEN] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[open] operator[SEP] identifier[mCameraDevice] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[closePreviewSession] operator[SEP] operator[SEP] operator[SEP] identifier[open] operator[SEP] identifier[mCameraSize] operator[=] Other[null] operator[SEP] identifier[firstFrame] operator[=] literal[boolean] operator[SEP] identifier[CameraManager] identifier[manager] operator[=] operator[SEP] identifier[CameraManager] operator[SEP] identifier[getSystemService] operator[SEP] identifier[Context] operator[SEP] identifier[CAMERA_SERVICE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[manager] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[open] operator[SEP] identifier[mPreviewReader] operator[=] identifier[ImageReader] operator[SEP] identifier[newInstance] operator[SEP] identifier[cameraWidth] , identifier[cameraHeight] , identifier[ImageFormat] operator[SEP] identifier[YUV_420_888] , Other[2] operator[SEP] operator[SEP] identifier[open] operator[SEP] identifier[mPreviewReader] operator[SEP] identifier[setOnImageAvailableListener] operator[SEP] identifier[onAvailableListener] , identifier[mBackgroundHandler] operator[SEP] operator[SEP] identifier[configureTransform] operator[SEP] identifier[viewWidth] , identifier[viewHeight] operator[SEP] operator[SEP] identifier[manager] operator[SEP] identifier[openCamera] operator[SEP] identifier[open] operator[SEP] identifier[cameraId] , identifier[mStateCallback] , Other[null] operator[SEP] operator[SEP] identifier[releaseLock] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalArgumentException] identifier[e] operator[SEP] {
identifier[Toast] operator[SEP] identifier[makeText] operator[SEP] Keyword[this] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[Toast] operator[SEP] identifier[LENGTH_LONG] operator[SEP] operator[SEP] identifier[show] operator[SEP] operator[SEP] operator[SEP] identifier[finish] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CameraAccessException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[releaseLock] operator[SEP] identifier[open] operator[SEP] identifier[mLock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static CmsContentDefinition prefetch(HttpServletRequest request) throws CmsRpcException {
CmsContentService srv = new CmsContentService();
srv.setCms(CmsFlexController.getCmsObject(request));
srv.setRequest(request);
CmsContentDefinition result = null;
try {
result = srv.prefetch();
} finally {
srv.clearThreadStorage();
}
return result;
}
|
class class_name[name] begin[{]
method[prefetch, return_type[type[CmsContentDefinition]], modifier[public static], parameter[request]] begin[{]
local_variable[type[CmsContentService], srv]
call[srv.setCms, parameter[call[CmsFlexController.getCmsObject, parameter[member[.request]]]]]
call[srv.setRequest, parameter[member[.request]]]
local_variable[type[CmsContentDefinition], result]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=prefetch, postfix_operators=[], prefix_operators=[], qualifier=srv, selectors=[], type_arguments=None)), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=clearThreadStorage, postfix_operators=[], prefix_operators=[], qualifier=srv, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CmsContentDefinition] identifier[prefetch] operator[SEP] identifier[HttpServletRequest] identifier[request] operator[SEP] Keyword[throws] identifier[CmsRpcException] {
identifier[CmsContentService] identifier[srv] operator[=] Keyword[new] identifier[CmsContentService] operator[SEP] operator[SEP] operator[SEP] identifier[srv] operator[SEP] identifier[setCms] operator[SEP] identifier[CmsFlexController] operator[SEP] identifier[getCmsObject] operator[SEP] identifier[request] operator[SEP] operator[SEP] operator[SEP] identifier[srv] operator[SEP] identifier[setRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[CmsContentDefinition] identifier[result] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[result] operator[=] identifier[srv] operator[SEP] identifier[prefetch] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[srv] operator[SEP] identifier[clearThreadStorage] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
protected HttpURLConnection generateConn() throws IOException {
HttpURLConnection conn;
conn = (HttpURLConnection) new URL(url).openConnection();
return conn;
}
|
class class_name[name] begin[{]
method[generateConn, return_type[type[HttpURLConnection]], modifier[protected], parameter[]] begin[{]
local_variable[type[HttpURLConnection], conn]
assign[member[.conn], Cast(expression=ClassCreator(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=openConnection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=URL, sub_type=None)), type=ReferenceType(arguments=None, dimensions=[], name=HttpURLConnection, sub_type=None))]
return[member[.conn]]
end[}]
END[}]
|
Keyword[protected] identifier[HttpURLConnection] identifier[generateConn] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[HttpURLConnection] identifier[conn] operator[SEP] identifier[conn] operator[=] operator[SEP] identifier[HttpURLConnection] operator[SEP] Keyword[new] identifier[URL] operator[SEP] identifier[url] operator[SEP] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[conn] operator[SEP]
}
|
@NotNull
public <R> Stream<R> mapIndexed(int from, int step,
@NotNull IndexedFunction<? super T, ? extends R> mapper) {
return new Stream<R>(params, new ObjMapIndexed<T, R>(
new IndexedIterator<T>(from, step, iterator),
mapper));
}
|
class class_name[name] begin[{]
method[mapIndexed, return_type[type[Stream]], modifier[public], parameter[from, step, mapper]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=from, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=step, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iterator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=IndexedIterator, sub_type=None)), MemberReference(member=mapper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None))], dimensions=None, name=ObjMapIndexed, sub_type=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[}]
|
annotation[@] identifier[NotNull] Keyword[public] operator[<] identifier[R] operator[>] identifier[Stream] operator[<] identifier[R] operator[>] identifier[mapIndexed] operator[SEP] Keyword[int] identifier[from] , Keyword[int] identifier[step] , annotation[@] identifier[NotNull] identifier[IndexedFunction] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[R] operator[>] identifier[mapper] operator[SEP] {
Keyword[return] Keyword[new] identifier[Stream] operator[<] identifier[R] operator[>] operator[SEP] identifier[params] , Keyword[new] identifier[ObjMapIndexed] operator[<] identifier[T] , identifier[R] operator[>] operator[SEP] Keyword[new] identifier[IndexedIterator] operator[<] identifier[T] operator[>] operator[SEP] identifier[from] , identifier[step] , identifier[iterator] operator[SEP] , identifier[mapper] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean track(TopologyAPI.StreamId stream, long ts) {
Long currentVal = streamToTs.get(stream);
if (currentVal == null || ts > currentVal) {
streamToTs.put(stream, ts);
}
return ts >= lastWaterMarkTs;
}
|
class class_name[name] begin[{]
method[track, return_type[type[boolean]], modifier[public], parameter[stream, ts]] begin[{]
local_variable[type[Long], currentVal]
if[binary_operation[binary_operation[member[.currentVal], ==, literal[null]], ||, binary_operation[member[.ts], >, member[.currentVal]]]] begin[{]
call[streamToTs.put, parameter[member[.stream], member[.ts]]]
else begin[{]
None
end[}]
return[binary_operation[member[.ts], >=, member[.lastWaterMarkTs]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[track] operator[SEP] identifier[TopologyAPI] operator[SEP] identifier[StreamId] identifier[stream] , Keyword[long] identifier[ts] operator[SEP] {
identifier[Long] identifier[currentVal] operator[=] identifier[streamToTs] operator[SEP] identifier[get] operator[SEP] identifier[stream] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentVal] operator[==] Other[null] operator[||] identifier[ts] operator[>] identifier[currentVal] operator[SEP] {
identifier[streamToTs] operator[SEP] identifier[put] operator[SEP] identifier[stream] , identifier[ts] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ts] operator[>=] identifier[lastWaterMarkTs] operator[SEP]
}
|
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
FieldList record = super.setHandle(bookmark, iHandleType);
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
this.syncTables(table, this.getRecord());
}
return record;
}
|
class class_name[name] begin[{]
method[setHandle, return_type[type[FieldList]], modifier[public], parameter[bookmark, iHandleType]] begin[{]
local_variable[type[FieldList], record]
local_variable[type[Iterator], iterator]
while[call[iterator.hasNext, parameter[]]] begin[{]
local_variable[type[BaseTable], table]
if[binary_operation[binary_operation[member[.table], !=, literal[null]], &&, binary_operation[member[.table], !=, THIS[call[None.getNextTable, parameter[]]]]]] begin[{]
THIS[call[None.syncTables, parameter[member[.table], THIS[call[None.getRecord, parameter[]]]]]]
else begin[{]
None
end[}]
end[}]
return[member[.record]]
end[}]
END[}]
|
Keyword[public] identifier[FieldList] identifier[setHandle] operator[SEP] identifier[Object] identifier[bookmark] , Keyword[int] identifier[iHandleType] operator[SEP] Keyword[throws] identifier[DBException] {
identifier[FieldList] identifier[record] operator[=] Keyword[super] operator[SEP] identifier[setHandle] operator[SEP] identifier[bookmark] , identifier[iHandleType] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[BaseTable] operator[>] identifier[iterator] operator[=] Keyword[this] operator[SEP] identifier[getTables] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[BaseTable] identifier[table] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[table] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[table] operator[!=] Keyword[this] operator[SEP] identifier[getNextTable] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[syncTables] operator[SEP] identifier[table] , Keyword[this] operator[SEP] identifier[getRecord] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[record] operator[SEP]
}
|
public ChannelFuture connect(Session session,
DatagramChannel datagramChannel, InetSocketAddress serverAddress,
int timeout, TimeUnit unit) throws UnknownHostException,
InterruptedException
{
if (null == datagramChannel)
{
throw new NullPointerException(
"DatagramChannel passed to connect method cannot be null");
}
if (!datagramChannel.isBound())
{
throw new IllegalStateException("DatagramChannel: "
+ datagramChannel
+ " Passed to connect method is not bound");
}
Event event = Events.event(null, Events.CONNECT);
ChannelFuture future = datagramChannel.write(event, serverAddress);
future.addListener(new ChannelFutureListener()
{
@Override
public void operationComplete(ChannelFuture future)
throws Exception
{
if (!future.isSuccess())
{
throw new RuntimeException(future.getCause());
}
}
});
CLIENTS.put(datagramChannel.getLocalAddress(), session);
return future;
}
|
class class_name[name] begin[{]
method[connect, return_type[type[ChannelFuture]], modifier[public], parameter[session, datagramChannel, serverAddress, timeout, unit]] begin[{]
if[binary_operation[literal[null], ==, member[.datagramChannel]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DatagramChannel passed to connect method cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[datagramChannel.isBound, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DatagramChannel: "), operandr=MemberReference(member=datagramChannel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" Passed to connect method is not bound"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Event], event]
local_variable[type[ChannelFuture], future]
call[future.addListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[], member=isSuccess, postfix_operators=[], prefix_operators=['!'], qualifier=future, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None)], 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)]))], documentation=None, modifiers={'public'}, name=operationComplete, parameters=[FormalParameter(annotations=[], modifiers=set(), name=future, type=ReferenceType(arguments=None, dimensions=[], name=ChannelFuture, sub_type=None), varargs=False)], return_type=None, throws=['Exception'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChannelFutureListener, sub_type=None))]]
call[CLIENTS.put, parameter[call[datagramChannel.getLocalAddress, parameter[]], member[.session]]]
return[member[.future]]
end[}]
END[}]
|
Keyword[public] identifier[ChannelFuture] identifier[connect] operator[SEP] identifier[Session] identifier[session] , identifier[DatagramChannel] identifier[datagramChannel] , identifier[InetSocketAddress] identifier[serverAddress] , Keyword[int] identifier[timeout] , identifier[TimeUnit] identifier[unit] operator[SEP] Keyword[throws] identifier[UnknownHostException] , identifier[InterruptedException] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[datagramChannel] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[datagramChannel] operator[SEP] identifier[isBound] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[datagramChannel] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[Event] identifier[event] operator[=] identifier[Events] operator[SEP] identifier[event] operator[SEP] Other[null] , identifier[Events] operator[SEP] identifier[CONNECT] operator[SEP] operator[SEP] identifier[ChannelFuture] identifier[future] operator[=] identifier[datagramChannel] operator[SEP] identifier[write] operator[SEP] identifier[event] , identifier[serverAddress] operator[SEP] operator[SEP] identifier[future] operator[SEP] identifier[addListener] operator[SEP] Keyword[new] identifier[ChannelFutureListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[operationComplete] operator[SEP] identifier[ChannelFuture] identifier[future] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] operator[!] identifier[future] operator[SEP] identifier[isSuccess] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[future] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP] identifier[CLIENTS] operator[SEP] identifier[put] operator[SEP] identifier[datagramChannel] operator[SEP] identifier[getLocalAddress] operator[SEP] operator[SEP] , identifier[session] operator[SEP] operator[SEP] Keyword[return] identifier[future] operator[SEP]
}
|
private static String simpleName(Class<?> clazz) {
String name = clazz.getName();
// the nth anonymous class has a class name ending in "Outer$n"
// and local inner classes have names ending in "Outer.$1Inner"
name = name.replaceAll("\\$[0-9]+", "\\$");
// we want the name of the inner class all by its lonesome
int start = name.lastIndexOf('$');
// if this isn't an inner class, just find the start of the
// top level class name.
if (start == -1) {
start = name.lastIndexOf('.');
}
return name.substring(start + 1);
}
|
class class_name[name] begin[{]
method[simpleName, return_type[type[String]], modifier[private static], parameter[clazz]] begin[{]
local_variable[type[String], name]
assign[member[.name], call[name.replaceAll, parameter[literal["\\$[0-9]+"], literal["\\$"]]]]
local_variable[type[int], start]
if[binary_operation[member[.start], ==, literal[1]]] begin[{]
assign[member[.start], call[name.lastIndexOf, parameter[literal['.']]]]
else begin[{]
None
end[}]
return[call[name.substring, parameter[binary_operation[member[.start], +, literal[1]]]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[String] identifier[simpleName] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[=] identifier[name] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[start] operator[=] identifier[name] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[start] operator[==] operator[-] Other[1] operator[SEP] {
identifier[start] operator[=] identifier[name] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[name] operator[SEP] identifier[substring] operator[SEP] identifier[start] operator[+] Other[1] operator[SEP] operator[SEP]
}
|
public void add(String key, String value)
{
if(key == null)
throw new IllegalArgumentException("Null keys not allowed.");
if(value == null)
throw new IllegalArgumentException("Null values not allowed.");
List<String> vals = map.get(key);
if(vals == null)
{
vals = new ArrayList<String>();
map.put(key,vals);
}
vals.add(value);
}
|
class class_name[name] begin[{]
method[add, return_type[void], modifier[public], parameter[key, value]] begin[{]
if[binary_operation[member[.key], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Null keys not allowed.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Null values not allowed.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[List], vals]
if[binary_operation[member[.vals], ==, literal[null]]] begin[{]
assign[member[.vals], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
call[map.put, parameter[member[.key], member[.vals]]]
else begin[{]
None
end[}]
call[vals.add, parameter[member[.value]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[add] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[vals] operator[=] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vals] operator[==] Other[null] operator[SEP] {
identifier[vals] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[vals] operator[SEP] operator[SEP]
}
identifier[vals] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
|
public static CPMeasurementUnit fetchByG_P_T_Last(long groupId,
boolean primary, int type,
OrderByComparator<CPMeasurementUnit> orderByComparator) {
return getPersistence()
.fetchByG_P_T_Last(groupId, primary, type, orderByComparator);
}
|
class class_name[name] begin[{]
method[fetchByG_P_T_Last, return_type[type[CPMeasurementUnit]], modifier[public static], parameter[groupId, primary, type, orderByComparator]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CPMeasurementUnit] identifier[fetchByG_P_T_Last] operator[SEP] Keyword[long] identifier[groupId] , Keyword[boolean] identifier[primary] , Keyword[int] identifier[type] , identifier[OrderByComparator] operator[<] identifier[CPMeasurementUnit] operator[>] identifier[orderByComparator] operator[SEP] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[fetchByG_P_T_Last] operator[SEP] identifier[groupId] , identifier[primary] , identifier[type] , identifier[orderByComparator] operator[SEP] operator[SEP]
}
|
public IfcInventoryTypeEnum createIfcInventoryTypeEnumFromString(EDataType eDataType, String initialValue) {
IfcInventoryTypeEnum result = IfcInventoryTypeEnum.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
}
|
class class_name[name] begin[{]
method[createIfcInventoryTypeEnumFromString, return_type[type[IfcInventoryTypeEnum]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[IfcInventoryTypeEnum], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[IfcInventoryTypeEnum] identifier[createIfcInventoryTypeEnumFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[IfcInventoryTypeEnum] identifier[result] operator[=] identifier[IfcInventoryTypeEnum] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@Deprecated
protected static ValidationBuilder convertTimestamp(String attributeName, String format){
return ModelDelegate.convertTimestamp(modelClass(), attributeName, format);
}
|
class class_name[name] begin[{]
method[convertTimestamp, return_type[type[ValidationBuilder]], modifier[static protected], parameter[attributeName, format]] begin[{]
return[call[ModelDelegate.convertTimestamp, parameter[call[.modelClass, parameter[]], member[.attributeName], member[.format]]]]
end[}]
END[}]
|
annotation[@] identifier[Deprecated] Keyword[protected] Keyword[static] identifier[ValidationBuilder] identifier[convertTimestamp] operator[SEP] identifier[String] identifier[attributeName] , identifier[String] identifier[format] operator[SEP] {
Keyword[return] identifier[ModelDelegate] operator[SEP] identifier[convertTimestamp] operator[SEP] identifier[modelClass] operator[SEP] operator[SEP] , identifier[attributeName] , identifier[format] operator[SEP] operator[SEP]
}
|
private MultipartBody createMultipartBody() throws Exception {
List<Attachment> atts = new LinkedList<Attachment>();
atts.add(new Attachment("book1", "application/xml", new Book("JAXB", 1L)));
atts.add(new Attachment("book2", "application/json", new Book("JSON", 2L)));
atts.add(new Attachment("image", "application/octet-stream",
getClass().getResourceAsStream("/java.jpg")));
return new MultipartBody(atts, true);
}
|
class class_name[name] begin[{]
method[createMultipartBody, return_type[type[MultipartBody]], modifier[private], parameter[]] begin[{]
local_variable[type[List], atts]
call[atts.add, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="book1"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="application/xml"), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="JAXB"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1L)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Book, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Attachment, sub_type=None))]]
call[atts.add, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="book2"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="application/json"), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="JSON"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2L)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Book, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Attachment, sub_type=None))]]
call[atts.add, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="image"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="application/octet-stream"), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/java.jpg")], member=getResourceAsStream, 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=Attachment, sub_type=None))]]
return[ClassCreator(arguments=[MemberReference(member=atts, 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=MultipartBody, sub_type=None))]
end[}]
END[}]
|
Keyword[private] identifier[MultipartBody] identifier[createMultipartBody] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[List] operator[<] identifier[Attachment] operator[>] identifier[atts] operator[=] Keyword[new] identifier[LinkedList] operator[<] identifier[Attachment] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[atts] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Attachment] operator[SEP] literal[String] , literal[String] , Keyword[new] identifier[Book] operator[SEP] literal[String] , Other[1L] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[atts] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Attachment] operator[SEP] literal[String] , literal[String] , Keyword[new] identifier[Book] operator[SEP] literal[String] , Other[2L] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[atts] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Attachment] operator[SEP] literal[String] , literal[String] , identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getResourceAsStream] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[MultipartBody] operator[SEP] identifier[atts] , literal[boolean] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(final Field field, final Class<A> annClass) throws AnnotationReadException {
final Class<?> clazz = field.getDeclaringClass();
if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
if(classInfo.containsFieldInfo(field.getName())) {
FieldInfo fieldInfo = classInfo.getFieldInfo(field.getName());
if(fieldInfo != null && fieldInfo.containsAnnotationInfo(annClass.getName())){
AnnotationInfo annInfo = fieldInfo.getAnnotationInfo(annClass.getName());
try {
return (A)annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo);
} catch (ClassNotFoundException e) {
throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
}
}
}
}
return field.getAnnotation(annClass);
}
|
class class_name[name] begin[{]
method[getAnnotation, return_type[type[A]], modifier[public], parameter[field, annClass]] begin[{]
local_variable[type[Class], clazz]
if[binary_operation[binary_operation[member[.xmlInfo], !=, literal[null]], &&, call[xmlInfo.containsClassInfo, parameter[call[clazz.getName, parameter[]]]]]] begin[{]
local_variable[type[ClassInfo], classInfo]
if[call[classInfo.containsFieldInfo, parameter[call[field.getName, parameter[]]]]] begin[{]
local_variable[type[FieldInfo], fieldInfo]
if[binary_operation[binary_operation[member[.fieldInfo], !=, literal[null]], &&, call[fieldInfo.containsAnnotationInfo, parameter[call[annClass.getName, parameter[]]]]]] begin[{]
local_variable[type[AnnotationInfo], annInfo]
TryStatement(block=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=annInfo, selectors=[], type_arguments=None)], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), MemberReference(member=annInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildAnnotation, postfix_operators=[], prefix_operators=[], qualifier=annotationBuilder, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=A, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="not found class '%s'"), MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=annInfo, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, 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=AnnotationReadException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[call[field.getAnnotation, parameter[member[.annClass]]]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] operator[<] identifier[A] Keyword[extends] identifier[Annotation] operator[>] identifier[A] identifier[getAnnotation] operator[SEP] Keyword[final] identifier[Field] identifier[field] , Keyword[final] identifier[Class] operator[<] identifier[A] operator[>] identifier[annClass] operator[SEP] Keyword[throws] identifier[AnnotationReadException] {
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[=] identifier[field] operator[SEP] identifier[getDeclaringClass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[xmlInfo] operator[!=] Other[null] operator[&&] identifier[xmlInfo] operator[SEP] identifier[containsClassInfo] operator[SEP] identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[ClassInfo] identifier[classInfo] operator[=] identifier[xmlInfo] operator[SEP] identifier[getClassInfo] operator[SEP] identifier[clazz] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[classInfo] operator[SEP] identifier[containsFieldInfo] operator[SEP] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[FieldInfo] identifier[fieldInfo] operator[=] identifier[classInfo] operator[SEP] identifier[getFieldInfo] operator[SEP] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fieldInfo] operator[!=] Other[null] operator[&&] identifier[fieldInfo] operator[SEP] identifier[containsAnnotationInfo] operator[SEP] identifier[annClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[AnnotationInfo] identifier[annInfo] operator[=] identifier[fieldInfo] operator[SEP] identifier[getAnnotationInfo] operator[SEP] identifier[annClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] operator[SEP] identifier[A] operator[SEP] identifier[annotationBuilder] operator[SEP] identifier[buildAnnotation] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[annInfo] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] , identifier[annInfo] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AnnotationReadException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[annInfo] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
}
Keyword[return] identifier[field] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[annClass] operator[SEP] operator[SEP]
}
|
private <T> Observable.Transformer<T, T> applyInsertRetryPolicy() {
return tObservable -> tObservable
.retryWhen(errors -> {
Observable<Integer> range = Observable.range(1, 2);
return errors
.zipWith(range, (t, i) -> {
if (t instanceof DriverException) {
return i;
}
throw Exceptions.propagate(t);
})
.flatMap(retryCount -> {
long delay = (long) Math.min(Math.pow(2, retryCount) * 1000, 3000);
log.debug("Retrying batch insert in " + delay + " ms");
return Observable.timer(delay, TimeUnit.MILLISECONDS);
});
});
}
|
class class_name[name] begin[{]
method[applyInsertRetryPolicy, return_type[type[Observable]], modifier[private], parameter[]] begin[{]
return[LambdaExpression(body=MethodInvocation(arguments=[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=range, postfix_operators=[], prefix_operators=[], qualifier=Observable, selectors=[], type_arguments=None), name=range)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=[], name=Observable, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=range, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), LambdaExpression(body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=DriverException, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=propagate, postfix_operators=[], prefix_operators=[], qualifier=Exceptions, selectors=[], type_arguments=None), label=None)], parameters=[InferredFormalParameter(name=t), InferredFormalParameter(name=i)])], member=zipWith, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[MethodInvocation(arguments=[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), MemberReference(member=retryCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pow, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operator=*), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3000)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=long)), name=delay)], modifiers=set(), type=BasicType(dimensions=[], name=long)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Retrying batch insert in "), operandr=MemberReference(member=delay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ms"), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=delay, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MILLISECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=timer, postfix_operators=[], prefix_operators=[], qualifier=Observable, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=retryCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=flatMap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], parameters=[MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=retryWhen, postfix_operators=[], prefix_operators=[], qualifier=tObservable, selectors=[], type_arguments=None), parameters=[MemberReference(member=tObservable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
end[}]
END[}]
|
Keyword[private] operator[<] identifier[T] operator[>] identifier[Observable] operator[SEP] identifier[Transformer] operator[<] identifier[T] , identifier[T] operator[>] identifier[applyInsertRetryPolicy] operator[SEP] operator[SEP] {
Keyword[return] identifier[tObservable] operator[->] identifier[tObservable] operator[SEP] identifier[retryWhen] operator[SEP] identifier[errors] operator[->] {
identifier[Observable] operator[<] identifier[Integer] operator[>] identifier[range] operator[=] identifier[Observable] operator[SEP] identifier[range] operator[SEP] Other[1] , Other[2] operator[SEP] operator[SEP] Keyword[return] identifier[errors] operator[SEP] identifier[zipWith] operator[SEP] identifier[range] , operator[SEP] identifier[t] , identifier[i] operator[SEP] operator[->] {
Keyword[if] operator[SEP] identifier[t] Keyword[instanceof] identifier[DriverException] operator[SEP] {
Keyword[return] identifier[i] operator[SEP]
}
Keyword[throw] identifier[Exceptions] operator[SEP] identifier[propagate] operator[SEP] identifier[t] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] identifier[retryCount] operator[->] {
Keyword[long] identifier[delay] operator[=] operator[SEP] Keyword[long] operator[SEP] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[Math] operator[SEP] identifier[pow] operator[SEP] Other[2] , identifier[retryCount] operator[SEP] operator[*] Other[1000] , Other[3000] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[delay] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[timer] operator[SEP] identifier[delay] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
protected void initConfiguration() {
getTomcat().setBaseDir(baseDir.getAbsolutePath());
// Setup HTTP port listening
getTomcat().setPort(getConfig().getPort());
// Setup vaadin production mode
getContext().addParameter(PRODUCTION_MODE_PARAM, String.valueOf(getConfig().isProductionMode()));
}
|
class class_name[name] begin[{]
method[initConfiguration, return_type[void], modifier[protected], parameter[]] begin[{]
call[.getTomcat, parameter[]]
call[.getTomcat, parameter[]]
call[.getContext, parameter[]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[initConfiguration] operator[SEP] operator[SEP] {
identifier[getTomcat] operator[SEP] operator[SEP] operator[SEP] identifier[setBaseDir] operator[SEP] identifier[baseDir] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getTomcat] operator[SEP] operator[SEP] operator[SEP] identifier[setPort] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[addParameter] operator[SEP] identifier[PRODUCTION_MODE_PARAM] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[isProductionMode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static MozuUrl validateTargetRuleUrl()
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/targetrules/validate");
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
}
|
class class_name[name] begin[{]
method[validateTargetRuleUrl, return_type[type[MozuUrl]], modifier[public static], parameter[]] begin[{]
local_variable[type[UrlFormatter], formatter]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getResourceUrl, postfix_operators=[], prefix_operators=[], qualifier=formatter, selectors=[], type_arguments=None), MemberReference(member=TENANT_POD, postfix_operators=[], prefix_operators=[], qualifier=MozuUrl.UrlLocation, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MozuUrl, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[MozuUrl] identifier[validateTargetRuleUrl] operator[SEP] operator[SEP] {
identifier[UrlFormatter] identifier[formatter] operator[=] Keyword[new] identifier[UrlFormatter] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[MozuUrl] operator[SEP] identifier[formatter] operator[SEP] identifier[getResourceUrl] operator[SEP] operator[SEP] , identifier[MozuUrl] operator[SEP] identifier[UrlLocation] operator[SEP] identifier[TENANT_POD] operator[SEP] operator[SEP]
}
|
private InstalledIFixInformation findInstalledIFixes(File wlpInstallationDirectory, CommandConsole console, boolean verbose) {
InstalledIFixInformation installedIFixInformation = new InstalledIFixInformation();
Set<IFixInfo> iFixInfos = IFixUtils.getInstalledIFixes(wlpInstallationDirectory, console);
// We only want iFixes that are applicable to the current version of the install. First we need to know what the current version is so get this now.
Version productVersion = null;
try {
productVersion = getProductVersion(wlpInstallationDirectory);
} catch (VersionParsingException e) {
/*
* We won't be able to do any version checking without a version. Not the end of the world but should give a message to the user warning them some iFixes that we have
* checked are not relevant
*/
console.printlnErrorMessage(getMessage("compare.version.parsing.error", e.getMessage()));
}
// Go through the iFixes checking they are valid and adding them to the appropriate map
for (IFixInfo iFixInfo : iFixInfos) {
try {
if (!isIFixFileListValid(iFixInfo, wlpInstallationDirectory)) {
installedIFixInformation.iFixesWithMissingFiles.add(iFixInfo.getId());
continue;
}
} catch (ParseException e) {
/*
* If there was an error getting the parsing the dates from this file then print out an error message then continue as we have to assume that this iFix is valid if
* we can't tell otherwise
*/
installedIFixInformation.iFixesWithInvalidXml.add(iFixInfo.getId());
if (verbose) {
console.printlnErrorMessage(getMessage("compare.ifix.file.parse.error", iFixInfo.getId()));
}
}
try {
if (!isIFixApplicable(productVersion, iFixInfo)) {
installedIFixInformation.inapplicableIFixes.add(iFixInfo.getId());
continue;
}
} catch (VersionParsingException e) {
/*
* If there was an error getting the version from this file then print out an error message then continue as we have to assume that this iFix is valid if we can't
* tell otherwise
*/
installedIFixInformation.iFixesWithInvalidXml.add(iFixInfo.getId());
if (verbose) {
console.printlnErrorMessage(e.getMessage());
}
}
Resolves resolves = iFixInfo.getResolves();
if (resolves == null) {
installedIFixInformation.iFixesWithInvalidXml.add(iFixInfo.getId());
if (verbose) {
console.printlnErrorMessage(getMessage("compare.no.apar", iFixInfo.getId()));
}
continue;
}
List<Problem> problems = resolves.getProblems();
if (problems == null) {
installedIFixInformation.iFixesWithInvalidXml.add(iFixInfo.getId());
if (verbose) {
console.printlnErrorMessage(getMessage("compare.no.apar", iFixInfo.getId()));
}
continue;
}
for (Problem problem : problems) {
String problemId = problem.getDisplayId();
if (problemId != null && !problemId.isEmpty()) {
Set<String> iFixesForThisApar = installedIFixInformation.validIFixes.get(problemId);
if (iFixesForThisApar == null) {
iFixesForThisApar = new HashSet<String>();
installedIFixInformation.validIFixes.put(problemId, iFixesForThisApar);
}
iFixesForThisApar.add(iFixInfo.getId());
}
}
}
return installedIFixInformation;
}
|
class class_name[name] begin[{]
method[findInstalledIFixes, return_type[type[InstalledIFixInformation]], modifier[private], parameter[wlpInstallationDirectory, console, verbose]] begin[{]
local_variable[type[InstalledIFixInformation], installedIFixInformation]
local_variable[type[Set], iFixInfos]
local_variable[type[Version], productVersion]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=productVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=wlpInstallationDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProductVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="compare.version.parsing.error"), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=printlnErrorMessage, postfix_operators=[], prefix_operators=[], qualifier=console, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['VersionParsingException']))], finally_block=None, label=None, resources=None)
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=iFixInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=wlpInstallationDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isIFixFileListValid, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=installedIFixInformation.iFixesWithMissingFiles, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=installedIFixInformation.iFixesWithInvalidXml, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=verbose, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="compare.ifix.file.parse.error"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=printlnErrorMessage, postfix_operators=[], prefix_operators=[], qualifier=console, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ParseException']))], finally_block=None, label=None, resources=None), TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=productVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iFixInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isIFixApplicable, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=installedIFixInformation.inapplicableIFixes, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=installedIFixInformation.iFixesWithInvalidXml, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=verbose, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=printlnErrorMessage, postfix_operators=[], prefix_operators=[], qualifier=console, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['VersionParsingException']))], finally_block=None, label=None, resources=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResolves, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None), name=resolves)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Resolves, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=resolves, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=installedIFixInformation.iFixesWithInvalidXml, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=verbose, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="compare.no.apar"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=printlnErrorMessage, postfix_operators=[], prefix_operators=[], qualifier=console, selectors=[], type_arguments=None), label=None)])), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getProblems, postfix_operators=[], prefix_operators=[], qualifier=resolves, selectors=[], type_arguments=None), name=problems)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Problem, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=problems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=installedIFixInformation.iFixesWithInvalidXml, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=verbose, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="compare.no.apar"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=printlnErrorMessage, postfix_operators=[], prefix_operators=[], qualifier=console, selectors=[], type_arguments=None), label=None)])), ContinueStatement(goto=None, label=None)])), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDisplayId, postfix_operators=[], prefix_operators=[], qualifier=problem, selectors=[], type_arguments=None), name=problemId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=problemId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=problemId, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=problemId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=installedIFixInformation.validIFixes, selectors=[], type_arguments=None), name=iFixesForThisApar)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=iFixesForThisApar, 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=iFixesForThisApar, 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=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashSet, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=problemId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iFixesForThisApar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=installedIFixInformation.validIFixes, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=iFixInfo, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=iFixesForThisApar, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=problems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=problem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Problem, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=iFixInfos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=iFixInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IFixInfo, sub_type=None))), label=None)
return[member[.installedIFixInformation]]
end[}]
END[}]
|
Keyword[private] identifier[InstalledIFixInformation] identifier[findInstalledIFixes] operator[SEP] identifier[File] identifier[wlpInstallationDirectory] , identifier[CommandConsole] identifier[console] , Keyword[boolean] identifier[verbose] operator[SEP] {
identifier[InstalledIFixInformation] identifier[installedIFixInformation] operator[=] Keyword[new] identifier[InstalledIFixInformation] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[IFixInfo] operator[>] identifier[iFixInfos] operator[=] identifier[IFixUtils] operator[SEP] identifier[getInstalledIFixes] operator[SEP] identifier[wlpInstallationDirectory] , identifier[console] operator[SEP] operator[SEP] identifier[Version] identifier[productVersion] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[productVersion] operator[=] identifier[getProductVersion] operator[SEP] identifier[wlpInstallationDirectory] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[VersionParsingException] identifier[e] operator[SEP] {
identifier[console] operator[SEP] identifier[printlnErrorMessage] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[IFixInfo] identifier[iFixInfo] operator[:] identifier[iFixInfos] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[isIFixFileListValid] operator[SEP] identifier[iFixInfo] , identifier[wlpInstallationDirectory] operator[SEP] operator[SEP] {
identifier[installedIFixInformation] operator[SEP] identifier[iFixesWithMissingFiles] operator[SEP] identifier[add] operator[SEP] identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[ParseException] identifier[e] operator[SEP] {
identifier[installedIFixInformation] operator[SEP] identifier[iFixesWithInvalidXml] operator[SEP] identifier[add] operator[SEP] identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[verbose] operator[SEP] {
identifier[console] operator[SEP] identifier[printlnErrorMessage] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[isIFixApplicable] operator[SEP] identifier[productVersion] , identifier[iFixInfo] operator[SEP] operator[SEP] {
identifier[installedIFixInformation] operator[SEP] identifier[inapplicableIFixes] operator[SEP] identifier[add] operator[SEP] identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[VersionParsingException] identifier[e] operator[SEP] {
identifier[installedIFixInformation] operator[SEP] identifier[iFixesWithInvalidXml] operator[SEP] identifier[add] operator[SEP] identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[verbose] operator[SEP] {
identifier[console] operator[SEP] identifier[printlnErrorMessage] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[Resolves] identifier[resolves] operator[=] identifier[iFixInfo] operator[SEP] identifier[getResolves] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resolves] operator[==] Other[null] operator[SEP] {
identifier[installedIFixInformation] operator[SEP] identifier[iFixesWithInvalidXml] operator[SEP] identifier[add] operator[SEP] identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[verbose] operator[SEP] {
identifier[console] operator[SEP] identifier[printlnErrorMessage] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[continue] operator[SEP]
}
identifier[List] operator[<] identifier[Problem] operator[>] identifier[problems] operator[=] identifier[resolves] operator[SEP] identifier[getProblems] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[problems] operator[==] Other[null] operator[SEP] {
identifier[installedIFixInformation] operator[SEP] identifier[iFixesWithInvalidXml] operator[SEP] identifier[add] operator[SEP] identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[verbose] operator[SEP] {
identifier[console] operator[SEP] identifier[printlnErrorMessage] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[continue] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Problem] identifier[problem] operator[:] identifier[problems] operator[SEP] {
identifier[String] identifier[problemId] operator[=] identifier[problem] operator[SEP] identifier[getDisplayId] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[problemId] operator[!=] Other[null] operator[&&] operator[!] identifier[problemId] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[iFixesForThisApar] operator[=] identifier[installedIFixInformation] operator[SEP] identifier[validIFixes] operator[SEP] identifier[get] operator[SEP] identifier[problemId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iFixesForThisApar] operator[==] Other[null] operator[SEP] {
identifier[iFixesForThisApar] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[installedIFixInformation] operator[SEP] identifier[validIFixes] operator[SEP] identifier[put] operator[SEP] identifier[problemId] , identifier[iFixesForThisApar] operator[SEP] operator[SEP]
}
identifier[iFixesForThisApar] operator[SEP] identifier[add] operator[SEP] identifier[iFixInfo] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[installedIFixInformation] operator[SEP]
}
|
@Override
public List<CommerceOrder> findByShippingAddressId(long shippingAddressId,
int start, int end) {
return findByShippingAddressId(shippingAddressId, start, end, null);
}
|
class class_name[name] begin[{]
method[findByShippingAddressId, return_type[type[List]], modifier[public], parameter[shippingAddressId, start, end]] begin[{]
return[call[.findByShippingAddressId, parameter[member[.shippingAddressId], member[.start], member[.end], literal[null]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[CommerceOrder] operator[>] identifier[findByShippingAddressId] operator[SEP] Keyword[long] identifier[shippingAddressId] , Keyword[int] identifier[start] , Keyword[int] identifier[end] operator[SEP] {
Keyword[return] identifier[findByShippingAddressId] operator[SEP] identifier[shippingAddressId] , identifier[start] , identifier[end] , Other[null] operator[SEP] operator[SEP]
}
|
public static HttpURLConnection getFileRanges(final URI uri, final FileRequestOptions fileOptions,
final OperationContext opContext, final AccessCondition accessCondition, final String snapshotVersion) throws StorageException,
IOException, URISyntaxException {
final UriQueryBuilder builder = new UriQueryBuilder();
addShareSnapshot(builder, snapshotVersion);
builder.add(Constants.QueryConstants.COMPONENT, RANGE_LIST_QUERY_ELEMENT_NAME);
final HttpURLConnection request = BaseRequest.createURLConnection(uri, fileOptions, builder, opContext);
request.setRequestMethod(Constants.HTTP_GET);
if (accessCondition != null) {
accessCondition.applyConditionToRequest(request);
}
return request;
}
|
class class_name[name] begin[{]
method[getFileRanges, return_type[type[HttpURLConnection]], modifier[public static], parameter[uri, fileOptions, opContext, accessCondition, snapshotVersion]] begin[{]
local_variable[type[UriQueryBuilder], builder]
call[.addShareSnapshot, parameter[member[.builder], member[.snapshotVersion]]]
call[builder.add, parameter[member[Constants.QueryConstants.COMPONENT], member[.RANGE_LIST_QUERY_ELEMENT_NAME]]]
local_variable[type[HttpURLConnection], request]
call[request.setRequestMethod, parameter[member[Constants.HTTP_GET]]]
if[binary_operation[member[.accessCondition], !=, literal[null]]] begin[{]
call[accessCondition.applyConditionToRequest, parameter[member[.request]]]
else begin[{]
None
end[}]
return[member[.request]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[HttpURLConnection] identifier[getFileRanges] operator[SEP] Keyword[final] identifier[URI] identifier[uri] , Keyword[final] identifier[FileRequestOptions] identifier[fileOptions] , Keyword[final] identifier[OperationContext] identifier[opContext] , Keyword[final] identifier[AccessCondition] identifier[accessCondition] , Keyword[final] identifier[String] identifier[snapshotVersion] operator[SEP] Keyword[throws] identifier[StorageException] , identifier[IOException] , identifier[URISyntaxException] {
Keyword[final] identifier[UriQueryBuilder] identifier[builder] operator[=] Keyword[new] identifier[UriQueryBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[addShareSnapshot] operator[SEP] identifier[builder] , identifier[snapshotVersion] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[add] operator[SEP] identifier[Constants] operator[SEP] identifier[QueryConstants] operator[SEP] identifier[COMPONENT] , identifier[RANGE_LIST_QUERY_ELEMENT_NAME] operator[SEP] operator[SEP] Keyword[final] identifier[HttpURLConnection] identifier[request] operator[=] identifier[BaseRequest] operator[SEP] identifier[createURLConnection] operator[SEP] identifier[uri] , identifier[fileOptions] , identifier[builder] , identifier[opContext] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setRequestMethod] operator[SEP] identifier[Constants] operator[SEP] identifier[HTTP_GET] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[accessCondition] operator[!=] Other[null] operator[SEP] {
identifier[accessCondition] operator[SEP] identifier[applyConditionToRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
Keyword[return] identifier[request] operator[SEP]
}
|
static Date toDate(double d) {
GregorianCalendar ret = new GregorianCalendar(1899,11,30);
int days = (int)d;
d -= days;
ret.add(Calendar.DATE,days);
d *= 24;
int hours = (int)d;
ret.add(Calendar.HOUR,hours);
d -= hours;
d *= 60;
// d += 0.5; // round
int min = (int)d;
ret.add(Calendar.MINUTE,min);
d -= min;
d *= 60;
int secs = (int) d;
ret.add(Calendar.SECOND, secs);
return ret.getTime();
}
|
class class_name[name] begin[{]
method[toDate, return_type[type[Date]], modifier[static], parameter[d]] begin[{]
local_variable[type[GregorianCalendar], ret]
local_variable[type[int], days]
assign[member[.d], member[.days]]
call[ret.add, parameter[member[Calendar.DATE], member[.days]]]
assign[member[.d], literal[24]]
local_variable[type[int], hours]
call[ret.add, parameter[member[Calendar.HOUR], member[.hours]]]
assign[member[.d], member[.hours]]
assign[member[.d], literal[60]]
local_variable[type[int], min]
call[ret.add, parameter[member[Calendar.MINUTE], member[.min]]]
assign[member[.d], member[.min]]
assign[member[.d], literal[60]]
local_variable[type[int], secs]
call[ret.add, parameter[member[Calendar.SECOND], member[.secs]]]
return[call[ret.getTime, parameter[]]]
end[}]
END[}]
|
Keyword[static] identifier[Date] identifier[toDate] operator[SEP] Keyword[double] identifier[d] operator[SEP] {
identifier[GregorianCalendar] identifier[ret] operator[=] Keyword[new] identifier[GregorianCalendar] operator[SEP] Other[1899] , Other[11] , Other[30] operator[SEP] operator[SEP] Keyword[int] identifier[days] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[d] operator[SEP] identifier[d] operator[-=] identifier[days] operator[SEP] identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[DATE] , identifier[days] operator[SEP] operator[SEP] identifier[d] operator[*=] Other[24] operator[SEP] Keyword[int] identifier[hours] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[d] operator[SEP] identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR] , identifier[hours] operator[SEP] operator[SEP] identifier[d] operator[-=] identifier[hours] operator[SEP] identifier[d] operator[*=] Other[60] operator[SEP] Keyword[int] identifier[min] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[d] operator[SEP] identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , identifier[min] operator[SEP] operator[SEP] identifier[d] operator[-=] identifier[min] operator[SEP] identifier[d] operator[*=] Other[60] operator[SEP] Keyword[int] identifier[secs] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[d] operator[SEP] identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , identifier[secs] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP]
}
|
public CacheKey create(final HttpServletRequest request) {
notNull(request);
CacheKey key = null;
final String groupName = groupExtractor.getGroupName(request);
final ResourceType resourceType = groupExtractor.getResourceType(request);
final boolean minimize = isMinimized(request);
if (groupName != null && resourceType != null) {
key = new CacheKey(groupName, resourceType, minimize);
}
return key;
}
|
class class_name[name] begin[{]
method[create, return_type[type[CacheKey]], modifier[public], parameter[request]] begin[{]
call[.notNull, parameter[member[.request]]]
local_variable[type[CacheKey], key]
local_variable[type[String], groupName]
local_variable[type[ResourceType], resourceType]
local_variable[type[boolean], minimize]
if[binary_operation[binary_operation[member[.groupName], !=, literal[null]], &&, binary_operation[member[.resourceType], !=, literal[null]]]] begin[{]
assign[member[.key], ClassCreator(arguments=[MemberReference(member=groupName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resourceType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=minimize, 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=CacheKey, sub_type=None))]
else begin[{]
None
end[}]
return[member[.key]]
end[}]
END[}]
|
Keyword[public] identifier[CacheKey] identifier[create] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[request] operator[SEP] {
identifier[notNull] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[CacheKey] identifier[key] operator[=] Other[null] operator[SEP] Keyword[final] identifier[String] identifier[groupName] operator[=] identifier[groupExtractor] operator[SEP] identifier[getGroupName] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[final] identifier[ResourceType] identifier[resourceType] operator[=] identifier[groupExtractor] operator[SEP] identifier[getResourceType] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[minimize] operator[=] identifier[isMinimized] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[groupName] operator[!=] Other[null] operator[&&] identifier[resourceType] operator[!=] Other[null] operator[SEP] {
identifier[key] operator[=] Keyword[new] identifier[CacheKey] operator[SEP] identifier[groupName] , identifier[resourceType] , identifier[minimize] operator[SEP] operator[SEP]
}
Keyword[return] identifier[key] operator[SEP]
}
|
public Vector getVector(String term) {
SparseDoubleVector v = termToVector.get(term);
return (v == null) ? null : Vectors.immutable(
Vectors.subview(v, 0, basisMapping.numDimensions()));
}
|
class class_name[name] begin[{]
method[getVector, return_type[type[Vector]], modifier[public], parameter[term]] begin[{]
local_variable[type[SparseDoubleVector], v]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MethodInvocation(arguments=[], member=numDimensions, postfix_operators=[], prefix_operators=[], qualifier=basisMapping, selectors=[], type_arguments=None)], member=subview, postfix_operators=[], prefix_operators=[], qualifier=Vectors, selectors=[], type_arguments=None)], member=immutable, postfix_operators=[], prefix_operators=[], qualifier=Vectors, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}]
|
Keyword[public] identifier[Vector] identifier[getVector] operator[SEP] identifier[String] identifier[term] operator[SEP] {
identifier[SparseDoubleVector] identifier[v] operator[=] identifier[termToVector] operator[SEP] identifier[get] operator[SEP] identifier[term] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[v] operator[==] Other[null] operator[SEP] operator[?] Other[null] operator[:] identifier[Vectors] operator[SEP] identifier[immutable] operator[SEP] identifier[Vectors] operator[SEP] identifier[subview] operator[SEP] identifier[v] , Other[0] , identifier[basisMapping] operator[SEP] identifier[numDimensions] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setFormatByArgumentIndex(int argumentIndex, Format newFormat) {
if (msgPattern.hasNamedArguments()) {
throw new IllegalArgumentException(
"This method is not available in MessageFormat objects " +
"that use alphanumeric argument names.");
}
for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) {
if (msgPattern.getPart(partIndex + 1).getValue() == argumentIndex) {
setCustomArgStartFormat(partIndex, newFormat);
}
}
}
|
class class_name[name] begin[{]
method[setFormatByArgumentIndex, return_type[void], modifier[public], parameter[argumentIndex, newFormat]] begin[{]
if[call[msgPattern.hasNamedArguments, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This method is not available in MessageFormat objects "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="that use alphanumeric argument names."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=partIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=getPart, postfix_operators=[], prefix_operators=[], qualifier=msgPattern, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=argumentIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=partIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setCustomArgStartFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=partIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=partIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nextTopLevelArgStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), 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=0), name=partIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=None), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setFormatByArgumentIndex] operator[SEP] Keyword[int] identifier[argumentIndex] , identifier[Format] identifier[newFormat] operator[SEP] {
Keyword[if] operator[SEP] identifier[msgPattern] operator[SEP] identifier[hasNamedArguments] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[partIndex] operator[=] Other[0] operator[SEP] operator[SEP] identifier[partIndex] operator[=] identifier[nextTopLevelArgStart] operator[SEP] identifier[partIndex] operator[SEP] operator[SEP] operator[>=] Other[0] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[msgPattern] operator[SEP] identifier[getPart] operator[SEP] identifier[partIndex] operator[+] Other[1] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[==] identifier[argumentIndex] operator[SEP] {
identifier[setCustomArgStartFormat] operator[SEP] identifier[partIndex] , identifier[newFormat] operator[SEP] operator[SEP]
}
}
}
|
public static void permuteRowInv(int permInv[], DMatrixSparseCSC input, DMatrixSparseCSC output) {
if( input.numRows > permInv.length )
throw new IllegalArgumentException("permutation vector must have at least as many elements as input has rows");
output.reshape(input.numRows,input.numCols,input.nz_length);
output.nz_length = input.nz_length;
output.indicesSorted = false;
System.arraycopy(input.nz_values,0,output.nz_values,0,input.nz_length);
System.arraycopy(input.col_idx,0,output.col_idx,0,input.numCols+1);
int idx0 = 0;
for (int i = 0; i < input.numCols; i++) {
int idx1 = output.col_idx[i+1];
for (int j = idx0; j < idx1; j++) {
output.nz_rows[j] = permInv[input.nz_rows[j]];
}
idx0 = idx1;
}
}
|
class class_name[name] begin[{]
method[permuteRowInv, return_type[void], modifier[public static], parameter[permInv, input, output]] begin[{]
if[binary_operation[member[input.numRows], >, member[permInv.length]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="permutation vector must have at least as many elements as input has rows")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[output.reshape, parameter[member[input.numRows], member[input.numCols], member[input.nz_length]]]
assign[member[output.nz_length], member[input.nz_length]]
assign[member[output.indicesSorted], literal[false]]
call[System.arraycopy, parameter[member[input.nz_values], literal[0], member[output.nz_values], literal[0], member[input.nz_length]]]
call[System.arraycopy, parameter[member[input.col_idx], literal[0], member[output.col_idx], literal[0], binary_operation[member[input.numCols], +, literal[1]]]]
local_variable[type[int], idx0]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=col_idx, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), name=idx1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=nz_rows, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=permInv, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=nz_rows, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=idx1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=idx0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=idx0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=idx1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numCols, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[permuteRowInv] operator[SEP] Keyword[int] identifier[permInv] operator[SEP] operator[SEP] , identifier[DMatrixSparseCSC] identifier[input] , identifier[DMatrixSparseCSC] identifier[output] operator[SEP] {
Keyword[if] operator[SEP] identifier[input] operator[SEP] identifier[numRows] operator[>] identifier[permInv] operator[SEP] identifier[length] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[output] operator[SEP] identifier[reshape] operator[SEP] identifier[input] operator[SEP] identifier[numRows] , identifier[input] operator[SEP] identifier[numCols] , identifier[input] operator[SEP] identifier[nz_length] operator[SEP] operator[SEP] identifier[output] operator[SEP] identifier[nz_length] operator[=] identifier[input] operator[SEP] identifier[nz_length] operator[SEP] identifier[output] operator[SEP] identifier[indicesSorted] operator[=] literal[boolean] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[input] operator[SEP] identifier[nz_values] , Other[0] , identifier[output] operator[SEP] identifier[nz_values] , Other[0] , identifier[input] operator[SEP] identifier[nz_length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[input] operator[SEP] identifier[col_idx] , Other[0] , identifier[output] operator[SEP] identifier[col_idx] , Other[0] , identifier[input] operator[SEP] identifier[numCols] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[idx0] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[input] operator[SEP] identifier[numCols] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[idx1] operator[=] identifier[output] operator[SEP] identifier[col_idx] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[idx0] operator[SEP] identifier[j] operator[<] identifier[idx1] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[output] operator[SEP] identifier[nz_rows] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[permInv] operator[SEP] identifier[input] operator[SEP] identifier[nz_rows] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP]
}
identifier[idx0] operator[=] identifier[idx1] operator[SEP]
}
}
|
public static Number math(int op, Number left, Number right) {
int type = getCompatibleType(left, right);
if (type == TYPE_DOUBLE) {
return math(op, left.doubleValue(), right.doubleValue());
}
else if (type == TYPE_FLOAT) {
return math(op, left.floatValue(), right.floatValue());
}
else if (type == TYPE_LONG) {
return math(op, left.longValue(), right.longValue());
}
else if (type == TYPE_INT) {
return math(op, left.intValue(), right.intValue());
}
else {
throw new IllegalStateException("unsupported number type: " + type);
}
}
|
class class_name[name] begin[{]
method[math, return_type[type[Number]], modifier[public static], parameter[op, left, right]] begin[{]
local_variable[type[int], type]
if[binary_operation[member[.type], ==, member[.TYPE_DOUBLE]]] begin[{]
return[call[.math, parameter[member[.op], call[left.doubleValue, parameter[]], call[right.doubleValue, parameter[]]]]]
else begin[{]
if[binary_operation[member[.type], ==, member[.TYPE_FLOAT]]] begin[{]
return[call[.math, parameter[member[.op], call[left.floatValue, parameter[]], call[right.floatValue, parameter[]]]]]
else begin[{]
if[binary_operation[member[.type], ==, member[.TYPE_LONG]]] begin[{]
return[call[.math, parameter[member[.op], call[left.longValue, parameter[]], call[right.longValue, parameter[]]]]]
else begin[{]
if[binary_operation[member[.type], ==, member[.TYPE_INT]]] begin[{]
return[call[.math, parameter[member[.op], call[left.intValue, parameter[]], call[right.intValue, parameter[]]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unsupported number type: "), operandr=MemberReference(member=type, 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=IllegalStateException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Number] identifier[math] operator[SEP] Keyword[int] identifier[op] , identifier[Number] identifier[left] , identifier[Number] identifier[right] operator[SEP] {
Keyword[int] identifier[type] operator[=] identifier[getCompatibleType] operator[SEP] identifier[left] , identifier[right] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[TYPE_DOUBLE] operator[SEP] {
Keyword[return] identifier[math] operator[SEP] identifier[op] , identifier[left] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] , identifier[right] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[TYPE_FLOAT] operator[SEP] {
Keyword[return] identifier[math] operator[SEP] identifier[op] , identifier[left] operator[SEP] identifier[floatValue] operator[SEP] operator[SEP] , identifier[right] operator[SEP] identifier[floatValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[TYPE_LONG] operator[SEP] {
Keyword[return] identifier[math] operator[SEP] identifier[op] , identifier[left] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] , identifier[right] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[TYPE_INT] operator[SEP] {
Keyword[return] identifier[math] operator[SEP] identifier[op] , identifier[left] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] , identifier[right] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[type] operator[SEP] operator[SEP]
}
}
|
public void setAllowedPrincipals(java.util.Collection<AllowedPrincipal> allowedPrincipals) {
if (allowedPrincipals == null) {
this.allowedPrincipals = null;
return;
}
this.allowedPrincipals = new com.amazonaws.internal.SdkInternalList<AllowedPrincipal>(allowedPrincipals);
}
|
class class_name[name] begin[{]
method[setAllowedPrincipals, return_type[void], modifier[public], parameter[allowedPrincipals]] begin[{]
if[binary_operation[member[.allowedPrincipals], ==, literal[null]]] begin[{]
assign[THIS[member[None.allowedPrincipals]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.allowedPrincipals]], ClassCreator(arguments=[MemberReference(member=allowedPrincipals, 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=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AllowedPrincipal, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setAllowedPrincipals] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[AllowedPrincipal] operator[>] identifier[allowedPrincipals] operator[SEP] {
Keyword[if] operator[SEP] identifier[allowedPrincipals] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[allowedPrincipals] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[allowedPrincipals] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[AllowedPrincipal] operator[>] operator[SEP] identifier[allowedPrincipals] operator[SEP] operator[SEP]
}
|
public double[] unhomogeneVector(double[] v) {
assert (v.length == dim + 1);
// TODO: this only works properly when trans[dim][dim] == 1.0, right?
double[] dv = new double[dim];
double scale = v[dim];
assert (Math.abs(scale) > 0.0);
for(int i = 0; i < dim; i++) {
dv[i] = v[i] / scale;
}
return dv;
}
|
class class_name[name] begin[{]
method[unhomogeneVector, return_type[type[double]], modifier[public], parameter[v]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=dim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operator===), label=None, value=None)
local_variable[type[double], dv]
local_variable[type[double], scale]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=scale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0), operator=>), label=None, value=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=dv, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=scale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.dv]]
end[}]
END[}]
|
Keyword[public] Keyword[double] operator[SEP] operator[SEP] identifier[unhomogeneVector] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[v] operator[SEP] {
Keyword[assert] operator[SEP] identifier[v] operator[SEP] identifier[length] operator[==] identifier[dim] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[dv] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[dim] operator[SEP] operator[SEP] Keyword[double] identifier[scale] operator[=] identifier[v] operator[SEP] identifier[dim] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[scale] operator[SEP] operator[>] literal[Float] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[dim] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[dv] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[v] operator[SEP] identifier[i] operator[SEP] operator[/] identifier[scale] operator[SEP]
}
Keyword[return] identifier[dv] operator[SEP]
}
|
protected void setupMethod(ActionMapping actionMapping) {
final Class<?> actionType = actionMapping.getActionDef().getComponentClass();
for (Method declaredMethod : actionType.getDeclaredMethods()) {
if (!isExecuteMethod(declaredMethod)) {
continue;
}
final ActionExecute existing = actionMapping.getActionExecute(declaredMethod);
if (existing != null) {
throwOverloadMethodCannotDefinedException(actionType);
}
actionMapping.registerExecute(createActionExecute(actionMapping, declaredMethod));
}
verifyExecuteMethodSize(actionMapping, actionType);
verifyExecuteMethodNotShadowingOthers(actionMapping, actionType);
verifyExecuteMethodDefinedInConcreteClassOnly(actionMapping, actionType);
verifyExecuteMethodRestfulIndependent(actionMapping, actionType);
}
|
class class_name[name] begin[{]
method[setupMethod, return_type[void], modifier[protected], parameter[actionMapping]] begin[{]
local_variable[type[Class], actionType]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=declaredMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isExecuteMethod, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=declaredMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getActionExecute, postfix_operators=[], prefix_operators=[], qualifier=actionMapping, selectors=[], type_arguments=None), name=existing)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ActionExecute, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=existing, 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=actionType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=throwOverloadMethodCannotDefinedException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=actionMapping, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=declaredMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createActionExecute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=registerExecute, postfix_operators=[], prefix_operators=[], qualifier=actionMapping, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDeclaredMethods, postfix_operators=[], prefix_operators=[], qualifier=actionType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=declaredMethod)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
call[.verifyExecuteMethodSize, parameter[member[.actionMapping], member[.actionType]]]
call[.verifyExecuteMethodNotShadowingOthers, parameter[member[.actionMapping], member[.actionType]]]
call[.verifyExecuteMethodDefinedInConcreteClassOnly, parameter[member[.actionMapping], member[.actionType]]]
call[.verifyExecuteMethodRestfulIndependent, parameter[member[.actionMapping], member[.actionType]]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[setupMethod] operator[SEP] identifier[ActionMapping] identifier[actionMapping] operator[SEP] {
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[actionType] operator[=] identifier[actionMapping] operator[SEP] identifier[getActionDef] operator[SEP] operator[SEP] operator[SEP] identifier[getComponentClass] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Method] identifier[declaredMethod] operator[:] identifier[actionType] operator[SEP] identifier[getDeclaredMethods] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isExecuteMethod] operator[SEP] identifier[declaredMethod] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[final] identifier[ActionExecute] identifier[existing] operator[=] identifier[actionMapping] operator[SEP] identifier[getActionExecute] operator[SEP] identifier[declaredMethod] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[existing] operator[!=] Other[null] operator[SEP] {
identifier[throwOverloadMethodCannotDefinedException] operator[SEP] identifier[actionType] operator[SEP] operator[SEP]
}
identifier[actionMapping] operator[SEP] identifier[registerExecute] operator[SEP] identifier[createActionExecute] operator[SEP] identifier[actionMapping] , identifier[declaredMethod] operator[SEP] operator[SEP] operator[SEP]
}
identifier[verifyExecuteMethodSize] operator[SEP] identifier[actionMapping] , identifier[actionType] operator[SEP] operator[SEP] identifier[verifyExecuteMethodNotShadowingOthers] operator[SEP] identifier[actionMapping] , identifier[actionType] operator[SEP] operator[SEP] identifier[verifyExecuteMethodDefinedInConcreteClassOnly] operator[SEP] identifier[actionMapping] , identifier[actionType] operator[SEP] operator[SEP] identifier[verifyExecuteMethodRestfulIndependent] operator[SEP] identifier[actionMapping] , identifier[actionType] operator[SEP] operator[SEP]
}
|
public static CloudResourceBundleControl getInstance(ServiceAccount serviceAccount,
long cacheExpiration, String inclusionPattern, String exclusionPattern) {
return getInstance(serviceAccount, cacheExpiration, null, null, null);
}
|
class class_name[name] begin[{]
method[getInstance, return_type[type[CloudResourceBundleControl]], modifier[public static], parameter[serviceAccount, cacheExpiration, inclusionPattern, exclusionPattern]] begin[{]
return[call[.getInstance, parameter[member[.serviceAccount], member[.cacheExpiration], literal[null], literal[null], literal[null]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CloudResourceBundleControl] identifier[getInstance] operator[SEP] identifier[ServiceAccount] identifier[serviceAccount] , Keyword[long] identifier[cacheExpiration] , identifier[String] identifier[inclusionPattern] , identifier[String] identifier[exclusionPattern] operator[SEP] {
Keyword[return] identifier[getInstance] operator[SEP] identifier[serviceAccount] , identifier[cacheExpiration] , Other[null] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
@Nonnull
public static ESuccess flush (@Nullable final Flushable aFlushable)
{
if (aFlushable != null)
try
{
aFlushable.flush ();
return ESuccess.SUCCESS;
}
catch (final NullPointerException ex)
{
// Happens if a java.io.FilterOutputStream is already closed!
}
catch (final IOException ex)
{
if (!isKnownEOFException (ex))
LOGGER.error ("Failed to flush object " + aFlushable.getClass ().getName (),
ex instanceof IMockException ? null : ex);
}
return ESuccess.FAILURE;
}
|
class class_name[name] begin[{]
method[flush, return_type[type[ESuccess]], modifier[public static], parameter[aFlushable]] begin[{]
if[binary_operation[member[.aFlushable], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=aFlushable, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=SUCCESS, postfix_operators=[], prefix_operators=[], qualifier=ESuccess, selectors=[]), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['NullPointerException'])), CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isKnownEOFException, postfix_operators=[], prefix_operators=['!'], qualifier=, 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="Failed to flush object "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=aFlushable, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=IMockException, sub_type=None), operator=instanceof), if_false=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[ESuccess.FAILURE]]
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[ESuccess] identifier[flush] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[Flushable] identifier[aFlushable] operator[SEP] {
Keyword[if] operator[SEP] identifier[aFlushable] operator[!=] Other[null] operator[SEP] Keyword[try] {
identifier[aFlushable] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ESuccess] operator[SEP] identifier[SUCCESS] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[NullPointerException] identifier[ex] operator[SEP] {
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isKnownEOFException] operator[SEP] identifier[ex] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[aFlushable] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[ex] Keyword[instanceof] identifier[IMockException] operator[?] Other[null] operator[:] identifier[ex] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ESuccess] operator[SEP] identifier[FAILURE] operator[SEP]
}
|
private ParseTree parseAdditiveExpression() {
SourcePosition start = getTreeStartLocation();
ParseTree left = parseMultiplicativeExpression();
while (peekAdditiveOperator()) {
Token operator = nextToken();
ParseTree right = parseMultiplicativeExpression();
left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
}
return left;
}
|
class class_name[name] begin[{]
method[parseAdditiveExpression, return_type[type[ParseTree]], modifier[private], parameter[]] begin[{]
local_variable[type[SourcePosition], start]
local_variable[type[ParseTree], left]
while[call[.peekAdditiveOperator, parameter[]]] begin[{]
local_variable[type[Token], operator]
local_variable[type[ParseTree], right]
assign[member[.left], ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTreeLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=right, 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=BinaryOperatorTree, sub_type=None))]
end[}]
return[member[.left]]
end[}]
END[}]
|
Keyword[private] identifier[ParseTree] identifier[parseAdditiveExpression] operator[SEP] operator[SEP] {
identifier[SourcePosition] identifier[start] operator[=] identifier[getTreeStartLocation] operator[SEP] operator[SEP] operator[SEP] identifier[ParseTree] identifier[left] operator[=] identifier[parseMultiplicativeExpression] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[peekAdditiveOperator] operator[SEP] operator[SEP] operator[SEP] {
identifier[Token] identifier[operator] operator[=] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[ParseTree] identifier[right] operator[=] identifier[parseMultiplicativeExpression] operator[SEP] operator[SEP] operator[SEP] identifier[left] operator[=] Keyword[new] identifier[BinaryOperatorTree] operator[SEP] identifier[getTreeLocation] operator[SEP] identifier[start] operator[SEP] , identifier[left] , identifier[operator] , identifier[right] operator[SEP] operator[SEP]
}
Keyword[return] identifier[left] operator[SEP]
}
|
private JSType getJSType(Node n) {
JSType type = n.getJSType();
if (type == null) {
// TODO(bradfordcsmith): This branch indicates a compiler bug. It should throw an exception.
return compiler.getTypeRegistry().getNativeType(JSTypeNative.UNKNOWN_TYPE);
} else {
return type;
}
}
|
class class_name[name] begin[{]
method[getJSType, return_type[type[JSType]], modifier[private], parameter[n]] begin[{]
local_variable[type[JSType], type]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
return[call[compiler.getTypeRegistry, parameter[]]]
else begin[{]
return[member[.type]]
end[}]
end[}]
END[}]
|
Keyword[private] identifier[JSType] identifier[getJSType] operator[SEP] identifier[Node] identifier[n] operator[SEP] {
identifier[JSType] identifier[type] operator[=] identifier[n] operator[SEP] identifier[getJSType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[compiler] operator[SEP] identifier[getTypeRegistry] operator[SEP] operator[SEP] operator[SEP] identifier[getNativeType] operator[SEP] identifier[JSTypeNative] operator[SEP] identifier[UNKNOWN_TYPE] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[type] operator[SEP]
}
}
|
@Override
public EClass getIfcElementQuantity() {
if (ifcElementQuantityEClass == null) {
ifcElementQuantityEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(226);
}
return ifcElementQuantityEClass;
}
|
class class_name[name] begin[{]
method[getIfcElementQuantity, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcElementQuantityEClass], ==, literal[null]]] begin[{]
assign[member[.ifcElementQuantityEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=226)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcElementQuantityEClass]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcElementQuantity] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcElementQuantityEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcElementQuantityEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[226] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcElementQuantityEClass] operator[SEP]
}
|
public Set<InternalQName> getSubtypes(final InternalQName nodeTypeName)
{
Set<InternalQName> resultSet = new HashSet<InternalQName>();
for (InternalQName ntName : nodeTypes.keySet())
{
if (getSupertypes(ntName).contains(nodeTypeName))
{
resultSet.add(ntName);
}
}
return resultSet;
}
|
class class_name[name] begin[{]
method[getSubtypes, return_type[type[Set]], modifier[public], parameter[nodeTypeName]] begin[{]
local_variable[type[Set], resultSet]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ntName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSupertypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=nodeTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ntName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=resultSet, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=nodeTypes, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ntName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InternalQName, sub_type=None))), label=None)
return[member[.resultSet]]
end[}]
END[}]
|
Keyword[public] identifier[Set] operator[<] identifier[InternalQName] operator[>] identifier[getSubtypes] operator[SEP] Keyword[final] identifier[InternalQName] identifier[nodeTypeName] operator[SEP] {
identifier[Set] operator[<] identifier[InternalQName] operator[>] identifier[resultSet] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[InternalQName] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[InternalQName] identifier[ntName] operator[:] identifier[nodeTypes] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[getSupertypes] operator[SEP] identifier[ntName] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[nodeTypeName] operator[SEP] operator[SEP] {
identifier[resultSet] operator[SEP] identifier[add] operator[SEP] identifier[ntName] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[resultSet] operator[SEP]
}
|
@Override
public void doSubscribeNotificationsRequestEvent(ServerShSession session, SubscribeNotificationsRequest request)
throws InternalException, IllegalDiameterStateException, RouteException, OverloadException {
// TODO Auto-generated method stub
}
|
class class_name[name] begin[{]
method[doSubscribeNotificationsRequestEvent, return_type[void], modifier[public], parameter[session, request]] begin[{]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[doSubscribeNotificationsRequestEvent] operator[SEP] identifier[ServerShSession] identifier[session] , identifier[SubscribeNotificationsRequest] identifier[request] operator[SEP] Keyword[throws] identifier[InternalException] , identifier[IllegalDiameterStateException] , identifier[RouteException] , identifier[OverloadException] {
}
|
@Override
public EClass getIfcCommunicationsAppliance() {
if (ifcCommunicationsApplianceEClass == null) {
ifcCommunicationsApplianceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(107);
}
return ifcCommunicationsApplianceEClass;
}
|
class class_name[name] begin[{]
method[getIfcCommunicationsAppliance, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcCommunicationsApplianceEClass], ==, literal[null]]] begin[{]
assign[member[.ifcCommunicationsApplianceEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=107)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcCommunicationsApplianceEClass]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcCommunicationsAppliance] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcCommunicationsApplianceEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcCommunicationsApplianceEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[107] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcCommunicationsApplianceEClass] operator[SEP]
}
|
@Override
public final T process(
final Map<String, Object> pAddParam,
final T pEntity, final IRequestData pRequestData) throws Exception {
String fieldPathName = pRequestData.getParameter("fieldNameFilePath");
Method getterFieldPath = this.gettersRapiHolder
.getFor(pEntity.getClass(), fieldPathName);
String filePath = (String) getterFieldPath.invoke(pEntity);
if (filePath != null) {
File fileToDel = new File(filePath);
if (fileToDel.exists() && !fileToDel.delete()) {
throw new ExceptionWithCode(ExceptionWithCode.SOMETHING_WRONG,
"Can not delete file: " + fileToDel);
}
}
this.srvOrm.deleteEntity(pAddParam, pEntity);
String ownerFieldName = this.srvOrm.getTablesMap()
.get(pEntity.getClass().getSimpleName()).getOwnerFieldName();
Method getter = this.gettersRapiHolder
.getFor(pEntity.getClass(), ownerFieldName);
@SuppressWarnings("unchecked")
T owner = (T) getter.invoke(pEntity);
pAddParam.put("nameOwnerEntity", owner.getClass().getSimpleName());
pAddParam.put("nextEntity", owner);
return null;
}
|
class class_name[name] begin[{]
method[process, return_type[type[T]], modifier[final public], parameter[pAddParam, pEntity, pRequestData]] begin[{]
local_variable[type[String], fieldPathName]
local_variable[type[Method], getterFieldPath]
local_variable[type[String], filePath]
if[binary_operation[member[.filePath], !=, literal[null]]] begin[{]
local_variable[type[File], fileToDel]
if[binary_operation[call[fileToDel.exists, parameter[]], &&, call[fileToDel.delete, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=SOMETHING_WRONG, postfix_operators=[], prefix_operators=[], qualifier=ExceptionWithCode, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can not delete file: "), operandr=MemberReference(member=fileToDel, 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=ExceptionWithCode, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
THIS[member[None.srvOrm]call[None.deleteEntity, parameter[member[.pAddParam], member[.pEntity]]]]
local_variable[type[String], ownerFieldName]
local_variable[type[Method], getter]
local_variable[type[T], owner]
call[pAddParam.put, parameter[literal["nameOwnerEntity"], call[owner.getClass, parameter[]]]]
call[pAddParam.put, parameter[literal["nextEntity"], member[.owner]]]
return[literal[null]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[final] identifier[T] identifier[process] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[pAddParam] , Keyword[final] identifier[T] identifier[pEntity] , Keyword[final] identifier[IRequestData] identifier[pRequestData] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[String] identifier[fieldPathName] operator[=] identifier[pRequestData] operator[SEP] identifier[getParameter] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Method] identifier[getterFieldPath] operator[=] Keyword[this] operator[SEP] identifier[gettersRapiHolder] operator[SEP] identifier[getFor] operator[SEP] identifier[pEntity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[fieldPathName] operator[SEP] operator[SEP] identifier[String] identifier[filePath] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[getterFieldPath] operator[SEP] identifier[invoke] operator[SEP] identifier[pEntity] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[filePath] operator[!=] Other[null] operator[SEP] {
identifier[File] identifier[fileToDel] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[filePath] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fileToDel] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[fileToDel] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ExceptionWithCode] operator[SEP] identifier[ExceptionWithCode] operator[SEP] identifier[SOMETHING_WRONG] , literal[String] operator[+] identifier[fileToDel] operator[SEP] operator[SEP]
}
}
Keyword[this] operator[SEP] identifier[srvOrm] operator[SEP] identifier[deleteEntity] operator[SEP] identifier[pAddParam] , identifier[pEntity] operator[SEP] operator[SEP] identifier[String] identifier[ownerFieldName] operator[=] Keyword[this] operator[SEP] identifier[srvOrm] operator[SEP] identifier[getTablesMap] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[pEntity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getOwnerFieldName] operator[SEP] operator[SEP] operator[SEP] identifier[Method] identifier[getter] operator[=] Keyword[this] operator[SEP] identifier[gettersRapiHolder] operator[SEP] identifier[getFor] operator[SEP] identifier[pEntity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] , identifier[ownerFieldName] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[T] identifier[owner] operator[=] operator[SEP] identifier[T] operator[SEP] identifier[getter] operator[SEP] identifier[invoke] operator[SEP] identifier[pEntity] operator[SEP] operator[SEP] identifier[pAddParam] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[owner] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pAddParam] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[owner] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public static Map<String, String> mapProperties(final Map<String, String> input, final Description desc) {
final Map<String, String> mapping = desc.getPropertiesMapping();
if (null == mapping) {
return input;
}
return performMapping(input, mapping, false);
}
|
class class_name[name] begin[{]
method[mapProperties, return_type[type[Map]], modifier[public static], parameter[input, desc]] begin[{]
local_variable[type[Map], mapping]
if[binary_operation[literal[null], ==, member[.mapping]]] begin[{]
return[member[.input]]
else begin[{]
None
end[}]
return[call[.performMapping, parameter[member[.input], member[.mapping], literal[false]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[mapProperties] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[input] , Keyword[final] identifier[Description] identifier[desc] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[mapping] operator[=] identifier[desc] operator[SEP] identifier[getPropertiesMapping] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[mapping] operator[SEP] {
Keyword[return] identifier[input] operator[SEP]
}
Keyword[return] identifier[performMapping] operator[SEP] identifier[input] , identifier[mapping] , literal[boolean] operator[SEP] operator[SEP]
}
|
public ConformanceMessagingComponent addMessaging() { //3
ConformanceMessagingComponent t = new ConformanceMessagingComponent();
if (this.messaging == null)
this.messaging = new ArrayList<ConformanceMessagingComponent>();
this.messaging.add(t);
return t;
}
|
class class_name[name] begin[{]
method[addMessaging, return_type[type[ConformanceMessagingComponent]], modifier[public], parameter[]] begin[{]
local_variable[type[ConformanceMessagingComponent], t]
if[binary_operation[THIS[member[None.messaging]], ==, literal[null]]] begin[{]
assign[THIS[member[None.messaging]], 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=ConformanceMessagingComponent, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.messaging]call[None.add, parameter[member[.t]]]]
return[member[.t]]
end[}]
END[}]
|
Keyword[public] identifier[ConformanceMessagingComponent] identifier[addMessaging] operator[SEP] operator[SEP] {
identifier[ConformanceMessagingComponent] identifier[t] operator[=] Keyword[new] identifier[ConformanceMessagingComponent] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[messaging] operator[==] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[messaging] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[ConformanceMessagingComponent] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[messaging] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[return] identifier[t] operator[SEP]
}
|
public void writeBinary(final PacketOutputStream pos) throws IOException {
Calendar calendar = Calendar.getInstance(timeZone);
calendar.setTimeInMillis(date.getTime());
pos.write((byte) 7);//length
pos.writeShort((short) calendar.get(Calendar.YEAR));
pos.write((byte) ((calendar.get(Calendar.MONTH) + 1) & 0xff));
pos.write((byte) (calendar.get(Calendar.DAY_OF_MONTH) & 0xff));
pos.write((byte) 0);
pos.write((byte) 0);
pos.write((byte) 0);
}
|
class class_name[name] begin[{]
method[writeBinary, return_type[void], modifier[public], parameter[pos]] begin[{]
local_variable[type[Calendar], calendar]
call[calendar.setTimeInMillis, parameter[call[date.getTime, parameter[]]]]
call[pos.write, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=7), type=BasicType(dimensions=[], name=byte))]]
call[pos.writeShort, parameter[Cast(expression=MethodInvocation(arguments=[MemberReference(member=YEAR, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=short))]]
call[pos.write, parameter[Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), type=BasicType(dimensions=[], name=byte))]]
call[pos.write, parameter[Cast(expression=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=DAY_OF_MONTH, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=calendar, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), type=BasicType(dimensions=[], name=byte))]]
call[pos.write, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), type=BasicType(dimensions=[], name=byte))]]
call[pos.write, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), type=BasicType(dimensions=[], name=byte))]]
call[pos.write, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), type=BasicType(dimensions=[], name=byte))]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[writeBinary] operator[SEP] Keyword[final] identifier[PacketOutputStream] identifier[pos] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Calendar] identifier[calendar] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] identifier[timeZone] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[setTimeInMillis] operator[SEP] identifier[date] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[write] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] Other[7] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[writeShort] operator[SEP] operator[SEP] Keyword[short] operator[SEP] identifier[calendar] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[YEAR] operator[SEP] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[write] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[MONTH] operator[SEP] operator[+] Other[1] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[write] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[calendar] operator[SEP] identifier[get] operator[SEP] identifier[Calendar] operator[SEP] identifier[DAY_OF_MONTH] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[write] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[write] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[pos] operator[SEP] identifier[write] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
private synchronized void getAndSetRESTHandlerContainer(HttpServletRequest request) throws ServletException {
if (REST_HANDLER_CONTAINER == null) {
//Get the bundle context
HttpSession session = request.getSession();
ServletContext sc = session.getServletContext();
BundleContext ctxt = (BundleContext) sc.getAttribute("osgi-bundlecontext");
ServiceReference<RESTHandlerContainer> ref = ctxt.getServiceReference(RESTHandlerContainer.class);
if (ref == null) {
// Couldn't find service, so throw the error.
throw new ServletException(Tr.formatMessage(tc, "OSGI_SERVICE_ERROR", "RESTHandlerContainer"));
} else {
REST_HANDLER_CONTAINER = ctxt.getService(ref);
}
}
}
|
class class_name[name] begin[{]
method[getAndSetRESTHandlerContainer, return_type[void], modifier[synchronized private], parameter[request]] begin[{]
if[binary_operation[member[.REST_HANDLER_CONTAINER], ==, literal[null]]] begin[{]
local_variable[type[HttpSession], session]
local_variable[type[ServletContext], sc]
local_variable[type[BundleContext], ctxt]
local_variable[type[ServiceReference], ref]
if[binary_operation[member[.ref], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="OSGI_SERVICE_ERROR"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="RESTHandlerContainer")], member=formatMessage, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServletException, sub_type=None)), label=None)
else begin[{]
assign[member[.REST_HANDLER_CONTAINER], call[ctxt.getService, parameter[member[.ref]]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[synchronized] Keyword[void] identifier[getAndSetRESTHandlerContainer] operator[SEP] identifier[HttpServletRequest] identifier[request] operator[SEP] Keyword[throws] identifier[ServletException] {
Keyword[if] operator[SEP] identifier[REST_HANDLER_CONTAINER] operator[==] Other[null] operator[SEP] {
identifier[HttpSession] identifier[session] operator[=] identifier[request] operator[SEP] identifier[getSession] operator[SEP] operator[SEP] operator[SEP] identifier[ServletContext] identifier[sc] operator[=] identifier[session] operator[SEP] identifier[getServletContext] operator[SEP] operator[SEP] operator[SEP] identifier[BundleContext] identifier[ctxt] operator[=] operator[SEP] identifier[BundleContext] operator[SEP] identifier[sc] operator[SEP] identifier[getAttribute] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ServiceReference] operator[<] identifier[RESTHandlerContainer] operator[>] identifier[ref] operator[=] identifier[ctxt] operator[SEP] identifier[getServiceReference] operator[SEP] identifier[RESTHandlerContainer] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ref] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ServletException] operator[SEP] identifier[Tr] operator[SEP] identifier[formatMessage] operator[SEP] identifier[tc] , literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[REST_HANDLER_CONTAINER] operator[=] identifier[ctxt] operator[SEP] identifier[getService] operator[SEP] identifier[ref] operator[SEP] operator[SEP]
}
}
}
|
public User createAdminUser(String passwordParam) {
User adminUserCreate = new User();
adminUserCreate.setPasswordClear(passwordParam);
return new User(this.putJson(
adminUserCreate, WS.Path.User.Version1.userCreateAdmin()));
}
|
class class_name[name] begin[{]
method[createAdminUser, return_type[type[User]], modifier[public], parameter[passwordParam]] begin[{]
local_variable[type[User], adminUserCreate]
call[adminUserCreate.setPasswordClear, parameter[member[.passwordParam]]]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=adminUserCreate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=userCreateAdmin, postfix_operators=[], prefix_operators=[], qualifier=WS.Path.User.Version1, selectors=[], type_arguments=None)], member=putJson, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=User, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[User] identifier[createAdminUser] operator[SEP] identifier[String] identifier[passwordParam] operator[SEP] {
identifier[User] identifier[adminUserCreate] operator[=] Keyword[new] identifier[User] operator[SEP] operator[SEP] operator[SEP] identifier[adminUserCreate] operator[SEP] identifier[setPasswordClear] operator[SEP] identifier[passwordParam] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[User] operator[SEP] Keyword[this] operator[SEP] identifier[putJson] operator[SEP] identifier[adminUserCreate] , identifier[WS] operator[SEP] identifier[Path] operator[SEP] identifier[User] operator[SEP] identifier[Version1] operator[SEP] identifier[userCreateAdmin] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void updateMasters(List<Long> masters, Map<Integer, Long> partitionMasters)
{
m_initiatorHSIds.clear();
m_initiatorHSIds.addAll(masters);
((MpTransactionState)getTransactionState()).updateMasters(masters, partitionMasters);
}
|
class class_name[name] begin[{]
method[updateMasters, return_type[void], modifier[public], parameter[masters, partitionMasters]] begin[{]
call[m_initiatorHSIds.clear, parameter[]]
call[m_initiatorHSIds.addAll, parameter[member[.masters]]]
Cast(expression=MethodInvocation(arguments=[], member=getTransactionState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=MpTransactionState, sub_type=None))
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[updateMasters] operator[SEP] identifier[List] operator[<] identifier[Long] operator[>] identifier[masters] , identifier[Map] operator[<] identifier[Integer] , identifier[Long] operator[>] identifier[partitionMasters] operator[SEP] {
identifier[m_initiatorHSIds] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[m_initiatorHSIds] operator[SEP] identifier[addAll] operator[SEP] identifier[masters] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[MpTransactionState] operator[SEP] identifier[getTransactionState] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[updateMasters] operator[SEP] identifier[masters] , identifier[partitionMasters] operator[SEP] operator[SEP]
}
|
public Element insertChildren(int index, Node... children) {
Validate.notNull(children, "Children collection to be inserted must not be null.");
int currentSize = childNodeSize();
if (index < 0) index += currentSize +1; // roll around
Validate.isTrue(index >= 0 && index <= currentSize, "Insert position out of bounds.");
addChildren(index, children);
return this;
}
|
class class_name[name] begin[{]
method[insertChildren, return_type[type[Element]], modifier[public], parameter[index, children]] begin[{]
call[Validate.notNull, parameter[member[.children], literal["Children collection to be inserted must not be null."]]]
local_variable[type[int], currentSize]
if[binary_operation[member[.index], <, literal[0]]] begin[{]
assign[member[.index], binary_operation[member[.currentSize], +, literal[1]]]
else begin[{]
None
end[}]
call[Validate.isTrue, parameter[binary_operation[binary_operation[member[.index], >=, literal[0]], &&, binary_operation[member[.index], <=, member[.currentSize]]], literal["Insert position out of bounds."]]]
call[.addChildren, parameter[member[.index], member[.children]]]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[Element] identifier[insertChildren] operator[SEP] Keyword[int] identifier[index] , identifier[Node] operator[...] identifier[children] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[children] , literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[currentSize] operator[=] identifier[childNodeSize] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[<] Other[0] operator[SEP] identifier[index] operator[+=] identifier[currentSize] operator[+] Other[1] operator[SEP] identifier[Validate] operator[SEP] identifier[isTrue] operator[SEP] identifier[index] operator[>=] Other[0] operator[&&] identifier[index] operator[<=] identifier[currentSize] , literal[String] operator[SEP] operator[SEP] identifier[addChildren] operator[SEP] identifier[index] , identifier[children] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public <I> Choice8<A, B, C, D, E, F, G, I> flatMap(
Function<? super H, ? extends Monad<I, Choice8<A, B, C, D, E, F, G, ?>>> fn) {
return match(Choice8::a, Choice8::b, Choice8::c, Choice8::d, Choice8::e, Choice8::f, Choice8::g, h -> fn.apply(h).coerce());
}
|
class class_name[name] begin[{]
method[flatMap, return_type[type[Choice8]], modifier[public], parameter[fn]] begin[{]
return[call[.match, parameter[MethodReference(expression=MemberReference(member=Choice8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), MethodReference(expression=MemberReference(member=Choice8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), MethodReference(expression=MemberReference(member=Choice8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), MethodReference(expression=MemberReference(member=Choice8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), MethodReference(expression=MemberReference(member=Choice8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), MethodReference(expression=MemberReference(member=Choice8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), MethodReference(expression=MemberReference(member=Choice8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=fn, selectors=[MethodInvocation(arguments=[], member=coerce, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), parameters=[MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] operator[<] identifier[I] operator[>] identifier[Choice8] operator[<] identifier[A] , identifier[B] , identifier[C] , identifier[D] , identifier[E] , identifier[F] , identifier[G] , identifier[I] operator[>] identifier[flatMap] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[H] , operator[?] Keyword[extends] identifier[Monad] operator[<] identifier[I] , identifier[Choice8] operator[<] identifier[A] , identifier[B] , identifier[C] , identifier[D] , identifier[E] , identifier[F] , identifier[G] , operator[?] operator[>] operator[>] operator[>] identifier[fn] operator[SEP] {
Keyword[return] identifier[match] operator[SEP] identifier[Choice8] operator[::] identifier[a] , identifier[Choice8] operator[::] identifier[b] , identifier[Choice8] operator[::] identifier[c] , identifier[Choice8] operator[::] identifier[d] , identifier[Choice8] operator[::] identifier[e] , identifier[Choice8] operator[::] identifier[f] , identifier[Choice8] operator[::] identifier[g] , identifier[h] operator[->] identifier[fn] operator[SEP] identifier[apply] operator[SEP] identifier[h] operator[SEP] operator[SEP] identifier[coerce] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static synchronized <T> T createNiceMockAndExpectNew(Class<T> type, Object... arguments) throws Exception {
T mock = createNiceMock(type);
IExpectationSetters<T> expectationSetters = expectNiceNew(type, arguments);
if (expectationSetters != null) {
expectationSetters.andReturn(mock);
}
return mock;
}
|
class class_name[name] begin[{]
method[createNiceMockAndExpectNew, return_type[type[T]], modifier[synchronized public static], parameter[type, arguments]] begin[{]
local_variable[type[T], mock]
local_variable[type[IExpectationSetters], expectationSetters]
if[binary_operation[member[.expectationSetters], !=, literal[null]]] begin[{]
call[expectationSetters.andReturn, parameter[member[.mock]]]
else begin[{]
None
end[}]
return[member[.mock]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[synchronized] operator[<] identifier[T] operator[>] identifier[T] identifier[createNiceMockAndExpectNew] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[type] , identifier[Object] operator[...] identifier[arguments] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[T] identifier[mock] operator[=] identifier[createNiceMock] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[IExpectationSetters] operator[<] identifier[T] operator[>] identifier[expectationSetters] operator[=] identifier[expectNiceNew] operator[SEP] identifier[type] , identifier[arguments] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[expectationSetters] operator[!=] Other[null] operator[SEP] {
identifier[expectationSetters] operator[SEP] identifier[andReturn] operator[SEP] identifier[mock] operator[SEP] operator[SEP]
}
Keyword[return] identifier[mock] operator[SEP]
}
|
public static SimpleDataSet read(Path path, int lines_to_skip, Set<Integer> cat_cols) throws IOException
{
return read(path, DEFAULT_DELIMITER, lines_to_skip, DEFAULT_COMMENT, cat_cols);
}
|
class class_name[name] begin[{]
method[read, return_type[type[SimpleDataSet]], modifier[public static], parameter[path, lines_to_skip, cat_cols]] begin[{]
return[call[.read, parameter[member[.path], member[.DEFAULT_DELIMITER], member[.lines_to_skip], member[.DEFAULT_COMMENT], member[.cat_cols]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[SimpleDataSet] identifier[read] operator[SEP] identifier[Path] identifier[path] , Keyword[int] identifier[lines_to_skip] , identifier[Set] operator[<] identifier[Integer] operator[>] identifier[cat_cols] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[read] operator[SEP] identifier[path] , identifier[DEFAULT_DELIMITER] , identifier[lines_to_skip] , identifier[DEFAULT_COMMENT] , identifier[cat_cols] operator[SEP] operator[SEP]
}
|
@Nullable
private static RawTextNode getAttributeValue(
HtmlAttributeNode htmlAttributeNode, String name, ErrorReporter errorReporter) {
StandaloneNode valueNode = htmlAttributeNode.getChild(1);
if (valueNode instanceof HtmlAttributeValueNode) {
HtmlAttributeValueNode attributeValueNode = (HtmlAttributeValueNode) valueNode;
if (attributeValueNode.numChildren() == 1
&& attributeValueNode.getChild(0) instanceof RawTextNode) {
return (RawTextNode) attributeValueNode.getChild(0);
}
}
errorReporter.report(valueNode.getSourceLocation(), INVALID_ATTRIBUTE, name);
return null;
}
|
class class_name[name] begin[{]
method[getAttributeValue, return_type[type[RawTextNode]], modifier[private static], parameter[htmlAttributeNode, name, errorReporter]] begin[{]
local_variable[type[StandaloneNode], valueNode]
if[binary_operation[member[.valueNode], instanceof, type[HtmlAttributeValueNode]]] begin[{]
local_variable[type[HtmlAttributeValueNode], attributeValueNode]
if[binary_operation[binary_operation[call[attributeValueNode.numChildren, parameter[]], ==, literal[1]], &&, binary_operation[call[attributeValueNode.getChild, parameter[literal[0]]], instanceof, type[RawTextNode]]]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=getChild, postfix_operators=[], prefix_operators=[], qualifier=attributeValueNode, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=RawTextNode, sub_type=None))]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[errorReporter.report, parameter[call[valueNode.getSourceLocation, parameter[]], member[.INVALID_ATTRIBUTE], member[.name]]]
return[literal[null]]
end[}]
END[}]
|
annotation[@] identifier[Nullable] Keyword[private] Keyword[static] identifier[RawTextNode] identifier[getAttributeValue] operator[SEP] identifier[HtmlAttributeNode] identifier[htmlAttributeNode] , identifier[String] identifier[name] , identifier[ErrorReporter] identifier[errorReporter] operator[SEP] {
identifier[StandaloneNode] identifier[valueNode] operator[=] identifier[htmlAttributeNode] operator[SEP] identifier[getChild] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[valueNode] Keyword[instanceof] identifier[HtmlAttributeValueNode] operator[SEP] {
identifier[HtmlAttributeValueNode] identifier[attributeValueNode] operator[=] operator[SEP] identifier[HtmlAttributeValueNode] operator[SEP] identifier[valueNode] operator[SEP] Keyword[if] operator[SEP] identifier[attributeValueNode] operator[SEP] identifier[numChildren] operator[SEP] operator[SEP] operator[==] Other[1] operator[&&] identifier[attributeValueNode] operator[SEP] identifier[getChild] operator[SEP] Other[0] operator[SEP] Keyword[instanceof] identifier[RawTextNode] operator[SEP] {
Keyword[return] operator[SEP] identifier[RawTextNode] operator[SEP] identifier[attributeValueNode] operator[SEP] identifier[getChild] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
}
identifier[errorReporter] operator[SEP] identifier[report] operator[SEP] identifier[valueNode] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] , identifier[INVALID_ATTRIBUTE] , identifier[name] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public static void get(@NotNull String path, @NotNull Handler handler, @NotNull Set<Role> permittedRoles) {
staticInstance().get(prefixPath(path), handler, permittedRoles);
}
|
class class_name[name] begin[{]
method[get, return_type[void], modifier[public static], parameter[path, handler, permittedRoles]] begin[{]
call[.staticInstance, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[get] operator[SEP] annotation[@] identifier[NotNull] identifier[String] identifier[path] , annotation[@] identifier[NotNull] identifier[Handler] identifier[handler] , annotation[@] identifier[NotNull] identifier[Set] operator[<] identifier[Role] operator[>] identifier[permittedRoles] operator[SEP] {
identifier[staticInstance] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[prefixPath] operator[SEP] identifier[path] operator[SEP] , identifier[handler] , identifier[permittedRoles] operator[SEP] operator[SEP]
}
|
@Override
public void authenticateWithBlackduck() throws IntegrationException {
final URL securityUrl;
try {
securityUrl = new URL(getBaseUrl(), "j_spring_security_check");
} catch (final MalformedURLException e) {
throw new IntegrationException("Error constructing the login URL: " + e.getMessage(), e);
}
if (StringUtils.isNotBlank(hubUsername) && StringUtils.isNotBlank(hubPassword)) {
final List<NameValuePair> bodyValues = new ArrayList<>();
bodyValues.add(new BasicNameValuePair("j_username", hubUsername));
bodyValues.add(new BasicNameValuePair("j_password", hubPassword));
final UrlEncodedFormEntity entity = new UrlEncodedFormEntity(bodyValues, Charsets.UTF_8);
final RequestBuilder requestBuilder = createRequestBuilder(HttpMethod.POST, null);
requestBuilder.setCharset(Charsets.UTF_8);
requestBuilder.setUri(securityUrl.toString());
requestBuilder.setEntity(entity);
final HttpUriRequest request = requestBuilder.build();
logRequestHeaders(request);
try (final CloseableHttpResponse closeableHttpResponse = getClient().execute(request)) {
logResponseHeaders(closeableHttpResponse);
final Response response = new Response(closeableHttpResponse);
final int statusCode = closeableHttpResponse.getStatusLine().getStatusCode();
final String statusMessage = closeableHttpResponse.getStatusLine().getReasonPhrase();
if (statusCode < RestConstants.OK_200 || statusCode >= RestConstants.MULT_CHOICE_300) {
final String httpResponseContent = response.getContentString();
throw new IntegrationRestException(statusCode, statusMessage, httpResponseContent, String.format("Connection Error: %s %s", statusCode, statusMessage));
} else {
// get the CSRF token
final Header csrfToken = closeableHttpResponse.getFirstHeader(RestConstants.X_CSRF_TOKEN);
if (csrfToken != null) {
addCommonRequestHeader(RestConstants.X_CSRF_TOKEN, csrfToken.getValue());
} else {
logger.error("No CSRF token found when authenticating");
}
}
} catch (final IOException e) {
throw new IntegrationException(e.getMessage(), e);
}
}
}
|
class class_name[name] begin[{]
method[authenticateWithBlackduck, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[URL], securityUrl]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=securityUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getBaseUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="j_spring_security_check")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URL, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error constructing the login URL: "), 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=IntegrationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MalformedURLException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[StringUtils.isNotBlank, parameter[member[.hubUsername]]], &&, call[StringUtils.isNotBlank, parameter[member[.hubPassword]]]]] begin[{]
local_variable[type[List], bodyValues]
call[bodyValues.add, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="j_username"), MemberReference(member=hubUsername, 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=BasicNameValuePair, sub_type=None))]]
call[bodyValues.add, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="j_password"), MemberReference(member=hubPassword, 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=BasicNameValuePair, sub_type=None))]]
local_variable[type[UrlEncodedFormEntity], entity]
local_variable[type[RequestBuilder], requestBuilder]
call[requestBuilder.setCharset, parameter[member[Charsets.UTF_8]]]
call[requestBuilder.setUri, parameter[call[securityUrl.toString, parameter[]]]]
call[requestBuilder.setEntity, parameter[member[.entity]]]
local_variable[type[HttpUriRequest], request]
call[.logRequestHeaders, parameter[member[.request]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=closeableHttpResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=logResponseHeaders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=closeableHttpResponse, 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=Response, sub_type=None)), name=response)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Response, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getStatusLine, postfix_operators=[], prefix_operators=[], qualifier=closeableHttpResponse, selectors=[MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=statusCode)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getStatusLine, postfix_operators=[], prefix_operators=[], qualifier=closeableHttpResponse, selectors=[MethodInvocation(arguments=[], member=getReasonPhrase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=statusMessage)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=OK_200, postfix_operators=[], prefix_operators=[], qualifier=RestConstants, selectors=[]), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MULT_CHOICE_300, postfix_operators=[], prefix_operators=[], qualifier=RestConstants, selectors=[]), operator=>=), operator=||), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=X_CSRF_TOKEN, postfix_operators=[], prefix_operators=[], qualifier=RestConstants, selectors=[])], member=getFirstHeader, postfix_operators=[], prefix_operators=[], qualifier=closeableHttpResponse, selectors=[], type_arguments=None), name=csrfToken)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Header, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=csrfToken, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No CSRF token found when authenticating")], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=X_CSRF_TOKEN, postfix_operators=[], prefix_operators=[], qualifier=RestConstants, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=csrfToken, selectors=[], type_arguments=None)], member=addCommonRequestHeader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getContentString, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), name=httpResponseContent)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=statusMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=httpResponseContent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Connection Error: %s %s"), MemberReference(member=statusCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=statusMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IntegrationRestException, 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=IntegrationException, 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={'final'}, name=closeableHttpResponse, type=ReferenceType(arguments=None, dimensions=[], name=CloseableHttpResponse, sub_type=None), value=MethodInvocation(arguments=[], member=getClient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=execute, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None))])
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[authenticateWithBlackduck] operator[SEP] operator[SEP] Keyword[throws] identifier[IntegrationException] {
Keyword[final] identifier[URL] identifier[securityUrl] operator[SEP] Keyword[try] {
identifier[securityUrl] operator[=] Keyword[new] identifier[URL] operator[SEP] identifier[getBaseUrl] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[MalformedURLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IntegrationException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[hubUsername] operator[SEP] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[hubPassword] operator[SEP] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[NameValuePair] operator[>] identifier[bodyValues] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[bodyValues] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[BasicNameValuePair] operator[SEP] literal[String] , identifier[hubUsername] operator[SEP] operator[SEP] operator[SEP] identifier[bodyValues] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[BasicNameValuePair] operator[SEP] literal[String] , identifier[hubPassword] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[UrlEncodedFormEntity] identifier[entity] operator[=] Keyword[new] identifier[UrlEncodedFormEntity] operator[SEP] identifier[bodyValues] , identifier[Charsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] Keyword[final] identifier[RequestBuilder] identifier[requestBuilder] operator[=] identifier[createRequestBuilder] operator[SEP] identifier[HttpMethod] operator[SEP] identifier[POST] , Other[null] operator[SEP] operator[SEP] identifier[requestBuilder] operator[SEP] identifier[setCharset] operator[SEP] identifier[Charsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] identifier[requestBuilder] operator[SEP] identifier[setUri] operator[SEP] identifier[securityUrl] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[requestBuilder] operator[SEP] identifier[setEntity] operator[SEP] identifier[entity] operator[SEP] operator[SEP] Keyword[final] identifier[HttpUriRequest] identifier[request] operator[=] identifier[requestBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[logRequestHeaders] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[try] operator[SEP] Keyword[final] identifier[CloseableHttpResponse] identifier[closeableHttpResponse] operator[=] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[execute] operator[SEP] identifier[request] operator[SEP] operator[SEP] {
identifier[logResponseHeaders] operator[SEP] identifier[closeableHttpResponse] operator[SEP] operator[SEP] Keyword[final] identifier[Response] identifier[response] operator[=] Keyword[new] identifier[Response] operator[SEP] identifier[closeableHttpResponse] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[statusCode] operator[=] identifier[closeableHttpResponse] operator[SEP] identifier[getStatusLine] operator[SEP] operator[SEP] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[statusMessage] operator[=] identifier[closeableHttpResponse] operator[SEP] identifier[getStatusLine] operator[SEP] operator[SEP] operator[SEP] identifier[getReasonPhrase] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[statusCode] operator[<] identifier[RestConstants] operator[SEP] identifier[OK_200] operator[||] identifier[statusCode] operator[>=] identifier[RestConstants] operator[SEP] identifier[MULT_CHOICE_300] operator[SEP] {
Keyword[final] identifier[String] identifier[httpResponseContent] operator[=] identifier[response] operator[SEP] identifier[getContentString] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IntegrationRestException] operator[SEP] identifier[statusCode] , identifier[statusMessage] , identifier[httpResponseContent] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[statusCode] , identifier[statusMessage] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[Header] identifier[csrfToken] operator[=] identifier[closeableHttpResponse] operator[SEP] identifier[getFirstHeader] operator[SEP] identifier[RestConstants] operator[SEP] identifier[X_CSRF_TOKEN] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[csrfToken] operator[!=] Other[null] operator[SEP] {
identifier[addCommonRequestHeader] operator[SEP] identifier[RestConstants] operator[SEP] identifier[X_CSRF_TOKEN] , identifier[csrfToken] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IntegrationException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public void addArguments (final String [] arguments)
{
if (arguments != null)
{
for (final String argument : arguments)
{
addArgument (argument);
}
}
}
|
class class_name[name] begin[{]
method[addArguments, return_type[void], modifier[public], parameter[arguments]] begin[{]
if[binary_operation[member[.arguments], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=argument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=argument)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addArguments] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[arguments] operator[SEP] {
Keyword[if] operator[SEP] identifier[arguments] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[argument] operator[:] identifier[arguments] operator[SEP] {
identifier[addArgument] operator[SEP] identifier[argument] operator[SEP] operator[SEP]
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.