code
stringlengths
63
466k
code_sememe
stringlengths
141
3.79M
token_type
stringlengths
274
1.23M
public JSONWriter value(JSONString jss) throws JSONException { if (jss == null) { valueNull(); return this; } try { String asString = jss.toJSONString(); if (asString == null) { throw new JSONException("Unexpected null from toJSONString"); } appendValue(asString); return this; } catch (Exception e) { throw new JSONException(e); } }
class class_name[name] begin[{] method[value, return_type[type[JSONWriter]], modifier[public], parameter[jss]] begin[{] if[binary_operation[member[.jss], ==, literal[null]]] begin[{] call[.valueNull, parameter[]] return[THIS[]] else begin[{] None end[}] TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=toJSONString, postfix_operators=[], prefix_operators=[], qualifier=jss, selectors=[], type_arguments=None), name=asString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=asString, 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=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected null from toJSONString")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSONException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=asString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=appendValue, 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=JSONException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None) end[}] END[}]
Keyword[public] identifier[JSONWriter] identifier[value] operator[SEP] identifier[JSONString] identifier[jss] operator[SEP] Keyword[throws] identifier[JSONException] { Keyword[if] operator[SEP] identifier[jss] operator[==] Other[null] operator[SEP] { identifier[valueNull] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] } Keyword[try] { identifier[String] identifier[asString] operator[=] identifier[jss] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[asString] operator[==] Other[null] operator[SEP] { Keyword[throw] Keyword[new] identifier[JSONException] operator[SEP] literal[String] operator[SEP] operator[SEP] } identifier[appendValue] operator[SEP] identifier[asString] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] } Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] { Keyword[throw] Keyword[new] identifier[JSONException] operator[SEP] identifier[e] operator[SEP] operator[SEP] } }
public UriComponents build(boolean encoded) { if (this.ssp != null) { return new OpaqueUriComponents(this.scheme, this.ssp, this.fragment); } else { return new HierarchicalUriComponents(this.scheme, this.userInfo, this.host, this.port, this.pathBuilder.build(), this.queryParams, this.fragment, encoded, true); } }
class class_name[name] begin[{] method[build, return_type[type[UriComponents]], modifier[public], parameter[encoded]] begin[{] if[binary_operation[THIS[member[None.ssp]], !=, literal[null]]] begin[{] return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=scheme, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ssp, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=fragment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OpaqueUriComponents, sub_type=None))] else begin[{] return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=scheme, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=userInfo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=host, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=port, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=pathBuilder, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=queryParams, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=fragment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MemberReference(member=encoded, 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=HierarchicalUriComponents, sub_type=None))] end[}] end[}] END[}]
Keyword[public] identifier[UriComponents] identifier[build] operator[SEP] Keyword[boolean] identifier[encoded] operator[SEP] { Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[ssp] operator[!=] Other[null] operator[SEP] { Keyword[return] Keyword[new] identifier[OpaqueUriComponents] operator[SEP] Keyword[this] operator[SEP] identifier[scheme] , Keyword[this] operator[SEP] identifier[ssp] , Keyword[this] operator[SEP] identifier[fragment] operator[SEP] operator[SEP] } Keyword[else] { Keyword[return] Keyword[new] identifier[HierarchicalUriComponents] operator[SEP] Keyword[this] operator[SEP] identifier[scheme] , Keyword[this] operator[SEP] identifier[userInfo] , Keyword[this] operator[SEP] identifier[host] , Keyword[this] operator[SEP] identifier[port] , Keyword[this] operator[SEP] identifier[pathBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[queryParams] , Keyword[this] operator[SEP] identifier[fragment] , identifier[encoded] , literal[boolean] operator[SEP] operator[SEP] } }
public OperationStatus add(UUID appId, AddPermissionsOptionalParameter addOptionalParameter) { return addWithServiceResponseAsync(appId, addOptionalParameter).toBlocking().single().body(); }
class class_name[name] begin[{] method[add, return_type[type[OperationStatus]], modifier[public], parameter[appId, addOptionalParameter]] begin[{] return[call[.addWithServiceResponseAsync, parameter[member[.appId], member[.addOptionalParameter]]]] end[}] END[}]
Keyword[public] identifier[OperationStatus] identifier[add] operator[SEP] identifier[UUID] identifier[appId] , identifier[AddPermissionsOptionalParameter] identifier[addOptionalParameter] operator[SEP] { Keyword[return] identifier[addWithServiceResponseAsync] operator[SEP] identifier[appId] , identifier[addOptionalParameter] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] }
private void checkBestDistance(KdTree.Node node, FastQueue<KdTreeResult> neighbors) { double distSq = distance.distance((P)node.point,target); // <= because multiple nodes could be at the bestDistanceSq if( distSq <= mostDistantNeighborSq) { if( neighbors.size() < searchN ) { // the list of nearest neighbors isn't full yet so it doesn't know what the distance will be // so just keep on adding them to the list until it is full KdTreeResult r = neighbors.grow(); r.distance = distSq; r.node = node; if( neighbors.size() == searchN ) { // find the most distant mostDistantNeighborSq = -1; for( int i = 0; i < searchN; i++ ) { r = neighbors.get(i); if( r.distance > mostDistantNeighborSq ) { mostDistantNeighborSq = r.distance; mostDistantNeighborIndex = i; } } } } else { for( int i = 0; i < searchN; i++ ) { KdTreeResult r = neighbors.get(i); if( r.distance > mostDistantNeighborSq ) { throw new RuntimeException("Most distant isn't the most distant"); } } // Write over the most distant neighbor since we known this node must be closer // and update the maximum distance KdTreeResult r = neighbors.get(mostDistantNeighborIndex); r.node = node; r.distance = distSq; // If there are multiple points then there can be more than one point with the value of // 'bestDistanceSq', which is why two searches are required mostDistantNeighborSq = -1; for( int i = 0; i < searchN; i++ ) { r = neighbors.get(i); if( r.distance > mostDistantNeighborSq ) { mostDistantNeighborSq = r.distance; mostDistantNeighborIndex = i; } } } } }
class class_name[name] begin[{] method[checkBestDistance, return_type[void], modifier[private], parameter[node, neighbors]] begin[{] local_variable[type[double], distSq] if[binary_operation[member[.distSq], <=, member[.mostDistantNeighborSq]]] begin[{] if[binary_operation[call[neighbors.size, parameter[]], <, member[.searchN]]] begin[{] local_variable[type[KdTreeResult], r] assign[member[r.distance], member[.distSq]] assign[member[r.node], member[.node]] if[binary_operation[call[neighbors.size, parameter[]], ==, member[.searchN]]] begin[{] assign[member[.mostDistantNeighborSq], literal[1]] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=neighbors, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=distance, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[]), operandr=MemberReference(member=mostDistantNeighborSq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mostDistantNeighborSq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=distance, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mostDistantNeighborIndex, 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=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=searchN, 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) else begin[{] None end[}] else begin[{] ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=neighbors, selectors=[], type_arguments=None), name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KdTreeResult, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=distance, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[]), operandr=MemberReference(member=mostDistantNeighborSq, postfix_operators=[], prefix_operators=[], qualifier=, 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="Most distant isn't the most distant")], 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)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=searchN, 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) local_variable[type[KdTreeResult], r] assign[member[r.node], member[.node]] assign[member[r.distance], member[.distSq]] assign[member[.mostDistantNeighborSq], literal[1]] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=neighbors, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=distance, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[]), operandr=MemberReference(member=mostDistantNeighborSq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mostDistantNeighborSq, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=distance, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mostDistantNeighborIndex, 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=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=searchN, 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) end[}] else begin[{] None end[}] end[}] END[}]
Keyword[private] Keyword[void] identifier[checkBestDistance] operator[SEP] identifier[KdTree] operator[SEP] identifier[Node] identifier[node] , identifier[FastQueue] operator[<] identifier[KdTreeResult] operator[>] identifier[neighbors] operator[SEP] { Keyword[double] identifier[distSq] operator[=] identifier[distance] operator[SEP] identifier[distance] operator[SEP] operator[SEP] identifier[P] operator[SEP] identifier[node] operator[SEP] identifier[point] , identifier[target] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[distSq] operator[<=] identifier[mostDistantNeighborSq] operator[SEP] { Keyword[if] operator[SEP] identifier[neighbors] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] identifier[searchN] operator[SEP] { identifier[KdTreeResult] identifier[r] operator[=] identifier[neighbors] operator[SEP] identifier[grow] operator[SEP] operator[SEP] operator[SEP] identifier[r] operator[SEP] identifier[distance] operator[=] identifier[distSq] operator[SEP] identifier[r] operator[SEP] identifier[node] operator[=] identifier[node] operator[SEP] Keyword[if] operator[SEP] identifier[neighbors] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] identifier[searchN] operator[SEP] { identifier[mostDistantNeighborSq] operator[=] operator[-] Other[1] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[searchN] operator[SEP] identifier[i] operator[++] operator[SEP] { identifier[r] operator[=] identifier[neighbors] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[SEP] identifier[distance] operator[>] identifier[mostDistantNeighborSq] operator[SEP] { identifier[mostDistantNeighborSq] operator[=] identifier[r] operator[SEP] identifier[distance] operator[SEP] identifier[mostDistantNeighborIndex] operator[=] identifier[i] operator[SEP] } } } } Keyword[else] { Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[searchN] operator[SEP] identifier[i] operator[++] operator[SEP] { identifier[KdTreeResult] identifier[r] operator[=] identifier[neighbors] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[SEP] identifier[distance] operator[>] identifier[mostDistantNeighborSq] operator[SEP] { Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] } } identifier[KdTreeResult] identifier[r] operator[=] identifier[neighbors] operator[SEP] identifier[get] operator[SEP] identifier[mostDistantNeighborIndex] operator[SEP] operator[SEP] identifier[r] operator[SEP] identifier[node] operator[=] identifier[node] operator[SEP] identifier[r] operator[SEP] identifier[distance] operator[=] identifier[distSq] operator[SEP] identifier[mostDistantNeighborSq] operator[=] operator[-] Other[1] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[searchN] operator[SEP] identifier[i] operator[++] operator[SEP] { identifier[r] operator[=] identifier[neighbors] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[SEP] identifier[distance] operator[>] identifier[mostDistantNeighborSq] operator[SEP] { identifier[mostDistantNeighborSq] operator[=] identifier[r] operator[SEP] identifier[distance] operator[SEP] identifier[mostDistantNeighborIndex] operator[=] identifier[i] operator[SEP] } } } } }
public void setUserLedBlinking(final boolean USER_LED_BLINKING) { this.userLedBlinking = USER_LED_BLINKING; if (USER_LED_BLINKING) { USER_LED_BLINKING_TIMER.start(); } else { setCurrentUserLedImage(getUserLedImageOff()); USER_LED_BLINKING_TIMER.stop(); } }
class class_name[name] begin[{] method[setUserLedBlinking, return_type[void], modifier[public], parameter[USER_LED_BLINKING]] begin[{] assign[THIS[member[None.userLedBlinking]], member[.USER_LED_BLINKING]] if[member[.USER_LED_BLINKING]] begin[{] call[USER_LED_BLINKING_TIMER.start, parameter[]] else begin[{] call[.setCurrentUserLedImage, parameter[call[.getUserLedImageOff, parameter[]]]] call[USER_LED_BLINKING_TIMER.stop, parameter[]] end[}] end[}] END[}]
Keyword[public] Keyword[void] identifier[setUserLedBlinking] operator[SEP] Keyword[final] Keyword[boolean] identifier[USER_LED_BLINKING] operator[SEP] { Keyword[this] operator[SEP] identifier[userLedBlinking] operator[=] identifier[USER_LED_BLINKING] operator[SEP] Keyword[if] operator[SEP] identifier[USER_LED_BLINKING] operator[SEP] { identifier[USER_LED_BLINKING_TIMER] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] } Keyword[else] { identifier[setCurrentUserLedImage] operator[SEP] identifier[getUserLedImageOff] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[USER_LED_BLINKING_TIMER] operator[SEP] identifier[stop] operator[SEP] operator[SEP] operator[SEP] } }
public int numVariables() { int maxVar = 0; for (Factor f : factors) { for (int n : f.neigborIndices) { if (n > maxVar) maxVar = n; } } return maxVar + 1; }
class class_name[name] begin[{] method[numVariables, return_type[type[int]], modifier[public], parameter[]] begin[{] local_variable[type[int], maxVar] ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxVar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxVar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=neigborIndices, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=n)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=factors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Factor, sub_type=None))), label=None) return[binary_operation[member[.maxVar], +, literal[1]]] end[}] END[}]
Keyword[public] Keyword[int] identifier[numVariables] operator[SEP] operator[SEP] { Keyword[int] identifier[maxVar] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Factor] identifier[f] operator[:] identifier[factors] operator[SEP] { Keyword[for] operator[SEP] Keyword[int] identifier[n] operator[:] identifier[f] operator[SEP] identifier[neigborIndices] operator[SEP] { Keyword[if] operator[SEP] identifier[n] operator[>] identifier[maxVar] operator[SEP] identifier[maxVar] operator[=] identifier[n] operator[SEP] } } Keyword[return] identifier[maxVar] operator[+] Other[1] operator[SEP] }
public TreeGraphNode headWordNode() { TreeGraphNode hwn = safeCast(label.get(TreeCoreAnnotations.HeadWordAnnotation.class)); if (hwn == null || (hwn.treeGraph() != null && !(hwn.treeGraph().equals(this.treeGraph())))) { return null; } return hwn; }
class class_name[name] begin[{] method[headWordNode, return_type[type[TreeGraphNode]], modifier[public], parameter[]] begin[{] local_variable[type[TreeGraphNode], hwn] if[binary_operation[binary_operation[member[.hwn], ==, literal[null]], ||, binary_operation[binary_operation[call[hwn.treeGraph, parameter[]], !=, literal[null]], &&, call[hwn.treeGraph, parameter[]]]]] begin[{] return[literal[null]] else begin[{] None end[}] return[member[.hwn]] end[}] END[}]
Keyword[public] identifier[TreeGraphNode] identifier[headWordNode] operator[SEP] operator[SEP] { identifier[TreeGraphNode] identifier[hwn] operator[=] identifier[safeCast] operator[SEP] identifier[label] operator[SEP] identifier[get] operator[SEP] identifier[TreeCoreAnnotations] operator[SEP] identifier[HeadWordAnnotation] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hwn] operator[==] Other[null] operator[||] operator[SEP] identifier[hwn] operator[SEP] identifier[treeGraph] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] operator[SEP] identifier[hwn] operator[SEP] identifier[treeGraph] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] Keyword[this] operator[SEP] identifier[treeGraph] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] { Keyword[return] Other[null] operator[SEP] } Keyword[return] identifier[hwn] operator[SEP] }
public void dismiss() { if (!isDismissed()) { if (!isHidden()) { playHideAnimation(); } setVisibility(GONE); ViewGroup parent = (ViewGroup) getParent(); parent.removeView(this); LOGGER.trace("Dismissed the Action Button"); } }
class class_name[name] begin[{] method[dismiss, return_type[void], modifier[public], parameter[]] begin[{] if[call[.isDismissed, parameter[]]] begin[{] if[call[.isHidden, parameter[]]] begin[{] call[.playHideAnimation, parameter[]] else begin[{] None end[}] call[.setVisibility, parameter[member[.GONE]]] local_variable[type[ViewGroup], parent] call[parent.removeView, parameter[THIS[]]] call[LOGGER.trace, parameter[literal["Dismissed the Action Button"]]] else begin[{] None end[}] end[}] END[}]
Keyword[public] Keyword[void] identifier[dismiss] operator[SEP] operator[SEP] { Keyword[if] operator[SEP] operator[!] identifier[isDismissed] operator[SEP] operator[SEP] operator[SEP] { Keyword[if] operator[SEP] operator[!] identifier[isHidden] operator[SEP] operator[SEP] operator[SEP] { identifier[playHideAnimation] operator[SEP] operator[SEP] operator[SEP] } identifier[setVisibility] operator[SEP] identifier[GONE] operator[SEP] operator[SEP] identifier[ViewGroup] identifier[parent] operator[=] operator[SEP] identifier[ViewGroup] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[removeView] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] } }
public void addOpacityBar(OpacityBar bar) { mOpacityBar = bar; // Give an instance of the color picker to the Opacity bar. mOpacityBar.setColorPicker(this); mOpacityBar.setColor(mColor); }
class class_name[name] begin[{] method[addOpacityBar, return_type[void], modifier[public], parameter[bar]] begin[{] assign[member[.mOpacityBar], member[.bar]] call[mOpacityBar.setColorPicker, parameter[THIS[]]] call[mOpacityBar.setColor, parameter[member[.mColor]]] end[}] END[}]
Keyword[public] Keyword[void] identifier[addOpacityBar] operator[SEP] identifier[OpacityBar] identifier[bar] operator[SEP] { identifier[mOpacityBar] operator[=] identifier[bar] operator[SEP] identifier[mOpacityBar] operator[SEP] identifier[setColorPicker] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[mOpacityBar] operator[SEP] identifier[setColor] operator[SEP] identifier[mColor] operator[SEP] operator[SEP] }
public String buildJson() throws ODataRenderException { LOG.debug("Start building Json service root document"); try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) { JsonGenerator jsonGenerator = JSON_FACTORY.createGenerator(stream, JsonEncoding.UTF8); jsonGenerator.writeStartObject(); jsonGenerator.writeStringField(CONTEXT, getContextURL(uri, entityDataModel)); jsonGenerator.writeArrayFieldStart(VALUE); List<EntitySet> entities = entityDataModel.getEntityContainer().getEntitySets(); for (EntitySet entity : entities) { if (entity.isIncludedInServiceDocument()) { writeObject(jsonGenerator, entity); } } List<Singleton> singletons = entityDataModel.getEntityContainer().getSingletons(); for (Singleton singleton : singletons) { writeObject(jsonGenerator, singleton); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); jsonGenerator.close(); return stream.toString(StandardCharsets.UTF_8.name()); } catch (IOException e) { throw new ODataRenderException("It is unable to render service document", e); } }
class class_name[name] begin[{] method[buildJson, return_type[type[String]], modifier[public], parameter[]] begin[{] call[LOG.debug, parameter[literal["Start building Json service root document"]]] TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=UTF8, postfix_operators=[], prefix_operators=[], qualifier=JsonEncoding, selectors=[])], member=createGenerator, postfix_operators=[], prefix_operators=[], qualifier=JSON_FACTORY, selectors=[], type_arguments=None), name=jsonGenerator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonGenerator, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=writeStartObject, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=CONTEXT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=entityDataModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getContextURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=writeStringField, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=VALUE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeArrayFieldStart, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getEntityContainer, postfix_operators=[], prefix_operators=[], qualifier=entityDataModel, selectors=[MethodInvocation(arguments=[], member=getEntitySets, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=entities)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=EntitySet, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isIncludedInServiceDocument, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jsonGenerator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=entities, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entity)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EntitySet, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getEntityContainer, postfix_operators=[], prefix_operators=[], qualifier=entityDataModel, selectors=[MethodInvocation(arguments=[], member=getSingletons, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=singletons)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Singleton, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jsonGenerator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=singleton, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=singletons, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=singleton)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Singleton, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writeEndArray, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writeEndObject, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=StandardCharsets.UTF_8, selectors=[], type_arguments=None)], member=toString, postfix_operators=[], prefix_operators=[], qualifier=stream, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="It is unable to render service document"), 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=ODataRenderException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=stream, type=ReferenceType(arguments=None, dimensions=[], name=ByteArrayOutputStream, sub_type=None), value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByteArrayOutputStream, sub_type=None)))]) end[}] END[}]
Keyword[public] identifier[String] identifier[buildJson] operator[SEP] operator[SEP] Keyword[throws] identifier[ODataRenderException] { identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[ByteArrayOutputStream] identifier[stream] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] { identifier[JsonGenerator] identifier[jsonGenerator] operator[=] identifier[JSON_FACTORY] operator[SEP] identifier[createGenerator] operator[SEP] identifier[stream] , identifier[JsonEncoding] operator[SEP] identifier[UTF8] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeStartObject] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeStringField] operator[SEP] identifier[CONTEXT] , identifier[getContextURL] operator[SEP] identifier[uri] , identifier[entityDataModel] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeArrayFieldStart] operator[SEP] identifier[VALUE] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[EntitySet] operator[>] identifier[entities] operator[=] identifier[entityDataModel] operator[SEP] identifier[getEntityContainer] operator[SEP] operator[SEP] operator[SEP] identifier[getEntitySets] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[EntitySet] identifier[entity] operator[:] identifier[entities] operator[SEP] { Keyword[if] operator[SEP] identifier[entity] operator[SEP] identifier[isIncludedInServiceDocument] operator[SEP] operator[SEP] operator[SEP] { identifier[writeObject] operator[SEP] identifier[jsonGenerator] , identifier[entity] operator[SEP] operator[SEP] } } identifier[List] operator[<] identifier[Singleton] operator[>] identifier[singletons] operator[=] identifier[entityDataModel] operator[SEP] identifier[getEntityContainer] operator[SEP] operator[SEP] operator[SEP] identifier[getSingletons] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Singleton] identifier[singleton] operator[:] identifier[singletons] operator[SEP] { identifier[writeObject] operator[SEP] identifier[jsonGenerator] , identifier[singleton] operator[SEP] operator[SEP] } identifier[jsonGenerator] operator[SEP] identifier[writeEndArray] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeEndObject] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[stream] operator[SEP] identifier[toString] operator[SEP] identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] { Keyword[throw] Keyword[new] identifier[ODataRenderException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] } }
public MongoCredential withMechanism(final AuthenticationMechanism mechanism) { if (this.mechanism != null) { throw new IllegalArgumentException("Mechanism already set"); } return new MongoCredential(mechanism, userName, source, password, mechanismProperties); }
class class_name[name] begin[{] method[withMechanism, return_type[type[MongoCredential]], modifier[public], parameter[mechanism]] begin[{] if[binary_operation[THIS[member[None.mechanism]], !=, literal[null]]] begin[{] ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Mechanism already set")], 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[ClassCreator(arguments=[MemberReference(member=mechanism, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=userName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=mechanismProperties, 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=MongoCredential, sub_type=None))] end[}] END[}]
Keyword[public] identifier[MongoCredential] identifier[withMechanism] operator[SEP] Keyword[final] identifier[AuthenticationMechanism] identifier[mechanism] operator[SEP] { Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[mechanism] operator[!=] Other[null] operator[SEP] { Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] } Keyword[return] Keyword[new] identifier[MongoCredential] operator[SEP] identifier[mechanism] , identifier[userName] , identifier[source] , identifier[password] , identifier[mechanismProperties] operator[SEP] operator[SEP] }
protected final void run(Block block) { if (stopping) { return; } final Authentication auth = Jenkins.getAuthentication(); task = GeneralNonBlockingStepExecutionUtils.getExecutorService().submit(() -> { threadName = Thread.currentThread().getName(); try { try (ACLContext acl = ACL.as(auth)) { block.run(); } } catch (Throwable e) { if (!stopping) { getContext().onFailure(e); } } finally { threadName = null; task = null; } }); }
class class_name[name] begin[{] method[run, return_type[void], modifier[final protected], parameter[block]] begin[{] if[member[.stopping]] begin[{] return[None] else begin[{] None end[}] local_variable[type[Authentication], auth] assign[member[.task], call[GeneralNonBlockingStepExecutionUtils.getExecutorService, parameter[]]] end[}] END[}]
Keyword[protected] Keyword[final] Keyword[void] identifier[run] operator[SEP] identifier[Block] identifier[block] operator[SEP] { Keyword[if] operator[SEP] identifier[stopping] operator[SEP] { Keyword[return] operator[SEP] } Keyword[final] identifier[Authentication] identifier[auth] operator[=] identifier[Jenkins] operator[SEP] identifier[getAuthentication] operator[SEP] operator[SEP] operator[SEP] identifier[task] operator[=] identifier[GeneralNonBlockingStepExecutionUtils] operator[SEP] identifier[getExecutorService] operator[SEP] operator[SEP] operator[SEP] identifier[submit] operator[SEP] operator[SEP] operator[SEP] operator[->] { identifier[threadName] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[try] { Keyword[try] operator[SEP] identifier[ACLContext] identifier[acl] operator[=] identifier[ACL] operator[SEP] identifier[as] operator[SEP] identifier[auth] operator[SEP] operator[SEP] { identifier[block] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP] } } Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] { Keyword[if] operator[SEP] operator[!] identifier[stopping] operator[SEP] { identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[onFailure] operator[SEP] identifier[e] operator[SEP] operator[SEP] } } Keyword[finally] { identifier[threadName] operator[=] Other[null] operator[SEP] identifier[task] operator[=] Other[null] operator[SEP] } } operator[SEP] operator[SEP] }
private void followRedirections(HttpMessage message, HttpRequestConfig requestConfig) throws IOException { HttpRedirectionValidator validator = requestConfig.getRedirectionValidator(); validator.notifyMessageReceived(message); User requestingUser = getUser(message); HttpMessage redirectMessage = message; int maxRedirections = client.getParams().getIntParameter(HttpClientParams.MAX_REDIRECTS, 100); for (int i = 0; i < maxRedirections && isRedirectionNeeded(redirectMessage.getResponseHeader().getStatusCode()); i++) { URI newLocation = extractRedirectLocation(redirectMessage); if (newLocation == null || !validator.isValid(newLocation)) { return; } redirectMessage = redirectMessage.cloneAll(); redirectMessage.setRequestingUser(requestingUser); redirectMessage.getRequestHeader().setURI(newLocation); if (isRequestRewriteNeeded(redirectMessage)) { redirectMessage.getRequestHeader().setMethod(HttpRequestHeader.GET); redirectMessage.getRequestHeader().setHeader(HttpHeader.CONTENT_TYPE, null); redirectMessage.getRequestHeader().setHeader(HttpHeader.CONTENT_LENGTH, null); redirectMessage.setRequestBody(""); } sendAndReceiveImpl(redirectMessage, requestConfig); validator.notifyMessageReceived(redirectMessage); // Update the response of the (original) message message.setResponseHeader(redirectMessage.getResponseHeader()); message.setResponseBody(redirectMessage.getResponseBody()); } }
class class_name[name] begin[{] method[followRedirections, return_type[void], modifier[private], parameter[message, requestConfig]] begin[{] local_variable[type[HttpRedirectionValidator], validator] call[validator.notifyMessageReceived, parameter[member[.message]]] local_variable[type[User], requestingUser] local_variable[type[HttpMessage], redirectMessage] local_variable[type[int], maxRedirections] ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=redirectMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extractRedirectLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=newLocation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URI, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=newLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[MemberReference(member=newLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isValid, postfix_operators=[], prefix_operators=['!'], qualifier=validator, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=redirectMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=cloneAll, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=requestingUser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRequestingUser, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getRequestHeader, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[MethodInvocation(arguments=[MemberReference(member=newLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setURI, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=redirectMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isRequestRewriteNeeded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getRequestHeader, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[MethodInvocation(arguments=[MemberReference(member=GET, postfix_operators=[], prefix_operators=[], qualifier=HttpRequestHeader, selectors=[])], member=setMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getRequestHeader, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[MethodInvocation(arguments=[MemberReference(member=CONTENT_TYPE, postfix_operators=[], prefix_operators=[], qualifier=HttpHeader, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setHeader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getRequestHeader, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[MethodInvocation(arguments=[MemberReference(member=CONTENT_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=HttpHeader, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setHeader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=setRequestBody, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=redirectMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requestConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendAndReceiveImpl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=redirectMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=notifyMessageReceived, postfix_operators=[], prefix_operators=[], qualifier=validator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResponseHeader, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[], type_arguments=None)], member=setResponseHeader, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResponseBody, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[], type_arguments=None)], member=setResponseBody, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxRedirections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResponseHeader, postfix_operators=[], prefix_operators=[], qualifier=redirectMessage, selectors=[MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=isRedirectionNeeded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None) end[}] END[}]
Keyword[private] Keyword[void] identifier[followRedirections] operator[SEP] identifier[HttpMessage] identifier[message] , identifier[HttpRequestConfig] identifier[requestConfig] operator[SEP] Keyword[throws] identifier[IOException] { identifier[HttpRedirectionValidator] identifier[validator] operator[=] identifier[requestConfig] operator[SEP] identifier[getRedirectionValidator] operator[SEP] operator[SEP] operator[SEP] identifier[validator] operator[SEP] identifier[notifyMessageReceived] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[User] identifier[requestingUser] operator[=] identifier[getUser] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[HttpMessage] identifier[redirectMessage] operator[=] identifier[message] operator[SEP] Keyword[int] identifier[maxRedirections] operator[=] identifier[client] operator[SEP] identifier[getParams] operator[SEP] operator[SEP] operator[SEP] identifier[getIntParameter] operator[SEP] identifier[HttpClientParams] operator[SEP] identifier[MAX_REDIRECTS] , Other[100] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[maxRedirections] operator[&&] identifier[isRedirectionNeeded] operator[SEP] identifier[redirectMessage] operator[SEP] identifier[getResponseHeader] operator[SEP] operator[SEP] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] { identifier[URI] identifier[newLocation] operator[=] identifier[extractRedirectLocation] operator[SEP] identifier[redirectMessage] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newLocation] operator[==] Other[null] operator[||] operator[!] identifier[validator] operator[SEP] identifier[isValid] operator[SEP] identifier[newLocation] operator[SEP] operator[SEP] { Keyword[return] operator[SEP] } identifier[redirectMessage] operator[=] identifier[redirectMessage] operator[SEP] identifier[cloneAll] operator[SEP] operator[SEP] operator[SEP] identifier[redirectMessage] operator[SEP] identifier[setRequestingUser] operator[SEP] identifier[requestingUser] operator[SEP] operator[SEP] identifier[redirectMessage] operator[SEP] identifier[getRequestHeader] operator[SEP] operator[SEP] operator[SEP] identifier[setURI] operator[SEP] identifier[newLocation] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isRequestRewriteNeeded] operator[SEP] identifier[redirectMessage] operator[SEP] operator[SEP] { identifier[redirectMessage] operator[SEP] identifier[getRequestHeader] operator[SEP] operator[SEP] operator[SEP] identifier[setMethod] operator[SEP] identifier[HttpRequestHeader] operator[SEP] identifier[GET] operator[SEP] operator[SEP] identifier[redirectMessage] operator[SEP] identifier[getRequestHeader] operator[SEP] operator[SEP] operator[SEP] identifier[setHeader] operator[SEP] identifier[HttpHeader] operator[SEP] identifier[CONTENT_TYPE] , Other[null] operator[SEP] operator[SEP] identifier[redirectMessage] operator[SEP] identifier[getRequestHeader] operator[SEP] operator[SEP] operator[SEP] identifier[setHeader] operator[SEP] identifier[HttpHeader] operator[SEP] identifier[CONTENT_LENGTH] , Other[null] operator[SEP] operator[SEP] identifier[redirectMessage] operator[SEP] identifier[setRequestBody] operator[SEP] literal[String] operator[SEP] operator[SEP] } identifier[sendAndReceiveImpl] operator[SEP] identifier[redirectMessage] , identifier[requestConfig] operator[SEP] operator[SEP] identifier[validator] operator[SEP] identifier[notifyMessageReceived] operator[SEP] identifier[redirectMessage] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[setResponseHeader] operator[SEP] identifier[redirectMessage] operator[SEP] identifier[getResponseHeader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[message] operator[SEP] identifier[setResponseBody] operator[SEP] identifier[redirectMessage] operator[SEP] identifier[getResponseBody] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } }
private void cacheCodes() { Set<ProcCode> set = new HashSet<ProcCode>(); if (parent != null) { set.addAll(Arrays.asList(parent.getCodes())); } if (scopeCodes != null) { set.addAll(scopeCodes); } cachedCodes = set.toArray(new ProcCode[set.size()]); Arrays.sort( cachedCodes, new Comparator<ProcCode>() { public int compare(ProcCode code1, ProcCode code2) { return code2.compareTo(code1); } } ); for (ProcCode code : cachedCodes) { hasCrazyCode = hasCrazyCode || !code.startsWithConstant(); hasCheck = hasCheck || code.containsCheck(); } }
class class_name[name] begin[{] method[cacheCodes, return_type[void], modifier[private], parameter[]] begin[{] local_variable[type[Set], set] if[binary_operation[member[.parent], !=, literal[null]]] begin[{] call[set.addAll, parameter[call[Arrays.asList, parameter[call[parent.getCodes, parameter[]]]]]] else begin[{] None end[}] if[binary_operation[member[.scopeCodes], !=, literal[null]]] begin[{] call[set.addAll, parameter[member[.scopeCodes]]] else begin[{] None end[}] assign[member[.cachedCodes], call[set.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=set, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ProcCode, sub_type=None))]]] call[Arrays.sort, parameter[member[.cachedCodes], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=code1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareTo, postfix_operators=[], prefix_operators=[], qualifier=code2, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers=set(), name=code1, type=ReferenceType(arguments=None, dimensions=[], name=ProcCode, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=code2, type=ReferenceType(arguments=None, dimensions=[], name=ProcCode, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ProcCode, sub_type=None))], dimensions=None, name=Comparator, sub_type=None))]] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=hasCrazyCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=hasCrazyCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=startsWithConstant, postfix_operators=[], prefix_operators=['!'], qualifier=code, selectors=[], type_arguments=None), operator=||)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=hasCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=hasCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=containsCheck, postfix_operators=[], prefix_operators=[], qualifier=code, selectors=[], type_arguments=None), operator=||)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=cachedCodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=code)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ProcCode, sub_type=None))), label=None) end[}] END[}]
Keyword[private] Keyword[void] identifier[cacheCodes] operator[SEP] operator[SEP] { identifier[Set] operator[<] identifier[ProcCode] operator[>] identifier[set] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[ProcCode] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parent] operator[!=] Other[null] operator[SEP] { identifier[set] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[parent] operator[SEP] identifier[getCodes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } Keyword[if] operator[SEP] identifier[scopeCodes] operator[!=] Other[null] operator[SEP] { identifier[set] operator[SEP] identifier[addAll] operator[SEP] identifier[scopeCodes] operator[SEP] operator[SEP] } identifier[cachedCodes] operator[=] identifier[set] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[ProcCode] operator[SEP] identifier[set] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[cachedCodes] , Keyword[new] identifier[Comparator] operator[<] identifier[ProcCode] operator[>] operator[SEP] operator[SEP] { Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[ProcCode] identifier[code1] , identifier[ProcCode] identifier[code2] operator[SEP] { Keyword[return] identifier[code2] operator[SEP] identifier[compareTo] operator[SEP] identifier[code1] operator[SEP] operator[SEP] } } operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ProcCode] identifier[code] operator[:] identifier[cachedCodes] operator[SEP] { identifier[hasCrazyCode] operator[=] identifier[hasCrazyCode] operator[||] operator[!] identifier[code] operator[SEP] identifier[startsWithConstant] operator[SEP] operator[SEP] operator[SEP] identifier[hasCheck] operator[=] identifier[hasCheck] operator[||] identifier[code] operator[SEP] identifier[containsCheck] operator[SEP] operator[SEP] operator[SEP] } }
public void setBucketAcl(SetBucketAclRequest request) { checkNotNull(request, "request should not be null."); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT); internalRequest.addParameter("acl", null); if (request.getCannedAcl() != null) { internalRequest.addHeader(Headers.BCE_ACL, request.getCannedAcl().toString()); this.setZeroContentLength(internalRequest); } else if (request.getAccessControlList() != null) { byte[] json = null; List<Grant> grants = request.getAccessControlList(); StringWriter writer = new StringWriter(); try { JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer); jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("accessControlList"); for (Grant grant : grants) { jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("grantee"); for (Grantee grantee : grant.getGrantee()) { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("id", grantee.getId()); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeArrayFieldStart("permission"); for (Permission permission : grant.getPermission()) { jsonGenerator.writeString(permission.toString()); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); jsonGenerator.close(); } catch (IOException e) { throw new BceClientException("Fail to generate json", e); } try { json = writer.toString().getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get UTF-8 bytes", e); } internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json"); internalRequest.setContent(RestartableInputStream.wrap(json)); } else if (request.getJsonAcl() != null) { byte[] json = null; try { json = request.getJsonAcl().getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get UTF-8 bytes", e); } internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json"); internalRequest.setContent(RestartableInputStream.wrap(json)); } else { checkNotNull(null, "request.acl should not be null."); } this.invokeHttpClient(internalRequest, BosResponse.class); }
class class_name[name] begin[{] method[setBucketAcl, return_type[void], modifier[public], parameter[request]] begin[{] call[.checkNotNull, parameter[member[.request], literal["request should not be null."]]] local_variable[type[InternalRequest], internalRequest] call[internalRequest.addParameter, parameter[literal["acl"], literal[null]]] if[binary_operation[call[request.getCannedAcl, parameter[]], !=, literal[null]]] begin[{] call[internalRequest.addHeader, parameter[member[Headers.BCE_ACL], call[request.getCannedAcl, parameter[]]]] THIS[call[None.setZeroContentLength, parameter[member[.internalRequest]]]] else begin[{] if[binary_operation[call[request.getAccessControlList, parameter[]], !=, literal[null]]] begin[{] local_variable[type[byte], json] local_variable[type[List], grants] local_variable[type[StringWriter], writer] TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=jsonGeneratorOf, postfix_operators=[], prefix_operators=[], qualifier=JsonUtils, selectors=[], type_arguments=None), name=jsonGenerator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonGenerator, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=writeStartObject, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="accessControlList")], member=writeArrayFieldStart, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeStartObject, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="grantee")], member=writeArrayFieldStart, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeStartObject, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=grantee, selectors=[], type_arguments=None)], member=writeStringField, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writeEndObject, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getGrantee, postfix_operators=[], prefix_operators=[], qualifier=grant, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=grantee)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Grantee, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writeEndArray, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="permission")], member=writeArrayFieldStart, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=permission, selectors=[], type_arguments=None)], member=writeString, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getPermission, postfix_operators=[], prefix_operators=[], qualifier=grant, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=permission)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Permission, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writeEndArray, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writeEndObject, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=grants, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=grant)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Grant, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writeEndArray, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=writeEndObject, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=jsonGenerator, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Fail to generate json"), 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=BceClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None) TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=json, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[MethodInvocation(arguments=[MemberReference(member=DEFAULT_ENCODING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBytes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Fail to get UTF-8 bytes"), 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=BceClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None) call[internalRequest.addHeader, parameter[member[Headers.CONTENT_LENGTH], call[String.valueOf, parameter[member[json.length]]]]] call[internalRequest.addHeader, parameter[member[Headers.CONTENT_TYPE], literal["application/json"]]] call[internalRequest.setContent, parameter[call[RestartableInputStream.wrap, parameter[member[.json]]]]] else begin[{] if[binary_operation[call[request.getJsonAcl, parameter[]], !=, literal[null]]] begin[{] local_variable[type[byte], json] TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=json, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getJsonAcl, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[MethodInvocation(arguments=[MemberReference(member=DEFAULT_ENCODING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBytes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Fail to get UTF-8 bytes"), 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=BceClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None) call[internalRequest.addHeader, parameter[member[Headers.CONTENT_LENGTH], call[String.valueOf, parameter[member[json.length]]]]] call[internalRequest.addHeader, parameter[member[Headers.CONTENT_TYPE], literal["application/json"]]] call[internalRequest.setContent, parameter[call[RestartableInputStream.wrap, parameter[member[.json]]]]] else begin[{] call[.checkNotNull, parameter[literal[null], literal["request.acl should not be null."]]] end[}] end[}] end[}] THIS[call[None.invokeHttpClient, parameter[member[.internalRequest], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BosResponse, sub_type=None))]]] end[}] END[}]
Keyword[public] Keyword[void] identifier[setBucketAcl] operator[SEP] identifier[SetBucketAclRequest] identifier[request] operator[SEP] { identifier[checkNotNull] operator[SEP] identifier[request] , literal[String] operator[SEP] operator[SEP] identifier[InternalRequest] identifier[internalRequest] operator[=] Keyword[this] operator[SEP] identifier[createRequest] operator[SEP] identifier[request] , identifier[HttpMethodName] operator[SEP] identifier[PUT] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getCannedAcl] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] { identifier[internalRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[BCE_ACL] , identifier[request] operator[SEP] identifier[getCannedAcl] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setZeroContentLength] operator[SEP] identifier[internalRequest] operator[SEP] operator[SEP] } Keyword[else] Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getAccessControlList] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] { Keyword[byte] operator[SEP] operator[SEP] identifier[json] operator[=] Other[null] operator[SEP] identifier[List] operator[<] identifier[Grant] operator[>] identifier[grants] operator[=] identifier[request] operator[SEP] identifier[getAccessControlList] operator[SEP] operator[SEP] operator[SEP] identifier[StringWriter] identifier[writer] operator[=] Keyword[new] identifier[StringWriter] operator[SEP] operator[SEP] operator[SEP] Keyword[try] { identifier[JsonGenerator] identifier[jsonGenerator] operator[=] identifier[JsonUtils] operator[SEP] identifier[jsonGeneratorOf] operator[SEP] identifier[writer] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeStartObject] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeArrayFieldStart] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Grant] identifier[grant] operator[:] identifier[grants] operator[SEP] { identifier[jsonGenerator] operator[SEP] identifier[writeStartObject] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeArrayFieldStart] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Grantee] identifier[grantee] operator[:] identifier[grant] operator[SEP] identifier[getGrantee] operator[SEP] operator[SEP] operator[SEP] { identifier[jsonGenerator] operator[SEP] identifier[writeStartObject] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeStringField] operator[SEP] literal[String] , identifier[grantee] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeEndObject] operator[SEP] operator[SEP] operator[SEP] } identifier[jsonGenerator] operator[SEP] identifier[writeEndArray] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeArrayFieldStart] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Permission] identifier[permission] operator[:] identifier[grant] operator[SEP] identifier[getPermission] operator[SEP] operator[SEP] operator[SEP] { identifier[jsonGenerator] operator[SEP] identifier[writeString] operator[SEP] identifier[permission] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } identifier[jsonGenerator] operator[SEP] identifier[writeEndArray] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeEndObject] operator[SEP] operator[SEP] operator[SEP] } identifier[jsonGenerator] operator[SEP] identifier[writeEndArray] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[writeEndObject] operator[SEP] operator[SEP] operator[SEP] identifier[jsonGenerator] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] { Keyword[throw] Keyword[new] identifier[BceClientException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] } Keyword[try] { identifier[json] operator[=] identifier[writer] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[DEFAULT_ENCODING] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] { Keyword[throw] Keyword[new] identifier[BceClientException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] } identifier[internalRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[CONTENT_LENGTH] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[json] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[CONTENT_TYPE] , literal[String] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[setContent] operator[SEP] identifier[RestartableInputStream] operator[SEP] identifier[wrap] operator[SEP] identifier[json] operator[SEP] operator[SEP] operator[SEP] } Keyword[else] Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getJsonAcl] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] { Keyword[byte] operator[SEP] operator[SEP] identifier[json] operator[=] Other[null] operator[SEP] Keyword[try] { identifier[json] operator[=] identifier[request] operator[SEP] identifier[getJsonAcl] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[DEFAULT_ENCODING] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] { Keyword[throw] Keyword[new] identifier[BceClientException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] } identifier[internalRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[CONTENT_LENGTH] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[json] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[CONTENT_TYPE] , literal[String] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[setContent] operator[SEP] identifier[RestartableInputStream] operator[SEP] identifier[wrap] operator[SEP] identifier[json] operator[SEP] operator[SEP] operator[SEP] } Keyword[else] { identifier[checkNotNull] operator[SEP] Other[null] , literal[String] operator[SEP] operator[SEP] } Keyword[this] operator[SEP] identifier[invokeHttpClient] operator[SEP] identifier[internalRequest] , identifier[BosResponse] operator[SEP] Keyword[class] operator[SEP] operator[SEP] }
private synchronized PersistenceServiceUnit createPsu() throws Exception { if (psu != null) { return psu; } // Load the PSU including the most recent entities. PersistenceServiceUnit retMe = createLatestPsu(); // If any tables are not up to the current code level, re-load the PSU with backleveled entities. int instanceVersion = getJobInstanceTableVersion(retMe); if (instanceVersion < 3) { logger.fine("The GROUPNAMES column could not be found. The persistence service unit will exclude the V3 instance entity."); retMe.close(); retMe = createPsu(instanceVersion, MAX_EXECUTION_VERSION); } int executionVersion = getJobExecutionTableVersion(retMe); if (executionVersion < 2) { logger.fine("The JOBPARAMETERS table could not be found. The persistence service unit will exclude the V2 execution entity."); retMe.close(); retMe = createPsu(instanceVersion, executionVersion); } //222050 - Backout 205106 RemotablePartitionEntity.class.getName()); // Perform recovery immediately, before returning from this method, so that // other callers won't be able to access the PSU (via getPsu()) until recovery is complete. new WSStartupRecoveryServiceImpl().setIPersistenceManagerService(JPAPersistenceManagerImpl.this).setPersistenceServiceUnit(retMe).recoverLocalJobsInInflightStates(); //222050 - Backout 205106 .recoverLocalPartitionsInInflightStates(); // Make sure we assign psu before leaving the synchronized block. psu = retMe; return psu; }
class class_name[name] begin[{] method[createPsu, return_type[type[PersistenceServiceUnit]], modifier[synchronized private], parameter[]] begin[{] if[binary_operation[member[.psu], !=, literal[null]]] begin[{] return[member[.psu]] else begin[{] None end[}] local_variable[type[PersistenceServiceUnit], retMe] local_variable[type[int], instanceVersion] if[binary_operation[member[.instanceVersion], <, literal[3]]] begin[{] call[logger.fine, parameter[literal["The GROUPNAMES column could not be found. The persistence service unit will exclude the V3 instance entity."]]] call[retMe.close, parameter[]] assign[member[.retMe], call[.createPsu, parameter[member[.instanceVersion], member[.MAX_EXECUTION_VERSION]]]] else begin[{] None end[}] local_variable[type[int], executionVersion] if[binary_operation[member[.executionVersion], <, literal[2]]] begin[{] call[logger.fine, parameter[literal["The JOBPARAMETERS table could not be found. The persistence service unit will exclude the V2 execution entity."]]] call[retMe.close, parameter[]] assign[member[.retMe], call[.createPsu, parameter[member[.instanceVersion], member[.executionVersion]]]] else begin[{] None end[}] ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=JPAPersistenceManagerImpl, selectors=[])], member=setIPersistenceManagerService, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=retMe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPersistenceServiceUnit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=recoverLocalJobsInInflightStates, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=WSStartupRecoveryServiceImpl, sub_type=None)) assign[member[.psu], member[.retMe]] return[member[.psu]] end[}] END[}]
Keyword[private] Keyword[synchronized] identifier[PersistenceServiceUnit] identifier[createPsu] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] { Keyword[if] operator[SEP] identifier[psu] operator[!=] Other[null] operator[SEP] { Keyword[return] identifier[psu] operator[SEP] } identifier[PersistenceServiceUnit] identifier[retMe] operator[=] identifier[createLatestPsu] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[instanceVersion] operator[=] identifier[getJobInstanceTableVersion] operator[SEP] identifier[retMe] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[instanceVersion] operator[<] Other[3] operator[SEP] { identifier[logger] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retMe] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[retMe] operator[=] identifier[createPsu] operator[SEP] identifier[instanceVersion] , identifier[MAX_EXECUTION_VERSION] operator[SEP] operator[SEP] } Keyword[int] identifier[executionVersion] operator[=] identifier[getJobExecutionTableVersion] operator[SEP] identifier[retMe] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[executionVersion] operator[<] Other[2] operator[SEP] { identifier[logger] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[retMe] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[retMe] operator[=] identifier[createPsu] operator[SEP] identifier[instanceVersion] , identifier[executionVersion] operator[SEP] operator[SEP] } Keyword[new] identifier[WSStartupRecoveryServiceImpl] operator[SEP] operator[SEP] operator[SEP] identifier[setIPersistenceManagerService] operator[SEP] identifier[JPAPersistenceManagerImpl] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[setPersistenceServiceUnit] operator[SEP] identifier[retMe] operator[SEP] operator[SEP] identifier[recoverLocalJobsInInflightStates] operator[SEP] operator[SEP] operator[SEP] identifier[psu] operator[=] identifier[retMe] operator[SEP] Keyword[return] identifier[psu] operator[SEP] }
public static PlaceholderFragment newInstance(int sectionNumber, @LayoutRes int layoutRes) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); args.putInt(ARG_LAYOUT_RESOURCE, layoutRes); fragment.setArguments(args); return fragment; }
class class_name[name] begin[{] method[newInstance, return_type[type[PlaceholderFragment]], modifier[public static], parameter[sectionNumber, layoutRes]] begin[{] local_variable[type[PlaceholderFragment], fragment] local_variable[type[Bundle], args] call[args.putInt, parameter[member[.ARG_SECTION_NUMBER], member[.sectionNumber]]] call[args.putInt, parameter[member[.ARG_LAYOUT_RESOURCE], member[.layoutRes]]] call[fragment.setArguments, parameter[member[.args]]] return[member[.fragment]] end[}] END[}]
Keyword[public] Keyword[static] identifier[PlaceholderFragment] identifier[newInstance] operator[SEP] Keyword[int] identifier[sectionNumber] , annotation[@] identifier[LayoutRes] Keyword[int] identifier[layoutRes] operator[SEP] { identifier[PlaceholderFragment] identifier[fragment] operator[=] Keyword[new] identifier[PlaceholderFragment] operator[SEP] operator[SEP] operator[SEP] identifier[Bundle] identifier[args] operator[=] Keyword[new] identifier[Bundle] operator[SEP] operator[SEP] operator[SEP] identifier[args] operator[SEP] identifier[putInt] operator[SEP] identifier[ARG_SECTION_NUMBER] , identifier[sectionNumber] operator[SEP] operator[SEP] identifier[args] operator[SEP] identifier[putInt] operator[SEP] identifier[ARG_LAYOUT_RESOURCE] , identifier[layoutRes] operator[SEP] operator[SEP] identifier[fragment] operator[SEP] identifier[setArguments] operator[SEP] identifier[args] operator[SEP] operator[SEP] Keyword[return] identifier[fragment] operator[SEP] }
@Override public HashMap<String, String> getValuesMap() { if (optionsHolder == null ) return null; else return optionsHolder.getOptionsMap(); }
class class_name[name] begin[{] method[getValuesMap, return_type[type[HashMap]], modifier[public], parameter[]] begin[{] if[binary_operation[member[.optionsHolder], ==, literal[null]]] begin[{] return[literal[null]] else begin[{] return[call[optionsHolder.getOptionsMap, parameter[]]] end[}] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[getValuesMap] operator[SEP] operator[SEP] { Keyword[if] operator[SEP] identifier[optionsHolder] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[else] Keyword[return] identifier[optionsHolder] operator[SEP] identifier[getOptionsMap] operator[SEP] operator[SEP] operator[SEP] }
public static void main(final String[] args) throws InterruptedException { MongoClient mongoClient; if (args.length == 0) { // connect to the local database server mongoClient = MongoClients.create(); } else { mongoClient = MongoClients.create(args[0]); } // create codec registry for POJOs CodecRegistry pojoCodecRegistry = fromRegistries(MongoClients.getDefaultCodecRegistry(), fromProviders(PojoCodecProvider.builder().automatic(true).build())); // get handle to "mydb" database MongoDatabase database = mongoClient.getDatabase("mydb").withCodecRegistry(pojoCodecRegistry); // get a handle to the "people" collection final MongoCollection<Person> collection = database.getCollection("people", Person.class); // drop all the data in it final CountDownLatch dropLatch = new CountDownLatch(1); collection.drop(new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { dropLatch.countDown(); } }); dropLatch.await(); // make a document and insert it final Person ada = new Person("Ada Byron", 20, new Address("St James Square", "London", "W1")); System.out.println("Original Person Model: " + ada); collection.insertOne(ada, new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { // Person will now have an ObjectId System.out.println("Mutated Person Model: " + ada); System.out.println("Inserted!"); } }); // get it (since it's the only one in there since we dropped the rest earlier on) SingleResultCallback<Person> printCallback = new SingleResultCallback<Person>() { @Override public void onResult(final Person person, final Throwable t) { System.out.println(person); } }; collection.find().first(printCallback); // now, lets add some more people so we can explore queries and cursors List<Person> people = asList( new Person("Charles Babbage", 45, new Address("5 Devonshire Street", "London", "W11")), new Person("Alan Turing", 28, new Address("Bletchley Hall", "Bletchley Park", "MK12")), new Person("Timothy Berners-Lee", 61, new Address("Colehill", "Wimborne", null)) ); final CountDownLatch countLatch = new CountDownLatch(1); collection.insertMany(people, new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { collection.countDocuments(new SingleResultCallback<Long>() { @Override public void onResult(final Long count, final Throwable t) { System.out.println("total # of people " + count); countLatch.countDown(); } }); } }); countLatch.await(); System.out.println(""); // lets get all the documents in the collection and print them out Block<Person> printBlock = new Block<Person>() { @Override public void apply(final Person person) { System.out.println(person); } }; SingleResultCallback<Void> callbackWhenFinished = new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { System.out.println("Operation Finished!"); } }; collection.find().forEach(printBlock, callbackWhenFinished); System.out.println(""); // now use a query to get 1 document out collection.find(eq("address.city", "Wimborne")).first(printCallback); System.out.println(""); // now lets find every over 30 collection.find(gt("age", 30)).forEach(printBlock, callbackWhenFinished); System.out.println(""); // Update One SingleResultCallback<UpdateResult> printModifiedCount = new SingleResultCallback<UpdateResult>() { @Override public void onResult(final UpdateResult result, final Throwable t) { System.out.println(result.getModifiedCount()); } }; collection.updateOne(eq("name", "Ada Byron"), combine(set("age", 23), set("name", "Ada Lovelace")), printModifiedCount); System.out.println(""); // Update Many collection.updateMany(not(eq("zip", null)), set("zip", null), printModifiedCount); System.out.println(""); // Replace One collection.replaceOne(eq("name", "Ada Lovelace"), ada, printModifiedCount); // Delete One SingleResultCallback<DeleteResult> printDeletedCount = new SingleResultCallback<DeleteResult>() { @Override public void onResult(final DeleteResult result, final Throwable t) { System.out.println(result.getDeletedCount()); } }; collection.deleteOne(eq("address.city", "Wimborne"), printDeletedCount); // Delete Many collection.deleteMany(eq("address.city", "London"), printDeletedCount); // Clean up final CountDownLatch deleteLatch = new CountDownLatch(1); database.drop(new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { deleteLatch.countDown(); } }); deleteLatch.await(); // release resources mongoClient.close(); }
class class_name[name] begin[{] method[main, return_type[void], modifier[public static], parameter[args]] begin[{] local_variable[type[MongoClient], mongoClient] if[binary_operation[member[args.length], ==, literal[0]]] begin[{] assign[member[.mongoClient], call[MongoClients.create, parameter[]]] else begin[{] assign[member[.mongoClient], call[MongoClients.create, parameter[member[.args]]]] end[}] local_variable[type[CodecRegistry], pojoCodecRegistry] local_variable[type[MongoDatabase], database] local_variable[type[MongoCollection], collection] local_variable[type[CountDownLatch], dropLatch] call[collection.drop, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=countDown, postfix_operators=[], prefix_operators=[], qualifier=dropLatch, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onResult, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=result, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers={'final'}, name=t, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None))], dimensions=None, name=SingleResultCallback, sub_type=None))]] call[dropLatch.await, parameter[]] local_variable[type[Person], ada] call[System.out.println, parameter[binary_operation[literal["Original Person Model: "], +, member[.ada]]]] call[collection.insertOne, parameter[member[.ada], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Mutated Person Model: "), operandr=MemberReference(member=ada, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Inserted!")], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onResult, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=result, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers={'final'}, name=t, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None))], dimensions=None, name=SingleResultCallback, sub_type=None))]] local_variable[type[SingleResultCallback], printCallback] call[collection.find, parameter[]] local_variable[type[List], people] local_variable[type[CountDownLatch], countLatch] call[collection.insertMany, parameter[member[.people], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="total # of people "), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=countDown, postfix_operators=[], prefix_operators=[], qualifier=countLatch, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onResult, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=count, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers={'final'}, name=t, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))], dimensions=None, name=SingleResultCallback, sub_type=None))], member=countDocuments, postfix_operators=[], prefix_operators=[], qualifier=collection, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onResult, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=result, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers={'final'}, name=t, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None))], dimensions=None, name=SingleResultCallback, sub_type=None))]] call[countLatch.await, parameter[]] call[System.out.println, parameter[literal[""]]] local_variable[type[Block], printBlock] local_variable[type[SingleResultCallback], callbackWhenFinished] call[collection.find, parameter[]] call[System.out.println, parameter[literal[""]]] call[collection.find, parameter[call[.eq, parameter[literal["address.city"], literal["Wimborne"]]]]] call[System.out.println, parameter[literal[""]]] call[collection.find, parameter[call[.gt, parameter[literal["age"], literal[30]]]]] call[System.out.println, parameter[literal[""]]] local_variable[type[SingleResultCallback], printModifiedCount] call[collection.updateOne, parameter[call[.eq, parameter[literal["name"], literal["Ada Byron"]]], call[.combine, parameter[call[.set, parameter[literal["age"], literal[23]]], call[.set, parameter[literal["name"], literal["Ada Lovelace"]]]]], member[.printModifiedCount]]] call[System.out.println, parameter[literal[""]]] call[collection.updateMany, parameter[call[.not, parameter[call[.eq, parameter[literal["zip"], literal[null]]]]], call[.set, parameter[literal["zip"], literal[null]]], member[.printModifiedCount]]] call[System.out.println, parameter[literal[""]]] call[collection.replaceOne, parameter[call[.eq, parameter[literal["name"], literal["Ada Lovelace"]]], member[.ada], member[.printModifiedCount]]] local_variable[type[SingleResultCallback], printDeletedCount] call[collection.deleteOne, parameter[call[.eq, parameter[literal["address.city"], literal["Wimborne"]]], member[.printDeletedCount]]] call[collection.deleteMany, parameter[call[.eq, parameter[literal["address.city"], literal["London"]]], member[.printDeletedCount]]] local_variable[type[CountDownLatch], deleteLatch] call[database.drop, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=countDown, postfix_operators=[], prefix_operators=[], qualifier=deleteLatch, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onResult, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=result, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers={'final'}, name=t, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Void, sub_type=None))], dimensions=None, name=SingleResultCallback, sub_type=None))]] call[deleteLatch.await, parameter[]] call[mongoClient.close, parameter[]] end[}] END[}]
Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[InterruptedException] { identifier[MongoClient] identifier[mongoClient] operator[SEP] Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] { identifier[mongoClient] operator[=] identifier[MongoClients] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] } Keyword[else] { identifier[mongoClient] operator[=] identifier[MongoClients] operator[SEP] identifier[create] operator[SEP] identifier[args] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] } identifier[CodecRegistry] identifier[pojoCodecRegistry] operator[=] identifier[fromRegistries] operator[SEP] identifier[MongoClients] operator[SEP] identifier[getDefaultCodecRegistry] operator[SEP] operator[SEP] , identifier[fromProviders] operator[SEP] identifier[PojoCodecProvider] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[automatic] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[MongoDatabase] identifier[database] operator[=] identifier[mongoClient] operator[SEP] identifier[getDatabase] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[withCodecRegistry] operator[SEP] identifier[pojoCodecRegistry] operator[SEP] operator[SEP] Keyword[final] identifier[MongoCollection] operator[<] identifier[Person] operator[>] identifier[collection] operator[=] identifier[database] operator[SEP] identifier[getCollection] operator[SEP] literal[String] , identifier[Person] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] identifier[CountDownLatch] identifier[dropLatch] operator[=] Keyword[new] identifier[CountDownLatch] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[collection] operator[SEP] identifier[drop] operator[SEP] Keyword[new] identifier[SingleResultCallback] operator[<] identifier[Void] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResult] operator[SEP] Keyword[final] identifier[Void] identifier[result] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] { identifier[dropLatch] operator[SEP] identifier[countDown] operator[SEP] operator[SEP] operator[SEP] } } operator[SEP] operator[SEP] identifier[dropLatch] operator[SEP] identifier[await] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Person] identifier[ada] operator[=] Keyword[new] identifier[Person] operator[SEP] literal[String] , Other[20] , Keyword[new] identifier[Address] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[ada] operator[SEP] operator[SEP] identifier[collection] operator[SEP] identifier[insertOne] operator[SEP] identifier[ada] , Keyword[new] identifier[SingleResultCallback] operator[<] identifier[Void] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResult] operator[SEP] Keyword[final] identifier[Void] identifier[result] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] { identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[ada] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] } } operator[SEP] operator[SEP] identifier[SingleResultCallback] operator[<] identifier[Person] operator[>] identifier[printCallback] operator[=] Keyword[new] identifier[SingleResultCallback] operator[<] identifier[Person] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResult] operator[SEP] Keyword[final] identifier[Person] identifier[person] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] { identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[person] operator[SEP] operator[SEP] } } operator[SEP] identifier[collection] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] identifier[first] operator[SEP] identifier[printCallback] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Person] operator[>] identifier[people] operator[=] identifier[asList] operator[SEP] Keyword[new] identifier[Person] operator[SEP] literal[String] , Other[45] , Keyword[new] identifier[Address] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] , Keyword[new] identifier[Person] operator[SEP] literal[String] , Other[28] , Keyword[new] identifier[Address] operator[SEP] literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] , Keyword[new] identifier[Person] operator[SEP] literal[String] , Other[61] , Keyword[new] identifier[Address] operator[SEP] literal[String] , literal[String] , Other[null] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[CountDownLatch] identifier[countLatch] operator[=] Keyword[new] identifier[CountDownLatch] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[collection] operator[SEP] identifier[insertMany] operator[SEP] identifier[people] , Keyword[new] identifier[SingleResultCallback] operator[<] identifier[Void] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResult] operator[SEP] Keyword[final] identifier[Void] identifier[result] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] { identifier[collection] operator[SEP] identifier[countDocuments] operator[SEP] Keyword[new] identifier[SingleResultCallback] operator[<] identifier[Long] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResult] operator[SEP] Keyword[final] identifier[Long] identifier[count] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] { identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[count] operator[SEP] operator[SEP] identifier[countLatch] operator[SEP] identifier[countDown] operator[SEP] operator[SEP] operator[SEP] } } operator[SEP] operator[SEP] } } operator[SEP] operator[SEP] identifier[countLatch] operator[SEP] identifier[await] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Block] operator[<] identifier[Person] operator[>] identifier[printBlock] operator[=] Keyword[new] identifier[Block] operator[<] identifier[Person] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[apply] operator[SEP] Keyword[final] identifier[Person] identifier[person] operator[SEP] { identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[person] operator[SEP] operator[SEP] } } operator[SEP] identifier[SingleResultCallback] operator[<] identifier[Void] operator[>] identifier[callbackWhenFinished] operator[=] Keyword[new] identifier[SingleResultCallback] operator[<] identifier[Void] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResult] operator[SEP] Keyword[final] identifier[Void] identifier[result] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] { identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] } } operator[SEP] identifier[collection] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[printBlock] , identifier[callbackWhenFinished] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[collection] operator[SEP] identifier[find] operator[SEP] identifier[eq] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[first] operator[SEP] identifier[printCallback] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[collection] operator[SEP] identifier[find] operator[SEP] identifier[gt] operator[SEP] literal[String] , Other[30] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[printBlock] , identifier[callbackWhenFinished] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[SingleResultCallback] operator[<] identifier[UpdateResult] operator[>] identifier[printModifiedCount] operator[=] Keyword[new] identifier[SingleResultCallback] operator[<] identifier[UpdateResult] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResult] operator[SEP] Keyword[final] identifier[UpdateResult] identifier[result] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] { identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[result] operator[SEP] identifier[getModifiedCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } } operator[SEP] identifier[collection] operator[SEP] identifier[updateOne] operator[SEP] identifier[eq] operator[SEP] literal[String] , literal[String] operator[SEP] , identifier[combine] operator[SEP] identifier[set] operator[SEP] literal[String] , Other[23] operator[SEP] , identifier[set] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] , identifier[printModifiedCount] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[collection] operator[SEP] identifier[updateMany] operator[SEP] identifier[not] operator[SEP] identifier[eq] operator[SEP] literal[String] , Other[null] operator[SEP] operator[SEP] , identifier[set] operator[SEP] literal[String] , Other[null] operator[SEP] , identifier[printModifiedCount] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[collection] operator[SEP] identifier[replaceOne] operator[SEP] identifier[eq] operator[SEP] literal[String] , literal[String] operator[SEP] , identifier[ada] , identifier[printModifiedCount] operator[SEP] operator[SEP] identifier[SingleResultCallback] operator[<] identifier[DeleteResult] operator[>] identifier[printDeletedCount] operator[=] Keyword[new] identifier[SingleResultCallback] operator[<] identifier[DeleteResult] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResult] operator[SEP] Keyword[final] identifier[DeleteResult] identifier[result] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] { identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[result] operator[SEP] identifier[getDeletedCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } } operator[SEP] identifier[collection] operator[SEP] identifier[deleteOne] operator[SEP] identifier[eq] operator[SEP] literal[String] , literal[String] operator[SEP] , identifier[printDeletedCount] operator[SEP] operator[SEP] identifier[collection] operator[SEP] identifier[deleteMany] operator[SEP] identifier[eq] operator[SEP] literal[String] , literal[String] operator[SEP] , identifier[printDeletedCount] operator[SEP] operator[SEP] Keyword[final] identifier[CountDownLatch] identifier[deleteLatch] operator[=] Keyword[new] identifier[CountDownLatch] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[database] operator[SEP] identifier[drop] operator[SEP] Keyword[new] identifier[SingleResultCallback] operator[<] identifier[Void] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResult] operator[SEP] Keyword[final] identifier[Void] identifier[result] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] { identifier[deleteLatch] operator[SEP] identifier[countDown] operator[SEP] operator[SEP] operator[SEP] } } operator[SEP] operator[SEP] identifier[deleteLatch] operator[SEP] identifier[await] operator[SEP] operator[SEP] operator[SEP] identifier[mongoClient] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] }
@Override public String getConversationId() { final HttpSession session = this.getPortalSesion(false); if (session == null) { return null; } return session.getId(); }
class class_name[name] begin[{] method[getConversationId, return_type[type[String]], modifier[public], parameter[]] begin[{] local_variable[type[HttpSession], session] if[binary_operation[member[.session], ==, literal[null]]] begin[{] return[literal[null]] else begin[{] None end[}] return[call[session.getId, parameter[]]] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getConversationId] operator[SEP] operator[SEP] { Keyword[final] identifier[HttpSession] identifier[session] operator[=] Keyword[this] operator[SEP] identifier[getPortalSesion] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[session] operator[==] Other[null] operator[SEP] { Keyword[return] Other[null] operator[SEP] } Keyword[return] identifier[session] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] }
public Observable<StorageAccountManagementPoliciesInner> getManagementPoliciesAsync(String resourceGroupName, String accountName) { return getManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<StorageAccountManagementPoliciesInner>, StorageAccountManagementPoliciesInner>() { @Override public StorageAccountManagementPoliciesInner call(ServiceResponse<StorageAccountManagementPoliciesInner> response) { return response.body(); } }); }
class class_name[name] begin[{] method[getManagementPoliciesAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, accountName]] begin[{] return[call[.getManagementPoliciesWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.accountName]]]] end[}] END[}]
Keyword[public] identifier[Observable] operator[<] identifier[StorageAccountManagementPoliciesInner] operator[>] identifier[getManagementPoliciesAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[accountName] operator[SEP] { Keyword[return] identifier[getManagementPoliciesWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[accountName] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[StorageAccountManagementPoliciesInner] operator[>] , identifier[StorageAccountManagementPoliciesInner] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] identifier[StorageAccountManagementPoliciesInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[StorageAccountManagementPoliciesInner] operator[>] identifier[response] operator[SEP] { Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] } } operator[SEP] operator[SEP] }
public static Experiment readExperiment(final InputStream inputStream) throws IOException { checkNotNull(inputStream); try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { return readExperiment(reader); } }
class class_name[name] begin[{] method[readExperiment, return_type[type[Experiment]], modifier[public static], parameter[inputStream]] begin[{] call[.checkNotNull, parameter[member[.inputStream]]] TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readExperiment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=reader, type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None), value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=inputStream, 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=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)))]) end[}] END[}]
Keyword[public] Keyword[static] identifier[Experiment] identifier[readExperiment] operator[SEP] Keyword[final] identifier[InputStream] identifier[inputStream] operator[SEP] Keyword[throws] identifier[IOException] { identifier[checkNotNull] operator[SEP] identifier[inputStream] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[inputStream] operator[SEP] operator[SEP] operator[SEP] { Keyword[return] identifier[readExperiment] operator[SEP] identifier[reader] operator[SEP] operator[SEP] } }
public <T> List<T> convertEDBObjectsToModelObjects(Class<T> model, List<EDBObject> objects) { List<T> models = new ArrayList<>(); for (EDBObject object : objects) { T instance = convertEDBObjectToModel(model, object); if (instance != null) { models.add(instance); } } return models; }
class class_name[name] begin[{] method[convertEDBObjectsToModelObjects, return_type[type[List]], modifier[public], parameter[model, objects]] begin[{] local_variable[type[List], models] ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convertEDBObjectToModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=instance)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=instance, 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=instance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=models, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=objects, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=object)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EDBObject, sub_type=None))), label=None) return[member[.models]] end[}] END[}]
Keyword[public] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[convertEDBObjectsToModelObjects] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[model] , identifier[List] operator[<] identifier[EDBObject] operator[>] identifier[objects] operator[SEP] { identifier[List] operator[<] identifier[T] operator[>] identifier[models] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[EDBObject] identifier[object] operator[:] identifier[objects] operator[SEP] { identifier[T] identifier[instance] operator[=] identifier[convertEDBObjectToModel] operator[SEP] identifier[model] , identifier[object] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[instance] operator[!=] Other[null] operator[SEP] { identifier[models] operator[SEP] identifier[add] operator[SEP] identifier[instance] operator[SEP] operator[SEP] } } Keyword[return] identifier[models] operator[SEP] }
@Override public ValidationResult validate(FormCheckerElement elem) { String value = elem.getValue(); ValidationResult vr = ValidationResult.ok(); if (value != null && !"".equals(value)) { vr = allCriteriaSatisfied(elem); } else { // blank input is valid if it's not required if (elem.isRequired()) { vr = ValidationResult.fail("jformchecker.required", ""); } } return vr; }
class class_name[name] begin[{] method[validate, return_type[type[ValidationResult]], modifier[public], parameter[elem]] begin[{] local_variable[type[String], value] local_variable[type[ValidationResult], vr] if[binary_operation[binary_operation[member[.value], !=, literal[null]], &&, literal[""]]] begin[{] assign[member[.vr], call[.allCriteriaSatisfied, parameter[member[.elem]]]] else begin[{] if[call[elem.isRequired, parameter[]]] begin[{] assign[member[.vr], call[ValidationResult.fail, parameter[literal["jformchecker.required"], literal[""]]]] else begin[{] None end[}] end[}] return[member[.vr]] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] identifier[ValidationResult] identifier[validate] operator[SEP] identifier[FormCheckerElement] identifier[elem] operator[SEP] { identifier[String] identifier[value] operator[=] identifier[elem] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[ValidationResult] identifier[vr] operator[=] identifier[ValidationResult] operator[SEP] identifier[ok] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[&&] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[value] operator[SEP] operator[SEP] { identifier[vr] operator[=] identifier[allCriteriaSatisfied] operator[SEP] identifier[elem] operator[SEP] operator[SEP] } Keyword[else] { Keyword[if] operator[SEP] identifier[elem] operator[SEP] identifier[isRequired] operator[SEP] operator[SEP] operator[SEP] { identifier[vr] operator[=] identifier[ValidationResult] operator[SEP] identifier[fail] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] } } Keyword[return] identifier[vr] operator[SEP] }
public static boolean copyFile(final File source, final File destination, final boolean lastModified) throws IOException { return copyFile(source, destination, null, null, lastModified); }
class class_name[name] begin[{] method[copyFile, return_type[type[boolean]], modifier[public static], parameter[source, destination, lastModified]] begin[{] return[call[.copyFile, parameter[member[.source], member[.destination], literal[null], literal[null], member[.lastModified]]]] end[}] END[}]
Keyword[public] Keyword[static] Keyword[boolean] identifier[copyFile] operator[SEP] Keyword[final] identifier[File] identifier[source] , Keyword[final] identifier[File] identifier[destination] , Keyword[final] Keyword[boolean] identifier[lastModified] operator[SEP] Keyword[throws] identifier[IOException] { Keyword[return] identifier[copyFile] operator[SEP] identifier[source] , identifier[destination] , Other[null] , Other[null] , identifier[lastModified] operator[SEP] operator[SEP] }
@Override public void reset() throws IOException { abortIfNeeded(); fileChannel.position(markPos); if (log.isTraceEnabled()) log.trace("Reset to position " + markPos); }
class class_name[name] begin[{] method[reset, return_type[void], modifier[public], parameter[]] begin[{] call[.abortIfNeeded, parameter[]] call[fileChannel.position, parameter[member[.markPos]]] if[call[log.isTraceEnabled, parameter[]]] begin[{] call[log.trace, parameter[binary_operation[literal["Reset to position "], +, member[.markPos]]]] else begin[{] None end[}] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[reset] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] { identifier[abortIfNeeded] operator[SEP] operator[SEP] operator[SEP] identifier[fileChannel] operator[SEP] identifier[position] operator[SEP] identifier[markPos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] identifier[markPos] operator[SEP] operator[SEP] }
private IAtomContainer getUnplacedAtoms(IAtom atom) { IAtomContainer unplacedAtoms = atom.getBuilder().newInstance(IAtomContainer.class); List bonds = molecule.getConnectedBondsList(atom); IAtom connectedAtom; for (int f = 0; f < bonds.size(); f++) { connectedAtom = ((IBond) bonds.get(f)).getOther(atom); if (!connectedAtom.getFlag(CDKConstants.ISPLACED)) { unplacedAtoms.addAtom(connectedAtom); } } return unplacedAtoms; }
class class_name[name] begin[{] method[getUnplacedAtoms, return_type[type[IAtomContainer]], modifier[private], parameter[atom]] begin[{] local_variable[type[IAtomContainer], unplacedAtoms] local_variable[type[List], bonds] local_variable[type[IAtom], connectedAtom] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=connectedAtom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=bonds, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=IBond, sub_type=None))), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ISPLACED, postfix_operators=[], prefix_operators=[], qualifier=CDKConstants, selectors=[])], member=getFlag, postfix_operators=[], prefix_operators=['!'], qualifier=connectedAtom, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=connectedAtom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAtom, postfix_operators=[], prefix_operators=[], qualifier=unplacedAtoms, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=bonds, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=f)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=f, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None) return[member[.unplacedAtoms]] end[}] END[}]
Keyword[private] identifier[IAtomContainer] identifier[getUnplacedAtoms] operator[SEP] identifier[IAtom] identifier[atom] operator[SEP] { identifier[IAtomContainer] identifier[unplacedAtoms] operator[=] identifier[atom] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IAtomContainer] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[List] identifier[bonds] operator[=] identifier[molecule] operator[SEP] identifier[getConnectedBondsList] operator[SEP] identifier[atom] operator[SEP] operator[SEP] identifier[IAtom] identifier[connectedAtom] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[f] operator[=] Other[0] operator[SEP] identifier[f] operator[<] identifier[bonds] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[f] operator[++] operator[SEP] { identifier[connectedAtom] operator[=] operator[SEP] operator[SEP] identifier[IBond] operator[SEP] identifier[bonds] operator[SEP] identifier[get] operator[SEP] identifier[f] operator[SEP] operator[SEP] operator[SEP] identifier[getOther] operator[SEP] identifier[atom] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[connectedAtom] operator[SEP] identifier[getFlag] operator[SEP] identifier[CDKConstants] operator[SEP] identifier[ISPLACED] operator[SEP] operator[SEP] { identifier[unplacedAtoms] operator[SEP] identifier[addAtom] operator[SEP] identifier[connectedAtom] operator[SEP] operator[SEP] } } Keyword[return] identifier[unplacedAtoms] operator[SEP] }
public Expression2 getLogicalForm() { Expression2 preUnaryLogicalForm = getPreUnaryLogicalForm(); if (unaryRule == null) { return preUnaryLogicalForm; } else if (preUnaryLogicalForm == null || unaryRule.getUnaryRule().getLogicalForm() == null) { return null; } else { return Expression2.nested(unaryRule.getUnaryRule().getLogicalForm(), preUnaryLogicalForm); } }
class class_name[name] begin[{] method[getLogicalForm, return_type[type[Expression2]], modifier[public], parameter[]] begin[{] local_variable[type[Expression2], preUnaryLogicalForm] if[binary_operation[member[.unaryRule], ==, literal[null]]] begin[{] return[member[.preUnaryLogicalForm]] else begin[{] if[binary_operation[binary_operation[member[.preUnaryLogicalForm], ==, literal[null]], ||, binary_operation[call[unaryRule.getUnaryRule, parameter[]], ==, literal[null]]]] begin[{] return[literal[null]] else begin[{] return[call[Expression2.nested, parameter[call[unaryRule.getUnaryRule, parameter[]], member[.preUnaryLogicalForm]]]] end[}] end[}] end[}] END[}]
Keyword[public] identifier[Expression2] identifier[getLogicalForm] operator[SEP] operator[SEP] { identifier[Expression2] identifier[preUnaryLogicalForm] operator[=] identifier[getPreUnaryLogicalForm] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[unaryRule] operator[==] Other[null] operator[SEP] { Keyword[return] identifier[preUnaryLogicalForm] operator[SEP] } Keyword[else] Keyword[if] operator[SEP] identifier[preUnaryLogicalForm] operator[==] Other[null] operator[||] identifier[unaryRule] operator[SEP] identifier[getUnaryRule] operator[SEP] operator[SEP] operator[SEP] identifier[getLogicalForm] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] { Keyword[return] Other[null] operator[SEP] } Keyword[else] { Keyword[return] identifier[Expression2] operator[SEP] identifier[nested] operator[SEP] identifier[unaryRule] operator[SEP] identifier[getUnaryRule] operator[SEP] operator[SEP] operator[SEP] identifier[getLogicalForm] operator[SEP] operator[SEP] , identifier[preUnaryLogicalForm] operator[SEP] operator[SEP] } }
public EClass getIfcPlate() { if (ifcPlateEClass == null) { ifcPlateEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers() .get(362); } return ifcPlateEClass; }
class class_name[name] begin[{] method[getIfcPlate, return_type[type[EClass]], modifier[public], parameter[]] begin[{] if[binary_operation[member[.ifcPlateEClass], ==, literal[null]]] begin[{] assign[member[.ifcPlateEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc2x3tc1Package, 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=362)], 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[.ifcPlateEClass]] end[}] END[}]
Keyword[public] identifier[EClass] identifier[getIfcPlate] operator[SEP] operator[SEP] { Keyword[if] operator[SEP] identifier[ifcPlateEClass] operator[==] Other[null] operator[SEP] { identifier[ifcPlateEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc2x3tc1Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[362] operator[SEP] operator[SEP] } Keyword[return] identifier[ifcPlateEClass] operator[SEP] }
public final static void addGroup(final GroupingNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfGroupings().add(position, notation); }
class class_name[name] begin[{] method[addGroup, return_type[void], modifier[final public static], parameter[notation, position, helm2notation]] begin[{] call[helm2notation.getListOfGroupings, parameter[]] end[}] END[}]
Keyword[public] Keyword[final] Keyword[static] Keyword[void] identifier[addGroup] operator[SEP] Keyword[final] identifier[GroupingNotation] identifier[notation] , Keyword[final] Keyword[int] identifier[position] , Keyword[final] identifier[HELM2Notation] identifier[helm2notation] operator[SEP] { identifier[helm2notation] operator[SEP] identifier[getListOfGroupings] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[position] , identifier[notation] operator[SEP] operator[SEP] }
@Override protected int delegateInsert(final Entity entity, final InsertOption<? extends ConditionBean> option) { final EsAbstractEntity esEntity = (EsAbstractEntity) entity; IndexRequestBuilder builder = createInsertRequest(esEntity); final IndexResponse response = builder.execute().actionGet(indexTimeout); esEntity.asDocMeta().id(response.getId()); return response.getResult() == Result.CREATED ? 1 : 0; }
class class_name[name] begin[{] method[delegateInsert, return_type[type[int]], modifier[protected], parameter[entity, option]] begin[{] local_variable[type[EsAbstractEntity], esEntity] local_variable[type[IndexRequestBuilder], builder] local_variable[type[IndexResponse], response] call[esEntity.asDocMeta, parameter[]] return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getResult, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), operandr=MemberReference(member=CREATED, postfix_operators=[], prefix_operators=[], qualifier=Result, selectors=[]), operator===), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))] end[}] END[}]
annotation[@] identifier[Override] Keyword[protected] Keyword[int] identifier[delegateInsert] operator[SEP] Keyword[final] identifier[Entity] identifier[entity] , Keyword[final] identifier[InsertOption] operator[<] operator[?] Keyword[extends] identifier[ConditionBean] operator[>] identifier[option] operator[SEP] { Keyword[final] identifier[EsAbstractEntity] identifier[esEntity] operator[=] operator[SEP] identifier[EsAbstractEntity] operator[SEP] identifier[entity] operator[SEP] identifier[IndexRequestBuilder] identifier[builder] operator[=] identifier[createInsertRequest] operator[SEP] identifier[esEntity] operator[SEP] operator[SEP] Keyword[final] identifier[IndexResponse] identifier[response] operator[=] identifier[builder] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] identifier[actionGet] operator[SEP] identifier[indexTimeout] operator[SEP] operator[SEP] identifier[esEntity] operator[SEP] identifier[asDocMeta] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] identifier[response] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP] identifier[getResult] operator[SEP] operator[SEP] operator[==] identifier[Result] operator[SEP] identifier[CREATED] operator[?] Other[1] operator[:] Other[0] operator[SEP] }
public @Nonnull StringAssert isEqualToIgnoringCase(@Nullable String expected) { strings.assertEqualsIgnoringCase(description, actual, expected); return this; }
class class_name[name] begin[{] method[isEqualToIgnoringCase, return_type[type[StringAssert]], modifier[public], parameter[expected]] begin[{] call[strings.assertEqualsIgnoringCase, parameter[member[.description], member[.actual], member[.expected]]] return[THIS[]] end[}] END[}]
Keyword[public] annotation[@] identifier[Nonnull] identifier[StringAssert] identifier[isEqualToIgnoringCase] operator[SEP] annotation[@] identifier[Nullable] identifier[String] identifier[expected] operator[SEP] { identifier[strings] operator[SEP] identifier[assertEqualsIgnoringCase] operator[SEP] identifier[description] , identifier[actual] , identifier[expected] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] }
public static ClassLoader getClassLoader(TypeToken<?> type) { Set<ClassLoader> classLoaders = Sets.newIdentityHashSet(); // Breath first traversal into the Type. Queue<TypeToken<?>> queue = Lists.newLinkedList(); queue.add(type); while (!queue.isEmpty()) { type = queue.remove(); ClassLoader classLoader = type.getRawType().getClassLoader(); if (classLoader != null) { classLoaders.add(classLoader); } if (type.getType() instanceof ParameterizedType) { for (Type typeArg : ((ParameterizedType) type.getType()).getActualTypeArguments()) { queue.add(TypeToken.of(typeArg)); } } } // Determine the parent classloader ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader parent = (contextClassLoader == null) ? ClassLoader.getSystemClassLoader() : contextClassLoader; if (classLoaders.isEmpty()) { return parent; } return new CombineClassLoader(parent, classLoaders); }
class class_name[name] begin[{] method[getClassLoader, return_type[type[ClassLoader]], modifier[public static], parameter[type]] begin[{] local_variable[type[Set], classLoaders] local_variable[type[Queue], queue] call[queue.add, parameter[member[.type]]] while[call[queue.isEmpty, parameter[]]] begin[{] assign[member[.type], call[queue.remove, parameter[]]] local_variable[type[ClassLoader], classLoader] if[binary_operation[member[.classLoader], !=, literal[null]]] begin[{] call[classLoaders.add, parameter[member[.classLoader]]] else begin[{] None end[}] if[binary_operation[call[type.getType, parameter[]], instanceof, type[ParameterizedType]]] begin[{] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=typeArg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=TypeToken, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=queue, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=Cast(expression=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ParameterizedType, sub_type=None)), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=typeArg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Type, sub_type=None))), label=None) else begin[{] None end[}] end[}] local_variable[type[ClassLoader], contextClassLoader] local_variable[type[ClassLoader], parent] if[call[classLoaders.isEmpty, parameter[]]] begin[{] return[member[.parent]] else begin[{] None end[}] return[ClassCreator(arguments=[MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=classLoaders, 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=CombineClassLoader, sub_type=None))] end[}] END[}]
Keyword[public] Keyword[static] identifier[ClassLoader] identifier[getClassLoader] operator[SEP] identifier[TypeToken] operator[<] operator[?] operator[>] identifier[type] operator[SEP] { identifier[Set] operator[<] identifier[ClassLoader] operator[>] identifier[classLoaders] operator[=] identifier[Sets] operator[SEP] identifier[newIdentityHashSet] operator[SEP] operator[SEP] operator[SEP] identifier[Queue] operator[<] identifier[TypeToken] operator[<] operator[?] operator[>] operator[>] identifier[queue] operator[=] identifier[Lists] operator[SEP] identifier[newLinkedList] operator[SEP] operator[SEP] operator[SEP] identifier[queue] operator[SEP] identifier[add] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[queue] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] { identifier[type] operator[=] identifier[queue] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP] identifier[ClassLoader] identifier[classLoader] operator[=] identifier[type] operator[SEP] identifier[getRawType] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[classLoader] operator[!=] Other[null] operator[SEP] { identifier[classLoaders] operator[SEP] identifier[add] operator[SEP] identifier[classLoader] operator[SEP] operator[SEP] } Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[getType] operator[SEP] operator[SEP] Keyword[instanceof] identifier[ParameterizedType] operator[SEP] { Keyword[for] operator[SEP] identifier[Type] identifier[typeArg] operator[:] operator[SEP] operator[SEP] identifier[ParameterizedType] operator[SEP] identifier[type] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getActualTypeArguments] operator[SEP] operator[SEP] operator[SEP] { identifier[queue] operator[SEP] identifier[add] operator[SEP] identifier[TypeToken] operator[SEP] identifier[of] operator[SEP] identifier[typeArg] operator[SEP] operator[SEP] operator[SEP] } } } identifier[ClassLoader] identifier[contextClassLoader] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getContextClassLoader] operator[SEP] operator[SEP] operator[SEP] identifier[ClassLoader] identifier[parent] operator[=] operator[SEP] identifier[contextClassLoader] operator[==] Other[null] operator[SEP] operator[?] identifier[ClassLoader] operator[SEP] identifier[getSystemClassLoader] operator[SEP] operator[SEP] operator[:] identifier[contextClassLoader] operator[SEP] Keyword[if] operator[SEP] identifier[classLoaders] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] { Keyword[return] identifier[parent] operator[SEP] } Keyword[return] Keyword[new] identifier[CombineClassLoader] operator[SEP] identifier[parent] , identifier[classLoaders] operator[SEP] operator[SEP] }
public Connection getConnection(final String username, final String password) throws SQLException { try { return new DrizzleConnection(new MySQLProtocol(hostname, port, database, username, password, new Properties()), new DrizzleQueryFactory()); } catch (QueryException e) { throw SQLExceptionMapper.get(e); } }
class class_name[name] begin[{] method[getConnection, return_type[type[Connection]], modifier[public], parameter[username, password]] begin[{] TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=hostname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=database, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Properties, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MySQLProtocol, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DrizzleQueryFactory, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DrizzleConnection, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=SQLExceptionMapper, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['QueryException']))], finally_block=None, label=None, resources=None) end[}] END[}]
Keyword[public] identifier[Connection] identifier[getConnection] operator[SEP] Keyword[final] identifier[String] identifier[username] , Keyword[final] identifier[String] identifier[password] operator[SEP] Keyword[throws] identifier[SQLException] { Keyword[try] { Keyword[return] Keyword[new] identifier[DrizzleConnection] operator[SEP] Keyword[new] identifier[MySQLProtocol] operator[SEP] identifier[hostname] , identifier[port] , identifier[database] , identifier[username] , identifier[password] , Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[DrizzleQueryFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[QueryException] identifier[e] operator[SEP] { Keyword[throw] identifier[SQLExceptionMapper] operator[SEP] identifier[get] operator[SEP] identifier[e] operator[SEP] operator[SEP] } }
public AbstractBaseDTNode<I, D> sift(Word<I> word, boolean hard) { return sift(root, word, hard); }
class class_name[name] begin[{] method[sift, return_type[type[AbstractBaseDTNode]], modifier[public], parameter[word, hard]] begin[{] return[call[.sift, parameter[member[.root], member[.word], member[.hard]]]] end[}] END[}]
Keyword[public] identifier[AbstractBaseDTNode] operator[<] identifier[I] , identifier[D] operator[>] identifier[sift] operator[SEP] identifier[Word] operator[<] identifier[I] operator[>] identifier[word] , Keyword[boolean] identifier[hard] operator[SEP] { Keyword[return] identifier[sift] operator[SEP] identifier[root] , identifier[word] , identifier[hard] operator[SEP] operator[SEP] }
protected boolean isWebSocketsUpgradeRequest(HttpRequest request) { String connectionHeader = request.getHeader( Names.CONNECTION ); String upgradeHeader = request.getHeader( Names.UPGRADE ); if (connectionHeader == null || upgradeHeader == null) { return false; } if (connectionHeader.trim().toLowerCase().contains( Values.UPGRADE.toLowerCase() )) { if (upgradeHeader.trim().equalsIgnoreCase( Values.WEBSOCKET )) { return true; } } return false; }
class class_name[name] begin[{] method[isWebSocketsUpgradeRequest, return_type[type[boolean]], modifier[protected], parameter[request]] begin[{] local_variable[type[String], connectionHeader] local_variable[type[String], upgradeHeader] if[binary_operation[binary_operation[member[.connectionHeader], ==, literal[null]], ||, binary_operation[member[.upgradeHeader], ==, literal[null]]]] begin[{] return[literal[false]] else begin[{] None end[}] if[call[connectionHeader.trim, parameter[]]] begin[{] if[call[upgradeHeader.trim, parameter[]]] begin[{] return[literal[true]] else begin[{] None end[}] else begin[{] None end[}] return[literal[false]] end[}] END[}]
Keyword[protected] Keyword[boolean] identifier[isWebSocketsUpgradeRequest] operator[SEP] identifier[HttpRequest] identifier[request] operator[SEP] { identifier[String] identifier[connectionHeader] operator[=] identifier[request] operator[SEP] identifier[getHeader] operator[SEP] identifier[Names] operator[SEP] identifier[CONNECTION] operator[SEP] operator[SEP] identifier[String] identifier[upgradeHeader] operator[=] identifier[request] operator[SEP] identifier[getHeader] operator[SEP] identifier[Names] operator[SEP] identifier[UPGRADE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[connectionHeader] operator[==] Other[null] operator[||] identifier[upgradeHeader] operator[==] Other[null] operator[SEP] { Keyword[return] literal[boolean] operator[SEP] } Keyword[if] operator[SEP] identifier[connectionHeader] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[Values] operator[SEP] identifier[UPGRADE] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP] { Keyword[if] operator[SEP] identifier[upgradeHeader] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[Values] operator[SEP] identifier[WEBSOCKET] operator[SEP] operator[SEP] { Keyword[return] literal[boolean] operator[SEP] } } Keyword[return] literal[boolean] operator[SEP] }
public void setTokenNameList(java.util.Collection<String> tokenNameList) { if (tokenNameList == null) { this.tokenNameList = null; return; } this.tokenNameList = new com.amazonaws.internal.SdkInternalList<String>(tokenNameList); }
class class_name[name] begin[{] method[setTokenNameList, return_type[void], modifier[public], parameter[tokenNameList]] begin[{] if[binary_operation[member[.tokenNameList], ==, literal[null]]] begin[{] assign[THIS[member[None.tokenNameList]], literal[null]] return[None] else begin[{] None end[}] assign[THIS[member[None.tokenNameList]], ClassCreator(arguments=[MemberReference(member=tokenNameList, 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=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))] end[}] END[}]
Keyword[public] Keyword[void] identifier[setTokenNameList] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[tokenNameList] operator[SEP] { Keyword[if] operator[SEP] identifier[tokenNameList] operator[==] Other[null] operator[SEP] { Keyword[this] operator[SEP] identifier[tokenNameList] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP] } Keyword[this] operator[SEP] identifier[tokenNameList] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] identifier[tokenNameList] operator[SEP] operator[SEP] }
public CallSite createPogoCallCurrentSite(CallSite site, Class sender, Object[] args) { if (!GroovyCategorySupport.hasCategoryInCurrentThread() && !(this instanceof AdaptingMetaClass)) { Class [] params = MetaClassHelper.convertToTypeArray(args); MetaMethod metaMethod = getMethodWithCachingInternal(sender, site, params); if (metaMethod != null) return PogoMetaMethodSite.createPogoMetaMethodSite(site, this, metaMethod, params, args); } return new PogoMetaClassSite(site, this); }
class class_name[name] begin[{] method[createPogoCallCurrentSite, return_type[type[CallSite]], modifier[public], parameter[site, sender, args]] begin[{] if[binary_operation[call[GroovyCategorySupport.hasCategoryInCurrentThread, parameter[]], &&, binary_operation[THIS[], instanceof, type[AdaptingMetaClass]]]] begin[{] local_variable[type[Class], params] local_variable[type[MetaMethod], metaMethod] if[binary_operation[member[.metaMethod], !=, literal[null]]] begin[{] return[call[PogoMetaMethodSite.createPogoMetaMethodSite, parameter[member[.site], THIS[], member[.metaMethod], member[.params], member[.args]]]] else begin[{] None end[}] else begin[{] None end[}] return[ClassCreator(arguments=[MemberReference(member=site, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PogoMetaClassSite, sub_type=None))] end[}] END[}]
Keyword[public] identifier[CallSite] identifier[createPogoCallCurrentSite] operator[SEP] identifier[CallSite] identifier[site] , identifier[Class] identifier[sender] , identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[SEP] { Keyword[if] operator[SEP] operator[!] identifier[GroovyCategorySupport] operator[SEP] identifier[hasCategoryInCurrentThread] operator[SEP] operator[SEP] operator[&&] operator[!] operator[SEP] Keyword[this] Keyword[instanceof] identifier[AdaptingMetaClass] operator[SEP] operator[SEP] { identifier[Class] operator[SEP] operator[SEP] identifier[params] operator[=] identifier[MetaClassHelper] operator[SEP] identifier[convertToTypeArray] operator[SEP] identifier[args] operator[SEP] operator[SEP] identifier[MetaMethod] identifier[metaMethod] operator[=] identifier[getMethodWithCachingInternal] operator[SEP] identifier[sender] , identifier[site] , identifier[params] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[metaMethod] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[PogoMetaMethodSite] operator[SEP] identifier[createPogoMetaMethodSite] operator[SEP] identifier[site] , Keyword[this] , identifier[metaMethod] , identifier[params] , identifier[args] operator[SEP] operator[SEP] } Keyword[return] Keyword[new] identifier[PogoMetaClassSite] operator[SEP] identifier[site] , Keyword[this] operator[SEP] operator[SEP] }
@NullSafe static File[] safeListFiles(File path, FileFilter fileFilter) { return (isDirectory(path) ? path.listFiles(fileFilter) : NO_FILES); }
class class_name[name] begin[{] method[safeListFiles, return_type[type[File]], modifier[static], parameter[path, fileFilter]] begin[{] return[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=MemberReference(member=NO_FILES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[MemberReference(member=fileFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listFiles, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None))] end[}] END[}]
annotation[@] identifier[NullSafe] Keyword[static] identifier[File] operator[SEP] operator[SEP] identifier[safeListFiles] operator[SEP] identifier[File] identifier[path] , identifier[FileFilter] identifier[fileFilter] operator[SEP] { Keyword[return] operator[SEP] identifier[isDirectory] operator[SEP] identifier[path] operator[SEP] operator[?] identifier[path] operator[SEP] identifier[listFiles] operator[SEP] identifier[fileFilter] operator[SEP] operator[:] identifier[NO_FILES] operator[SEP] operator[SEP] }
public String getAuthorizationUri(List<Scope> scopes, String redirectUri, String state, String userName, String userEmail) { // this method must use www instead of just naked domain for security reasons. String host = key.isProduction() ? "https://www.wepay.com" : "https://stage.wepay.com"; String uri = host + "/v2/oauth2/authorize?"; uri += "client_id=" + urlEncode(key.getClientId()) + "&"; uri += "redirect_uri=" + urlEncode(redirectUri) + "&"; uri += "scope=" + urlEncode(StringUtils.join(scopes, ",")); if (state != null || userName != null || userEmail != null) uri += "&"; uri += state != null ? "state=" + urlEncode(state) + "&" : ""; uri += userName != null ? "user_name=" + urlEncode(userName) + "&" : ""; uri += userEmail != null ? "user_email=" + urlEncode(userEmail) : ""; return uri; }
class class_name[name] begin[{] method[getAuthorizationUri, return_type[type[String]], modifier[public], parameter[scopes, redirectUri, state, userName, userEmail]] begin[{] local_variable[type[String], host] local_variable[type[String], uri] assign[member[.uri], binary_operation[binary_operation[literal["client_id="], +, call[.urlEncode, parameter[call[key.getClientId, parameter[]]]]], +, literal["&"]]] assign[member[.uri], binary_operation[binary_operation[literal["redirect_uri="], +, call[.urlEncode, parameter[member[.redirectUri]]]], +, literal["&"]]] assign[member[.uri], binary_operation[literal["scope="], +, call[.urlEncode, parameter[call[StringUtils.join, parameter[member[.scopes], literal[","]]]]]]] if[binary_operation[binary_operation[binary_operation[member[.state], !=, literal[null]], ||, binary_operation[member[.userName], !=, literal[null]]], ||, binary_operation[member[.userEmail], !=, literal[null]]]] begin[{] assign[member[.uri], literal["&"]] else begin[{] None end[}] assign[member[.uri], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="state="), operandr=MethodInvocation(arguments=[MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=urlEncode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="&"), operator=+))] assign[member[.uri], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=userName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="user_name="), operandr=MethodInvocation(arguments=[MemberReference(member=userName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=urlEncode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="&"), operator=+))] assign[member[.uri], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=userEmail, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="user_email="), operandr=MethodInvocation(arguments=[MemberReference(member=userEmail, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=urlEncode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+))] return[member[.uri]] end[}] END[}]
Keyword[public] identifier[String] identifier[getAuthorizationUri] operator[SEP] identifier[List] operator[<] identifier[Scope] operator[>] identifier[scopes] , identifier[String] identifier[redirectUri] , identifier[String] identifier[state] , identifier[String] identifier[userName] , identifier[String] identifier[userEmail] operator[SEP] { identifier[String] identifier[host] operator[=] identifier[key] operator[SEP] identifier[isProduction] operator[SEP] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] identifier[String] identifier[uri] operator[=] identifier[host] operator[+] literal[String] operator[SEP] identifier[uri] operator[+=] literal[String] operator[+] identifier[urlEncode] operator[SEP] identifier[key] operator[SEP] identifier[getClientId] operator[SEP] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[uri] operator[+=] literal[String] operator[+] identifier[urlEncode] operator[SEP] identifier[redirectUri] operator[SEP] operator[+] literal[String] operator[SEP] identifier[uri] operator[+=] literal[String] operator[+] identifier[urlEncode] operator[SEP] identifier[StringUtils] operator[SEP] identifier[join] operator[SEP] identifier[scopes] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[!=] Other[null] operator[||] identifier[userName] operator[!=] Other[null] operator[||] identifier[userEmail] operator[!=] Other[null] operator[SEP] identifier[uri] operator[+=] literal[String] operator[SEP] identifier[uri] operator[+=] identifier[state] operator[!=] Other[null] operator[?] literal[String] operator[+] identifier[urlEncode] operator[SEP] identifier[state] operator[SEP] operator[+] literal[String] operator[:] literal[String] operator[SEP] identifier[uri] operator[+=] identifier[userName] operator[!=] Other[null] operator[?] literal[String] operator[+] identifier[urlEncode] operator[SEP] identifier[userName] operator[SEP] operator[+] literal[String] operator[:] literal[String] operator[SEP] identifier[uri] operator[+=] identifier[userEmail] operator[!=] Other[null] operator[?] literal[String] operator[+] identifier[urlEncode] operator[SEP] identifier[userEmail] operator[SEP] operator[:] literal[String] operator[SEP] Keyword[return] identifier[uri] operator[SEP] }
public Trigger parse() { DateTime fromDate = parseDate(FROM_PATTERN, "00:00:00"); DateTime toDate = parseDate(TO_PATTERN, "23:59:59"); if (fromDate != null && toDate != null && fromDate.isAfterNow()) { throw new WestCacheException("scheduler expression is not valid " + "because of from-date is after of to-date"); } val scheduleBuilder = createScheduleBuilder(); val triggerBuilder = newTrigger().withSchedule(scheduleBuilder); if (fromDate != null && fromDate.isAfterNow()) { triggerBuilder.startAt(fromDate.toDate()); } if (toDate != null && toDate.isAfterNow()) { triggerBuilder.endAt(toDate.toDate()); } return triggerBuilder.build(); }
class class_name[name] begin[{] method[parse, return_type[type[Trigger]], modifier[public], parameter[]] begin[{] local_variable[type[DateTime], fromDate] local_variable[type[DateTime], toDate] if[binary_operation[binary_operation[binary_operation[member[.fromDate], !=, literal[null]], &&, binary_operation[member[.toDate], !=, literal[null]]], &&, call[fromDate.isAfterNow, parameter[]]]] begin[{] ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="scheduler expression is not valid "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="because of from-date is after of to-date"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WestCacheException, sub_type=None)), label=None) else begin[{] None end[}] local_variable[type[val], scheduleBuilder] local_variable[type[val], triggerBuilder] if[binary_operation[binary_operation[member[.fromDate], !=, literal[null]], &&, call[fromDate.isAfterNow, parameter[]]]] begin[{] call[triggerBuilder.startAt, parameter[call[fromDate.toDate, parameter[]]]] else begin[{] None end[}] if[binary_operation[binary_operation[member[.toDate], !=, literal[null]], &&, call[toDate.isAfterNow, parameter[]]]] begin[{] call[triggerBuilder.endAt, parameter[call[toDate.toDate, parameter[]]]] else begin[{] None end[}] return[call[triggerBuilder.build, parameter[]]] end[}] END[}]
Keyword[public] identifier[Trigger] identifier[parse] operator[SEP] operator[SEP] { identifier[DateTime] identifier[fromDate] operator[=] identifier[parseDate] operator[SEP] identifier[FROM_PATTERN] , literal[String] operator[SEP] operator[SEP] identifier[DateTime] identifier[toDate] operator[=] identifier[parseDate] operator[SEP] identifier[TO_PATTERN] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fromDate] operator[!=] Other[null] operator[&&] identifier[toDate] operator[!=] Other[null] operator[&&] identifier[fromDate] operator[SEP] identifier[isAfterNow] operator[SEP] operator[SEP] operator[SEP] { Keyword[throw] Keyword[new] identifier[WestCacheException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] } identifier[val] identifier[scheduleBuilder] operator[=] identifier[createScheduleBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[val] identifier[triggerBuilder] operator[=] identifier[newTrigger] operator[SEP] operator[SEP] operator[SEP] identifier[withSchedule] operator[SEP] identifier[scheduleBuilder] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fromDate] operator[!=] Other[null] operator[&&] identifier[fromDate] operator[SEP] identifier[isAfterNow] operator[SEP] operator[SEP] operator[SEP] { identifier[triggerBuilder] operator[SEP] identifier[startAt] operator[SEP] identifier[fromDate] operator[SEP] identifier[toDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } Keyword[if] operator[SEP] identifier[toDate] operator[!=] Other[null] operator[&&] identifier[toDate] operator[SEP] identifier[isAfterNow] operator[SEP] operator[SEP] operator[SEP] { identifier[triggerBuilder] operator[SEP] identifier[endAt] operator[SEP] identifier[toDate] operator[SEP] identifier[toDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } Keyword[return] identifier[triggerBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] }
public T withTags(Iterable<Tag> tags) { for (Tag t : tags) { extraTags.add(t); } return (T) this; }
class class_name[name] begin[{] method[withTags, return_type[type[T]], modifier[public], parameter[tags]] begin[{] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=extraTags, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Tag, sub_type=None))), label=None) return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))] end[}] END[}]
Keyword[public] identifier[T] identifier[withTags] operator[SEP] identifier[Iterable] operator[<] identifier[Tag] operator[>] identifier[tags] operator[SEP] { Keyword[for] operator[SEP] identifier[Tag] identifier[t] operator[:] identifier[tags] operator[SEP] { identifier[extraTags] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP] } Keyword[return] operator[SEP] identifier[T] operator[SEP] Keyword[this] operator[SEP] }
public ServiceFuture<Void> beginCreateOrUpdateSecuritySettingsAsync(String deviceName, String resourceGroupName, AsymmetricEncryptedSecret deviceAdminPassword, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginCreateOrUpdateSecuritySettingsWithServiceResponseAsync(deviceName, resourceGroupName, deviceAdminPassword), serviceCallback); }
class class_name[name] begin[{] method[beginCreateOrUpdateSecuritySettingsAsync, return_type[type[ServiceFuture]], modifier[public], parameter[deviceName, resourceGroupName, deviceAdminPassword, serviceCallback]] begin[{] return[call[ServiceFuture.fromResponse, parameter[call[.beginCreateOrUpdateSecuritySettingsWithServiceResponseAsync, parameter[member[.deviceName], member[.resourceGroupName], member[.deviceAdminPassword]]], member[.serviceCallback]]]] end[}] END[}]
Keyword[public] identifier[ServiceFuture] operator[<] identifier[Void] operator[>] identifier[beginCreateOrUpdateSecuritySettingsAsync] operator[SEP] identifier[String] identifier[deviceName] , identifier[String] identifier[resourceGroupName] , identifier[AsymmetricEncryptedSecret] identifier[deviceAdminPassword] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[Void] operator[>] identifier[serviceCallback] operator[SEP] { Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[beginCreateOrUpdateSecuritySettingsWithServiceResponseAsync] operator[SEP] identifier[deviceName] , identifier[resourceGroupName] , identifier[deviceAdminPassword] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP] }
public static ReceiveChannelEndpointSupplier receiveChannelEndpointSupplier() { ReceiveChannelEndpointSupplier supplier = null; try { final String className = getProperty(RECEIVE_CHANNEL_ENDPOINT_SUPPLIER_PROP_NAME); if (null == className) { return new DefaultReceiveChannelEndpointSupplier(); } supplier = (ReceiveChannelEndpointSupplier)Class.forName(className).getConstructor().newInstance(); } catch (final Exception ex) { LangUtil.rethrowUnchecked(ex); } return supplier; }
class class_name[name] begin[{] method[receiveChannelEndpointSupplier, return_type[type[ReceiveChannelEndpointSupplier]], modifier[public static], parameter[]] begin[{] local_variable[type[ReceiveChannelEndpointSupplier], supplier] TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=RECEIVE_CHANNEL_ENDPOINT_SUPPLIER_PROP_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=className)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultReceiveChannelEndpointSupplier, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=supplier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[MethodInvocation(arguments=[], member=getConstructor, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ReceiveChannelEndpointSupplier, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rethrowUnchecked, postfix_operators=[], prefix_operators=[], qualifier=LangUtil, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None) return[member[.supplier]] end[}] END[}]
Keyword[public] Keyword[static] identifier[ReceiveChannelEndpointSupplier] identifier[receiveChannelEndpointSupplier] operator[SEP] operator[SEP] { identifier[ReceiveChannelEndpointSupplier] identifier[supplier] operator[=] Other[null] operator[SEP] Keyword[try] { Keyword[final] identifier[String] identifier[className] operator[=] identifier[getProperty] operator[SEP] identifier[RECEIVE_CHANNEL_ENDPOINT_SUPPLIER_PROP_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[className] operator[SEP] { Keyword[return] Keyword[new] identifier[DefaultReceiveChannelEndpointSupplier] operator[SEP] operator[SEP] operator[SEP] } identifier[supplier] operator[=] operator[SEP] identifier[ReceiveChannelEndpointSupplier] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[className] operator[SEP] operator[SEP] identifier[getConstructor] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[ex] operator[SEP] { identifier[LangUtil] operator[SEP] identifier[rethrowUnchecked] operator[SEP] identifier[ex] operator[SEP] operator[SEP] } Keyword[return] identifier[supplier] operator[SEP] }
public void processTimeout(TimeoutEvent timeoutEvent) { Transaction transaction = null; if(timeoutEvent.isServerTransaction()) { transaction = timeoutEvent.getServerTransaction(); if(logger.isDebugEnabled()) { logger.debug("timeout => " + transaction.getRequest().toString()); } } else { transaction = timeoutEvent.getClientTransaction(); if(logger.isDebugEnabled()) { logger.debug("timeout => " + transaction.getRequest().toString()); } } String callId = ((CallIdHeader)transaction.getRequest().getHeader(CallIdHeader.NAME)).getCallId(); register.unStickSessionFromNode(callId); }
class class_name[name] begin[{] method[processTimeout, return_type[void], modifier[public], parameter[timeoutEvent]] begin[{] local_variable[type[Transaction], transaction] if[call[timeoutEvent.isServerTransaction, parameter[]]] begin[{] assign[member[.transaction], call[timeoutEvent.getServerTransaction, parameter[]]] if[call[logger.isDebugEnabled, parameter[]]] begin[{] call[logger.debug, parameter[binary_operation[literal["timeout => "], +, call[transaction.getRequest, parameter[]]]]] else begin[{] None end[}] else begin[{] assign[member[.transaction], call[timeoutEvent.getClientTransaction, parameter[]]] if[call[logger.isDebugEnabled, parameter[]]] begin[{] call[logger.debug, parameter[binary_operation[literal["timeout => "], +, call[transaction.getRequest, parameter[]]]]] else begin[{] None end[}] end[}] local_variable[type[String], callId] call[register.unStickSessionFromNode, parameter[member[.callId]]] end[}] END[}]
Keyword[public] Keyword[void] identifier[processTimeout] operator[SEP] identifier[TimeoutEvent] identifier[timeoutEvent] operator[SEP] { identifier[Transaction] identifier[transaction] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[timeoutEvent] operator[SEP] identifier[isServerTransaction] operator[SEP] operator[SEP] operator[SEP] { identifier[transaction] operator[=] identifier[timeoutEvent] operator[SEP] identifier[getServerTransaction] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] { identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[transaction] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } } Keyword[else] { identifier[transaction] operator[=] identifier[timeoutEvent] operator[SEP] identifier[getClientTransaction] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] { identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[transaction] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } } identifier[String] identifier[callId] operator[=] operator[SEP] operator[SEP] identifier[CallIdHeader] operator[SEP] identifier[transaction] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getHeader] operator[SEP] identifier[CallIdHeader] operator[SEP] identifier[NAME] operator[SEP] operator[SEP] operator[SEP] identifier[getCallId] operator[SEP] operator[SEP] operator[SEP] identifier[register] operator[SEP] identifier[unStickSessionFromNode] operator[SEP] identifier[callId] operator[SEP] operator[SEP] }
public static Double getDouble(String propertyName, Double defaultValue) { Double propertyValue = NumberUtil.toDoubleObject(System.getProperty(propertyName), null); return propertyValue != null ? propertyValue : defaultValue; }
class class_name[name] begin[{] method[getDouble, return_type[type[Double]], modifier[public static], parameter[propertyName, defaultValue]] begin[{] local_variable[type[Double], propertyValue] return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=propertyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=defaultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=propertyValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))] end[}] END[}]
Keyword[public] Keyword[static] identifier[Double] identifier[getDouble] operator[SEP] identifier[String] identifier[propertyName] , identifier[Double] identifier[defaultValue] operator[SEP] { identifier[Double] identifier[propertyValue] operator[=] identifier[NumberUtil] operator[SEP] identifier[toDoubleObject] operator[SEP] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[propertyName] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[propertyValue] operator[!=] Other[null] operator[?] identifier[propertyValue] operator[:] identifier[defaultValue] operator[SEP] }
private List<FileItem> readMultipartFileItems(CmsUploadListener listener) throws Exception { DiskFileItemFactory factory = new DiskFileItemFactory(); // maximum size that will be stored in memory factory.setSizeThreshold(4096); // the location for saving data that is larger than the threshold File temp = new File(OpenCms.getSystemInfo().getPackagesRfsPath()); if (temp.exists() || temp.mkdirs()) { // make sure the folder exists factory.setRepository(temp); } // create a file upload servlet ServletFileUpload fu = new ServletFileUpload(factory); // set the listener fu.setProgressListener(listener); // set encoding to correctly handle special chars (e.g. in filenames) fu.setHeaderEncoding(getRequest().getCharacterEncoding()); // set the maximum size for a single file (value is in bytes) long maxFileSizeBytes = OpenCms.getWorkplaceManager().getFileBytesMaxUploadSize(getCmsObject()); if (maxFileSizeBytes > 0) { fu.setFileSizeMax(maxFileSizeBytes); } // try to parse the request try { return CmsCollectionsGenericWrapper.list(fu.parseRequest(getRequest())); } catch (SizeLimitExceededException e) { // request size is larger than maximum allowed request size, throw an error Integer actualSize = new Integer((int)(e.getActualSize() / 1024)); Integer maxSize = new Integer((int)(e.getPermittedSize() / 1024)); throw new CmsUploadException( m_bundle.key(org.opencms.ade.upload.Messages.ERR_UPLOAD_REQUEST_SIZE_LIMIT_2, actualSize, maxSize), e); } catch (FileSizeLimitExceededException e) { // file size is larger than maximum allowed file size, throw an error Integer actualSize = new Integer((int)(e.getActualSize() / 1024)); Integer maxSize = new Integer((int)(e.getPermittedSize() / 1024)); throw new CmsUploadException( m_bundle.key( org.opencms.ade.upload.Messages.ERR_UPLOAD_FILE_SIZE_LIMIT_3, actualSize, e.getFileName(), maxSize), e); } }
class class_name[name] begin[{] method[readMultipartFileItems, return_type[type[List]], modifier[private], parameter[listener]] begin[{] local_variable[type[DiskFileItemFactory], factory] call[factory.setSizeThreshold, parameter[literal[4096]]] local_variable[type[File], temp] if[binary_operation[call[temp.exists, parameter[]], ||, call[temp.mkdirs, parameter[]]]] begin[{] call[factory.setRepository, parameter[member[.temp]]] else begin[{] None end[}] local_variable[type[ServletFileUpload], fu] call[fu.setProgressListener, parameter[member[.listener]]] call[fu.setHeaderEncoding, parameter[call[.getRequest, parameter[]]]] local_variable[type[long], maxFileSizeBytes] if[binary_operation[member[.maxFileSizeBytes], >, literal[0]]] begin[{] call[fu.setFileSizeMax, parameter[member[.maxFileSizeBytes]]] else begin[{] None end[}] TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=parseRequest, postfix_operators=[], prefix_operators=[], qualifier=fu, selectors=[], type_arguments=None)], member=list, postfix_operators=[], prefix_operators=[], qualifier=CmsCollectionsGenericWrapper, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Cast(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getActualSize, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), operator=/), type=BasicType(dimensions=[], name=int))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None)), name=actualSize)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Cast(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPermittedSize, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), operator=/), type=BasicType(dimensions=[], name=int))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None)), name=maxSize)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ERR_UPLOAD_REQUEST_SIZE_LIMIT_2, postfix_operators=[], prefix_operators=[], qualifier=org.opencms.ade.upload.Messages, selectors=[]), MemberReference(member=actualSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=key, postfix_operators=[], prefix_operators=[], qualifier=m_bundle, 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=CmsUploadException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SizeLimitExceededException'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Cast(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getActualSize, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), operator=/), type=BasicType(dimensions=[], name=int))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None)), name=actualSize)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Cast(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPermittedSize, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1024), operator=/), type=BasicType(dimensions=[], name=int))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None)), name=maxSize)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ERR_UPLOAD_FILE_SIZE_LIMIT_3, postfix_operators=[], prefix_operators=[], qualifier=org.opencms.ade.upload.Messages, selectors=[]), MemberReference(member=actualSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getFileName, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=maxSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=key, postfix_operators=[], prefix_operators=[], qualifier=m_bundle, 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=CmsUploadException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['FileSizeLimitExceededException']))], finally_block=None, label=None, resources=None) end[}] END[}]
Keyword[private] identifier[List] operator[<] identifier[FileItem] operator[>] identifier[readMultipartFileItems] operator[SEP] identifier[CmsUploadListener] identifier[listener] operator[SEP] Keyword[throws] identifier[Exception] { identifier[DiskFileItemFactory] identifier[factory] operator[=] Keyword[new] identifier[DiskFileItemFactory] operator[SEP] operator[SEP] operator[SEP] identifier[factory] operator[SEP] identifier[setSizeThreshold] operator[SEP] Other[4096] operator[SEP] operator[SEP] identifier[File] identifier[temp] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getSystemInfo] operator[SEP] operator[SEP] operator[SEP] identifier[getPackagesRfsPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[temp] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[||] identifier[temp] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] { identifier[factory] operator[SEP] identifier[setRepository] operator[SEP] identifier[temp] operator[SEP] operator[SEP] } identifier[ServletFileUpload] identifier[fu] operator[=] Keyword[new] identifier[ServletFileUpload] operator[SEP] identifier[factory] operator[SEP] operator[SEP] identifier[fu] operator[SEP] identifier[setProgressListener] operator[SEP] identifier[listener] operator[SEP] operator[SEP] identifier[fu] operator[SEP] identifier[setHeaderEncoding] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getCharacterEncoding] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[maxFileSizeBytes] operator[=] identifier[OpenCms] operator[SEP] identifier[getWorkplaceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getFileBytesMaxUploadSize] operator[SEP] identifier[getCmsObject] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[maxFileSizeBytes] operator[>] Other[0] operator[SEP] { identifier[fu] operator[SEP] identifier[setFileSizeMax] operator[SEP] identifier[maxFileSizeBytes] operator[SEP] operator[SEP] } Keyword[try] { Keyword[return] identifier[CmsCollectionsGenericWrapper] operator[SEP] identifier[list] operator[SEP] identifier[fu] operator[SEP] identifier[parseRequest] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[SizeLimitExceededException] identifier[e] operator[SEP] { identifier[Integer] identifier[actualSize] operator[=] Keyword[new] identifier[Integer] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[getActualSize] operator[SEP] operator[SEP] operator[/] Other[1024] operator[SEP] operator[SEP] operator[SEP] identifier[Integer] identifier[maxSize] operator[=] Keyword[new] identifier[Integer] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[getPermittedSize] operator[SEP] operator[SEP] operator[/] Other[1024] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CmsUploadException] operator[SEP] identifier[m_bundle] operator[SEP] identifier[key] operator[SEP] identifier[org] operator[SEP] identifier[opencms] operator[SEP] identifier[ade] operator[SEP] identifier[upload] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_UPLOAD_REQUEST_SIZE_LIMIT_2] , identifier[actualSize] , identifier[maxSize] operator[SEP] , identifier[e] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[FileSizeLimitExceededException] identifier[e] operator[SEP] { identifier[Integer] identifier[actualSize] operator[=] Keyword[new] identifier[Integer] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[getActualSize] operator[SEP] operator[SEP] operator[/] Other[1024] operator[SEP] operator[SEP] operator[SEP] identifier[Integer] identifier[maxSize] operator[=] Keyword[new] identifier[Integer] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[getPermittedSize] operator[SEP] operator[SEP] operator[/] Other[1024] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CmsUploadException] operator[SEP] identifier[m_bundle] operator[SEP] identifier[key] operator[SEP] identifier[org] operator[SEP] identifier[opencms] operator[SEP] identifier[ade] operator[SEP] identifier[upload] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_UPLOAD_FILE_SIZE_LIMIT_3] , identifier[actualSize] , identifier[e] operator[SEP] identifier[getFileName] operator[SEP] operator[SEP] , identifier[maxSize] operator[SEP] , identifier[e] operator[SEP] operator[SEP] } }
protected WxCpXmlOutMessage service(WxCpXmlMessage wxMessage, WxCpService wxCpService, WxSessionManager sessionManager, WxErrorExceptionHandler exceptionHandler) { try { Map<String, Object> context = new HashMap<String, Object>(); // 如果拦截器不通过 for (WxCpMessageInterceptor interceptor : this.interceptors) { if (!interceptor.intercept(wxMessage, context, wxCpService, sessionManager)) { return null; } } // 交给handler处理 WxCpXmlOutMessage res = null; for (WxCpMessageHandler handler : this.handlers) { // 返回最后handler的结果 res = handler.handle(wxMessage, context, wxCpService, sessionManager); } return res; } catch (WxErrorException e) { exceptionHandler.handle(e); } return null; }
class class_name[name] begin[{] method[service, return_type[type[WxCpXmlOutMessage]], modifier[protected], parameter[wxMessage, wxCpService, sessionManager, exceptionHandler]] begin[{] TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=HashMap, sub_type=None)), name=context)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=wxMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=wxCpService, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sessionManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=intercept, postfix_operators=[], prefix_operators=['!'], qualifier=interceptor, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]))]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=interceptors, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=interceptor)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WxCpMessageInterceptor, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=res)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WxCpXmlOutMessage, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=wxMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=wxCpService, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sessionManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handle, postfix_operators=[], prefix_operators=[], qualifier=handler, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=handlers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=handler)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WxCpMessageHandler, sub_type=None))), label=None), ReturnStatement(expression=MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handle, postfix_operators=[], prefix_operators=[], qualifier=exceptionHandler, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['WxErrorException']))], finally_block=None, label=None, resources=None) return[literal[null]] end[}] END[}]
Keyword[protected] identifier[WxCpXmlOutMessage] identifier[service] operator[SEP] identifier[WxCpXmlMessage] identifier[wxMessage] , identifier[WxCpService] identifier[wxCpService] , identifier[WxSessionManager] identifier[sessionManager] , identifier[WxErrorExceptionHandler] identifier[exceptionHandler] operator[SEP] { Keyword[try] { identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[context] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[WxCpMessageInterceptor] identifier[interceptor] operator[:] Keyword[this] operator[SEP] identifier[interceptors] operator[SEP] { Keyword[if] operator[SEP] operator[!] identifier[interceptor] operator[SEP] identifier[intercept] operator[SEP] identifier[wxMessage] , identifier[context] , identifier[wxCpService] , identifier[sessionManager] operator[SEP] operator[SEP] { Keyword[return] Other[null] operator[SEP] } } identifier[WxCpXmlOutMessage] identifier[res] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[WxCpMessageHandler] identifier[handler] operator[:] Keyword[this] operator[SEP] identifier[handlers] operator[SEP] { identifier[res] operator[=] identifier[handler] operator[SEP] identifier[handle] operator[SEP] identifier[wxMessage] , identifier[context] , identifier[wxCpService] , identifier[sessionManager] operator[SEP] operator[SEP] } Keyword[return] identifier[res] operator[SEP] } Keyword[catch] operator[SEP] identifier[WxErrorException] identifier[e] operator[SEP] { identifier[exceptionHandler] operator[SEP] identifier[handle] operator[SEP] identifier[e] operator[SEP] operator[SEP] } Keyword[return] Other[null] operator[SEP] }
@Override public void encode(final OtpOutputStream buf) { final int arity = elems.length; buf.write_tuple_head(arity); for (int i = 0; i < arity; i++) { buf.write_any(elems[i]); } }
class class_name[name] begin[{] method[encode, return_type[void], modifier[public], parameter[buf]] begin[{] local_variable[type[int], arity] call[buf.write_tuple_head, parameter[member[.arity]]] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=elems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=write_any, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=arity, 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) end[}] END[}]
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[encode] operator[SEP] Keyword[final] identifier[OtpOutputStream] identifier[buf] operator[SEP] { Keyword[final] Keyword[int] identifier[arity] operator[=] identifier[elems] operator[SEP] identifier[length] operator[SEP] identifier[buf] operator[SEP] identifier[write_tuple_head] operator[SEP] identifier[arity] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[arity] operator[SEP] identifier[i] operator[++] operator[SEP] { identifier[buf] operator[SEP] identifier[write_any] operator[SEP] identifier[elems] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] } }
private static void filterClasses(final Collection<Class<?>> classes) { final Iterator<Class<?>> iterator = classes.iterator(); while (iterator.hasNext()) { final Class<?> clazz = iterator.next(); if (clazz.isAnnotation() || !Reflections.isConcrete(clazz)) { iterator.remove(); } } }
class class_name[name] begin[{] method[filterClasses, return_type[void], modifier[private static], parameter[classes]] begin[{] local_variable[type[Iterator], iterator] while[call[iterator.hasNext, parameter[]]] begin[{] local_variable[type[Class], clazz] if[binary_operation[call[clazz.isAnnotation, parameter[]], ||, call[Reflections.isConcrete, parameter[member[.clazz]]]]] begin[{] call[iterator.remove, parameter[]] else begin[{] None end[}] end[}] end[}] END[}]
Keyword[private] Keyword[static] Keyword[void] identifier[filterClasses] operator[SEP] Keyword[final] identifier[Collection] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[classes] operator[SEP] { Keyword[final] identifier[Iterator] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[iterator] operator[=] identifier[classes] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] { Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[clazz] operator[SEP] identifier[isAnnotation] operator[SEP] operator[SEP] operator[||] operator[!] identifier[Reflections] operator[SEP] identifier[isConcrete] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] { identifier[iterator] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP] } } }
@NullSafe public static void dumpStack(String tag) { Thread currentThread = Thread.currentThread(); System.err.printf("%1$s - %2$s Thread @ %3$d%n", String.valueOf(tag).toUpperCase(), currentThread.getName(), currentThread.getId()); Thread.dumpStack(); }
class class_name[name] begin[{] method[dumpStack, return_type[void], modifier[public static], parameter[tag]] begin[{] local_variable[type[Thread], currentThread] call[System.err.printf, parameter[literal["%1$s - %2$s Thread @ %3$d%n"], call[String.valueOf, parameter[member[.tag]]], call[currentThread.getName, parameter[]], call[currentThread.getId, parameter[]]]] call[Thread.dumpStack, parameter[]] end[}] END[}]
annotation[@] identifier[NullSafe] Keyword[public] Keyword[static] Keyword[void] identifier[dumpStack] operator[SEP] identifier[String] identifier[tag] operator[SEP] { identifier[Thread] identifier[currentThread] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[tag] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] , identifier[currentThread] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[currentThread] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Thread] operator[SEP] identifier[dumpStack] operator[SEP] operator[SEP] operator[SEP] }
@Help( help = "Get all the PhysicalNetworkFunctionRecords of a specific NetworkServiceRecord with id" ) public List<PhysicalNetworkFunctionRecord> getPhysicalNetworkFunctionRecords(final String idNsr) throws SDKException { String url = idNsr + "/pnfrecords"; return Arrays.asList( (PhysicalNetworkFunctionRecord[]) requestGetAll(url, PhysicalNetworkFunctionRecord.class)); }
class class_name[name] begin[{] method[getPhysicalNetworkFunctionRecords, return_type[type[List]], modifier[public], parameter[idNsr]] begin[{] local_variable[type[String], url] return[call[Arrays.asList, parameter[Cast(expression=MethodInvocation(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PhysicalNetworkFunctionRecord, sub_type=None))], member=requestGetAll, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=PhysicalNetworkFunctionRecord, sub_type=None))]]] end[}] END[}]
annotation[@] identifier[Help] operator[SEP] identifier[help] operator[=] literal[String] operator[SEP] Keyword[public] identifier[List] operator[<] identifier[PhysicalNetworkFunctionRecord] operator[>] identifier[getPhysicalNetworkFunctionRecords] operator[SEP] Keyword[final] identifier[String] identifier[idNsr] operator[SEP] Keyword[throws] identifier[SDKException] { identifier[String] identifier[url] operator[=] identifier[idNsr] operator[+] literal[String] operator[SEP] Keyword[return] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] operator[SEP] identifier[PhysicalNetworkFunctionRecord] operator[SEP] operator[SEP] operator[SEP] identifier[requestGetAll] operator[SEP] identifier[url] , identifier[PhysicalNetworkFunctionRecord] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] }
public static void decryptFile(File encryptedFile, File result, String password) throws IOException { byte[] b = readBytes(encryptedFile); String decryptedImageString = new RNCryptorNative().decrypt(new String(b), password); byte[] decodedBytes = Base64.decode(decryptedImageString, 0); writeBytes(result, decodedBytes); }
class class_name[name] begin[{] method[decryptFile, return_type[void], modifier[public static], parameter[encryptedFile, result, password]] begin[{] local_variable[type[byte], b] local_variable[type[String], decryptedImageString] local_variable[type[byte], decodedBytes] call[.writeBytes, parameter[member[.result], member[.decodedBytes]]] end[}] END[}]
Keyword[public] Keyword[static] Keyword[void] identifier[decryptFile] operator[SEP] identifier[File] identifier[encryptedFile] , identifier[File] identifier[result] , identifier[String] identifier[password] operator[SEP] Keyword[throws] identifier[IOException] { Keyword[byte] operator[SEP] operator[SEP] identifier[b] operator[=] identifier[readBytes] operator[SEP] identifier[encryptedFile] operator[SEP] operator[SEP] identifier[String] identifier[decryptedImageString] operator[=] Keyword[new] identifier[RNCryptorNative] operator[SEP] operator[SEP] operator[SEP] identifier[decrypt] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[b] operator[SEP] , identifier[password] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[decodedBytes] operator[=] identifier[Base64] operator[SEP] identifier[decode] operator[SEP] identifier[decryptedImageString] , Other[0] operator[SEP] operator[SEP] identifier[writeBytes] operator[SEP] identifier[result] , identifier[decodedBytes] operator[SEP] operator[SEP] }
public List<GenericType> getGenericParameterTypes() { if (root.children.isEmpty()) { return null; } List<GenericType> genericParameters = new ArrayList<GenericType>(); putAllChildren(root, genericParameters); return unmodifiableList(new ArrayList<GenericType>(genericParameters)); }
class class_name[name] begin[{] method[getGenericParameterTypes, return_type[type[List]], modifier[public], parameter[]] begin[{] if[call[root.children.isEmpty, parameter[]]] begin[{] return[literal[null]] else begin[{] None end[}] local_variable[type[List], genericParameters] call[.putAllChildren, parameter[member[.root], member[.genericParameters]]] return[call[.unmodifiableList, parameter[ClassCreator(arguments=[MemberReference(member=genericParameters, 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=GenericType, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]]] end[}] END[}]
Keyword[public] identifier[List] operator[<] identifier[GenericType] operator[>] identifier[getGenericParameterTypes] operator[SEP] operator[SEP] { Keyword[if] operator[SEP] identifier[root] operator[SEP] identifier[children] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] { Keyword[return] Other[null] operator[SEP] } identifier[List] operator[<] identifier[GenericType] operator[>] identifier[genericParameters] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[GenericType] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[putAllChildren] operator[SEP] identifier[root] , identifier[genericParameters] operator[SEP] operator[SEP] Keyword[return] identifier[unmodifiableList] operator[SEP] Keyword[new] identifier[ArrayList] operator[<] identifier[GenericType] operator[>] operator[SEP] identifier[genericParameters] operator[SEP] operator[SEP] operator[SEP] }
public LocalDateTime minusYears(long years) { return (years == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-years)); }
class class_name[name] begin[{] method[minusYears, return_type[type[LocalDateTime]], modifier[public], parameter[years]] begin[{] return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=years, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MIN_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[]), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=years, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])], member=plusYears, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[])], member=plusYears, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=plusYears, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None))] end[}] END[}]
Keyword[public] identifier[LocalDateTime] identifier[minusYears] operator[SEP] Keyword[long] identifier[years] operator[SEP] { Keyword[return] operator[SEP] identifier[years] operator[==] identifier[Long] operator[SEP] identifier[MIN_VALUE] operator[?] identifier[plusYears] operator[SEP] identifier[Long] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP] identifier[plusYears] operator[SEP] Other[1] operator[SEP] operator[:] identifier[plusYears] operator[SEP] operator[-] identifier[years] operator[SEP] operator[SEP] operator[SEP] }
public static void logStderr(String msg, Throwable e) { try { long now = CurrentTime.currentTime(); //msg = QDate.formatLocal(now, "[%Y-%m-%d %H:%M:%S] ") + msg; _origSystemErr.println(msg); //e.printStackTrace(_origSystemErr.getPrintWriter()); _origSystemErr.flush(); } catch (Throwable e1) { } }
class class_name[name] begin[{] method[logStderr, return_type[void], modifier[public static], parameter[msg, e]] begin[{] TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=currentTime, postfix_operators=[], prefix_operators=[], qualifier=CurrentTime, selectors=[], type_arguments=None), name=now)], modifiers=set(), type=BasicType(dimensions=[], name=long)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=println, postfix_operators=[], prefix_operators=[], qualifier=_origSystemErr, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=_origSystemErr, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['Throwable']))], finally_block=None, label=None, resources=None) end[}] END[}]
Keyword[public] Keyword[static] Keyword[void] identifier[logStderr] operator[SEP] identifier[String] identifier[msg] , identifier[Throwable] identifier[e] operator[SEP] { Keyword[try] { Keyword[long] identifier[now] operator[=] identifier[CurrentTime] operator[SEP] identifier[currentTime] operator[SEP] operator[SEP] operator[SEP] identifier[_origSystemErr] operator[SEP] identifier[println] operator[SEP] identifier[msg] operator[SEP] operator[SEP] identifier[_origSystemErr] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[Throwable] identifier[e1] operator[SEP] { } }
public void setValue(final double VALUE) { if (null == value) { _value = VALUE; } else { value.set(VALUE); } fireMarkerEvent(VALUE_CHANGED_EVENT); }
class class_name[name] begin[{] method[setValue, return_type[void], modifier[public], parameter[VALUE]] begin[{] if[binary_operation[literal[null], ==, member[.value]]] begin[{] assign[member[._value], member[.VALUE]] else begin[{] call[value.set, parameter[member[.VALUE]]] end[}] call[.fireMarkerEvent, parameter[member[.VALUE_CHANGED_EVENT]]] end[}] END[}]
Keyword[public] Keyword[void] identifier[setValue] operator[SEP] Keyword[final] Keyword[double] identifier[VALUE] operator[SEP] { Keyword[if] operator[SEP] Other[null] operator[==] identifier[value] operator[SEP] { identifier[_value] operator[=] identifier[VALUE] operator[SEP] } Keyword[else] { identifier[value] operator[SEP] identifier[set] operator[SEP] identifier[VALUE] operator[SEP] operator[SEP] } identifier[fireMarkerEvent] operator[SEP] identifier[VALUE_CHANGED_EVENT] operator[SEP] operator[SEP] }
public VpnConnectionOptionsSpecification withTunnelOptions(VpnTunnelOptionsSpecification... tunnelOptions) { if (this.tunnelOptions == null) { setTunnelOptions(new com.amazonaws.internal.SdkInternalList<VpnTunnelOptionsSpecification>(tunnelOptions.length)); } for (VpnTunnelOptionsSpecification ele : tunnelOptions) { this.tunnelOptions.add(ele); } return this; }
class class_name[name] begin[{] method[withTunnelOptions, return_type[type[VpnConnectionOptionsSpecification]], modifier[public], parameter[tunnelOptions]] begin[{] if[binary_operation[THIS[member[None.tunnelOptions]], ==, literal[null]]] begin[{] call[.setTunnelOptions, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=tunnelOptions, 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=VpnTunnelOptionsSpecification, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]] else begin[{] None end[}] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=tunnelOptions, 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=tunnelOptions, 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=VpnTunnelOptionsSpecification, sub_type=None))), label=None) return[THIS[]] end[}] END[}]
Keyword[public] identifier[VpnConnectionOptionsSpecification] identifier[withTunnelOptions] operator[SEP] identifier[VpnTunnelOptionsSpecification] operator[...] identifier[tunnelOptions] operator[SEP] { Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[tunnelOptions] operator[==] Other[null] operator[SEP] { identifier[setTunnelOptions] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[VpnTunnelOptionsSpecification] operator[>] operator[SEP] identifier[tunnelOptions] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] } Keyword[for] operator[SEP] identifier[VpnTunnelOptionsSpecification] identifier[ele] operator[:] identifier[tunnelOptions] operator[SEP] { Keyword[this] operator[SEP] identifier[tunnelOptions] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP] } Keyword[return] Keyword[this] operator[SEP] }
public void marshall(DescribeFleetRequest describeFleetRequest, ProtocolMarshaller protocolMarshaller) { if (describeFleetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeFleetRequest.getFleet(), FLEET_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
class class_name[name] begin[{] method[marshall, return_type[void], modifier[public], parameter[describeFleetRequest, protocolMarshaller]] begin[{] if[binary_operation[member[.describeFleetRequest], ==, literal[null]]] begin[{] ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None) else begin[{] None end[}] TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFleet, postfix_operators=[], prefix_operators=[], qualifier=describeFleetRequest, selectors=[], type_arguments=None), MemberReference(member=FLEET_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None) end[}] END[}]
Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[DescribeFleetRequest] identifier[describeFleetRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] { Keyword[if] operator[SEP] identifier[describeFleetRequest] operator[==] Other[null] operator[SEP] { Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP] } Keyword[try] { identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeFleetRequest] operator[SEP] identifier[getFleet] operator[SEP] operator[SEP] , identifier[FLEET_BINDING] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] { Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] } }
@Override @Path("/{groupName}/{'users'}/{cuid}") @ApiOperation(value="Create a workgroup or add a user to an existing workgroup", notes="If users/{cuid} is present, user is added to workgroup.", response=StatusMessage.class) @ApiImplicitParams({ @ApiImplicitParam(name="Workgroup", paramType="body", required=true, dataType="com.centurylink.mdw.model.user.Workgroup"), @ApiImplicitParam(name="groupName", paramType="path", required=true)}) public JSONObject post(String path, JSONObject content, Map<String,String> headers) throws ServiceException, JSONException { String name = getSegment(path, 1); String rel = getSegment(path, 2); UserServices userServices = ServiceLocator.getUserServices(); try { if (rel == null) { Workgroup workgroup = new Workgroup(content); Workgroup existing = userServices.getWorkgroups().get(workgroup.getName()); if (existing != null) throw new ServiceException(HTTP_409_CONFLICT, "Workgroup name already exists: " + workgroup.getName()); userServices.createWorkgroup(workgroup); headers.put(Listener.METAINFO_HTTP_STATUS_CODE, "201"); } else if (rel.equals("users")) { String cuid = getSegment(path, 3); User user = UserGroupCache.getUser(cuid); if (user == null) { throw new CachingException("Cannot find user: " + cuid); } if (user.belongsToGroup(name)) // in case added elsewhere throw new ServiceException(HTTP_409_CONFLICT, "User " + cuid + " already belongs to workgroup " + name); userServices.addUserToWorkgroup(cuid, name); } else { String msg = "Unsupported relationship for workgroup " + name + ": " + rel; throw new ServiceException(HTTP_400_BAD_REQUEST, msg); } return null; } catch (DataAccessException ex) { throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex); } catch (CachingException ex) { throw new ServiceException(HTTP_500_INTERNAL_ERROR, ex.getMessage(), ex); } }
class class_name[name] begin[{] method[post, return_type[type[JSONObject]], modifier[public], parameter[path, content, headers]] begin[{] local_variable[type[String], name] local_variable[type[String], rel] local_variable[type[UserServices], userServices] TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="users")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=rel, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported relationship for workgroup "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), operandr=MemberReference(member=rel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=HTTP_400_BAD_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServiceException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], member=getSegment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=cuid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=cuid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getUser, postfix_operators=[], prefix_operators=[], qualifier=UserGroupCache, selectors=[], type_arguments=None), name=user)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=User, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=user, 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=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot find user: "), operandr=MemberReference(member=cuid, 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=CachingException, sub_type=None)), label=None)])), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=belongsToGroup, postfix_operators=[], prefix_operators=[], qualifier=user, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=HTTP_409_CONFLICT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="User "), operandr=MemberReference(member=cuid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" already belongs to workgroup "), operator=+), operandr=MemberReference(member=name, 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=ServiceException, sub_type=None)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cuid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addUserToWorkgroup, postfix_operators=[], prefix_operators=[], qualifier=userServices, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=content, 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=Workgroup, sub_type=None)), name=workgroup)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Workgroup, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getWorkgroups, postfix_operators=[], prefix_operators=[], qualifier=userServices, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=workgroup, selectors=[], type_arguments=None)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=existing)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Workgroup, 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=ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=HTTP_409_CONFLICT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Workgroup name already exists: "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=workgroup, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServiceException, sub_type=None)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=workgroup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createWorkgroup, postfix_operators=[], prefix_operators=[], qualifier=userServices, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=METAINFO_HTTP_STATUS_CODE, postfix_operators=[], prefix_operators=[], qualifier=Listener, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="201")], member=put, postfix_operators=[], prefix_operators=[], qualifier=headers, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=HTTP_500_INTERNAL_ERROR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServiceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['DataAccessException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=HTTP_500_INTERNAL_ERROR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServiceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['CachingException']))], finally_block=None, label=None, resources=None) end[}] END[}]
annotation[@] identifier[Override] annotation[@] identifier[Path] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[ApiOperation] operator[SEP] identifier[value] operator[=] literal[String] , identifier[notes] operator[=] literal[String] , identifier[response] operator[=] identifier[StatusMessage] operator[SEP] Keyword[class] operator[SEP] annotation[@] identifier[ApiImplicitParams] operator[SEP] { annotation[@] identifier[ApiImplicitParam] operator[SEP] identifier[name] operator[=] literal[String] , identifier[paramType] operator[=] literal[String] , identifier[required] operator[=] literal[boolean] , identifier[dataType] operator[=] literal[String] operator[SEP] , annotation[@] identifier[ApiImplicitParam] operator[SEP] identifier[name] operator[=] literal[String] , identifier[paramType] operator[=] literal[String] , identifier[required] operator[=] literal[boolean] operator[SEP] } operator[SEP] Keyword[public] identifier[JSONObject] identifier[post] operator[SEP] identifier[String] identifier[path] , identifier[JSONObject] identifier[content] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[headers] operator[SEP] Keyword[throws] identifier[ServiceException] , identifier[JSONException] { identifier[String] identifier[name] operator[=] identifier[getSegment] operator[SEP] identifier[path] , Other[1] operator[SEP] operator[SEP] identifier[String] identifier[rel] operator[=] identifier[getSegment] operator[SEP] identifier[path] , Other[2] operator[SEP] operator[SEP] identifier[UserServices] identifier[userServices] operator[=] identifier[ServiceLocator] operator[SEP] identifier[getUserServices] operator[SEP] operator[SEP] operator[SEP] Keyword[try] { Keyword[if] operator[SEP] identifier[rel] operator[==] Other[null] operator[SEP] { identifier[Workgroup] identifier[workgroup] operator[=] Keyword[new] identifier[Workgroup] operator[SEP] identifier[content] operator[SEP] operator[SEP] identifier[Workgroup] identifier[existing] operator[=] identifier[userServices] operator[SEP] identifier[getWorkgroups] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[workgroup] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[existing] operator[!=] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[HTTP_409_CONFLICT] , literal[String] operator[+] identifier[workgroup] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[userServices] operator[SEP] identifier[createWorkgroup] operator[SEP] identifier[workgroup] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[put] operator[SEP] identifier[Listener] operator[SEP] identifier[METAINFO_HTTP_STATUS_CODE] , literal[String] operator[SEP] operator[SEP] } Keyword[else] Keyword[if] operator[SEP] identifier[rel] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] { identifier[String] identifier[cuid] operator[=] identifier[getSegment] operator[SEP] identifier[path] , Other[3] operator[SEP] operator[SEP] identifier[User] identifier[user] operator[=] identifier[UserGroupCache] operator[SEP] identifier[getUser] operator[SEP] identifier[cuid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[user] operator[==] Other[null] operator[SEP] { Keyword[throw] Keyword[new] identifier[CachingException] operator[SEP] literal[String] operator[+] identifier[cuid] operator[SEP] operator[SEP] } Keyword[if] operator[SEP] identifier[user] operator[SEP] identifier[belongsToGroup] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[HTTP_409_CONFLICT] , literal[String] operator[+] identifier[cuid] operator[+] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP] identifier[userServices] operator[SEP] identifier[addUserToWorkgroup] operator[SEP] identifier[cuid] , identifier[name] operator[SEP] operator[SEP] } Keyword[else] { identifier[String] identifier[msg] operator[=] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[+] identifier[rel] operator[SEP] Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[HTTP_400_BAD_REQUEST] , identifier[msg] operator[SEP] operator[SEP] } Keyword[return] Other[null] operator[SEP] } Keyword[catch] operator[SEP] identifier[DataAccessException] identifier[ex] operator[SEP] { Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[HTTP_500_INTERNAL_ERROR] , identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[CachingException] identifier[ex] operator[SEP] { Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] identifier[HTTP_500_INTERNAL_ERROR] , identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP] } }
private int checkDictionary(int startPos, int endPos, boolean reverse) { // Reset the old break cache first. reset(); // note: code segment below assumes that dictionary chars are in the // startPos-endPos range // value returned should be next character in sequence if ((endPos - startPos) <= 1) { return (reverse ? startPos : endPos); } // Starting from the starting point, scan towards the proposed result, // looking for the first dictionary character (which may be the one // we're on, if we're starting in the middle of a range). fText.setIndex(reverse ? endPos : startPos); if (reverse) { CharacterIteration.previous32(fText); } int rangeStart = startPos; int rangeEnd = endPos; int category; int current; DictionaryBreakEngine.DequeI breaks = new DictionaryBreakEngine.DequeI(); int foundBreakCount = 0; int c = CharacterIteration.current32(fText); category = (short)fRData.fTrie.getCodePointValue(c); // Is the character we're starting on a dictionary character? If so, we // need to back up to include the entire run; otherwise the results of // the break algorithm will differ depending on where we start. Since // the result is cached and there is typically a non-dictionary break // within a small number of words, there should be little performance impact. if ((category & 0x4000) != 0) { if (reverse) { do { CharacterIteration.next32(fText); c = CharacterIteration.current32(fText); category = (short)fRData.fTrie.getCodePointValue(c); } while (c != CharacterIteration.DONE32 && ((category & 0x4000)) != 0); // Back up to the last dictionary character rangeEnd = fText.getIndex(); if (c == CharacterIteration.DONE32) { // c = fText->last32(); // TODO: why was this if needed? c = CharacterIteration.previous32(fText); } else { c = CharacterIteration.previous32(fText); } } else { do { c = CharacterIteration.previous32(fText); category = (short)fRData.fTrie.getCodePointValue(c); } while (c != CharacterIteration.DONE32 && ((category & 0x4000) != 0)); // Back up to the last dictionary character if (c == CharacterIteration.DONE32) { // c = fText->first32(); c = CharacterIteration.current32(fText); } else { CharacterIteration.next32(fText); c = CharacterIteration.current32(fText); } rangeStart = fText.getIndex(); } category = (short)fRData.fTrie.getCodePointValue(c); } // Loop through the text, looking for ranges of dictionary characters. // For each span, find the appropriate break engine, and ask it to find // any breaks within the span. // Note: we always do this in the forward direction, so that the break // cache is built in the right order. if (reverse) { fText.setIndex(rangeStart); c = CharacterIteration.current32(fText); category = (short)fRData.fTrie.getCodePointValue(c); } LanguageBreakEngine lbe = null; while(true) { while((current = fText.getIndex()) < rangeEnd && (category & 0x4000) == 0) { CharacterIteration.next32(fText); c = CharacterIteration.current32(fText); category = (short)fRData.fTrie.getCodePointValue(c); } if (current >= rangeEnd) { break; } // We now have a dictionary character. Get the appropriate language object // to deal with it. lbe = getLanguageBreakEngine(c); // Ask the language object if there are any breaks. It will leave the text // pointer on the other side of its range, ready to search for the next one. if (lbe != null) { int startingIdx = fText.getIndex(); foundBreakCount += lbe.findBreaks(fText, rangeStart, rangeEnd, false, fBreakType, breaks); assert fText.getIndex() > startingIdx; } // Reload the loop variables for the next go-round c = CharacterIteration.current32(fText); category = (short)fRData.fTrie.getCodePointValue(c); } // If we found breaks, build a new break cache. The first and last entries must // be the original starting and ending position. if (foundBreakCount > 0) { if (foundBreakCount != breaks.size()) { System.out.println("oops, foundBreakCount != breaks.size(). LBE = " + lbe.getClass()); } assert foundBreakCount == breaks.size(); if (startPos < breaks.peekLast()) { breaks.offer(startPos); } if (endPos > breaks.peek()) { breaks.push(endPos); } // TODO: get rid of this array, use results from the deque directly fCachedBreakPositions = new int[breaks.size()]; int i = 0; while (breaks.size() > 0) { fCachedBreakPositions[i++] = breaks.pollLast(); } // If there are breaks, then by definition, we are replacing the original // proposed break by one of the breaks we found. Use following() and // preceding() to do the work. They should never recurse in this case. if (reverse) { return preceding(endPos); } else { return following(startPos); } } // If we get here, there were no language-based breaks. Set the text pointer // to the original proposed break. fText.setIndex(reverse ? startPos : endPos); return (reverse ? startPos : endPos); }
class class_name[name] begin[{] method[checkDictionary, return_type[type[int]], modifier[private], parameter[startPos, endPos, reverse]] begin[{] call[.reset, parameter[]] if[binary_operation[binary_operation[member[.endPos], -, member[.startPos]], <=, literal[1]]] begin[{] return[TernaryExpression(condition=MemberReference(member=reverse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=endPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=startPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))] else begin[{] None end[}] call[fText.setIndex, parameter[TernaryExpression(condition=MemberReference(member=reverse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=startPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=endPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]] if[member[.reverse]] begin[{] call[CharacterIteration.previous32, parameter[member[.fText]]] else begin[{] None end[}] local_variable[type[int], rangeStart] local_variable[type[int], rangeEnd] local_variable[type[int], category] local_variable[type[int], current] local_variable[type[DictionaryBreakEngine], breaks] local_variable[type[int], foundBreakCount] local_variable[type[int], c] assign[member[.category], Cast(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCodePointValue, postfix_operators=[], prefix_operators=[], qualifier=fRData.fTrie, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=short))] if[binary_operation[binary_operation[member[.category], &, literal[0x4000]], !=, literal[0]]] begin[{] if[member[.reverse]] begin[{] do[binary_operation[binary_operation[member[.c], !=, member[CharacterIteration.DONE32]], &&, binary_operation[binary_operation[member[.category], &, literal[0x4000]], !=, literal[0]]]] begin[{] call[CharacterIteration.next32, parameter[member[.fText]]] assign[member[.c], call[CharacterIteration.current32, parameter[member[.fText]]]] assign[member[.category], Cast(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCodePointValue, postfix_operators=[], prefix_operators=[], qualifier=fRData.fTrie, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=short))] end[}] assign[member[.rangeEnd], call[fText.getIndex, parameter[]]] if[binary_operation[member[.c], ==, member[CharacterIteration.DONE32]]] begin[{] assign[member[.c], call[CharacterIteration.previous32, parameter[member[.fText]]]] else begin[{] assign[member[.c], call[CharacterIteration.previous32, parameter[member[.fText]]]] end[}] else begin[{] do[binary_operation[binary_operation[member[.c], !=, member[CharacterIteration.DONE32]], &&, binary_operation[binary_operation[member[.category], &, literal[0x4000]], !=, literal[0]]]] begin[{] assign[member[.c], call[CharacterIteration.previous32, parameter[member[.fText]]]] assign[member[.category], Cast(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCodePointValue, postfix_operators=[], prefix_operators=[], qualifier=fRData.fTrie, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=short))] end[}] if[binary_operation[member[.c], ==, member[CharacterIteration.DONE32]]] begin[{] assign[member[.c], call[CharacterIteration.current32, parameter[member[.fText]]]] else begin[{] call[CharacterIteration.next32, parameter[member[.fText]]] assign[member[.c], call[CharacterIteration.current32, parameter[member[.fText]]]] end[}] assign[member[.rangeStart], call[fText.getIndex, parameter[]]] end[}] assign[member[.category], Cast(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCodePointValue, postfix_operators=[], prefix_operators=[], qualifier=fRData.fTrie, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=short))] else begin[{] None end[}] if[member[.reverse]] begin[{] call[fText.setIndex, parameter[member[.rangeStart]]] assign[member[.c], call[CharacterIteration.current32, parameter[member[.fText]]]] assign[member[.category], Cast(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCodePointValue, postfix_operators=[], prefix_operators=[], qualifier=fRData.fTrie, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=short))] else begin[{] None end[}] local_variable[type[LanguageBreakEngine], lbe] while[literal[true]] begin[{] while[binary_operation[binary_operation[assign[member[.current], call[fText.getIndex, parameter[]]], <, member[.rangeEnd]], &&, binary_operation[binary_operation[member[.category], &, literal[0x4000]], ==, literal[0]]]] begin[{] call[CharacterIteration.next32, parameter[member[.fText]]] assign[member[.c], call[CharacterIteration.current32, parameter[member[.fText]]]] assign[member[.category], Cast(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCodePointValue, postfix_operators=[], prefix_operators=[], qualifier=fRData.fTrie, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=short))] end[}] if[binary_operation[member[.current], >=, member[.rangeEnd]]] begin[{] BreakStatement(goto=None, label=None) else begin[{] None end[}] assign[member[.lbe], call[.getLanguageBreakEngine, parameter[member[.c]]]] if[binary_operation[member[.lbe], !=, literal[null]]] begin[{] local_variable[type[int], startingIdx] assign[member[.foundBreakCount], call[lbe.findBreaks, parameter[member[.fText], member[.rangeStart], member[.rangeEnd], literal[false], member[.fBreakType], member[.breaks]]]] AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getIndex, postfix_operators=[], prefix_operators=[], qualifier=fText, selectors=[], type_arguments=None), operandr=MemberReference(member=startingIdx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), label=None, value=None) else begin[{] None end[}] assign[member[.c], call[CharacterIteration.current32, parameter[member[.fText]]]] assign[member[.category], Cast(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCodePointValue, postfix_operators=[], prefix_operators=[], qualifier=fRData.fTrie, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=short))] end[}] if[binary_operation[member[.foundBreakCount], >, literal[0]]] begin[{] if[binary_operation[member[.foundBreakCount], !=, call[breaks.size, parameter[]]]] begin[{] call[System.out.println, parameter[binary_operation[literal["oops, foundBreakCount != breaks.size(). LBE = "], +, call[lbe.getClass, parameter[]]]]] else begin[{] None end[}] AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=foundBreakCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=breaks, selectors=[], type_arguments=None), operator===), label=None, value=None) if[binary_operation[member[.startPos], <, call[breaks.peekLast, parameter[]]]] begin[{] call[breaks.offer, parameter[member[.startPos]]] else begin[{] None end[}] if[binary_operation[member[.endPos], >, call[breaks.peek, parameter[]]]] begin[{] call[breaks.push, parameter[member[.endPos]]] else begin[{] None end[}] assign[member[.fCachedBreakPositions], ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=breaks, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))] local_variable[type[int], i] while[binary_operation[call[breaks.size, parameter[]], >, literal[0]]] begin[{] assign[member[.fCachedBreakPositions], call[breaks.pollLast, parameter[]]] end[}] if[member[.reverse]] begin[{] return[call[.preceding, parameter[member[.endPos]]]] else begin[{] return[call[.following, parameter[member[.startPos]]]] end[}] else begin[{] None end[}] call[fText.setIndex, parameter[TernaryExpression(condition=MemberReference(member=reverse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=endPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=startPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]] return[TernaryExpression(condition=MemberReference(member=reverse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=endPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=startPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))] end[}] END[}]
Keyword[private] Keyword[int] identifier[checkDictionary] operator[SEP] Keyword[int] identifier[startPos] , Keyword[int] identifier[endPos] , Keyword[boolean] identifier[reverse] operator[SEP] { identifier[reset] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[endPos] operator[-] identifier[startPos] operator[SEP] operator[<=] Other[1] operator[SEP] { Keyword[return] operator[SEP] identifier[reverse] operator[?] identifier[startPos] operator[:] identifier[endPos] operator[SEP] operator[SEP] } identifier[fText] operator[SEP] identifier[setIndex] operator[SEP] identifier[reverse] operator[?] identifier[endPos] operator[:] identifier[startPos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reverse] operator[SEP] { identifier[CharacterIteration] operator[SEP] identifier[previous32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] } Keyword[int] identifier[rangeStart] operator[=] identifier[startPos] operator[SEP] Keyword[int] identifier[rangeEnd] operator[=] identifier[endPos] operator[SEP] Keyword[int] identifier[category] operator[SEP] Keyword[int] identifier[current] operator[SEP] identifier[DictionaryBreakEngine] operator[SEP] identifier[DequeI] identifier[breaks] operator[=] Keyword[new] identifier[DictionaryBreakEngine] operator[SEP] identifier[DequeI] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[foundBreakCount] operator[=] Other[0] operator[SEP] Keyword[int] identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[current32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] identifier[category] operator[=] operator[SEP] Keyword[short] operator[SEP] identifier[fRData] operator[SEP] identifier[fTrie] operator[SEP] identifier[getCodePointValue] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[category] operator[&] literal[Integer] operator[SEP] operator[!=] Other[0] operator[SEP] { Keyword[if] operator[SEP] identifier[reverse] operator[SEP] { Keyword[do] { identifier[CharacterIteration] operator[SEP] identifier[next32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[current32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] identifier[category] operator[=] operator[SEP] Keyword[short] operator[SEP] identifier[fRData] operator[SEP] identifier[fTrie] operator[SEP] identifier[getCodePointValue] operator[SEP] identifier[c] operator[SEP] operator[SEP] } Keyword[while] operator[SEP] identifier[c] operator[!=] identifier[CharacterIteration] operator[SEP] identifier[DONE32] operator[&&] operator[SEP] operator[SEP] identifier[category] operator[&] literal[Integer] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] operator[SEP] identifier[rangeEnd] operator[=] identifier[fText] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] identifier[CharacterIteration] operator[SEP] identifier[DONE32] operator[SEP] { identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[previous32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] } Keyword[else] { identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[previous32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] } } Keyword[else] { Keyword[do] { identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[previous32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] identifier[category] operator[=] operator[SEP] Keyword[short] operator[SEP] identifier[fRData] operator[SEP] identifier[fTrie] operator[SEP] identifier[getCodePointValue] operator[SEP] identifier[c] operator[SEP] operator[SEP] } Keyword[while] operator[SEP] identifier[c] operator[!=] identifier[CharacterIteration] operator[SEP] identifier[DONE32] operator[&&] operator[SEP] operator[SEP] identifier[category] operator[&] literal[Integer] operator[SEP] operator[!=] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] identifier[CharacterIteration] operator[SEP] identifier[DONE32] operator[SEP] { identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[current32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] } Keyword[else] { identifier[CharacterIteration] operator[SEP] identifier[next32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[current32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] } identifier[rangeStart] operator[=] identifier[fText] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[SEP] } identifier[category] operator[=] operator[SEP] Keyword[short] operator[SEP] identifier[fRData] operator[SEP] identifier[fTrie] operator[SEP] identifier[getCodePointValue] operator[SEP] identifier[c] operator[SEP] operator[SEP] } Keyword[if] operator[SEP] identifier[reverse] operator[SEP] { identifier[fText] operator[SEP] identifier[setIndex] operator[SEP] identifier[rangeStart] operator[SEP] operator[SEP] identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[current32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] identifier[category] operator[=] operator[SEP] Keyword[short] operator[SEP] identifier[fRData] operator[SEP] identifier[fTrie] operator[SEP] identifier[getCodePointValue] operator[SEP] identifier[c] operator[SEP] operator[SEP] } identifier[LanguageBreakEngine] identifier[lbe] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] { Keyword[while] operator[SEP] operator[SEP] identifier[current] operator[=] identifier[fText] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[SEP] operator[<] identifier[rangeEnd] operator[&&] operator[SEP] identifier[category] operator[&] literal[Integer] operator[SEP] operator[==] Other[0] operator[SEP] { identifier[CharacterIteration] operator[SEP] identifier[next32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[current32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] identifier[category] operator[=] operator[SEP] Keyword[short] operator[SEP] identifier[fRData] operator[SEP] identifier[fTrie] operator[SEP] identifier[getCodePointValue] operator[SEP] identifier[c] operator[SEP] operator[SEP] } Keyword[if] operator[SEP] identifier[current] operator[>=] identifier[rangeEnd] operator[SEP] { Keyword[break] operator[SEP] } identifier[lbe] operator[=] identifier[getLanguageBreakEngine] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lbe] operator[!=] Other[null] operator[SEP] { Keyword[int] identifier[startingIdx] operator[=] identifier[fText] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[SEP] identifier[foundBreakCount] operator[+=] identifier[lbe] operator[SEP] identifier[findBreaks] operator[SEP] identifier[fText] , identifier[rangeStart] , identifier[rangeEnd] , literal[boolean] , identifier[fBreakType] , identifier[breaks] operator[SEP] operator[SEP] Keyword[assert] identifier[fText] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[>] identifier[startingIdx] operator[SEP] } identifier[c] operator[=] identifier[CharacterIteration] operator[SEP] identifier[current32] operator[SEP] identifier[fText] operator[SEP] operator[SEP] identifier[category] operator[=] operator[SEP] Keyword[short] operator[SEP] identifier[fRData] operator[SEP] identifier[fTrie] operator[SEP] identifier[getCodePointValue] operator[SEP] identifier[c] operator[SEP] operator[SEP] } Keyword[if] operator[SEP] identifier[foundBreakCount] operator[>] Other[0] operator[SEP] { Keyword[if] operator[SEP] identifier[foundBreakCount] operator[!=] identifier[breaks] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] { identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[lbe] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } Keyword[assert] identifier[foundBreakCount] operator[==] identifier[breaks] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[startPos] operator[<] identifier[breaks] operator[SEP] identifier[peekLast] operator[SEP] operator[SEP] operator[SEP] { identifier[breaks] operator[SEP] identifier[offer] operator[SEP] identifier[startPos] operator[SEP] operator[SEP] } Keyword[if] operator[SEP] identifier[endPos] operator[>] identifier[breaks] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] { identifier[breaks] operator[SEP] identifier[push] operator[SEP] identifier[endPos] operator[SEP] operator[SEP] } identifier[fCachedBreakPositions] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[breaks] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[breaks] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] { identifier[fCachedBreakPositions] operator[SEP] identifier[i] operator[++] operator[SEP] operator[=] identifier[breaks] operator[SEP] identifier[pollLast] operator[SEP] operator[SEP] operator[SEP] } Keyword[if] operator[SEP] identifier[reverse] operator[SEP] { Keyword[return] identifier[preceding] operator[SEP] identifier[endPos] operator[SEP] operator[SEP] } Keyword[else] { Keyword[return] identifier[following] operator[SEP] identifier[startPos] operator[SEP] operator[SEP] } } identifier[fText] operator[SEP] identifier[setIndex] operator[SEP] identifier[reverse] operator[?] identifier[startPos] operator[:] identifier[endPos] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[reverse] operator[?] identifier[startPos] operator[:] identifier[endPos] operator[SEP] operator[SEP] }
public String getNewFileName(CmsObject cms, String namePattern, int defaultDigits, boolean explorerMode) throws CmsException { String checkPattern = cms.getRequestContext().removeSiteRoot(namePattern); String folderName = CmsResource.getFolderPath(checkPattern); // must check ALL resources in folder because name doesn't care for type List<CmsResource> resources = cms.readResources(folderName, CmsResourceFilter.ALL, false); // now create a list of all the file names List<String> fileNames = new ArrayList<String>(resources.size()); for (CmsResource res : resources) { fileNames.add(cms.getSitePath(res)); } return getNewFileNameFromList(fileNames, checkPattern, defaultDigits, explorerMode); }
class class_name[name] begin[{] method[getNewFileName, return_type[type[String]], modifier[public], parameter[cms, namePattern, defaultDigits, explorerMode]] begin[{] local_variable[type[String], checkPattern] local_variable[type[String], folderName] local_variable[type[List], resources] local_variable[type[List], fileNames] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSitePath, postfix_operators=[], prefix_operators=[], qualifier=cms, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=fileNames, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=res)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsResource, sub_type=None))), label=None) return[call[.getNewFileNameFromList, parameter[member[.fileNames], member[.checkPattern], member[.defaultDigits], member[.explorerMode]]]] end[}] END[}]
Keyword[public] identifier[String] identifier[getNewFileName] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[String] identifier[namePattern] , Keyword[int] identifier[defaultDigits] , Keyword[boolean] identifier[explorerMode] operator[SEP] Keyword[throws] identifier[CmsException] { identifier[String] identifier[checkPattern] operator[=] identifier[cms] operator[SEP] identifier[getRequestContext] operator[SEP] operator[SEP] operator[SEP] identifier[removeSiteRoot] operator[SEP] identifier[namePattern] operator[SEP] operator[SEP] identifier[String] identifier[folderName] operator[=] identifier[CmsResource] operator[SEP] identifier[getFolderPath] operator[SEP] identifier[checkPattern] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[CmsResource] operator[>] identifier[resources] operator[=] identifier[cms] operator[SEP] identifier[readResources] operator[SEP] identifier[folderName] , identifier[CmsResourceFilter] operator[SEP] identifier[ALL] , literal[boolean] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[fileNames] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[resources] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CmsResource] identifier[res] operator[:] identifier[resources] operator[SEP] { identifier[fileNames] operator[SEP] identifier[add] operator[SEP] identifier[cms] operator[SEP] identifier[getSitePath] operator[SEP] identifier[res] operator[SEP] operator[SEP] operator[SEP] } Keyword[return] identifier[getNewFileNameFromList] operator[SEP] identifier[fileNames] , identifier[checkPattern] , identifier[defaultDigits] , identifier[explorerMode] operator[SEP] operator[SEP] }
public static Observable<String> getFileExtension(final String fileName) { return Observable.fromCallable(new Func0<String>() { @Override public String call() { return fileName.substring((fileName.lastIndexOf('.')) + 1); } }); }
class class_name[name] begin[{] method[getFileExtension, return_type[type[Observable]], modifier[public static], parameter[fileName]] begin[{] return[call[Observable.fromCallable, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.')], member=lastIndexOf, postfix_operators=[], prefix_operators=[], qualifier=fileName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=fileName, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=call, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=Func0, sub_type=None))]]] end[}] END[}]
Keyword[public] Keyword[static] identifier[Observable] operator[<] identifier[String] operator[>] identifier[getFileExtension] operator[SEP] Keyword[final] identifier[String] identifier[fileName] operator[SEP] { Keyword[return] identifier[Observable] operator[SEP] identifier[fromCallable] operator[SEP] Keyword[new] identifier[Func0] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] { annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[call] operator[SEP] operator[SEP] { Keyword[return] identifier[fileName] operator[SEP] identifier[substring] operator[SEP] operator[SEP] identifier[fileName] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] } } operator[SEP] operator[SEP] }
public ClassInfoList getClassInfoRecursive() { final Set<ClassInfo> reachableClassInfo = new HashSet<>(); obtainClassInfoRecursive(reachableClassInfo); return new ClassInfoList(reachableClassInfo, /* sortByName = */ true); }
class class_name[name] begin[{] method[getClassInfoRecursive, return_type[type[ClassInfoList]], modifier[public], parameter[]] begin[{] local_variable[type[Set], reachableClassInfo] call[.obtainClassInfoRecursive, parameter[member[.reachableClassInfo]]] return[ClassCreator(arguments=[MemberReference(member=reachableClassInfo, 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=ClassInfoList, sub_type=None))] end[}] END[}]
Keyword[public] identifier[ClassInfoList] identifier[getClassInfoRecursive] operator[SEP] operator[SEP] { Keyword[final] identifier[Set] operator[<] identifier[ClassInfo] operator[>] identifier[reachableClassInfo] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[obtainClassInfoRecursive] operator[SEP] identifier[reachableClassInfo] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ClassInfoList] operator[SEP] identifier[reachableClassInfo] , literal[boolean] operator[SEP] operator[SEP] }
@Override public <RET extends ORecord> RET save(final ORecord iRecord, final OPERATION_MODE iMode, boolean iForceCreate, final ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback) { return save(iRecord, null, iMode, iForceCreate, iRecordCreatedCallback, iRecordUpdatedCallback); }
class class_name[name] begin[{] method[save, return_type[type[RET]], modifier[public], parameter[iRecord, iMode, iForceCreate, iRecordCreatedCallback, iRecordUpdatedCallback]] begin[{] return[call[.save, parameter[member[.iRecord], literal[null], member[.iMode], member[.iForceCreate], member[.iRecordCreatedCallback], member[.iRecordUpdatedCallback]]]] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] operator[<] identifier[RET] Keyword[extends] identifier[ORecord] operator[>] identifier[RET] identifier[save] operator[SEP] Keyword[final] identifier[ORecord] identifier[iRecord] , Keyword[final] identifier[OPERATION_MODE] identifier[iMode] , Keyword[boolean] identifier[iForceCreate] , Keyword[final] identifier[ORecordCallback] operator[<] operator[?] Keyword[extends] identifier[Number] operator[>] identifier[iRecordCreatedCallback] , identifier[ORecordCallback] operator[<] identifier[Integer] operator[>] identifier[iRecordUpdatedCallback] operator[SEP] { Keyword[return] identifier[save] operator[SEP] identifier[iRecord] , Other[null] , identifier[iMode] , identifier[iForceCreate] , identifier[iRecordCreatedCallback] , identifier[iRecordUpdatedCallback] operator[SEP] operator[SEP] }
public GroupZipper up() { if (!canUp()) { throw new NoSuchElementException("Could not move up because this group does not have a parent"); } this.index = parent.index; this.node = parent.node; this.parent = parent.parent; return this; }
class class_name[name] begin[{] method[up, return_type[type[GroupZipper]], modifier[public], parameter[]] begin[{] if[call[.canUp, parameter[]]] begin[{] ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not move up because this group does not have a parent")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchElementException, sub_type=None)), label=None) else begin[{] None end[}] assign[THIS[member[None.index]], member[parent.index]] assign[THIS[member[None.node]], member[parent.node]] assign[THIS[member[None.parent]], member[parent.parent]] return[THIS[]] end[}] END[}]
Keyword[public] identifier[GroupZipper] identifier[up] operator[SEP] operator[SEP] { Keyword[if] operator[SEP] operator[!] identifier[canUp] operator[SEP] operator[SEP] operator[SEP] { Keyword[throw] Keyword[new] identifier[NoSuchElementException] operator[SEP] literal[String] operator[SEP] operator[SEP] } Keyword[this] operator[SEP] identifier[index] operator[=] identifier[parent] operator[SEP] identifier[index] operator[SEP] Keyword[this] operator[SEP] identifier[node] operator[=] identifier[parent] operator[SEP] identifier[node] operator[SEP] Keyword[this] operator[SEP] identifier[parent] operator[=] identifier[parent] operator[SEP] identifier[parent] operator[SEP] Keyword[return] Keyword[this] operator[SEP] }
public static boolean isTraceEnabled(StaplerRequest req) { if (TRACE) return true; if (TRACE_PER_REQUEST && "true".equals(req.getHeader("X-Stapler-Trace"))) return true; return false; }
class class_name[name] begin[{] method[isTraceEnabled, return_type[type[boolean]], modifier[public static], parameter[req]] begin[{] if[member[.TRACE]] begin[{] return[literal[true]] else begin[{] None end[}] if[binary_operation[member[.TRACE_PER_REQUEST], &&, literal["true"]]] begin[{] return[literal[true]] else begin[{] None end[}] return[literal[false]] end[}] END[}]
Keyword[public] Keyword[static] Keyword[boolean] identifier[isTraceEnabled] operator[SEP] identifier[StaplerRequest] identifier[req] operator[SEP] { Keyword[if] operator[SEP] identifier[TRACE] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[TRACE_PER_REQUEST] operator[&&] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[req] operator[SEP] identifier[getHeader] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP] }
public CreateTableRequest getTableSchema() { return new CreateTableRequest() .withTableName(tableName) .withProvisionedThroughput(new ProvisionedThroughput(client.readCapacity(tableName), client.writeCapacity(tableName))); }
class class_name[name] begin[{] method[getTableSchema, return_type[type[CreateTableRequest]], modifier[public], parameter[]] begin[{] return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withTableName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readCapacity, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeCapacity, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ProvisionedThroughput, sub_type=None))], member=withProvisionedThroughput, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=CreateTableRequest, sub_type=None))] end[}] END[}]
Keyword[public] identifier[CreateTableRequest] identifier[getTableSchema] operator[SEP] operator[SEP] { Keyword[return] Keyword[new] identifier[CreateTableRequest] operator[SEP] operator[SEP] operator[SEP] identifier[withTableName] operator[SEP] identifier[tableName] operator[SEP] operator[SEP] identifier[withProvisionedThroughput] operator[SEP] Keyword[new] identifier[ProvisionedThroughput] operator[SEP] identifier[client] operator[SEP] identifier[readCapacity] operator[SEP] identifier[tableName] operator[SEP] , identifier[client] operator[SEP] identifier[writeCapacity] operator[SEP] identifier[tableName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] }
private void processRunAs(Servlet servlet) { String servletName = servlet.getServletName(); Map<String, ConfigItem<String>> runAsMap = this.configurator.getConfigItemMap(RUN_AS_KEY); ConfigItem<String> existingRunAs = runAsMap.get(servletName); RunAs runAs = servlet.getRunAs(); String roleName = (runAs != null) ? runAs.getRoleName() : null; if (runAs != null) { if (existingRunAs == null) { runAsMap.put(servletName, this.configurator.createConfigItem(roleName)); if (roleName != null) this.servletNameToRunAsRole.put(servletName, roleName); } else { this.configurator.validateDuplicateKeyValueConfiguration(SERVLET_KEY, SERVLET_NAME_KEY, servletName, RUN_AS_KEY, roleName, existingRunAs); } } if ((TraceComponent.isAnyTracingEnabled()) && (SecurityServletConfiguratorHelper.tc.isDebugEnabled())) Tr.debug(SecurityServletConfiguratorHelper.tc, "servletNameToRunAsRole: " + this.servletNameToRunAsRole, new Object[0]); }
class class_name[name] begin[{] method[processRunAs, return_type[void], modifier[private], parameter[servlet]] begin[{] local_variable[type[String], servletName] local_variable[type[Map], runAsMap] local_variable[type[ConfigItem], existingRunAs] local_variable[type[RunAs], runAs] local_variable[type[String], roleName] if[binary_operation[member[.runAs], !=, literal[null]]] begin[{] if[binary_operation[member[.existingRunAs], ==, literal[null]]] begin[{] call[runAsMap.put, parameter[member[.servletName], THIS[member[None.configurator]call[None.createConfigItem, parameter[member[.roleName]]]]]] if[binary_operation[member[.roleName], !=, literal[null]]] begin[{] THIS[member[None.servletNameToRunAsRole]call[None.put, parameter[member[.servletName], member[.roleName]]]] else begin[{] None end[}] else begin[{] THIS[member[None.configurator]call[None.validateDuplicateKeyValueConfiguration, parameter[member[.SERVLET_KEY], member[.SERVLET_NAME_KEY], member[.servletName], member[.RUN_AS_KEY], member[.roleName], member[.existingRunAs]]]] end[}] else begin[{] None end[}] if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[SecurityServletConfiguratorHelper.tc.isDebugEnabled, parameter[]]]] begin[{] call[Tr.debug, parameter[member[SecurityServletConfiguratorHelper.tc], binary_operation[literal["servletNameToRunAsRole: "], +, THIS[member[None.servletNameToRunAsRole]]], ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]] else begin[{] None end[}] end[}] END[}]
Keyword[private] Keyword[void] identifier[processRunAs] operator[SEP] identifier[Servlet] identifier[servlet] operator[SEP] { identifier[String] identifier[servletName] operator[=] identifier[servlet] operator[SEP] identifier[getServletName] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[ConfigItem] operator[<] identifier[String] operator[>] operator[>] identifier[runAsMap] operator[=] Keyword[this] operator[SEP] identifier[configurator] operator[SEP] identifier[getConfigItemMap] operator[SEP] identifier[RUN_AS_KEY] operator[SEP] operator[SEP] identifier[ConfigItem] operator[<] identifier[String] operator[>] identifier[existingRunAs] operator[=] identifier[runAsMap] operator[SEP] identifier[get] operator[SEP] identifier[servletName] operator[SEP] operator[SEP] identifier[RunAs] identifier[runAs] operator[=] identifier[servlet] operator[SEP] identifier[getRunAs] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[roleName] operator[=] operator[SEP] identifier[runAs] operator[!=] Other[null] operator[SEP] operator[?] identifier[runAs] operator[SEP] identifier[getRoleName] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[runAs] operator[!=] Other[null] operator[SEP] { Keyword[if] operator[SEP] identifier[existingRunAs] operator[==] Other[null] operator[SEP] { identifier[runAsMap] operator[SEP] identifier[put] operator[SEP] identifier[servletName] , Keyword[this] operator[SEP] identifier[configurator] operator[SEP] identifier[createConfigItem] operator[SEP] identifier[roleName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[roleName] operator[!=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[servletNameToRunAsRole] operator[SEP] identifier[put] operator[SEP] identifier[servletName] , identifier[roleName] operator[SEP] operator[SEP] } Keyword[else] { Keyword[this] operator[SEP] identifier[configurator] operator[SEP] identifier[validateDuplicateKeyValueConfiguration] operator[SEP] identifier[SERVLET_KEY] , identifier[SERVLET_NAME_KEY] , identifier[servletName] , identifier[RUN_AS_KEY] , identifier[roleName] , identifier[existingRunAs] operator[SEP] operator[SEP] } } Keyword[if] operator[SEP] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[SecurityServletConfiguratorHelper] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[SecurityServletConfiguratorHelper] operator[SEP] identifier[tc] , literal[String] operator[+] Keyword[this] operator[SEP] identifier[servletNameToRunAsRole] , Keyword[new] identifier[Object] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] }
private void configure(ModelMapper modelMapper) { if (configurers != null) { for (ModelMapperConfigurer modelMapperConfigurer : configurers) { modelMapperConfigurer.configure(modelMapper); } } }
class class_name[name] begin[{] method[configure, return_type[void], modifier[private], parameter[modelMapper]] begin[{] if[binary_operation[member[.configurers], !=, literal[null]]] begin[{] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=modelMapper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=configure, postfix_operators=[], prefix_operators=[], qualifier=modelMapperConfigurer, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=configurers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=modelMapperConfigurer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ModelMapperConfigurer, sub_type=None))), label=None) else begin[{] None end[}] end[}] END[}]
Keyword[private] Keyword[void] identifier[configure] operator[SEP] identifier[ModelMapper] identifier[modelMapper] operator[SEP] { Keyword[if] operator[SEP] identifier[configurers] operator[!=] Other[null] operator[SEP] { Keyword[for] operator[SEP] identifier[ModelMapperConfigurer] identifier[modelMapperConfigurer] operator[:] identifier[configurers] operator[SEP] { identifier[modelMapperConfigurer] operator[SEP] identifier[configure] operator[SEP] identifier[modelMapper] operator[SEP] operator[SEP] } } }
public CoreLabel makeToken(String tokenText, String originalText, int begin, int length) { CoreLabel cl = addIndices ? new CoreLabel(5) : new CoreLabel(); cl.setValue(tokenText); cl.setWord(tokenText); cl.setOriginalText(originalText); if(addIndices) { cl.set(CharacterOffsetBeginAnnotation.class, begin); cl.set(CharacterOffsetEndAnnotation.class, begin+length); } return cl; }
class class_name[name] begin[{] method[makeToken, return_type[type[CoreLabel]], modifier[public], parameter[tokenText, originalText, begin, length]] begin[{] local_variable[type[CoreLabel], cl] call[cl.setValue, parameter[member[.tokenText]]] call[cl.setWord, parameter[member[.tokenText]]] call[cl.setOriginalText, parameter[member[.originalText]]] if[member[.addIndices]] begin[{] call[cl.set, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CharacterOffsetBeginAnnotation, sub_type=None)), member[.begin]]] call[cl.set, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CharacterOffsetEndAnnotation, sub_type=None)), binary_operation[member[.begin], +, member[.length]]]] else begin[{] None end[}] return[member[.cl]] end[}] END[}]
Keyword[public] identifier[CoreLabel] identifier[makeToken] operator[SEP] identifier[String] identifier[tokenText] , identifier[String] identifier[originalText] , Keyword[int] identifier[begin] , Keyword[int] identifier[length] operator[SEP] { identifier[CoreLabel] identifier[cl] operator[=] identifier[addIndices] operator[?] Keyword[new] identifier[CoreLabel] operator[SEP] Other[5] operator[SEP] operator[:] Keyword[new] identifier[CoreLabel] operator[SEP] operator[SEP] operator[SEP] identifier[cl] operator[SEP] identifier[setValue] operator[SEP] identifier[tokenText] operator[SEP] operator[SEP] identifier[cl] operator[SEP] identifier[setWord] operator[SEP] identifier[tokenText] operator[SEP] operator[SEP] identifier[cl] operator[SEP] identifier[setOriginalText] operator[SEP] identifier[originalText] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[addIndices] operator[SEP] { identifier[cl] operator[SEP] identifier[set] operator[SEP] identifier[CharacterOffsetBeginAnnotation] operator[SEP] Keyword[class] , identifier[begin] operator[SEP] operator[SEP] identifier[cl] operator[SEP] identifier[set] operator[SEP] identifier[CharacterOffsetEndAnnotation] operator[SEP] Keyword[class] , identifier[begin] operator[+] identifier[length] operator[SEP] operator[SEP] } Keyword[return] identifier[cl] operator[SEP] }
public static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string) { if (c != null && string != null) { return Enum.valueOf(c, string.trim().toUpperCase()); } return null; }
class class_name[name] begin[{] method[getEnumFromString, return_type[type[T]], modifier[public static], parameter[c, string]] begin[{] if[binary_operation[binary_operation[member[.c], !=, literal[null]], &&, binary_operation[member[.string], !=, literal[null]]]] begin[{] return[call[Enum.valueOf, parameter[member[.c], call[string.trim, parameter[]]]]] else begin[{] None end[}] return[literal[null]] end[}] END[}]
Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Enum] operator[<] identifier[T] operator[>] operator[>] identifier[T] identifier[getEnumFromString] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[c] , identifier[String] identifier[string] operator[SEP] { Keyword[if] operator[SEP] identifier[c] operator[!=] Other[null] operator[&&] identifier[string] operator[!=] Other[null] operator[SEP] { Keyword[return] identifier[Enum] operator[SEP] identifier[valueOf] operator[SEP] identifier[c] , identifier[string] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } Keyword[return] Other[null] operator[SEP] }
public CommonEvent parse(String cefString, final boolean validate, Locale locale) { int cefHeaderSize = 7; CommonEvent cefEvent = new CefRev23(locale); // Note how split number of splits is cefHeaderSize + 1. This is because the final split // should be the body of the CEF message // Compiled pattern is equivalent to "(?<!\\\\)" + Pattern.quote("|") final String[] extractedMessage = cefString.split("(?<!\\\\)" + Pattern.quote("|"), cefHeaderSize + 1); // CEF header misses values if (extractedMessage.length < cefHeaderSize) { if (logger.isDebugEnabled()) { logger.debug("CEF message failed validation"); } return null; } final HashMap<String, Object> headers = new HashMap<String, Object>(); headers.put("version", Integer.valueOf(extractedMessage[0].substring(extractedMessage[0].length() - 1))); headers.put("deviceVendor", extractedMessage[1]); headers.put("deviceProduct", extractedMessage[2]); headers.put("deviceVersion", extractedMessage[3]); headers.put("deviceEventClassId", extractedMessage[4]); headers.put("name", extractedMessage[5]); headers.put("severity", extractedMessage[6]); final HashMap<String, String> extensions = new HashMap<String, String>(); final String ext = extractedMessage[7]; // Compiled pattern is equivalent to String extensionRegex = "(?<!\\\\)" + Pattern.quote("="); final Matcher matcher = extensionPattern.matcher(ext); final Matcher valueMatcher = extensionPattern.matcher(ext); int index = 0; while (matcher.find()) { String key = ext.substring(index, matcher.end() - 1).replace(" ", ""); // Capture the start of the value (first char after delimiter match); int valueStart = matcher.end(); // Handle all but last extension if (valueMatcher.find(valueStart)) { // FInd the next match to determine the maximum length of the value int nextMatch = valueMatcher.start(); // Find the last space prior to next match (i.e. last char before next key) int lastSpace = ext.lastIndexOf(" ", nextMatch); // Copy the value between the value start (i.e. this match) // and the lastSpace (i.e. last char prior to next key) String value = ext.substring(valueStart, lastSpace); // Put to map. extensions.put(key, value); // Update index to the last character before the next key index = lastSpace + 1; // Treat the last KV (if match is true) } else if (valueMatcher.find(valueStart - 1)) { // We are handling the final character, value end if newline at the // end of string int valueEnd = ext.length(); String value = ext.substring(valueStart, valueEnd); extensions.put(key, value); // Update the index to the end of the string so no matches are possible index = valueEnd; } } try { cefEvent.setHeader(headers); cefEvent.setExtension(extensions); } catch (CEFHandlingException e) { logger.error(e.toString()); return null; } if (validate) { if (validator == null) { // Since the validator wasn't initiated previously, create a new one; this.validator = Validation.buildDefaultValidatorFactory().getValidator();; } Set<ConstraintViolation<CommonEvent>> validationResult = validator.validate(cefEvent); if (validationResult.size() > 0) { if (logger.isDebugEnabled()) { logger.debug("CEF message failed validation"); } return null; } else { return cefEvent; } } else { return cefEvent; } }
class class_name[name] begin[{] method[parse, return_type[type[CommonEvent]], modifier[public], parameter[cefString, validate, locale]] begin[{] local_variable[type[int], cefHeaderSize] local_variable[type[CommonEvent], cefEvent] local_variable[type[String], extractedMessage] if[binary_operation[member[extractedMessage.length], <, member[.cefHeaderSize]]] begin[{] if[call[logger.isDebugEnabled, parameter[]]] begin[{] call[logger.debug, parameter[literal["CEF message failed validation"]]] else begin[{] None end[}] return[literal[null]] else begin[{] None end[}] local_variable[type[HashMap], headers] call[headers.put, parameter[literal["version"], call[Integer.valueOf, parameter[member[.extractedMessage]]]]] call[headers.put, parameter[literal["deviceVendor"], member[.extractedMessage]]] call[headers.put, parameter[literal["deviceProduct"], member[.extractedMessage]]] call[headers.put, parameter[literal["deviceVersion"], member[.extractedMessage]]] call[headers.put, parameter[literal["deviceEventClassId"], member[.extractedMessage]]] call[headers.put, parameter[literal["name"], member[.extractedMessage]]] call[headers.put, parameter[literal["severity"], member[.extractedMessage]]] local_variable[type[HashMap], extensions] local_variable[type[String], ext] local_variable[type[Matcher], matcher] local_variable[type[Matcher], valueMatcher] local_variable[type[int], index] while[call[matcher.find, parameter[]]] begin[{] local_variable[type[String], key] local_variable[type[int], valueStart] if[call[valueMatcher.find, parameter[member[.valueStart]]]] begin[{] local_variable[type[int], nextMatch] local_variable[type[int], lastSpace] local_variable[type[String], value] call[extensions.put, parameter[member[.key], member[.value]]] assign[member[.index], binary_operation[member[.lastSpace], +, literal[1]]] else begin[{] if[call[valueMatcher.find, parameter[binary_operation[member[.valueStart], -, literal[1]]]]] begin[{] local_variable[type[int], valueEnd] local_variable[type[String], value] call[extensions.put, parameter[member[.key], member[.value]]] assign[member[.index], member[.valueEnd]] else begin[{] None end[}] end[}] end[}] TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=headers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setHeader, postfix_operators=[], prefix_operators=[], qualifier=cefEvent, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=extensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setExtension, postfix_operators=[], prefix_operators=[], qualifier=cefEvent, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CEFHandlingException']))], finally_block=None, label=None, resources=None) if[member[.validate]] begin[{] if[binary_operation[member[.validator], ==, literal[null]]] begin[{] assign[THIS[member[None.validator]], call[Validation.buildDefaultValidatorFactory, parameter[]]] Statement(label=None) else begin[{] None end[}] local_variable[type[Set], validationResult] if[binary_operation[call[validationResult.size, parameter[]], >, literal[0]]] begin[{] if[call[logger.isDebugEnabled, parameter[]]] begin[{] call[logger.debug, parameter[literal["CEF message failed validation"]]] else begin[{] None end[}] return[literal[null]] else begin[{] return[member[.cefEvent]] end[}] else begin[{] return[member[.cefEvent]] end[}] end[}] END[}]
Keyword[public] identifier[CommonEvent] identifier[parse] operator[SEP] identifier[String] identifier[cefString] , Keyword[final] Keyword[boolean] identifier[validate] , identifier[Locale] identifier[locale] operator[SEP] { Keyword[int] identifier[cefHeaderSize] operator[=] Other[7] operator[SEP] identifier[CommonEvent] identifier[cefEvent] operator[=] Keyword[new] identifier[CefRev23] operator[SEP] identifier[locale] operator[SEP] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[extractedMessage] operator[=] identifier[cefString] operator[SEP] identifier[split] operator[SEP] literal[String] operator[+] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] literal[String] operator[SEP] , identifier[cefHeaderSize] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[extractedMessage] operator[SEP] identifier[length] operator[<] identifier[cefHeaderSize] operator[SEP] { Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] { identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] } Keyword[return] Other[null] operator[SEP] } Keyword[final] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[headers] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[extractedMessage] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[substring] operator[SEP] identifier[extractedMessage] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[extractedMessage] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[extractedMessage] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[extractedMessage] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[extractedMessage] operator[SEP] Other[4] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[extractedMessage] operator[SEP] Other[5] operator[SEP] operator[SEP] operator[SEP] identifier[headers] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[extractedMessage] operator[SEP] Other[6] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[extensions] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[ext] operator[=] identifier[extractedMessage] operator[SEP] Other[7] operator[SEP] operator[SEP] Keyword[final] identifier[Matcher] identifier[matcher] operator[=] identifier[extensionPattern] operator[SEP] identifier[matcher] operator[SEP] identifier[ext] operator[SEP] operator[SEP] Keyword[final] identifier[Matcher] identifier[valueMatcher] operator[=] identifier[extensionPattern] operator[SEP] identifier[matcher] operator[SEP] identifier[ext] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[matcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] { identifier[String] identifier[key] operator[=] identifier[ext] operator[SEP] identifier[substring] operator[SEP] identifier[index] , identifier[matcher] operator[SEP] identifier[end] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[valueStart] operator[=] identifier[matcher] operator[SEP] identifier[end] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[valueMatcher] operator[SEP] identifier[find] operator[SEP] identifier[valueStart] operator[SEP] operator[SEP] { Keyword[int] identifier[nextMatch] operator[=] identifier[valueMatcher] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[lastSpace] operator[=] identifier[ext] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] , identifier[nextMatch] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] identifier[ext] operator[SEP] identifier[substring] operator[SEP] identifier[valueStart] , identifier[lastSpace] operator[SEP] operator[SEP] identifier[extensions] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP] identifier[index] operator[=] identifier[lastSpace] operator[+] Other[1] operator[SEP] } Keyword[else] Keyword[if] operator[SEP] identifier[valueMatcher] operator[SEP] identifier[find] operator[SEP] identifier[valueStart] operator[-] Other[1] operator[SEP] operator[SEP] { Keyword[int] identifier[valueEnd] operator[=] identifier[ext] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] identifier[ext] operator[SEP] identifier[substring] operator[SEP] identifier[valueStart] , identifier[valueEnd] operator[SEP] operator[SEP] identifier[extensions] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP] identifier[index] operator[=] identifier[valueEnd] operator[SEP] } } Keyword[try] { identifier[cefEvent] operator[SEP] identifier[setHeader] operator[SEP] identifier[headers] operator[SEP] operator[SEP] identifier[cefEvent] operator[SEP] identifier[setExtension] operator[SEP] identifier[extensions] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[CEFHandlingException] identifier[e] operator[SEP] { identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP] } Keyword[if] operator[SEP] identifier[validate] operator[SEP] { Keyword[if] operator[SEP] identifier[validator] operator[==] Other[null] operator[SEP] { Keyword[this] operator[SEP] identifier[validator] operator[=] identifier[Validation] operator[SEP] identifier[buildDefaultValidatorFactory] operator[SEP] operator[SEP] operator[SEP] identifier[getValidator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } identifier[Set] operator[<] identifier[ConstraintViolation] operator[<] identifier[CommonEvent] operator[>] operator[>] identifier[validationResult] operator[=] identifier[validator] operator[SEP] identifier[validate] operator[SEP] identifier[cefEvent] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[validationResult] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] { Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] { identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] } Keyword[return] Other[null] operator[SEP] } Keyword[else] { Keyword[return] identifier[cefEvent] operator[SEP] } } Keyword[else] { Keyword[return] identifier[cefEvent] operator[SEP] } }
public static String deleteAny(String inString, String charsToDelete) { if (!hasLength(inString) || !hasLength(charsToDelete)) { return inString; } StringBuilder sb = new StringBuilder(inString.length()); for (int i = 0; i < inString.length(); i++) { char c = inString.charAt(i); if (charsToDelete.indexOf(c) == -1) { sb.append(c); } } return sb.toString(); }
class class_name[name] begin[{] method[deleteAny, return_type[type[String]], modifier[public static], parameter[inString, charsToDelete]] begin[{] if[binary_operation[call[.hasLength, parameter[member[.inString]]], ||, call[.hasLength, parameter[member[.charsToDelete]]]]] begin[{] return[member[.inString]] else begin[{] None end[}] local_variable[type[StringBuilder], sb] ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=inString, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=charsToDelete, 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=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=inString, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None) return[call[sb.toString, parameter[]]] end[}] END[}]
Keyword[public] Keyword[static] identifier[String] identifier[deleteAny] operator[SEP] identifier[String] identifier[inString] , identifier[String] identifier[charsToDelete] operator[SEP] { Keyword[if] operator[SEP] operator[!] identifier[hasLength] operator[SEP] identifier[inString] operator[SEP] operator[||] operator[!] identifier[hasLength] operator[SEP] identifier[charsToDelete] operator[SEP] operator[SEP] { Keyword[return] identifier[inString] operator[SEP] } identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[inString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[inString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] { Keyword[char] identifier[c] operator[=] identifier[inString] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[charsToDelete] operator[SEP] identifier[indexOf] operator[SEP] identifier[c] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] { identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] } } Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] }
public static void saveMediaDataToFile(byte[] mediaData, String fileName) throws FileNotFoundException, IOException { saveMediaDataToFile(mediaData, new File(fileName)); }
class class_name[name] begin[{] method[saveMediaDataToFile, return_type[void], modifier[public static], parameter[mediaData, fileName]] begin[{] call[.saveMediaDataToFile, parameter[member[.mediaData], ClassCreator(arguments=[MemberReference(member=fileName, 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=File, sub_type=None))]] end[}] END[}]
Keyword[public] Keyword[static] Keyword[void] identifier[saveMediaDataToFile] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[mediaData] , identifier[String] identifier[fileName] operator[SEP] Keyword[throws] identifier[FileNotFoundException] , identifier[IOException] { identifier[saveMediaDataToFile] operator[SEP] identifier[mediaData] , Keyword[new] identifier[File] operator[SEP] identifier[fileName] operator[SEP] operator[SEP] operator[SEP] }
String getConfigString() throws XPathExpressionException { ganglia = getXmlNode("/jmxetric-config/ganglia", inputSource); String hostname = getHostName(); int port = getPort(); UDPAddressingMode addressingMode = getAddressingMode(); boolean v31x = getV31(); String spoof = getSpoof(); StringBuilder buf = new StringBuilder(); buf.append("GMetric host=").append(hostname); buf.append(" port=").append(port); buf.append(" mode=").append(addressingMode); buf.append(" v31x=").append(v31x); buf.append(" spoof=").append(spoof); return buf.toString(); }
class class_name[name] begin[{] method[getConfigString, return_type[type[String]], modifier[default], parameter[]] begin[{] assign[member[.ganglia], call[.getXmlNode, parameter[literal["/jmxetric-config/ganglia"], member[.inputSource]]]] local_variable[type[String], hostname] local_variable[type[int], port] local_variable[type[UDPAddressingMode], addressingMode] local_variable[type[boolean], v31x] local_variable[type[String], spoof] local_variable[type[StringBuilder], buf] call[buf.append, parameter[literal["GMetric host="]]] call[buf.append, parameter[literal[" port="]]] call[buf.append, parameter[literal[" mode="]]] call[buf.append, parameter[literal[" v31x="]]] call[buf.append, parameter[literal[" spoof="]]] return[call[buf.toString, parameter[]]] end[}] END[}]
identifier[String] identifier[getConfigString] operator[SEP] operator[SEP] Keyword[throws] identifier[XPathExpressionException] { identifier[ganglia] operator[=] identifier[getXmlNode] operator[SEP] literal[String] , identifier[inputSource] operator[SEP] operator[SEP] identifier[String] identifier[hostname] operator[=] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[port] operator[=] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] identifier[UDPAddressingMode] identifier[addressingMode] operator[=] identifier[getAddressingMode] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[v31x] operator[=] identifier[getV31] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[spoof] operator[=] identifier[getSpoof] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[buf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[hostname] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[port] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[addressingMode] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[v31x] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[spoof] operator[SEP] operator[SEP] Keyword[return] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] }
public static boolean isJavaVersionOK() { boolean isJavaVersionOK = true; String versionStr = System.getProperty("java.version"); String[] parts; double version; if (versionStr.contains(".")) { parts = versionStr.split("\\."); } else { parts = new String[]{versionStr}; } if (parts.length == 1) { try { version = Double.parseDouble(parts[0]); } catch (Exception e) { System.err.println("Unparsable Java version: " + versionStr); return false; } } else { try { version = Double.parseDouble(parts[0]) + Double.parseDouble(parts[1]) / 10; } catch (Exception e) { System.err.println("Unparsable Java version: " + versionStr); return false; } } if (version < 1.8) { isJavaVersionOK = false; System.err.println(); System.err.println(Globals.getWorkbenchInfoString()); System.err.println(); System.err.print("Java 8 or higher is required to run MOA. "); System.err.println("Java version " + versionStr + " found"); } return isJavaVersionOK; }
class class_name[name] begin[{] method[isJavaVersionOK, return_type[type[boolean]], modifier[public static], parameter[]] begin[{] local_variable[type[boolean], isJavaVersionOK] local_variable[type[String], versionStr] local_variable[type[String], parts] local_variable[type[double], version] if[call[versionStr.contains, parameter[literal["."]]]] begin[{] assign[member[.parts], call[versionStr.split, parameter[literal["\\."]]]] else begin[{] assign[member[.parts], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=versionStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))] end[}] if[binary_operation[member[parts.length], ==, literal[1]]] begin[{] TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], member=parseDouble, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unparsable Java version: "), operandr=MemberReference(member=versionStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None) else begin[{] TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], member=parseDouble, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], member=parseDouble, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), operator=/), operator=+)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unparsable Java version: "), operandr=MemberReference(member=versionStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None) end[}] if[binary_operation[member[.version], <, literal[1.8]]] begin[{] assign[member[.isJavaVersionOK], literal[false]] call[System.err.println, parameter[]] call[System.err.println, parameter[call[Globals.getWorkbenchInfoString, parameter[]]]] call[System.err.println, parameter[]] call[System.err.print, parameter[literal["Java 8 or higher is required to run MOA. "]]] call[System.err.println, parameter[binary_operation[binary_operation[literal["Java version "], +, member[.versionStr]], +, literal[" found"]]]] else begin[{] None end[}] return[member[.isJavaVersionOK]] end[}] END[}]
Keyword[public] Keyword[static] Keyword[boolean] identifier[isJavaVersionOK] operator[SEP] operator[SEP] { Keyword[boolean] identifier[isJavaVersionOK] operator[=] literal[boolean] operator[SEP] identifier[String] identifier[versionStr] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[parts] operator[SEP] Keyword[double] identifier[version] operator[SEP] Keyword[if] operator[SEP] identifier[versionStr] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] { identifier[parts] operator[=] identifier[versionStr] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] } Keyword[else] { identifier[parts] operator[=] Keyword[new] identifier[String] operator[SEP] operator[SEP] { identifier[versionStr] } operator[SEP] } Keyword[if] operator[SEP] identifier[parts] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] { Keyword[try] { identifier[version] operator[=] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[parts] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] } Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] { identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[versionStr] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] } } Keyword[else] { Keyword[try] { identifier[version] operator[=] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[parts] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[+] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[parts] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[/] Other[10] operator[SEP] } Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] { identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[versionStr] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] } } Keyword[if] operator[SEP] identifier[version] operator[<] literal[Float] operator[SEP] { identifier[isJavaVersionOK] operator[=] literal[boolean] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] identifier[Globals] operator[SEP] identifier[getWorkbenchInfoString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[versionStr] operator[+] literal[String] operator[SEP] operator[SEP] } Keyword[return] identifier[isJavaVersionOK] operator[SEP] }
public boolean isAcceptValid(HttpHeaders headers) { String accept = headers.get(HttpHeaders.Names.ACCEPT); // if we get no Accept (which means */*), or */*, // or application/json, then it's valid return ( Strings.isNullOrEmpty(accept) || accept.contains(ACCEPT_ALL) || accept.toLowerCase().contains(MEDIA_TYPE_APPLICATION_JSON)); }
class class_name[name] begin[{] method[isAcceptValid, return_type[type[boolean]], modifier[public], parameter[headers]] begin[{] local_variable[type[String], accept] return[binary_operation[binary_operation[call[Strings.isNullOrEmpty, parameter[member[.accept]]], ||, call[accept.contains, parameter[member[.ACCEPT_ALL]]]], ||, call[accept.toLowerCase, parameter[]]]] end[}] END[}]
Keyword[public] Keyword[boolean] identifier[isAcceptValid] operator[SEP] identifier[HttpHeaders] identifier[headers] operator[SEP] { identifier[String] identifier[accept] operator[=] identifier[headers] operator[SEP] identifier[get] operator[SEP] identifier[HttpHeaders] operator[SEP] identifier[Names] operator[SEP] identifier[ACCEPT] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[Strings] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[accept] operator[SEP] operator[||] identifier[accept] operator[SEP] identifier[contains] operator[SEP] identifier[ACCEPT_ALL] operator[SEP] operator[||] identifier[accept] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[MEDIA_TYPE_APPLICATION_JSON] operator[SEP] operator[SEP] operator[SEP] }
private static SpecTopic transformSpecTopicWithoutTypeCheck(final CSNodeWrapper node, final Map<Integer, Node> nodes, final Map<String, SpecTopic> targetTopics, final List<CSNodeWrapper> relationshipFromNodes) { final SpecTopic specTopic = new SpecTopic(node.getEntityId(), node.getTitle()); // Basic data specTopic.setRevision(node.getEntityRevision()); specTopic.setConditionStatement(node.getCondition()); specTopic.setTargetId(node.getTargetId()); specTopic.setUniqueId(node.getId() == null ? null : node.getId().toString()); // Set the fixed url properties applyFixedURLs(node, specTopic); // Collect any relationships for processing after everything is transformed if (node.getRelatedToNodes() != null && node.getRelatedToNodes().getItems() != null && !node.getRelatedToNodes().getItems() .isEmpty()) { relationshipFromNodes.add(node); } // Add the node to the list of processed nodes so that the relationships can be added once everything is processed nodes.put(node.getId(), specTopic); // If there is a target add it to the list if (node.getTargetId() != null) { targetTopics.put(node.getTargetId(), specTopic); } return specTopic; }
class class_name[name] begin[{] method[transformSpecTopicWithoutTypeCheck, return_type[type[SpecTopic]], modifier[private static], parameter[node, nodes, targetTopics, relationshipFromNodes]] begin[{] local_variable[type[SpecTopic], specTopic] call[specTopic.setRevision, parameter[call[node.getEntityRevision, parameter[]]]] call[specTopic.setConditionStatement, parameter[call[node.getCondition, parameter[]]]] call[specTopic.setTargetId, parameter[call[node.getTargetId, parameter[]]]] call[specTopic.setUniqueId, parameter[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]] call[.applyFixedURLs, parameter[member[.node], member[.specTopic]]] if[binary_operation[binary_operation[binary_operation[call[node.getRelatedToNodes, parameter[]], !=, literal[null]], &&, binary_operation[call[node.getRelatedToNodes, parameter[]], !=, literal[null]]], &&, call[node.getRelatedToNodes, parameter[]]]] begin[{] call[relationshipFromNodes.add, parameter[member[.node]]] else begin[{] None end[}] call[nodes.put, parameter[call[node.getId, parameter[]], member[.specTopic]]] if[binary_operation[call[node.getTargetId, parameter[]], !=, literal[null]]] begin[{] call[targetTopics.put, parameter[call[node.getTargetId, parameter[]], member[.specTopic]]] else begin[{] None end[}] return[member[.specTopic]] end[}] END[}]
Keyword[private] Keyword[static] identifier[SpecTopic] identifier[transformSpecTopicWithoutTypeCheck] operator[SEP] Keyword[final] identifier[CSNodeWrapper] identifier[node] , Keyword[final] identifier[Map] operator[<] identifier[Integer] , identifier[Node] operator[>] identifier[nodes] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[SpecTopic] operator[>] identifier[targetTopics] , Keyword[final] identifier[List] operator[<] identifier[CSNodeWrapper] operator[>] identifier[relationshipFromNodes] operator[SEP] { Keyword[final] identifier[SpecTopic] identifier[specTopic] operator[=] Keyword[new] identifier[SpecTopic] operator[SEP] identifier[node] operator[SEP] identifier[getEntityId] operator[SEP] operator[SEP] , identifier[node] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[specTopic] operator[SEP] identifier[setRevision] operator[SEP] identifier[node] operator[SEP] identifier[getEntityRevision] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[specTopic] operator[SEP] identifier[setConditionStatement] operator[SEP] identifier[node] operator[SEP] identifier[getCondition] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[specTopic] operator[SEP] identifier[setTargetId] operator[SEP] identifier[node] operator[SEP] identifier[getTargetId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[specTopic] operator[SEP] identifier[setUniqueId] operator[SEP] identifier[node] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[node] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[applyFixedURLs] operator[SEP] identifier[node] , identifier[specTopic] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[getRelatedToNodes] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[node] operator[SEP] identifier[getRelatedToNodes] operator[SEP] operator[SEP] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] identifier[node] operator[SEP] identifier[getRelatedToNodes] operator[SEP] operator[SEP] operator[SEP] identifier[getItems] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] { identifier[relationshipFromNodes] operator[SEP] identifier[add] operator[SEP] identifier[node] operator[SEP] operator[SEP] } identifier[nodes] operator[SEP] identifier[put] operator[SEP] identifier[node] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[specTopic] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[getTargetId] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] { identifier[targetTopics] operator[SEP] identifier[put] operator[SEP] identifier[node] operator[SEP] identifier[getTargetId] operator[SEP] operator[SEP] , identifier[specTopic] operator[SEP] operator[SEP] } Keyword[return] identifier[specTopic] operator[SEP] }
@Override public CreateRobotApplicationResult createRobotApplication(CreateRobotApplicationRequest request) { request = beforeClientExecution(request); return executeCreateRobotApplication(request); }
class class_name[name] begin[{] method[createRobotApplication, return_type[type[CreateRobotApplicationResult]], modifier[public], parameter[request]] begin[{] assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]] return[call[.executeCreateRobotApplication, parameter[member[.request]]]] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] identifier[CreateRobotApplicationResult] identifier[createRobotApplication] operator[SEP] identifier[CreateRobotApplicationRequest] identifier[request] operator[SEP] { identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeCreateRobotApplication] operator[SEP] identifier[request] operator[SEP] operator[SEP] }
protected final <T> void mergeSavedValue(T oldValue, T newValue, String name) // d681743 throws InjectionConfigurationException { if (oldValue == null ? newValue != null : !oldValue.equals(newValue)) { Tr.error(tc, "INCOMPATIBLE_MERGE_ATTRIBUTES_CWNEN0072E", getJndiName(), name, oldValue, newValue); throw new InjectionConfigurationException("The " + getJndiName() + " reference has conflicting values for the " + name + " attribute: " + oldValue + " and " + newValue); } }
class class_name[name] begin[{] method[mergeSavedValue, return_type[void], modifier[final protected], parameter[oldValue, newValue, name]] begin[{] if[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=oldValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=oldValue, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=))] begin[{] call[Tr.error, parameter[member[.tc], literal["INCOMPATIBLE_MERGE_ATTRIBUTES_CWNEN0072E"], call[.getJndiName, parameter[]], member[.name], member[.oldValue], member[.newValue]]] ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The "), operandr=MethodInvocation(arguments=[], member=getJndiName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" reference has conflicting values for the "), operator=+), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" attribute: "), operator=+), operandr=MemberReference(member=oldValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" and "), operator=+), operandr=MemberReference(member=newValue, 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=InjectionConfigurationException, sub_type=None)), label=None) else begin[{] None end[}] end[}] END[}]
Keyword[protected] Keyword[final] operator[<] identifier[T] operator[>] Keyword[void] identifier[mergeSavedValue] operator[SEP] identifier[T] identifier[oldValue] , identifier[T] identifier[newValue] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[InjectionConfigurationException] { Keyword[if] operator[SEP] identifier[oldValue] operator[==] Other[null] operator[?] identifier[newValue] operator[!=] Other[null] operator[:] operator[!] identifier[oldValue] operator[SEP] identifier[equals] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] { identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , identifier[getJndiName] operator[SEP] operator[SEP] , identifier[name] , identifier[oldValue] , identifier[newValue] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InjectionConfigurationException] operator[SEP] literal[String] operator[+] identifier[getJndiName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[+] identifier[oldValue] operator[+] literal[String] operator[+] identifier[newValue] operator[SEP] operator[SEP] } }
@Override public void listInsertAfter(final T currentElement, final T newElement) throws FrameworkException { if (currentElement.getUuid().equals(newElement.getUuid())) { throw new IllegalStateException("Cannot link a node to itself!"); } final T next = listGetNext(currentElement); if (next == null) { linkNodes(getSiblingLinkType(), currentElement, newElement); } else { // unlink predecessor and successor unlinkNodes(getSiblingLinkType(), currentElement, next); // link predecessor to new element linkNodes(getSiblingLinkType(), currentElement, newElement); // dont create self link if (!newElement.getUuid().equals(next.getUuid())) { // link new element to successor linkNodes(getSiblingLinkType(), newElement, next); } } }
class class_name[name] begin[{] method[listInsertAfter, return_type[void], modifier[public], parameter[currentElement, newElement]] begin[{] if[call[currentElement.getUuid, parameter[]]] begin[{] ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot link a node to itself!")], 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[T], next] if[binary_operation[member[.next], ==, literal[null]]] begin[{] call[.linkNodes, parameter[call[.getSiblingLinkType, parameter[]], member[.currentElement], member[.newElement]]] else begin[{] call[.unlinkNodes, parameter[call[.getSiblingLinkType, parameter[]], member[.currentElement], member[.next]]] call[.linkNodes, parameter[call[.getSiblingLinkType, parameter[]], member[.currentElement], member[.newElement]]] if[call[newElement.getUuid, parameter[]]] begin[{] call[.linkNodes, parameter[call[.getSiblingLinkType, parameter[]], member[.newElement], member[.next]]] else begin[{] None end[}] end[}] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[listInsertAfter] operator[SEP] Keyword[final] identifier[T] identifier[currentElement] , Keyword[final] identifier[T] identifier[newElement] operator[SEP] Keyword[throws] identifier[FrameworkException] { Keyword[if] operator[SEP] identifier[currentElement] operator[SEP] identifier[getUuid] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[newElement] operator[SEP] identifier[getUuid] operator[SEP] operator[SEP] operator[SEP] operator[SEP] { Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] } Keyword[final] identifier[T] identifier[next] operator[=] identifier[listGetNext] operator[SEP] identifier[currentElement] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[next] operator[==] Other[null] operator[SEP] { identifier[linkNodes] operator[SEP] identifier[getSiblingLinkType] operator[SEP] operator[SEP] , identifier[currentElement] , identifier[newElement] operator[SEP] operator[SEP] } Keyword[else] { identifier[unlinkNodes] operator[SEP] identifier[getSiblingLinkType] operator[SEP] operator[SEP] , identifier[currentElement] , identifier[next] operator[SEP] operator[SEP] identifier[linkNodes] operator[SEP] identifier[getSiblingLinkType] operator[SEP] operator[SEP] , identifier[currentElement] , identifier[newElement] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[newElement] operator[SEP] identifier[getUuid] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[next] operator[SEP] identifier[getUuid] operator[SEP] operator[SEP] operator[SEP] operator[SEP] { identifier[linkNodes] operator[SEP] identifier[getSiblingLinkType] operator[SEP] operator[SEP] , identifier[newElement] , identifier[next] operator[SEP] operator[SEP] } } }
public static MetadataType findType(String name) { if (name == null) return null; for (MetadataType m : members) { if (m.name.equalsIgnoreCase(name)) return m; } return null; }
class class_name[name] begin[{] method[findType, return_type[type[MetadataType]], modifier[public static], parameter[name]] begin[{] if[binary_operation[member[.name], ==, literal[null]]] begin[{] return[literal[null]] else begin[{] None end[}] ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=m.name, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=members, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MetadataType, sub_type=None))), label=None) return[literal[null]] end[}] END[}]
Keyword[public] Keyword[static] identifier[MetadataType] identifier[findType] operator[SEP] identifier[String] identifier[name] operator[SEP] { Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[MetadataType] identifier[m] operator[:] identifier[members] operator[SEP] { Keyword[if] operator[SEP] identifier[m] operator[SEP] identifier[name] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[m] operator[SEP] } Keyword[return] Other[null] operator[SEP] }
public void restart() { if (frames.size() == 0) { return; } stopped = false; currentFrame = 0; nextChange = (int) (((Frame) frames.get(0)).duration / speed); firstUpdate = true; lastUpdate = 0; }
class class_name[name] begin[{] method[restart, return_type[void], modifier[public], parameter[]] begin[{] if[binary_operation[call[frames.size, parameter[]], ==, literal[0]]] begin[{] return[None] else begin[{] None end[}] assign[member[.stopped], literal[false]] assign[member[.currentFrame], literal[0]] assign[member[.nextChange], Cast(expression=BinaryOperation(operandl=Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=frames, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Frame, sub_type=None)), operandr=MemberReference(member=speed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), type=BasicType(dimensions=[], name=int))] assign[member[.firstUpdate], literal[true]] assign[member[.lastUpdate], literal[0]] end[}] END[}]
Keyword[public] Keyword[void] identifier[restart] operator[SEP] operator[SEP] { Keyword[if] operator[SEP] identifier[frames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] { Keyword[return] operator[SEP] } identifier[stopped] operator[=] literal[boolean] operator[SEP] identifier[currentFrame] operator[=] Other[0] operator[SEP] identifier[nextChange] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Frame] operator[SEP] identifier[frames] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[duration] operator[/] identifier[speed] operator[SEP] operator[SEP] identifier[firstUpdate] operator[=] literal[boolean] operator[SEP] identifier[lastUpdate] operator[=] Other[0] operator[SEP] }
public Elements getElementsByAttributeValue(String key, String value) { return Collector.collect(new Evaluator.AttributeWithValue(key, value), this); }
class class_name[name] begin[{] method[getElementsByAttributeValue, return_type[type[Elements]], modifier[public], parameter[key, value]] begin[{] return[call[Collector.collect, parameter[ClassCreator(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=Evaluator, sub_type=ReferenceType(arguments=None, dimensions=None, name=AttributeWithValue, sub_type=None))), THIS[]]]] end[}] END[}]
Keyword[public] identifier[Elements] identifier[getElementsByAttributeValue] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] { Keyword[return] identifier[Collector] operator[SEP] identifier[collect] operator[SEP] Keyword[new] identifier[Evaluator] operator[SEP] identifier[AttributeWithValue] operator[SEP] identifier[key] , identifier[value] operator[SEP] , Keyword[this] operator[SEP] operator[SEP] }
public static Type[] getGenericTypes(Class<?> clazz) { Type mySuperClass = clazz.getGenericSuperclass(); System.out.println(mySuperClass); System.out.println(mySuperClass.getClass()); Type[] types = ((ParameterizedType) mySuperClass).getActualTypeArguments(); for (int i = 0; i < types.length; i++) { Type type = types[i]; System.out.println(type); } return types; }
class class_name[name] begin[{] method[getGenericTypes, return_type[type[Type]], modifier[public static], parameter[clazz]] begin[{] local_variable[type[Type], mySuperClass] call[System.out.println, parameter[member[.mySuperClass]]] call[System.out.println, parameter[call[mySuperClass.getClass, parameter[]]]] local_variable[type[Type], types] ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=types, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Type, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=types, 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[.types]] end[}] END[}]
Keyword[public] Keyword[static] identifier[Type] operator[SEP] operator[SEP] identifier[getGenericTypes] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] operator[SEP] { identifier[Type] identifier[mySuperClass] operator[=] identifier[clazz] operator[SEP] identifier[getGenericSuperclass] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[mySuperClass] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[mySuperClass] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Type] operator[SEP] operator[SEP] identifier[types] operator[=] operator[SEP] operator[SEP] identifier[ParameterizedType] operator[SEP] identifier[mySuperClass] operator[SEP] operator[SEP] identifier[getActualTypeArguments] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[types] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] { identifier[Type] identifier[type] operator[=] identifier[types] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[type] operator[SEP] operator[SEP] } Keyword[return] identifier[types] operator[SEP] }
public synchronized NbtAddress getByName ( String host, CIFSContext tc ) { return getByName(new Name(tc.getConfig(), host, 0x20, null), tc); }
class class_name[name] begin[{] method[getByName, return_type[type[NbtAddress]], modifier[synchronized public], parameter[host, tc]] begin[{] return[call[.getByName, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getConfig, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x20), 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=Name, sub_type=None)), member[.tc]]]] end[}] END[}]
Keyword[public] Keyword[synchronized] identifier[NbtAddress] identifier[getByName] operator[SEP] identifier[String] identifier[host] , identifier[CIFSContext] identifier[tc] operator[SEP] { Keyword[return] identifier[getByName] operator[SEP] Keyword[new] identifier[Name] operator[SEP] identifier[tc] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] , identifier[host] , literal[Integer] , Other[null] operator[SEP] , identifier[tc] operator[SEP] operator[SEP] }
public static void addAttributes(SerializationHandler handler, int src) throws TransformerException { TransformerImpl transformer = (TransformerImpl) handler.getTransformer(); DTM dtm = transformer.getXPathContext().getDTM(src); for (int node = dtm.getFirstAttribute(src); DTM.NULL != node; node = dtm.getNextAttribute(node)) { addAttribute(handler, node); } }
class class_name[name] begin[{] method[addAttributes, return_type[void], modifier[public static], parameter[handler, src]] begin[{] local_variable[type[TransformerImpl], transformer] local_variable[type[DTM], dtm] ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAttribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=NULL, postfix_operators=[], prefix_operators=[], qualifier=DTM, selectors=[]), operandr=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[MemberReference(member=src, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFirstAttribute, postfix_operators=[], prefix_operators=[], qualifier=dtm, selectors=[], type_arguments=None), name=node)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNextAttribute, postfix_operators=[], prefix_operators=[], qualifier=dtm, selectors=[], type_arguments=None))]), label=None) end[}] END[}]
Keyword[public] Keyword[static] Keyword[void] identifier[addAttributes] operator[SEP] identifier[SerializationHandler] identifier[handler] , Keyword[int] identifier[src] operator[SEP] Keyword[throws] identifier[TransformerException] { identifier[TransformerImpl] identifier[transformer] operator[=] operator[SEP] identifier[TransformerImpl] operator[SEP] identifier[handler] operator[SEP] identifier[getTransformer] operator[SEP] operator[SEP] operator[SEP] identifier[DTM] identifier[dtm] operator[=] identifier[transformer] operator[SEP] identifier[getXPathContext] operator[SEP] operator[SEP] operator[SEP] identifier[getDTM] operator[SEP] identifier[src] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[node] operator[=] identifier[dtm] operator[SEP] identifier[getFirstAttribute] operator[SEP] identifier[src] operator[SEP] operator[SEP] identifier[DTM] operator[SEP] identifier[NULL] operator[!=] identifier[node] operator[SEP] identifier[node] operator[=] identifier[dtm] operator[SEP] identifier[getNextAttribute] operator[SEP] identifier[node] operator[SEP] operator[SEP] { identifier[addAttribute] operator[SEP] identifier[handler] , identifier[node] operator[SEP] operator[SEP] } }
private static void buildAndDisplayAdUnitTree(AdUnit root, List<AdUnit> adUnits) { Map<String, List<AdUnit>> treeMap = new HashMap<String, List<AdUnit>>(); for (AdUnit adUnit : adUnits) { if (adUnit.getParentId() != null) { if (treeMap.get(adUnit.getParentId()) == null) { treeMap.put(adUnit.getParentId(), new ArrayList<AdUnit>()); } treeMap.get(adUnit.getParentId()).add(adUnit); } } if (root != null) { displayInventoryTree(root, treeMap); } else { System.out.println("No root unit found."); } }
class class_name[name] begin[{] method[buildAndDisplayAdUnitTree, return_type[void], modifier[private static], parameter[root, adUnits]] begin[{] local_variable[type[Map], treeMap] ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getParentId, postfix_operators=[], prefix_operators=[], qualifier=adUnit, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParentId, postfix_operators=[], prefix_operators=[], qualifier=adUnit, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=treeMap, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParentId, postfix_operators=[], prefix_operators=[], qualifier=adUnit, selectors=[], type_arguments=None), 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=AdUnit, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=treeMap, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParentId, postfix_operators=[], prefix_operators=[], qualifier=adUnit, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=treeMap, selectors=[MethodInvocation(arguments=[MemberReference(member=adUnit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=adUnits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=adUnit)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AdUnit, sub_type=None))), label=None) if[binary_operation[member[.root], !=, literal[null]]] begin[{] call[.displayInventoryTree, parameter[member[.root], member[.treeMap]]] else begin[{] call[System.out.println, parameter[literal["No root unit found."]]] end[}] end[}] END[}]
Keyword[private] Keyword[static] Keyword[void] identifier[buildAndDisplayAdUnitTree] operator[SEP] identifier[AdUnit] identifier[root] , identifier[List] operator[<] identifier[AdUnit] operator[>] identifier[adUnits] operator[SEP] { identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[AdUnit] operator[>] operator[>] identifier[treeMap] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[List] operator[<] identifier[AdUnit] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[AdUnit] identifier[adUnit] operator[:] identifier[adUnits] operator[SEP] { Keyword[if] operator[SEP] identifier[adUnit] operator[SEP] identifier[getParentId] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] { Keyword[if] operator[SEP] identifier[treeMap] operator[SEP] identifier[get] operator[SEP] identifier[adUnit] operator[SEP] identifier[getParentId] operator[SEP] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] { identifier[treeMap] operator[SEP] identifier[put] operator[SEP] identifier[adUnit] operator[SEP] identifier[getParentId] operator[SEP] operator[SEP] , Keyword[new] identifier[ArrayList] operator[<] identifier[AdUnit] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] } identifier[treeMap] operator[SEP] identifier[get] operator[SEP] identifier[adUnit] operator[SEP] identifier[getParentId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[adUnit] operator[SEP] operator[SEP] } } Keyword[if] operator[SEP] identifier[root] operator[!=] Other[null] operator[SEP] { identifier[displayInventoryTree] operator[SEP] identifier[root] , identifier[treeMap] operator[SEP] operator[SEP] } Keyword[else] { identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] } }
@Override public <B> IdentityT<M, B> fmap(Function<? super A, ? extends B> fn) { return MonadT.super.<B>fmap(fn).coerce(); }
class class_name[name] begin[{] method[fmap, return_type[type[IdentityT]], modifier[public], parameter[fn]] begin[{] return[member[.MonadT]] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] operator[<] identifier[B] operator[>] identifier[IdentityT] operator[<] identifier[M] , identifier[B] operator[>] identifier[fmap] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[A] , operator[?] Keyword[extends] identifier[B] operator[>] identifier[fn] operator[SEP] { Keyword[return] identifier[MonadT] operator[SEP] Keyword[super] operator[SEP] operator[<] identifier[B] operator[>] identifier[fmap] operator[SEP] identifier[fn] operator[SEP] operator[SEP] identifier[coerce] operator[SEP] operator[SEP] operator[SEP] }
public static void Debug(String message) { if (BranchUtil.isDebugEnabled() || enableLogging_) { if (!TextUtils.isEmpty(message)) { Log.i(TAG, message); } } }
class class_name[name] begin[{] method[Debug, return_type[void], modifier[public static], parameter[message]] begin[{] if[binary_operation[call[BranchUtil.isDebugEnabled, parameter[]], ||, member[.enableLogging_]]] begin[{] if[call[TextUtils.isEmpty, parameter[member[.message]]]] begin[{] call[Log.i, parameter[member[.TAG], member[.message]]] else begin[{] None end[}] else begin[{] None end[}] end[}] END[}]
Keyword[public] Keyword[static] Keyword[void] identifier[Debug] operator[SEP] identifier[String] identifier[message] operator[SEP] { Keyword[if] operator[SEP] identifier[BranchUtil] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[||] identifier[enableLogging_] operator[SEP] { Keyword[if] operator[SEP] operator[!] identifier[TextUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[message] operator[SEP] operator[SEP] { identifier[Log] operator[SEP] identifier[i] operator[SEP] identifier[TAG] , identifier[message] operator[SEP] operator[SEP] } } }
@Override public void setPrimaryKey( com.liferay.commerce.account.service.persistence.CommerceAccountUserRelPK primaryKey) { _commerceAccountUserRel.setPrimaryKey(primaryKey); }
class class_name[name] begin[{] method[setPrimaryKey, return_type[void], modifier[public], parameter[primaryKey]] begin[{] call[_commerceAccountUserRel.setPrimaryKey, parameter[member[.primaryKey]]] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setPrimaryKey] operator[SEP] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[account] operator[SEP] identifier[service] operator[SEP] identifier[persistence] operator[SEP] identifier[CommerceAccountUserRelPK] identifier[primaryKey] operator[SEP] { identifier[_commerceAccountUserRel] operator[SEP] identifier[setPrimaryKey] operator[SEP] identifier[primaryKey] operator[SEP] operator[SEP] }
private static int makeIndex(int c) { // check the predefined indices if(c >= 0x00C0 && c < 0x0140) return LATININDEX; else if(c >= 0x0250 && c < 0x02D0) return IPAEXTENSIONINDEX; else if(c >= 0x0370 && c < 0x03F0) return GREEKINDEX; else if(c >= 0x0530 && c < 0x0590) return ARMENIANINDEX; else if(c >= 0x3040 && c < 0x30A0) return HIRAGANAINDEX; else if(c >= 0x30A0 && c < 0x3120) return KATAKANAINDEX; else if(c >= 0xFF60 && c < 0xFF9F) return HALFWIDTHKATAKANAINDEX; // calculate index else if(c >= 0x0080 && c < 0x3400) return (c / 0x80) & 0xFF; else if(c >= 0xE000 && c <= 0xFFFF) return ((c - 0xAC00) / 0x80) & 0xFF; // should never happen else { return RESERVEDINDEX; } }
class class_name[name] begin[{] method[makeIndex, return_type[type[int]], modifier[private static], parameter[c]] begin[{] if[binary_operation[binary_operation[member[.c], >=, literal[0x00C0]], &&, binary_operation[member[.c], <, literal[0x0140]]]] begin[{] return[member[.LATININDEX]] else begin[{] if[binary_operation[binary_operation[member[.c], >=, literal[0x0250]], &&, binary_operation[member[.c], <, literal[0x02D0]]]] begin[{] return[member[.IPAEXTENSIONINDEX]] else begin[{] if[binary_operation[binary_operation[member[.c], >=, literal[0x0370]], &&, binary_operation[member[.c], <, literal[0x03F0]]]] begin[{] return[member[.GREEKINDEX]] else begin[{] if[binary_operation[binary_operation[member[.c], >=, literal[0x0530]], &&, binary_operation[member[.c], <, literal[0x0590]]]] begin[{] return[member[.ARMENIANINDEX]] else begin[{] if[binary_operation[binary_operation[member[.c], >=, literal[0x3040]], &&, binary_operation[member[.c], <, literal[0x30A0]]]] begin[{] return[member[.HIRAGANAINDEX]] else begin[{] if[binary_operation[binary_operation[member[.c], >=, literal[0x30A0]], &&, binary_operation[member[.c], <, literal[0x3120]]]] begin[{] return[member[.KATAKANAINDEX]] else begin[{] if[binary_operation[binary_operation[member[.c], >=, literal[0xFF60]], &&, binary_operation[member[.c], <, literal[0xFF9F]]]] begin[{] return[member[.HALFWIDTHKATAKANAINDEX]] else begin[{] if[binary_operation[binary_operation[member[.c], >=, literal[0x0080]], &&, binary_operation[member[.c], <, literal[0x3400]]]] begin[{] return[binary_operation[binary_operation[member[.c], /, literal[0x80]], &, literal[0xFF]]] else begin[{] if[binary_operation[binary_operation[member[.c], >=, literal[0xE000]], &&, binary_operation[member[.c], <=, literal[0xFFFF]]]] begin[{] return[binary_operation[binary_operation[binary_operation[member[.c], -, literal[0xAC00]], /, literal[0x80]], &, literal[0xFF]]] else begin[{] return[member[.RESERVEDINDEX]] end[}] end[}] end[}] end[}] end[}] end[}] end[}] end[}] end[}] end[}] END[}]
Keyword[private] Keyword[static] Keyword[int] identifier[makeIndex] operator[SEP] Keyword[int] identifier[c] operator[SEP] { Keyword[if] operator[SEP] identifier[c] operator[>=] literal[Integer] operator[&&] identifier[c] operator[<] literal[Integer] operator[SEP] Keyword[return] identifier[LATININDEX] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[>=] literal[Integer] operator[&&] identifier[c] operator[<] literal[Integer] operator[SEP] Keyword[return] identifier[IPAEXTENSIONINDEX] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[>=] literal[Integer] operator[&&] identifier[c] operator[<] literal[Integer] operator[SEP] Keyword[return] identifier[GREEKINDEX] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[>=] literal[Integer] operator[&&] identifier[c] operator[<] literal[Integer] operator[SEP] Keyword[return] identifier[ARMENIANINDEX] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[>=] literal[Integer] operator[&&] identifier[c] operator[<] literal[Integer] operator[SEP] Keyword[return] identifier[HIRAGANAINDEX] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[>=] literal[Integer] operator[&&] identifier[c] operator[<] literal[Integer] operator[SEP] Keyword[return] identifier[KATAKANAINDEX] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[>=] literal[Integer] operator[&&] identifier[c] operator[<] literal[Integer] operator[SEP] Keyword[return] identifier[HALFWIDTHKATAKANAINDEX] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[>=] literal[Integer] operator[&&] identifier[c] operator[<] literal[Integer] operator[SEP] Keyword[return] operator[SEP] identifier[c] operator[/] literal[Integer] operator[SEP] operator[&] literal[Integer] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[>=] literal[Integer] operator[&&] identifier[c] operator[<=] literal[Integer] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[c] operator[-] literal[Integer] operator[SEP] operator[/] literal[Integer] operator[SEP] operator[&] literal[Integer] operator[SEP] Keyword[else] { Keyword[return] identifier[RESERVEDINDEX] operator[SEP] } }
public static Point2D_F64 mean( Point2D_F64 a , Point2D_F64 b, Point2D_F64 mean ) { if( mean == null ) mean = new Point2D_F64(); mean.x = (a.x + b.x)/2.0; mean.y = (a.y + b.y)/2.0; return mean; }
class class_name[name] begin[{] method[mean, return_type[type[Point2D_F64]], modifier[public static], parameter[a, b, mean]] begin[{] if[binary_operation[member[.mean], ==, literal[null]]] begin[{] assign[member[.mean], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Point2D_F64, sub_type=None))] else begin[{] None end[}] assign[member[mean.x], binary_operation[binary_operation[member[a.x], +, member[b.x]], /, literal[2.0]]] assign[member[mean.y], binary_operation[binary_operation[member[a.y], +, member[b.y]], /, literal[2.0]]] return[member[.mean]] end[}] END[}]
Keyword[public] Keyword[static] identifier[Point2D_F64] identifier[mean] operator[SEP] identifier[Point2D_F64] identifier[a] , identifier[Point2D_F64] identifier[b] , identifier[Point2D_F64] identifier[mean] operator[SEP] { Keyword[if] operator[SEP] identifier[mean] operator[==] Other[null] operator[SEP] identifier[mean] operator[=] Keyword[new] identifier[Point2D_F64] operator[SEP] operator[SEP] operator[SEP] identifier[mean] operator[SEP] identifier[x] operator[=] operator[SEP] identifier[a] operator[SEP] identifier[x] operator[+] identifier[b] operator[SEP] identifier[x] operator[SEP] operator[/] literal[Float] operator[SEP] identifier[mean] operator[SEP] identifier[y] operator[=] operator[SEP] identifier[a] operator[SEP] identifier[y] operator[+] identifier[b] operator[SEP] identifier[y] operator[SEP] operator[/] literal[Float] operator[SEP] Keyword[return] identifier[mean] operator[SEP] }
static Finding createFindingWithSourceProperties(SourceName sourceName) { try (SecurityCenterClient client = SecurityCenterClient.create()) { // SourceName sourceName = SourceName.of(/*organization=*/"123234324",/*source=*/ // "423432321"); // Use the current time as the finding "event time". Instant eventTime = Instant.now(); // Controlled by caller. String findingId = "samplefindingid2"; // The resource this finding applies to. The CSCC UI can link // the findings for a resource to the corresponding Asset of a resource // if there are matches. String resourceName = "//cloudresourcemanager.googleapis.com/organizations/11232"; // Define source properties values as protobuf "Value" objects. Value stringValue = Value.newBuilder().setStringValue("stringExample").build(); Value numValue = Value.newBuilder().setNumberValue(1234).build(); ImmutableMap<String, Value> sourceProperties = ImmutableMap.of("stringKey", stringValue, "numKey", numValue); // Start setting up a request to create a finding in a source. Finding finding = Finding.newBuilder() .setParent(sourceName.toString()) .setState(State.ACTIVE) .setResourceName(resourceName) .setEventTime( Timestamp.newBuilder() .setSeconds(eventTime.getEpochSecond()) .setNanos(eventTime.getNano())) .putAllSourceProperties(sourceProperties) .build(); // Call the API. Finding response = client.createFinding(sourceName, findingId, finding); System.out.println("Created Finding with Source Properties: " + response); return response; } catch (IOException e) { throw new RuntimeException("Couldn't create client.", e); } }
class class_name[name] begin[{] method[createFindingWithSourceProperties, return_type[type[Finding]], modifier[static], parameter[sourceName]] begin[{] TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=now, postfix_operators=[], prefix_operators=[], qualifier=Instant, selectors=[], type_arguments=None), name=eventTime)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Instant, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="samplefindingid2"), name=findingId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="//cloudresourcemanager.googleapis.com/organizations/11232"), name=resourceName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=Value, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="stringExample")], member=setStringValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=stringValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Value, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=Value, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1234)], member=setNumberValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=numValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Value, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="stringKey"), MemberReference(member=stringValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="numKey"), MemberReference(member=numValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=ImmutableMap, selectors=[], type_arguments=None), name=sourceProperties)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Value, sub_type=None))], dimensions=[], name=ImmutableMap, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=Finding, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=sourceName, selectors=[], type_arguments=None)], member=setParent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=ACTIVE, postfix_operators=[], prefix_operators=[], qualifier=State, selectors=[])], member=setState, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=resourceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setResourceName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=Timestamp, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEpochSecond, postfix_operators=[], prefix_operators=[], qualifier=eventTime, selectors=[], type_arguments=None)], member=setSeconds, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNano, postfix_operators=[], prefix_operators=[], qualifier=eventTime, selectors=[], type_arguments=None)], member=setNanos, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setEventTime, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=sourceProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putAllSourceProperties, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=finding)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Finding, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=sourceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=findingId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=finding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createFinding, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Finding, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Created Finding with Source Properties: "), operandr=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Couldn't create client."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=client, type=ReferenceType(arguments=None, dimensions=[], name=SecurityCenterClient, sub_type=None), value=MethodInvocation(arguments=[], member=create, postfix_operators=[], prefix_operators=[], qualifier=SecurityCenterClient, selectors=[], type_arguments=None))]) end[}] END[}]
Keyword[static] identifier[Finding] identifier[createFindingWithSourceProperties] operator[SEP] identifier[SourceName] identifier[sourceName] operator[SEP] { Keyword[try] operator[SEP] identifier[SecurityCenterClient] identifier[client] operator[=] identifier[SecurityCenterClient] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] { identifier[Instant] identifier[eventTime] operator[=] identifier[Instant] operator[SEP] identifier[now] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[findingId] operator[=] literal[String] operator[SEP] identifier[String] identifier[resourceName] operator[=] literal[String] operator[SEP] identifier[Value] identifier[stringValue] operator[=] identifier[Value] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setStringValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[Value] identifier[numValue] operator[=] identifier[Value] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setNumberValue] operator[SEP] Other[1234] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[ImmutableMap] operator[<] identifier[String] , identifier[Value] operator[>] identifier[sourceProperties] operator[=] identifier[ImmutableMap] operator[SEP] identifier[of] operator[SEP] literal[String] , identifier[stringValue] , literal[String] , identifier[numValue] operator[SEP] operator[SEP] identifier[Finding] identifier[finding] operator[=] identifier[Finding] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setParent] operator[SEP] identifier[sourceName] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setState] operator[SEP] identifier[State] operator[SEP] identifier[ACTIVE] operator[SEP] operator[SEP] identifier[setResourceName] operator[SEP] identifier[resourceName] operator[SEP] operator[SEP] identifier[setEventTime] operator[SEP] identifier[Timestamp] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setSeconds] operator[SEP] identifier[eventTime] operator[SEP] identifier[getEpochSecond] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setNanos] operator[SEP] identifier[eventTime] operator[SEP] identifier[getNano] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAllSourceProperties] operator[SEP] identifier[sourceProperties] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[Finding] identifier[response] operator[=] identifier[client] operator[SEP] identifier[createFinding] operator[SEP] identifier[sourceName] , identifier[findingId] , identifier[finding] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP] } Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] { Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] } }
public static Predicate<HandlerInput> canFulfillIntentName(String intentName) { return i -> i.getRequestEnvelope().getRequest() instanceof CanFulfillIntentRequest && intentName.equals(((CanFulfillIntentRequest) i.getRequestEnvelope().getRequest()).getIntent().getName()); }
class class_name[name] begin[{] method[canFulfillIntentName, return_type[type[Predicate]], modifier[public static], parameter[intentName]] begin[{] return[LambdaExpression(body=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getRequestEnvelope, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[MethodInvocation(arguments=[], member=getRequest, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=CanFulfillIntentRequest, sub_type=None), operator=instanceof), operandr=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[], member=getRequestEnvelope, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[MethodInvocation(arguments=[], member=getRequest, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=CanFulfillIntentRequest, sub_type=None))], member=equals, postfix_operators=[], prefix_operators=[], qualifier=intentName, selectors=[], type_arguments=None), operator=&&), parameters=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])] end[}] END[}]
Keyword[public] Keyword[static] identifier[Predicate] operator[<] identifier[HandlerInput] operator[>] identifier[canFulfillIntentName] operator[SEP] identifier[String] identifier[intentName] operator[SEP] { Keyword[return] identifier[i] operator[->] identifier[i] operator[SEP] identifier[getRequestEnvelope] operator[SEP] operator[SEP] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] Keyword[instanceof] identifier[CanFulfillIntentRequest] operator[&&] identifier[intentName] operator[SEP] identifier[equals] operator[SEP] operator[SEP] operator[SEP] identifier[CanFulfillIntentRequest] operator[SEP] identifier[i] operator[SEP] identifier[getRequestEnvelope] operator[SEP] operator[SEP] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getIntent] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] }
public ChannelHandler[] getClientChannelHandlers() { NetworkClientHandler networkClientHandler = creditBasedEnabled ? new CreditBasedPartitionRequestClientHandler() : new PartitionRequestClientHandler(); return new ChannelHandler[] { messageEncoder, new NettyMessage.NettyMessageDecoder(!creditBasedEnabled), networkClientHandler}; }
class class_name[name] begin[{] method[getClientChannelHandlers, return_type[type[ChannelHandler]], modifier[public], parameter[]] begin[{] local_variable[type[NetworkClientHandler], networkClientHandler] return[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=messageEncoder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=creditBasedEnabled, 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=NettyMessage, sub_type=ReferenceType(arguments=None, dimensions=None, name=NettyMessageDecoder, sub_type=None))), MemberReference(member=networkClientHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ChannelHandler, sub_type=None))] end[}] END[}]
Keyword[public] identifier[ChannelHandler] operator[SEP] operator[SEP] identifier[getClientChannelHandlers] operator[SEP] operator[SEP] { identifier[NetworkClientHandler] identifier[networkClientHandler] operator[=] identifier[creditBasedEnabled] operator[?] Keyword[new] identifier[CreditBasedPartitionRequestClientHandler] operator[SEP] operator[SEP] operator[:] Keyword[new] identifier[PartitionRequestClientHandler] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ChannelHandler] operator[SEP] operator[SEP] { identifier[messageEncoder] , Keyword[new] identifier[NettyMessage] operator[SEP] identifier[NettyMessageDecoder] operator[SEP] operator[!] identifier[creditBasedEnabled] operator[SEP] , identifier[networkClientHandler] } operator[SEP] }
private void registerTemplates(Iterable<TemplateType> templates, @Nullable Node scopeRoot) { if (!Iterables.isEmpty(templates)) { // Add any templates from JSDoc into our template scope. this.templateScope = typeRegistry.createScopeWithTemplates(templateScope, templates); // Register the template types on the scope root node, if there is one. if (scopeRoot != null) { typeRegistry.registerTemplateTypeNamesInScope(templates, scopeRoot); } } }
class class_name[name] begin[{] method[registerTemplates, return_type[void], modifier[private], parameter[templates, scopeRoot]] begin[{] if[call[Iterables.isEmpty, parameter[member[.templates]]]] begin[{] assign[THIS[member[None.templateScope]], call[typeRegistry.createScopeWithTemplates, parameter[member[.templateScope], member[.templates]]]] if[binary_operation[member[.scopeRoot], !=, literal[null]]] begin[{] call[typeRegistry.registerTemplateTypeNamesInScope, parameter[member[.templates], member[.scopeRoot]]] else begin[{] None end[}] else begin[{] None end[}] end[}] END[}]
Keyword[private] Keyword[void] identifier[registerTemplates] operator[SEP] identifier[Iterable] operator[<] identifier[TemplateType] operator[>] identifier[templates] , annotation[@] identifier[Nullable] identifier[Node] identifier[scopeRoot] operator[SEP] { Keyword[if] operator[SEP] operator[!] identifier[Iterables] operator[SEP] identifier[isEmpty] operator[SEP] identifier[templates] operator[SEP] operator[SEP] { Keyword[this] operator[SEP] identifier[templateScope] operator[=] identifier[typeRegistry] operator[SEP] identifier[createScopeWithTemplates] operator[SEP] identifier[templateScope] , identifier[templates] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scopeRoot] operator[!=] Other[null] operator[SEP] { identifier[typeRegistry] operator[SEP] identifier[registerTemplateTypeNamesInScope] operator[SEP] identifier[templates] , identifier[scopeRoot] operator[SEP] operator[SEP] } } }
@Override public Enumerable<T> enumerate(SET source) throws E, MappingException { return getMapperFromSet(source).enumerate(source); }
class class_name[name] begin[{] method[enumerate, return_type[type[Enumerable]], modifier[public], parameter[source]] begin[{] return[call[.getMapperFromSet, parameter[member[.source]]]] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] identifier[Enumerable] operator[<] identifier[T] operator[>] identifier[enumerate] operator[SEP] identifier[SET] identifier[source] operator[SEP] Keyword[throws] identifier[E] , identifier[MappingException] { Keyword[return] identifier[getMapperFromSet] operator[SEP] identifier[source] operator[SEP] operator[SEP] identifier[enumerate] operator[SEP] identifier[source] operator[SEP] operator[SEP] }
@Override public Activator createActivator(ServiceDomain domain) { BPMActivator activator = new BPMActivator(); activator.setServiceDomain(domain); return activator; }
class class_name[name] begin[{] method[createActivator, return_type[type[Activator]], modifier[public], parameter[domain]] begin[{] local_variable[type[BPMActivator], activator] call[activator.setServiceDomain, parameter[member[.domain]]] return[member[.activator]] end[}] END[}]
annotation[@] identifier[Override] Keyword[public] identifier[Activator] identifier[createActivator] operator[SEP] identifier[ServiceDomain] identifier[domain] operator[SEP] { identifier[BPMActivator] identifier[activator] operator[=] Keyword[new] identifier[BPMActivator] operator[SEP] operator[SEP] operator[SEP] identifier[activator] operator[SEP] identifier[setServiceDomain] operator[SEP] identifier[domain] operator[SEP] operator[SEP] Keyword[return] identifier[activator] operator[SEP] }