code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
static String search(String word) {
word = word.replaceAll(" ", "+");
String u;
if(isUseBaidu)
u = URL_BAIDU.replace("${wd}", word);
else
u = URL_GOOGLE.replace("${wd}", word);
URL url;
try {
url = new URL(u);
} catch (MalformedURLException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
return null;
}
InputStream istream = null;
while (true) {
try {
HttpURLConnection conn = (HttpURLConnection) url
.openConnection();
istream = conn.getInputStream();
break;
} catch (IOException e) {
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
}
}
}
StringBuilder sb = new StringBuilder();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
istream, "utf-8"));
while (true) {
String buf = reader.readLine();
if (null == buf)
break;
sb.append(buf);
}
} catch (IOException e) {
}
String htmlStr =sb.toString();
//stripping script tags whether the tag contains "/n" or "/r" or not.
Matcher m_script = p_script.matcher(htmlStr);
htmlStr = m_script.replaceAll("");
//stripping style tags whether the tag contains "/n" or "/r" or not.
Matcher m_style = p_style.matcher(htmlStr);
htmlStr = m_style.replaceAll("");
//stripping html tags but continue to have the "/n" and "/r" in right place.
Matcher m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll("");
htmlStr = htmlStr.replaceAll("(&| |▶|©|◆| |>|<)+", " ");
if(isUseBaidu)
htmlStr = htmlStr.replaceAll("(百度|_|搜索|\\.\\.\\.|-|2012|2011)", " ");
htmlStr = htmlStr.replaceAll(String.valueOf(((char)12288))," ");
htmlStr = htmlStr.replaceAll(" +", " ");
return htmlStr;
}
|
class class_name[name] begin[{]
method[search, return_type[type[String]], modifier[static], parameter[word]] begin[{]
assign[member[.word], call[word.replaceAll, parameter[literal[" "], literal["+"]]]]
local_variable[type[String], u]
if[member[.isUseBaidu]] begin[{]
assign[member[.u], call[URL_BAIDU.replace, parameter[literal["${wd}"], member[.word]]]]
else begin[{]
assign[member[.u], call[URL_GOOGLE.replace, parameter[literal["${wd}"], member[.word]]]]
end[}]
local_variable[type[URL], url]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=u, 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=URL, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e2, 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=e2, types=['MalformedURLException']))], finally_block=None, label=None, resources=None)
local_variable[type[InputStream], istream]
while[literal[true]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=openConnection, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=HttpURLConnection, sub_type=None)), name=conn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HttpURLConnection, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=istream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)], catches=[CatchClause(block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=500)], member=sleep, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['InterruptedException']))], finally_block=None, label=None, resources=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
local_variable[type[StringBuilder], sb]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=istream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="utf-8")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)), name=reader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), name=buf)], modifiers=set(), 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=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BreakStatement(goto=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
local_variable[type[String], htmlStr]
local_variable[type[Matcher], m_script]
assign[member[.htmlStr], call[m_script.replaceAll, parameter[literal[""]]]]
local_variable[type[Matcher], m_style]
assign[member[.htmlStr], call[m_style.replaceAll, parameter[literal[""]]]]
local_variable[type[Matcher], m_html]
assign[member[.htmlStr], call[m_html.replaceAll, parameter[literal[""]]]]
assign[member[.htmlStr], call[htmlStr.replaceAll, parameter[literal["(&| |▶|©|◆| |>|<)+"], literal[" "]]]]
if[member[.isUseBaidu]] begin[{]
assign[member[.htmlStr], call[htmlStr.replaceAll, parameter[literal["(百度|_|搜索|\\.\\.\\.|-|2012|2011)"], literal[" "]]]]
else begin[{]
None
end[}]
assign[member[.htmlStr], call[htmlStr.replaceAll, parameter[call[String.valueOf, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=12288), type=BasicType(dimensions=[], name=char))]], literal[" "]]]]
assign[member[.htmlStr], call[htmlStr.replaceAll, parameter[literal[" +"], literal[" "]]]]
return[member[.htmlStr]]
end[}]
END[}]
|
Keyword[static] identifier[String] identifier[search] operator[SEP] identifier[String] identifier[word] operator[SEP] {
identifier[word] operator[=] identifier[word] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[u] operator[SEP] Keyword[if] operator[SEP] identifier[isUseBaidu] operator[SEP] identifier[u] operator[=] identifier[URL_BAIDU] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[word] operator[SEP] operator[SEP] Keyword[else] identifier[u] operator[=] identifier[URL_GOOGLE] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[word] operator[SEP] operator[SEP] identifier[URL] identifier[url] operator[SEP] Keyword[try] {
identifier[url] operator[=] Keyword[new] identifier[URL] operator[SEP] identifier[u] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MalformedURLException] identifier[e2] operator[SEP] {
identifier[e2] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[InputStream] identifier[istream] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[try] {
identifier[HttpURLConnection] identifier[conn] operator[=] operator[SEP] identifier[HttpURLConnection] operator[SEP] identifier[url] operator[SEP] identifier[openConnection] operator[SEP] operator[SEP] operator[SEP] identifier[istream] operator[=] identifier[conn] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[try] {
identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] Other[500] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e1] operator[SEP] {
}
}
}
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[istream] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[String] identifier[buf] operator[=] identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[buf] operator[SEP] Keyword[break] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[buf] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
}
identifier[String] identifier[htmlStr] operator[=] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[Matcher] identifier[m_script] operator[=] identifier[p_script] operator[SEP] identifier[matcher] operator[SEP] identifier[htmlStr] operator[SEP] operator[SEP] identifier[htmlStr] operator[=] identifier[m_script] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Matcher] identifier[m_style] operator[=] identifier[p_style] operator[SEP] identifier[matcher] operator[SEP] identifier[htmlStr] operator[SEP] operator[SEP] identifier[htmlStr] operator[=] identifier[m_style] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Matcher] identifier[m_html] operator[=] identifier[p_html] operator[SEP] identifier[matcher] operator[SEP] identifier[htmlStr] operator[SEP] operator[SEP] identifier[htmlStr] operator[=] identifier[m_html] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[htmlStr] operator[=] identifier[htmlStr] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isUseBaidu] operator[SEP] identifier[htmlStr] operator[=] identifier[htmlStr] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[htmlStr] operator[=] identifier[htmlStr] operator[SEP] identifier[replaceAll] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] operator[SEP] Keyword[char] operator[SEP] Other[12288] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[htmlStr] operator[=] identifier[htmlStr] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[htmlStr] operator[SEP]
}
|
@Override
public DeletePlaybackConfigurationResult deletePlaybackConfiguration(DeletePlaybackConfigurationRequest request) {
request = beforeClientExecution(request);
return executeDeletePlaybackConfiguration(request);
}
|
class class_name[name] begin[{]
method[deletePlaybackConfiguration, return_type[type[DeletePlaybackConfigurationResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDeletePlaybackConfiguration, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[DeletePlaybackConfigurationResult] identifier[deletePlaybackConfiguration] operator[SEP] identifier[DeletePlaybackConfigurationRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDeletePlaybackConfiguration] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public NodeGroup withNodeGroupMembers(NodeGroupMember... nodeGroupMembers) {
if (this.nodeGroupMembers == null) {
setNodeGroupMembers(new com.amazonaws.internal.SdkInternalList<NodeGroupMember>(nodeGroupMembers.length));
}
for (NodeGroupMember ele : nodeGroupMembers) {
this.nodeGroupMembers.add(ele);
}
return this;
}
|
class class_name[name] begin[{]
method[withNodeGroupMembers, return_type[type[NodeGroup]], modifier[public], parameter[nodeGroupMembers]] begin[{]
if[binary_operation[THIS[member[None.nodeGroupMembers]], ==, literal[null]]] begin[{]
call[.setNodeGroupMembers, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=nodeGroupMembers, 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=NodeGroupMember, 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=nodeGroupMembers, 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=nodeGroupMembers, 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=NodeGroupMember, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[NodeGroup] identifier[withNodeGroupMembers] operator[SEP] identifier[NodeGroupMember] operator[...] identifier[nodeGroupMembers] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[nodeGroupMembers] operator[==] Other[null] operator[SEP] {
identifier[setNodeGroupMembers] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[NodeGroupMember] operator[>] operator[SEP] identifier[nodeGroupMembers] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[NodeGroupMember] identifier[ele] operator[:] identifier[nodeGroupMembers] operator[SEP] {
Keyword[this] operator[SEP] identifier[nodeGroupMembers] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public CdnPathBuilder sharp(int strength) {
if (strength < 0 || strength > 20) {
strength = 5;
}
sb.append("/-/sharp/")
.append(strength);
return this;
}
|
class class_name[name] begin[{]
method[sharp, return_type[type[CdnPathBuilder]], modifier[public], parameter[strength]] begin[{]
if[binary_operation[binary_operation[member[.strength], <, literal[0]], ||, binary_operation[member[.strength], >, literal[20]]]] begin[{]
assign[member[.strength], literal[5]]
else begin[{]
None
end[}]
call[sb.append, parameter[literal["/-/sharp/"]]]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[CdnPathBuilder] identifier[sharp] operator[SEP] Keyword[int] identifier[strength] operator[SEP] {
Keyword[if] operator[SEP] identifier[strength] operator[<] Other[0] operator[||] identifier[strength] operator[>] Other[20] operator[SEP] {
identifier[strength] operator[=] Other[5] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[strength] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public boolean match(String str, String regex) {
if (str == null || regex == null)
return false;
if (regex.trim().isEmpty())
return true;
return Pattern.compile(regex.trim()).matcher(str).find();
}
|
class class_name[name] begin[{]
method[match, return_type[type[boolean]], modifier[public], parameter[str, regex]] begin[{]
if[binary_operation[binary_operation[member[.str], ==, literal[null]], ||, binary_operation[member[.regex], ==, literal[null]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[call[regex.trim, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[call[Pattern.compile, parameter[call[regex.trim, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[match] operator[SEP] identifier[String] identifier[str] , identifier[String] identifier[regex] operator[SEP] {
Keyword[if] operator[SEP] identifier[str] operator[==] Other[null] operator[||] identifier[regex] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[regex] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] identifier[regex] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[matcher] operator[SEP] identifier[str] operator[SEP] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP]
}
|
public Weighting createWeighting(HintsMap hintsMap, FlagEncoder encoder, Graph graph) {
String weightingStr = toLowerCase(hintsMap.getWeighting());
Weighting weighting = null;
if (encoder.supports(GenericWeighting.class)) {
weighting = new GenericWeighting((DataFlagEncoder) encoder, hintsMap);
} else if ("shortest".equalsIgnoreCase(weightingStr)) {
weighting = new ShortestWeighting(encoder);
} else if ("fastest".equalsIgnoreCase(weightingStr) || weightingStr.isEmpty()) {
if (encoder.supports(PriorityWeighting.class))
weighting = new PriorityWeighting(encoder, hintsMap);
else
weighting = new FastestWeighting(encoder, hintsMap);
} else if ("curvature".equalsIgnoreCase(weightingStr)) {
if (encoder.supports(CurvatureWeighting.class))
weighting = new CurvatureWeighting(encoder, hintsMap);
} else if ("short_fastest".equalsIgnoreCase(weightingStr)) {
weighting = new ShortFastestWeighting(encoder, hintsMap);
}
if (weighting == null)
throw new IllegalArgumentException("weighting " + weightingStr + " not supported");
if (hintsMap.has(Routing.BLOCK_AREA)) {
String blockAreaStr = hintsMap.get(Parameters.Routing.BLOCK_AREA, "");
GraphEdgeIdFinder.BlockArea blockArea = new GraphEdgeIdFinder(graph, locationIndex).
parseBlockArea(blockAreaStr, DefaultEdgeFilter.allEdges(encoder), hintsMap.getDouble("block_area.edge_id_max_area", 1000 * 1000));
return new BlockAreaWeighting(weighting, blockArea);
}
return weighting;
}
|
class class_name[name] begin[{]
method[createWeighting, return_type[type[Weighting]], modifier[public], parameter[hintsMap, encoder, graph]] begin[{]
local_variable[type[String], weightingStr]
local_variable[type[Weighting], weighting]
if[call[encoder.supports, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GenericWeighting, sub_type=None))]]] begin[{]
assign[member[.weighting], ClassCreator(arguments=[Cast(expression=MemberReference(member=encoder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DataFlagEncoder, sub_type=None)), MemberReference(member=hintsMap, 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=GenericWeighting, sub_type=None))]
else begin[{]
if[literal["shortest"]] begin[{]
assign[member[.weighting], ClassCreator(arguments=[MemberReference(member=encoder, 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=ShortestWeighting, sub_type=None))]
else begin[{]
if[binary_operation[literal["fastest"], ||, call[weightingStr.isEmpty, parameter[]]]] begin[{]
if[call[encoder.supports, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PriorityWeighting, sub_type=None))]]] begin[{]
assign[member[.weighting], ClassCreator(arguments=[MemberReference(member=encoder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hintsMap, 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=PriorityWeighting, sub_type=None))]
else begin[{]
assign[member[.weighting], ClassCreator(arguments=[MemberReference(member=encoder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hintsMap, 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=FastestWeighting, sub_type=None))]
end[}]
else begin[{]
if[literal["curvature"]] begin[{]
if[call[encoder.supports, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CurvatureWeighting, sub_type=None))]]] begin[{]
assign[member[.weighting], ClassCreator(arguments=[MemberReference(member=encoder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hintsMap, 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=CurvatureWeighting, sub_type=None))]
else begin[{]
None
end[}]
else begin[{]
if[literal["short_fastest"]] begin[{]
assign[member[.weighting], ClassCreator(arguments=[MemberReference(member=encoder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hintsMap, 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=ShortFastestWeighting, sub_type=None))]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
if[binary_operation[member[.weighting], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="weighting "), operandr=MemberReference(member=weightingStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" not supported"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[hintsMap.has, parameter[member[Routing.BLOCK_AREA]]]] begin[{]
local_variable[type[String], blockAreaStr]
local_variable[type[GraphEdgeIdFinder], blockArea]
return[ClassCreator(arguments=[MemberReference(member=weighting, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=blockArea, 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=BlockAreaWeighting, sub_type=None))]
else begin[{]
None
end[}]
return[member[.weighting]]
end[}]
END[}]
|
Keyword[public] identifier[Weighting] identifier[createWeighting] operator[SEP] identifier[HintsMap] identifier[hintsMap] , identifier[FlagEncoder] identifier[encoder] , identifier[Graph] identifier[graph] operator[SEP] {
identifier[String] identifier[weightingStr] operator[=] identifier[toLowerCase] operator[SEP] identifier[hintsMap] operator[SEP] identifier[getWeighting] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Weighting] identifier[weighting] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[encoder] operator[SEP] identifier[supports] operator[SEP] identifier[GenericWeighting] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[weighting] operator[=] Keyword[new] identifier[GenericWeighting] operator[SEP] operator[SEP] identifier[DataFlagEncoder] operator[SEP] identifier[encoder] , identifier[hintsMap] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[weightingStr] operator[SEP] operator[SEP] {
identifier[weighting] operator[=] Keyword[new] identifier[ShortestWeighting] operator[SEP] identifier[encoder] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[weightingStr] operator[SEP] operator[||] identifier[weightingStr] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[encoder] operator[SEP] identifier[supports] operator[SEP] identifier[PriorityWeighting] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[weighting] operator[=] Keyword[new] identifier[PriorityWeighting] operator[SEP] identifier[encoder] , identifier[hintsMap] operator[SEP] operator[SEP] Keyword[else] identifier[weighting] operator[=] Keyword[new] identifier[FastestWeighting] operator[SEP] identifier[encoder] , identifier[hintsMap] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[weightingStr] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[encoder] operator[SEP] identifier[supports] operator[SEP] identifier[CurvatureWeighting] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[weighting] operator[=] Keyword[new] identifier[CurvatureWeighting] operator[SEP] identifier[encoder] , identifier[hintsMap] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[weightingStr] operator[SEP] operator[SEP] {
identifier[weighting] operator[=] Keyword[new] identifier[ShortFastestWeighting] operator[SEP] identifier[encoder] , identifier[hintsMap] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[weighting] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[weightingStr] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hintsMap] operator[SEP] identifier[has] operator[SEP] identifier[Routing] operator[SEP] identifier[BLOCK_AREA] operator[SEP] operator[SEP] {
identifier[String] identifier[blockAreaStr] operator[=] identifier[hintsMap] operator[SEP] identifier[get] operator[SEP] identifier[Parameters] operator[SEP] identifier[Routing] operator[SEP] identifier[BLOCK_AREA] , literal[String] operator[SEP] operator[SEP] identifier[GraphEdgeIdFinder] operator[SEP] identifier[BlockArea] identifier[blockArea] operator[=] Keyword[new] identifier[GraphEdgeIdFinder] operator[SEP] identifier[graph] , identifier[locationIndex] operator[SEP] operator[SEP] identifier[parseBlockArea] operator[SEP] identifier[blockAreaStr] , identifier[DefaultEdgeFilter] operator[SEP] identifier[allEdges] operator[SEP] identifier[encoder] operator[SEP] , identifier[hintsMap] operator[SEP] identifier[getDouble] operator[SEP] literal[String] , Other[1000] operator[*] Other[1000] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[BlockAreaWeighting] operator[SEP] identifier[weighting] , identifier[blockArea] operator[SEP] operator[SEP]
}
Keyword[return] identifier[weighting] operator[SEP]
}
|
public void setTargetFolder(CmsUUID structureId) throws CmsException {
CmsObject cms = A_CmsUI.getCmsObject();
CmsResource res = cms.readResource(structureId);
setTargetForlder(res);
}
|
class class_name[name] begin[{]
method[setTargetFolder, return_type[void], modifier[public], parameter[structureId]] begin[{]
local_variable[type[CmsObject], cms]
local_variable[type[CmsResource], res]
call[.setTargetForlder, parameter[member[.res]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setTargetFolder] operator[SEP] identifier[CmsUUID] identifier[structureId] operator[SEP] Keyword[throws] identifier[CmsException] {
identifier[CmsObject] identifier[cms] operator[=] identifier[A_CmsUI] operator[SEP] identifier[getCmsObject] operator[SEP] operator[SEP] operator[SEP] identifier[CmsResource] identifier[res] operator[=] identifier[cms] operator[SEP] identifier[readResource] operator[SEP] identifier[structureId] operator[SEP] operator[SEP] identifier[setTargetForlder] operator[SEP] identifier[res] operator[SEP] operator[SEP]
}
|
public void resetCheckpoint() {
synchronized (lock) {
if (c4ReplStatus != null && c4ReplStatus
.getActivityLevel() != C4ReplicatorStatus.ActivityLevel.STOPPED) {
throw new IllegalStateException(
"Replicator is not stopped. Resetting checkpoint is only allowed when the replicator is in the "
+ "stopped state.");
}
shouldResetCheckpoint = true;
}
}
|
class class_name[name] begin[{]
method[resetCheckpoint, return_type[void], modifier[public], parameter[]] begin[{]
SYNCHRONIZED[member[.lock]] BEGIN[{]
if[binary_operation[binary_operation[member[.c4ReplStatus], !=, literal[null]], &&, binary_operation[call[c4ReplStatus.getActivityLevel, parameter[]], !=, member[C4ReplicatorStatus.ActivityLevel.STOPPED]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Replicator is not stopped. Resetting checkpoint is only allowed when the replicator is in the "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="stopped state."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.shouldResetCheckpoint], literal[true]]
END[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[resetCheckpoint] operator[SEP] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[lock] operator[SEP] {
Keyword[if] operator[SEP] identifier[c4ReplStatus] operator[!=] Other[null] operator[&&] identifier[c4ReplStatus] operator[SEP] identifier[getActivityLevel] operator[SEP] operator[SEP] operator[!=] identifier[C4ReplicatorStatus] operator[SEP] identifier[ActivityLevel] operator[SEP] identifier[STOPPED] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[shouldResetCheckpoint] operator[=] literal[boolean] operator[SEP]
}
}
|
public java.lang.String getFilename() {
java.lang.Object ref = filename_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
filename_ = s;
return s;
}
}
|
class class_name[name] begin[{]
method[getFilename, return_type[type[java]], modifier[public], parameter[]] begin[{]
local_variable[type[java], ref]
if[binary_operation[member[.ref], instanceof, type[java]]] begin[{]
return[Cast(expression=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=lang, sub_type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))))]
else begin[{]
local_variable[type[com], bs]
local_variable[type[java], s]
assign[member[.filename_], member[.s]]
return[member[.s]]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[getFilename] operator[SEP] operator[SEP] {
identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[Object] identifier[ref] operator[=] identifier[filename_] operator[SEP] Keyword[if] operator[SEP] identifier[ref] Keyword[instanceof] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] operator[SEP] {
Keyword[return] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] operator[SEP] identifier[ref] operator[SEP]
}
Keyword[else] {
identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] identifier[bs] operator[=] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[protobuf] operator[SEP] identifier[ByteString] operator[SEP] identifier[ref] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[s] operator[=] identifier[bs] operator[SEP] identifier[toStringUtf8] operator[SEP] operator[SEP] operator[SEP] identifier[filename_] operator[=] identifier[s] operator[SEP] Keyword[return] identifier[s] operator[SEP]
}
}
|
public static WorkUnit create(Extract extract, WatermarkInterval watermarkInterval) {
return new WorkUnit(null, extract, watermarkInterval);
}
|
class class_name[name] begin[{]
method[create, return_type[type[WorkUnit]], modifier[public static], parameter[extract, watermarkInterval]] begin[{]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=extract, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=watermarkInterval, 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=WorkUnit, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[WorkUnit] identifier[create] operator[SEP] identifier[Extract] identifier[extract] , identifier[WatermarkInterval] identifier[watermarkInterval] operator[SEP] {
Keyword[return] Keyword[new] identifier[WorkUnit] operator[SEP] Other[null] , identifier[extract] , identifier[watermarkInterval] operator[SEP] operator[SEP]
}
|
public XsdSchema getSchema(List<XsdSchema> schemas, Document doc) {
XsdSchema schema = null;
for (XsdSchemaMappingStrategy strategy : strategies) {
schema = strategy.getSchema(schemas, doc);
if (schema != null) {
return schema;
}
}
return schema;
}
|
class class_name[name] begin[{]
method[getSchema, return_type[type[XsdSchema]], modifier[public], parameter[schemas, doc]] begin[{]
local_variable[type[XsdSchema], schema]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=schema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=schemas, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSchema, postfix_operators=[], prefix_operators=[], qualifier=strategy, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=schema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=schema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=strategies, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=strategy)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=XsdSchemaMappingStrategy, sub_type=None))), label=None)
return[member[.schema]]
end[}]
END[}]
|
Keyword[public] identifier[XsdSchema] identifier[getSchema] operator[SEP] identifier[List] operator[<] identifier[XsdSchema] operator[>] identifier[schemas] , identifier[Document] identifier[doc] operator[SEP] {
identifier[XsdSchema] identifier[schema] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[XsdSchemaMappingStrategy] identifier[strategy] operator[:] identifier[strategies] operator[SEP] {
identifier[schema] operator[=] identifier[strategy] operator[SEP] identifier[getSchema] operator[SEP] identifier[schemas] , identifier[doc] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[schema] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[schema] operator[SEP]
}
}
Keyword[return] identifier[schema] operator[SEP]
}
|
@Override
public void generateParseOnJacksonAsString(BindTypeContext context, MethodSpec.Builder methodBuilder, String parserName, TypeName beanClass, String beanName, BindProperty property) {
// TODO QUA
// TypeName typeName = resolveTypeName(property.getParent(),
// property.getPropertyType().getTypeName());
TypeName typeName = property.getPropertyType().getTypeName();
String bindName = context.getBindMapperName(context, typeName);
if (property.isNullable()) {
methodBuilder.beginControlFlow("if ($L.currentToken()==$T.START_OBJECT || $L.currentToken()==$T.VALUE_STRING)", parserName, JsonToken.class, parserName, JsonToken.class);
}
methodBuilder.addStatement(setter(beanClass, beanName, property, "$L.parseOnJacksonAsString(jacksonParser)"), bindName);
if (property.isNullable()) {
methodBuilder.endControlFlow();
}
}
|
class class_name[name] begin[{]
method[generateParseOnJacksonAsString, return_type[void], modifier[public], parameter[context, methodBuilder, parserName, beanClass, beanName, property]] begin[{]
local_variable[type[TypeName], typeName]
local_variable[type[String], bindName]
if[call[property.isNullable, parameter[]]] begin[{]
call[methodBuilder.beginControlFlow, parameter[literal["if ($L.currentToken()==$T.START_OBJECT || $L.currentToken()==$T.VALUE_STRING)"], member[.parserName], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonToken, sub_type=None)), member[.parserName], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonToken, sub_type=None))]]
else begin[{]
None
end[}]
call[methodBuilder.addStatement, parameter[call[.setter, parameter[member[.beanClass], member[.beanName], member[.property], literal["$L.parseOnJacksonAsString(jacksonParser)"]]], member[.bindName]]]
if[call[property.isNullable, parameter[]]] begin[{]
call[methodBuilder.endControlFlow, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[generateParseOnJacksonAsString] operator[SEP] identifier[BindTypeContext] identifier[context] , identifier[MethodSpec] operator[SEP] identifier[Builder] identifier[methodBuilder] , identifier[String] identifier[parserName] , identifier[TypeName] identifier[beanClass] , identifier[String] identifier[beanName] , identifier[BindProperty] identifier[property] operator[SEP] {
identifier[TypeName] identifier[typeName] operator[=] identifier[property] operator[SEP] identifier[getPropertyType] operator[SEP] operator[SEP] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[bindName] operator[=] identifier[context] operator[SEP] identifier[getBindMapperName] operator[SEP] identifier[context] , identifier[typeName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[property] operator[SEP] identifier[isNullable] operator[SEP] operator[SEP] operator[SEP] {
identifier[methodBuilder] operator[SEP] identifier[beginControlFlow] operator[SEP] literal[String] , identifier[parserName] , identifier[JsonToken] operator[SEP] Keyword[class] , identifier[parserName] , identifier[JsonToken] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
identifier[methodBuilder] operator[SEP] identifier[addStatement] operator[SEP] identifier[setter] operator[SEP] identifier[beanClass] , identifier[beanName] , identifier[property] , literal[String] operator[SEP] , identifier[bindName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[property] operator[SEP] identifier[isNullable] operator[SEP] operator[SEP] operator[SEP] {
identifier[methodBuilder] operator[SEP] identifier[endControlFlow] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private static long simulate(long bytesPerSecond, long latency, int bytes, long timeTaken, boolean roundUp) {
if ( bytesPerSecond <= 0) { //< defensive code
return 0;
}
// workout how much we should have waited to read this amount of bytes
double d = ((double) bytes / bytesPerSecond) * 1000;
long expectedTime = (long) (roundUp ? Math.ceil(d) : Math.floor(d)) + latency;
long diff = expectedTime - timeTaken; //< subtract the amount of time ALREADY taken to get those bytes
if (diff > 0) {
StreamManager.threadSleep(diff);
}
return diff;
}
|
class class_name[name] begin[{]
method[simulate, return_type[type[long]], modifier[private static], parameter[bytesPerSecond, latency, bytes, timeTaken, roundUp]] begin[{]
if[binary_operation[member[.bytesPerSecond], <=, literal[0]]] begin[{]
return[literal[0]]
else begin[{]
None
end[}]
local_variable[type[double], d]
local_variable[type[long], expectedTime]
local_variable[type[long], diff]
if[binary_operation[member[.diff], >, literal[0]]] begin[{]
call[StreamManager.threadSleep, parameter[member[.diff]]]
else begin[{]
None
end[}]
return[member[.diff]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[long] identifier[simulate] operator[SEP] Keyword[long] identifier[bytesPerSecond] , Keyword[long] identifier[latency] , Keyword[int] identifier[bytes] , Keyword[long] identifier[timeTaken] , Keyword[boolean] identifier[roundUp] operator[SEP] {
Keyword[if] operator[SEP] identifier[bytesPerSecond] operator[<=] Other[0] operator[SEP] {
Keyword[return] Other[0] operator[SEP]
}
Keyword[double] identifier[d] operator[=] operator[SEP] operator[SEP] Keyword[double] operator[SEP] identifier[bytes] operator[/] identifier[bytesPerSecond] operator[SEP] operator[*] Other[1000] operator[SEP] Keyword[long] identifier[expectedTime] operator[=] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[roundUp] operator[?] identifier[Math] operator[SEP] identifier[ceil] operator[SEP] identifier[d] operator[SEP] operator[:] identifier[Math] operator[SEP] identifier[floor] operator[SEP] identifier[d] operator[SEP] operator[SEP] operator[+] identifier[latency] operator[SEP] Keyword[long] identifier[diff] operator[=] identifier[expectedTime] operator[-] identifier[timeTaken] operator[SEP] Keyword[if] operator[SEP] identifier[diff] operator[>] Other[0] operator[SEP] {
identifier[StreamManager] operator[SEP] identifier[threadSleep] operator[SEP] identifier[diff] operator[SEP] operator[SEP]
}
Keyword[return] identifier[diff] operator[SEP]
}
|
private Map<String, String> expandConfig(Map<String, String> map) {
return expandAllProperties(map, getPropertyLookup().getPropertiesMap());
}
|
class class_name[name] begin[{]
method[expandConfig, return_type[type[Map]], modifier[private], parameter[map]] begin[{]
return[call[.expandAllProperties, parameter[member[.map], call[.getPropertyLookup, parameter[]]]]]
end[}]
END[}]
|
Keyword[private] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[expandConfig] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[map] operator[SEP] {
Keyword[return] identifier[expandAllProperties] operator[SEP] identifier[map] , identifier[getPropertyLookup] operator[SEP] operator[SEP] operator[SEP] identifier[getPropertiesMap] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
boolean isFailure(ExecutionResult result) {
return failureConditions.isEmpty() ?
result.getFailure() != null :
isFailure((R) result.getResult(), result.getFailure());
}
|
class class_name[name] begin[{]
method[isFailure, return_type[type[boolean]], modifier[default], parameter[result]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=failureConditions, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[], member=getResult, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None)), MethodInvocation(arguments=[], member=getFailure, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=isFailure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getFailure, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=))]
end[}]
END[}]
|
Keyword[boolean] identifier[isFailure] operator[SEP] identifier[ExecutionResult] identifier[result] operator[SEP] {
Keyword[return] identifier[failureConditions] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[?] identifier[result] operator[SEP] identifier[getFailure] operator[SEP] operator[SEP] operator[!=] Other[null] operator[:] identifier[isFailure] operator[SEP] operator[SEP] identifier[R] operator[SEP] identifier[result] operator[SEP] identifier[getResult] operator[SEP] operator[SEP] , identifier[result] operator[SEP] identifier[getFailure] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected boolean updateDerivates() {
functionGradientHessian(x,true, gradient, hessian);
if( config.hessianScaling) {
computeHessianScaling();
applyHessianScaling();
}
hessian.extractDiagonals(diagOrig);
if( checkConvergenceGTest(gradient) ) {
if( verbose != null ) {
verbose.println("Converged g-test");
}
return true;
}
mode = Mode.DETERMINE_STEP;
return false;
}
|
class class_name[name] begin[{]
method[updateDerivates, return_type[type[boolean]], modifier[protected], parameter[]] begin[{]
call[.functionGradientHessian, parameter[member[.x], literal[true], member[.gradient], member[.hessian]]]
if[member[config.hessianScaling]] begin[{]
call[.computeHessianScaling, parameter[]]
call[.applyHessianScaling, parameter[]]
else begin[{]
None
end[}]
call[hessian.extractDiagonals, parameter[member[.diagOrig]]]
if[call[.checkConvergenceGTest, parameter[member[.gradient]]]] begin[{]
if[binary_operation[member[.verbose], !=, literal[null]]] begin[{]
call[verbose.println, parameter[literal["Converged g-test"]]]
else begin[{]
None
end[}]
return[literal[true]]
else begin[{]
None
end[}]
assign[member[.mode], member[Mode.DETERMINE_STEP]]
return[literal[false]]
end[}]
END[}]
|
Keyword[protected] Keyword[boolean] identifier[updateDerivates] operator[SEP] operator[SEP] {
identifier[functionGradientHessian] operator[SEP] identifier[x] , literal[boolean] , identifier[gradient] , identifier[hessian] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[hessianScaling] operator[SEP] {
identifier[computeHessianScaling] operator[SEP] operator[SEP] operator[SEP] identifier[applyHessianScaling] operator[SEP] operator[SEP] operator[SEP]
}
identifier[hessian] operator[SEP] identifier[extractDiagonals] operator[SEP] identifier[diagOrig] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[checkConvergenceGTest] operator[SEP] identifier[gradient] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[verbose] operator[!=] Other[null] operator[SEP] {
identifier[verbose] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
identifier[mode] operator[=] identifier[Mode] operator[SEP] identifier[DETERMINE_STEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public double getCurrentMaxBondOrder(IAtom atom, IAtomContainer ac) throws CDKException {
IAtomType[] atomTypes = getAtomTypeFactory(atom.getBuilder()).getAtomTypes(atom.getSymbol());
if (atomTypes.length == 0) return 0;
double bondOrderSum = ac.getBondOrderSum(atom);
Integer hcount = atom.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : atom.getImplicitHydrogenCount();
double max = 0;
double current = 0;
for (int f = 0; f < atomTypes.length; f++) {
current = hcount + bondOrderSum;
if (atomTypes[f].getBondOrderSum() - current > max) {
max = atomTypes[f].getBondOrderSum() - current;
}
}
return max;
}
|
class class_name[name] begin[{]
method[getCurrentMaxBondOrder, return_type[type[double]], modifier[public], parameter[atom, ac]] begin[{]
local_variable[type[IAtomType], atomTypes]
if[binary_operation[member[atomTypes.length], ==, literal[0]]] begin[{]
return[literal[0]]
else begin[{]
None
end[}]
local_variable[type[double], bondOrderSum]
local_variable[type[Integer], hcount]
local_variable[type[double], max]
local_variable[type[double], current]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=hcount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bondOrderSum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=atomTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getBondOrderSum, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=atomTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getBondOrderSum, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=atomTypes, selectors=[]), 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[.max]]
end[}]
END[}]
|
Keyword[public] Keyword[double] identifier[getCurrentMaxBondOrder] operator[SEP] identifier[IAtom] identifier[atom] , identifier[IAtomContainer] identifier[ac] operator[SEP] Keyword[throws] identifier[CDKException] {
identifier[IAtomType] operator[SEP] operator[SEP] identifier[atomTypes] operator[=] identifier[getAtomTypeFactory] operator[SEP] identifier[atom] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getAtomTypes] operator[SEP] identifier[atom] operator[SEP] identifier[getSymbol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[atomTypes] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] Keyword[return] Other[0] operator[SEP] Keyword[double] identifier[bondOrderSum] operator[=] identifier[ac] operator[SEP] identifier[getBondOrderSum] operator[SEP] identifier[atom] operator[SEP] operator[SEP] identifier[Integer] identifier[hcount] operator[=] identifier[atom] operator[SEP] identifier[getImplicitHydrogenCount] operator[SEP] operator[SEP] operator[==] identifier[CDKConstants] operator[SEP] identifier[UNSET] operator[?] Other[0] operator[:] identifier[atom] operator[SEP] identifier[getImplicitHydrogenCount] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[max] operator[=] Other[0] operator[SEP] Keyword[double] identifier[current] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[f] operator[=] Other[0] operator[SEP] identifier[f] operator[<] identifier[atomTypes] operator[SEP] identifier[length] operator[SEP] identifier[f] operator[++] operator[SEP] {
identifier[current] operator[=] identifier[hcount] operator[+] identifier[bondOrderSum] operator[SEP] Keyword[if] operator[SEP] identifier[atomTypes] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[getBondOrderSum] operator[SEP] operator[SEP] operator[-] identifier[current] operator[>] identifier[max] operator[SEP] {
identifier[max] operator[=] identifier[atomTypes] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[getBondOrderSum] operator[SEP] operator[SEP] operator[-] identifier[current] operator[SEP]
}
}
Keyword[return] identifier[max] operator[SEP]
}
|
private boolean checkForAddOnAccess() {
Class[] classContext = getClassContext();
for (Class clazz : classContext) {
if (clazz.getClassLoader() instanceof IzouPluginClassLoader) {
return true;
}
}
return false;
}
|
class class_name[name] begin[{]
method[checkForAddOnAccess, return_type[type[boolean]], modifier[private], parameter[]] begin[{]
local_variable[type[Class], classContext]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClassLoader, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=IzouPluginClassLoader, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=classContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=clazz)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[checkForAddOnAccess] operator[SEP] operator[SEP] {
identifier[Class] operator[SEP] operator[SEP] identifier[classContext] operator[=] identifier[getClassContext] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Class] identifier[clazz] operator[:] identifier[classContext] operator[SEP] {
Keyword[if] operator[SEP] identifier[clazz] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] Keyword[instanceof] identifier[IzouPluginClassLoader] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static void storeRecentConnectionSettings(Hashtable settings) {
try {
if (recentSettings == null) {
setHomeDir();
if (homedir == null) {
return;
}
recentSettings = new File(homedir, fileName);
if (!recentSettings.exists()) {
// recentSettings.createNewFile();
}
}
if (settings == null || settings.size() == 0) {
return;
}
// setup a stream to a physical file on the filesystem
FileOutputStream out = new FileOutputStream(recentSettings);
ObjectOutputStream objStream = new ObjectOutputStream(out);
Enumeration en = settings.elements();
while (en.hasMoreElements()) {
objStream.writeObject(en.nextElement());
}
objStream.flush();
objStream.close();
out.close();
} catch (Throwable t) {}
}
|
class class_name[name] begin[{]
method[storeRecentConnectionSettings, return_type[void], modifier[private static], parameter[settings]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=recentSettings, 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=[], member=setHomeDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=homedir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=recentSettings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=homedir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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))), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=['!'], qualifier=recentSettings, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[]))])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=settings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=recentSettings, 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=FileOutputStream, sub_type=None)), name=out)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileOutputStream, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=out, 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=ObjectOutputStream, sub_type=None)), name=objStream)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ObjectOutputStream, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=elements, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[], type_arguments=None), name=en)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Enumeration, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=en, selectors=[], type_arguments=None)], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=objStream, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=en, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=objStream, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=objStream, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[storeRecentConnectionSettings] operator[SEP] identifier[Hashtable] identifier[settings] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[recentSettings] operator[==] Other[null] operator[SEP] {
identifier[setHomeDir] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[homedir] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[recentSettings] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[homedir] , identifier[fileName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[recentSettings] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
}
}
Keyword[if] operator[SEP] identifier[settings] operator[==] Other[null] operator[||] identifier[settings] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[FileOutputStream] identifier[out] operator[=] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[recentSettings] operator[SEP] operator[SEP] identifier[ObjectOutputStream] identifier[objStream] operator[=] Keyword[new] identifier[ObjectOutputStream] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[Enumeration] identifier[en] operator[=] identifier[settings] operator[SEP] identifier[elements] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[en] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[objStream] operator[SEP] identifier[writeObject] operator[SEP] identifier[en] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[objStream] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[objStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
}
}
|
public Document getDocument(String xmlFilename) throws CmsXmlException {
// try to get it from the cache
Document document = m_cache.get(xmlFilename);
if (document == null) {
try {
document = CmsXmlUtils.unmarshalHelper(
new InputSource(new FileReader(getFile(xmlFilename))),
NO_ENTITY_RESOLVER);
} catch (FileNotFoundException e) {
LOG.error("Could not read file " + xmlFilename, e);
throw new CmsXmlException(new CmsMessageContainer(null, e.toString()));
} catch (Exception e) {
LOG.error("Could not parse file " + xmlFilename, e);
throw new CmsXmlException(
Messages.get().container(Messages.ERR_XML_COULD_NOT_PARSE_FILE_1, xmlFilename),
e);
}
// cache the doc
m_cache.put(xmlFilename, document);
}
return document;
}
|
class class_name[name] begin[{]
method[getDocument, return_type[type[Document]], modifier[public], parameter[xmlFilename]] begin[{]
local_variable[type[Document], document]
if[binary_operation[member[.document], ==, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=document, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=xmlFilename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputSource, sub_type=None)), MemberReference(member=NO_ENTITY_RESOLVER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmarshalHelper, postfix_operators=[], prefix_operators=[], qualifier=CmsXmlUtils, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not read file "), operandr=MemberReference(member=xmlFilename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsMessageContainer, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsXmlException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['FileNotFoundException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not parse file "), operandr=MemberReference(member=xmlFilename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=ERR_XML_COULD_NOT_PARSE_FILE_1, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MemberReference(member=xmlFilename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=container, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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=CmsXmlException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
call[m_cache.put, parameter[member[.xmlFilename], member[.document]]]
else begin[{]
None
end[}]
return[member[.document]]
end[}]
END[}]
|
Keyword[public] identifier[Document] identifier[getDocument] operator[SEP] identifier[String] identifier[xmlFilename] operator[SEP] Keyword[throws] identifier[CmsXmlException] {
identifier[Document] identifier[document] operator[=] identifier[m_cache] operator[SEP] identifier[get] operator[SEP] identifier[xmlFilename] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[document] operator[==] Other[null] operator[SEP] {
Keyword[try] {
identifier[document] operator[=] identifier[CmsXmlUtils] operator[SEP] identifier[unmarshalHelper] operator[SEP] Keyword[new] identifier[InputSource] operator[SEP] Keyword[new] identifier[FileReader] operator[SEP] identifier[getFile] operator[SEP] identifier[xmlFilename] operator[SEP] operator[SEP] operator[SEP] , identifier[NO_ENTITY_RESOLVER] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[FileNotFoundException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[xmlFilename] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CmsXmlException] operator[SEP] Keyword[new] identifier[CmsMessageContainer] operator[SEP] Other[null] , identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[xmlFilename] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CmsXmlException] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_XML_COULD_NOT_PARSE_FILE_1] , identifier[xmlFilename] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
identifier[m_cache] operator[SEP] identifier[put] operator[SEP] identifier[xmlFilename] , identifier[document] operator[SEP] operator[SEP]
}
Keyword[return] identifier[document] operator[SEP]
}
|
private static final Atom[] getFragment(Atom[] caall, int pos, int fragmentLength ,
boolean clone){
if ( pos+fragmentLength > caall.length)
return null;
Atom[] tmp = new Atom[fragmentLength];
for (int i=0;i< fragmentLength;i++){
if (clone){
tmp[i] = (Atom)caall[i+pos].clone();
} else {
tmp[i] = caall[i+pos];
}
}
return tmp;
}
|
class class_name[name] begin[{]
method[getFragment, return_type[type[Atom]], modifier[final private static], parameter[caall, pos, fragmentLength, clone]] begin[{]
if[binary_operation[binary_operation[member[.pos], +, member[.fragmentLength]], >, member[caall.length]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Atom], tmp]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=clone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=caall, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MemberReference(member=caall, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), MethodInvocation(arguments=[], member=clone, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=Atom, sub_type=None))), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=fragmentLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.tmp]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[final] identifier[Atom] operator[SEP] operator[SEP] identifier[getFragment] operator[SEP] identifier[Atom] operator[SEP] operator[SEP] identifier[caall] , Keyword[int] identifier[pos] , Keyword[int] identifier[fragmentLength] , Keyword[boolean] identifier[clone] operator[SEP] {
Keyword[if] operator[SEP] identifier[pos] operator[+] identifier[fragmentLength] operator[>] identifier[caall] operator[SEP] identifier[length] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[Atom] operator[SEP] operator[SEP] identifier[tmp] operator[=] Keyword[new] identifier[Atom] operator[SEP] identifier[fragmentLength] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[fragmentLength] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[clone] operator[SEP] {
identifier[tmp] operator[SEP] identifier[i] operator[SEP] operator[=] operator[SEP] identifier[Atom] operator[SEP] identifier[caall] operator[SEP] identifier[i] operator[+] identifier[pos] operator[SEP] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[tmp] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[caall] operator[SEP] identifier[i] operator[+] identifier[pos] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[tmp] operator[SEP]
}
|
private void writeHandleXMINillableAttribute(PrintWriter out, String indent, ModelAttribute attribute, String object) {
ModelMethod method = attribute.method;
String fieldName = method.field.name;
String typeName = method.getType().getJavaImplTypeName();
out.append(indent).append(" ").append(typeName).append(' ').append(fieldName).append(" = new ").append(typeName).append("();").println();
out.append(indent).append(" parser.parse(").append(fieldName).append(");").println();
out.append(indent).append(" if (!").append(fieldName).append(".isNil()) {").println();
out.append(indent).append(" ").append(object).append('.').append(fieldName).append(" = ").append(fieldName).append(';').println();
out.append(indent).append(" }").println();
out.append(indent).append(" return true;").println();
}
|
class class_name[name] begin[{]
method[writeHandleXMINillableAttribute, return_type[void], modifier[private], parameter[out, indent, attribute, object]] begin[{]
local_variable[type[ModelMethod], method]
local_variable[type[String], fieldName]
local_variable[type[String], typeName]
call[out.append, parameter[member[.indent]]]
call[out.append, parameter[member[.indent]]]
call[out.append, parameter[member[.indent]]]
call[out.append, parameter[member[.indent]]]
call[out.append, parameter[member[.indent]]]
call[out.append, parameter[member[.indent]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[writeHandleXMINillableAttribute] operator[SEP] identifier[PrintWriter] identifier[out] , identifier[String] identifier[indent] , identifier[ModelAttribute] identifier[attribute] , identifier[String] identifier[object] operator[SEP] {
identifier[ModelMethod] identifier[method] operator[=] identifier[attribute] operator[SEP] identifier[method] operator[SEP] identifier[String] identifier[fieldName] operator[=] identifier[method] operator[SEP] identifier[field] operator[SEP] identifier[name] operator[SEP] identifier[String] identifier[typeName] operator[=] identifier[method] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[getJavaImplTypeName] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[indent] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[typeName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[typeName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[indent] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[indent] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[indent] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[object] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[indent] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[indent] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[println] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected ResultSet findChildNodesByParentIdentifierCQ(String parentIdentifier, List<QPathEntryFilter> pattern)
throws SQLException
{
if (pattern.isEmpty())
{
throw new SQLException("Pattern list is empty.");
}
else
{
if (findNodesByParentIdAndComplexPatternCQ == null)
{
findNodesByParentIdAndComplexPatternCQ = dbConnection.createStatement();
}
//create query from list
StringBuilder query = new StringBuilder(FIND_NODES_BY_PARENTID_AND_PATTERN_CQ_TEMPLATE);
query.append(" where I.PARENT_ID='");
query.append(parentIdentifier);
query.append("' and I.I_CLASS=1 and I.CONTAINER_NAME='");
query.append(this.containerConfig.containerName);
query.append("' and ( ");
appendPattern(query, pattern.get(0).getQPathEntry(), true);
for (int i = 1; i < pattern.size(); i++)
{
query.append(" or ");
appendPattern(query, pattern.get(i).getQPathEntry(), true);
}
query.append(" ) and P.PARENT_ID=I.ID and P.I_CLASS=2 and P.CONTAINER_NAME='");
query.append(this.containerConfig.containerName);
query.append("' and (P.NAME='[http://www.jcp.org/jcr/1.0]primaryType'");
query.append(" or P.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes'");
query.append(" or P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner'");
query.append(" or P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions')");
query.append(" and V.PROPERTY_ID=P.ID order by I.N_ORDER_NUM, I.ID");
return findNodesByParentIdAndComplexPatternCQ.executeQuery(query.toString());
}
}
|
class class_name[name] begin[{]
method[findChildNodesByParentIdentifierCQ, return_type[type[ResultSet]], modifier[protected], parameter[parentIdentifier, pattern]] begin[{]
if[call[pattern.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Pattern list is empty.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLException, sub_type=None)), label=None)
else begin[{]
if[binary_operation[member[.findNodesByParentIdAndComplexPatternCQ], ==, literal[null]]] begin[{]
assign[member[.findNodesByParentIdAndComplexPatternCQ], call[dbConnection.createStatement, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], query]
call[query.append, parameter[literal[" where I.PARENT_ID='"]]]
call[query.append, parameter[member[.parentIdentifier]]]
call[query.append, parameter[literal["' and I.I_CLASS=1 and I.CONTAINER_NAME='"]]]
call[query.append, parameter[THIS[member[None.containerConfig]member[None.containerName]]]]
call[query.append, parameter[literal["' and ( "]]]
call[.appendPattern, parameter[member[.query], call[pattern.get, parameter[literal[0]]], literal[true]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" or ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[MethodInvocation(arguments=[], member=getQPathEntry, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=appendPattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[query.append, parameter[literal[" ) and P.PARENT_ID=I.ID and P.I_CLASS=2 and P.CONTAINER_NAME='"]]]
call[query.append, parameter[THIS[member[None.containerConfig]member[None.containerName]]]]
call[query.append, parameter[literal["' and (P.NAME='[http://www.jcp.org/jcr/1.0]primaryType'"]]]
call[query.append, parameter[literal[" or P.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes'"]]]
call[query.append, parameter[literal[" or P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner'"]]]
call[query.append, parameter[literal[" or P.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions')"]]]
call[query.append, parameter[literal[" and V.PROPERTY_ID=P.ID order by I.N_ORDER_NUM, I.ID"]]]
return[call[findNodesByParentIdAndComplexPatternCQ.executeQuery, parameter[call[query.toString, parameter[]]]]]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] identifier[ResultSet] identifier[findChildNodesByParentIdentifierCQ] operator[SEP] identifier[String] identifier[parentIdentifier] , identifier[List] operator[<] identifier[QPathEntryFilter] operator[>] identifier[pattern] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[if] operator[SEP] identifier[pattern] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[findNodesByParentIdAndComplexPatternCQ] operator[==] Other[null] operator[SEP] {
identifier[findNodesByParentIdAndComplexPatternCQ] operator[=] identifier[dbConnection] operator[SEP] identifier[createStatement] operator[SEP] operator[SEP] operator[SEP]
}
identifier[StringBuilder] identifier[query] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[FIND_NODES_BY_PARENTID_AND_PATTERN_CQ_TEMPLATE] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] identifier[parentIdentifier] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] Keyword[this] operator[SEP] identifier[containerConfig] operator[SEP] identifier[containerName] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[appendPattern] operator[SEP] identifier[query] , identifier[pattern] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getQPathEntry] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[pattern] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[appendPattern] operator[SEP] identifier[query] , identifier[pattern] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getQPathEntry] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] Keyword[this] operator[SEP] identifier[containerConfig] operator[SEP] identifier[containerName] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[query] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[findNodesByParentIdAndComplexPatternCQ] operator[SEP] identifier[executeQuery] operator[SEP] identifier[query] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private Session getSession(boolean isSingleton) {
final MailAccount mailAccount = this.mailAccount;
Authenticator authenticator = null;
if (mailAccount.isAuth()) {
authenticator = new UserPassAuthenticator(mailAccount.getUser(), mailAccount.getPass());
}
return isSingleton ? Session.getDefaultInstance(mailAccount.getSmtpProps(), authenticator) //
: Session.getInstance(mailAccount.getSmtpProps(), authenticator);
}
|
class class_name[name] begin[{]
method[getSession, return_type[type[Session]], modifier[private], parameter[isSingleton]] begin[{]
local_variable[type[MailAccount], mailAccount]
local_variable[type[Authenticator], authenticator]
if[call[mailAccount.isAuth, parameter[]]] begin[{]
assign[member[.authenticator], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getUser, postfix_operators=[], prefix_operators=[], qualifier=mailAccount, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getPass, postfix_operators=[], prefix_operators=[], qualifier=mailAccount, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UserPassAuthenticator, sub_type=None))]
else begin[{]
None
end[}]
return[TernaryExpression(condition=MemberReference(member=isSingleton, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSmtpProps, postfix_operators=[], prefix_operators=[], qualifier=mailAccount, selectors=[], type_arguments=None), MemberReference(member=authenticator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=Session, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSmtpProps, postfix_operators=[], prefix_operators=[], qualifier=mailAccount, selectors=[], type_arguments=None), MemberReference(member=authenticator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDefaultInstance, postfix_operators=[], prefix_operators=[], qualifier=Session, selectors=[], type_arguments=None))]
end[}]
END[}]
|
Keyword[private] identifier[Session] identifier[getSession] operator[SEP] Keyword[boolean] identifier[isSingleton] operator[SEP] {
Keyword[final] identifier[MailAccount] identifier[mailAccount] operator[=] Keyword[this] operator[SEP] identifier[mailAccount] operator[SEP] identifier[Authenticator] identifier[authenticator] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[mailAccount] operator[SEP] identifier[isAuth] operator[SEP] operator[SEP] operator[SEP] {
identifier[authenticator] operator[=] Keyword[new] identifier[UserPassAuthenticator] operator[SEP] identifier[mailAccount] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] , identifier[mailAccount] operator[SEP] identifier[getPass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[isSingleton] operator[?] identifier[Session] operator[SEP] identifier[getDefaultInstance] operator[SEP] identifier[mailAccount] operator[SEP] identifier[getSmtpProps] operator[SEP] operator[SEP] , identifier[authenticator] operator[SEP] operator[:] identifier[Session] operator[SEP] identifier[getInstance] operator[SEP] identifier[mailAccount] operator[SEP] identifier[getSmtpProps] operator[SEP] operator[SEP] , identifier[authenticator] operator[SEP] operator[SEP]
}
|
public List<ExpandedAnnotation> expand(final Annotation[] targetAnnos) {
Objects.requireNonNull(targetAnnos);
final List<ExpandedAnnotation> expanedList = new ArrayList<>();
for(Annotation targetAnno : targetAnnos) {
expanedList.addAll(expand(targetAnno));
}
Collections.sort(expanedList, comparator);
return expanedList;
}
|
class class_name[name] begin[{]
method[expand, return_type[type[List]], modifier[public], parameter[targetAnnos]] begin[{]
call[Objects.requireNonNull, parameter[member[.targetAnnos]]]
local_variable[type[List], expanedList]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=targetAnno, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=expand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=expanedList, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=targetAnnos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=targetAnno)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Annotation, sub_type=None))), label=None)
call[Collections.sort, parameter[member[.expanedList], member[.comparator]]]
return[member[.expanedList]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[ExpandedAnnotation] operator[>] identifier[expand] operator[SEP] Keyword[final] identifier[Annotation] operator[SEP] operator[SEP] identifier[targetAnnos] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[targetAnnos] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[ExpandedAnnotation] operator[>] identifier[expanedList] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Annotation] identifier[targetAnno] operator[:] identifier[targetAnnos] operator[SEP] {
identifier[expanedList] operator[SEP] identifier[addAll] operator[SEP] identifier[expand] operator[SEP] identifier[targetAnno] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[expanedList] , identifier[comparator] operator[SEP] operator[SEP] Keyword[return] identifier[expanedList] operator[SEP]
}
|
public static <T> Predicate<T> iterablePresent() {
return t -> t instanceof Iterable ? ((Iterable) t).iterator()
.hasNext()
: false;
}
|
class class_name[name] begin[{]
method[iterablePresent, return_type[type[Predicate]], modifier[public static], parameter[]] begin[{]
return[LambdaExpression(body=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Iterable, sub_type=None), operator=instanceof), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), if_true=Cast(expression=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Iterable, sub_type=None))), parameters=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Predicate] operator[<] identifier[T] operator[>] identifier[iterablePresent] operator[SEP] operator[SEP] {
Keyword[return] identifier[t] operator[->] identifier[t] Keyword[instanceof] identifier[Iterable] operator[?] operator[SEP] operator[SEP] identifier[Iterable] operator[SEP] identifier[t] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[:] literal[boolean] operator[SEP]
}
|
private void initHandshaker() {
switch (connectionState) {
//
// Starting a new handshake.
//
case cs_START:
case cs_DATA:
break;
//
// We're already in the middle of a handshake.
//
case cs_HANDSHAKE:
case cs_RENEGOTIATE:
return;
//
// Anyone allowed to call this routine is required to
// do so ONLY if the connection state is reasonable...
//
default:
throw new IllegalStateException("Internal error");
}
// state is either cs_START or cs_DATA
if (connectionState == cs_START) {
connectionState = cs_HANDSHAKE;
} else { // cs_DATA
connectionState = cs_RENEGOTIATE;
}
if (roleIsServer) {
handshaker = new ServerHandshaker(this, sslContext,
enabledProtocols, doClientAuth,
protocolVersion, connectionState == cs_HANDSHAKE,
secureRenegotiation, clientVerifyData, serverVerifyData);
} else {
handshaker = new ClientHandshaker(this, sslContext,
enabledProtocols,
protocolVersion, connectionState == cs_HANDSHAKE,
secureRenegotiation, clientVerifyData, serverVerifyData);
}
handshaker.setEnabledCipherSuites(enabledCipherSuites);
handshaker.setEnableSessionCreation(enableSessionCreation);
}
|
class class_name[name] begin[{]
method[initHandshaker, return_type[void], modifier[private], parameter[]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['cs_START', 'cs_DATA'], statements=[BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['cs_HANDSHAKE', 'cs_RENEGOTIATE'], statements=[ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Internal error")], 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)])], expression=MemberReference(member=connectionState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
if[binary_operation[member[.connectionState], ==, member[.cs_START]]] begin[{]
assign[member[.connectionState], member[.cs_HANDSHAKE]]
else begin[{]
assign[member[.connectionState], member[.cs_RENEGOTIATE]]
end[}]
if[member[.roleIsServer]] begin[{]
assign[member[.handshaker], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=sslContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=enabledProtocols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=doClientAuth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=protocolVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=connectionState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cs_HANDSHAKE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), MemberReference(member=secureRenegotiation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clientVerifyData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=serverVerifyData, 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=ServerHandshaker, sub_type=None))]
else begin[{]
assign[member[.handshaker], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=sslContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=enabledProtocols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=protocolVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=connectionState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cs_HANDSHAKE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), MemberReference(member=secureRenegotiation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clientVerifyData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=serverVerifyData, 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=ClientHandshaker, sub_type=None))]
end[}]
call[handshaker.setEnabledCipherSuites, parameter[member[.enabledCipherSuites]]]
call[handshaker.setEnableSessionCreation, parameter[member[.enableSessionCreation]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[initHandshaker] operator[SEP] operator[SEP] {
Keyword[switch] operator[SEP] identifier[connectionState] operator[SEP] {
Keyword[case] identifier[cs_START] operator[:] Keyword[case] identifier[cs_DATA] operator[:] Keyword[break] operator[SEP] Keyword[case] identifier[cs_HANDSHAKE] operator[:] Keyword[case] identifier[cs_RENEGOTIATE] operator[:] Keyword[return] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[connectionState] operator[==] identifier[cs_START] operator[SEP] {
identifier[connectionState] operator[=] identifier[cs_HANDSHAKE] operator[SEP]
}
Keyword[else] {
identifier[connectionState] operator[=] identifier[cs_RENEGOTIATE] operator[SEP]
}
Keyword[if] operator[SEP] identifier[roleIsServer] operator[SEP] {
identifier[handshaker] operator[=] Keyword[new] identifier[ServerHandshaker] operator[SEP] Keyword[this] , identifier[sslContext] , identifier[enabledProtocols] , identifier[doClientAuth] , identifier[protocolVersion] , identifier[connectionState] operator[==] identifier[cs_HANDSHAKE] , identifier[secureRenegotiation] , identifier[clientVerifyData] , identifier[serverVerifyData] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[handshaker] operator[=] Keyword[new] identifier[ClientHandshaker] operator[SEP] Keyword[this] , identifier[sslContext] , identifier[enabledProtocols] , identifier[protocolVersion] , identifier[connectionState] operator[==] identifier[cs_HANDSHAKE] , identifier[secureRenegotiation] , identifier[clientVerifyData] , identifier[serverVerifyData] operator[SEP] operator[SEP]
}
identifier[handshaker] operator[SEP] identifier[setEnabledCipherSuites] operator[SEP] identifier[enabledCipherSuites] operator[SEP] operator[SEP] identifier[handshaker] operator[SEP] identifier[setEnableSessionCreation] operator[SEP] identifier[enableSessionCreation] operator[SEP] operator[SEP]
}
|
public Calendar retrieveCalendar(String name, T jedis) throws JobPersistenceException{
final String calendarHashKey = redisSchema.calendarHashKey(name);
Calendar calendar;
try{
final Map<String, String> calendarMap = jedis.hgetAll(calendarHashKey);
if(calendarMap == null || calendarMap.isEmpty()){
return null;
}
final Class<?> calendarClass = Class.forName(calendarMap.get(CALENDAR_CLASS));
calendar = (Calendar) mapper.readValue(calendarMap.get(CALENDAR_JSON), calendarClass);
} catch (ClassNotFoundException e) {
logger.error("Class not found for calendar " + name);
throw new JobPersistenceException(e.getMessage(), e);
} catch (IOException e) {
logger.error("Unable to deserialize calendar json for calendar " + name);
throw new JobPersistenceException(e.getMessage(), e);
}
return calendar;
}
|
class class_name[name] begin[{]
method[retrieveCalendar, return_type[type[Calendar]], modifier[public], parameter[name, jedis]] begin[{]
local_variable[type[String], calendarHashKey]
local_variable[type[Calendar], calendar]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=calendarHashKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hgetAll, postfix_operators=[], prefix_operators=[], qualifier=jedis, selectors=[], type_arguments=None), name=calendarMap)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=calendarMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=calendarMap, selectors=[], type_arguments=None), operator=||), 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)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=CALENDAR_CLASS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=calendarMap, selectors=[], type_arguments=None)], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), name=calendarClass)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=calendar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=CALENDAR_JSON, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=calendarMap, selectors=[], type_arguments=None), MemberReference(member=calendarClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readValue, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Calendar, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Class not found for calendar "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JobPersistenceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to deserialize calendar json for calendar "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JobPersistenceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
return[member[.calendar]]
end[}]
END[}]
|
Keyword[public] identifier[Calendar] identifier[retrieveCalendar] operator[SEP] identifier[String] identifier[name] , identifier[T] identifier[jedis] operator[SEP] Keyword[throws] identifier[JobPersistenceException] {
Keyword[final] identifier[String] identifier[calendarHashKey] operator[=] identifier[redisSchema] operator[SEP] identifier[calendarHashKey] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[Calendar] identifier[calendar] operator[SEP] Keyword[try] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[calendarMap] operator[=] identifier[jedis] operator[SEP] identifier[hgetAll] operator[SEP] identifier[calendarHashKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[calendarMap] operator[==] Other[null] operator[||] identifier[calendarMap] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[calendarClass] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[calendarMap] operator[SEP] identifier[get] operator[SEP] identifier[CALENDAR_CLASS] operator[SEP] operator[SEP] operator[SEP] identifier[calendar] operator[=] operator[SEP] identifier[Calendar] operator[SEP] identifier[mapper] operator[SEP] identifier[readValue] operator[SEP] identifier[calendarMap] operator[SEP] identifier[get] operator[SEP] identifier[CALENDAR_JSON] operator[SEP] , identifier[calendarClass] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[JobPersistenceException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[JobPersistenceException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[calendar] operator[SEP]
}
|
public com.google.api.ads.admanager.axis.v201808.VideoPositionTargeting getVideoPositionTargeting() {
return videoPositionTargeting;
}
|
class class_name[name] begin[{]
method[getVideoPositionTargeting, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.videoPositionTargeting]]
end[}]
END[}]
|
Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201808] operator[SEP] identifier[VideoPositionTargeting] identifier[getVideoPositionTargeting] operator[SEP] operator[SEP] {
Keyword[return] identifier[videoPositionTargeting] operator[SEP]
}
|
@Override
public double distance( Object pt1, Object pt2 ) {
double[] coords1 = coords(pt1);
double[] coords2 = coords(pt2);
double sum = 0.0;
for( int i = 0; i < dimensions; i++ ) {
double d = coords1[i] - coords2[i];
sum += d * d;
}
return Math.sqrt(sum);
}
|
class class_name[name] begin[{]
method[distance, return_type[type[double]], modifier[public], parameter[pt1, pt2]] begin[{]
local_variable[type[double], coords1]
local_variable[type[double], coords2]
local_variable[type[double], sum]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=coords1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=coords2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=-), name=d)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dimensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[Math.sqrt, parameter[member[.sum]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[double] identifier[distance] operator[SEP] identifier[Object] identifier[pt1] , identifier[Object] identifier[pt2] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] identifier[coords1] operator[=] identifier[coords] operator[SEP] identifier[pt1] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[coords2] operator[=] identifier[coords] operator[SEP] identifier[pt2] operator[SEP] operator[SEP] Keyword[double] identifier[sum] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[dimensions] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[double] identifier[d] operator[=] identifier[coords1] operator[SEP] identifier[i] operator[SEP] operator[-] identifier[coords2] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[sum] operator[+=] identifier[d] operator[*] identifier[d] operator[SEP]
}
Keyword[return] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[sum] operator[SEP] operator[SEP]
}
|
public Matrix getMatrix(int i0, int i1, int[] c)
{
Matrix X = new Matrix(i1 - i0 + 1, c.length);
double[][] B = X.getArray();
try
{
for (int i = i0; i <= i1; i++)
{
for (int j = 0; j < c.length; j++)
{
B[i - i0][j] = A[i][c[j]];
}
}
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new ArrayIndexOutOfBoundsException("Submatrix indices");
}
return X;
}
|
class class_name[name] begin[{]
method[getMatrix, return_type[type[Matrix]], modifier[public], parameter[i0, i1, c]] begin[{]
local_variable[type[Matrix], X]
local_variable[type[double], B]
TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=B, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)), ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=A, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), ArraySelector(index=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=i0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Submatrix indices")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArrayIndexOutOfBoundsException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ArrayIndexOutOfBoundsException']))], finally_block=None, label=None, resources=None)
return[member[.X]]
end[}]
END[}]
|
Keyword[public] identifier[Matrix] identifier[getMatrix] operator[SEP] Keyword[int] identifier[i0] , Keyword[int] identifier[i1] , Keyword[int] operator[SEP] operator[SEP] identifier[c] operator[SEP] {
identifier[Matrix] identifier[X] operator[=] Keyword[new] identifier[Matrix] operator[SEP] identifier[i1] operator[-] identifier[i0] operator[+] Other[1] , identifier[c] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[B] operator[=] identifier[X] operator[SEP] identifier[getArray] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[i0] operator[SEP] identifier[i] operator[<=] identifier[i1] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[c] operator[SEP] identifier[length] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[B] operator[SEP] identifier[i] operator[-] identifier[i0] operator[SEP] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[A] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[c] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[ArrayIndexOutOfBoundsException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ArrayIndexOutOfBoundsException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[X] operator[SEP]
}
|
public File getCorePlatformDir() {
File platformDir = null;
File installDir = Utils.getInstallDir();
if (installDir != null) {
platformDir = new File(installDir, PLATFORM_DIR);
}
if (platformDir == null) {
throw new RuntimeException("Platform Directory not found");
}
return platformDir;
}
|
class class_name[name] begin[{]
method[getCorePlatformDir, return_type[type[File]], modifier[public], parameter[]] begin[{]
local_variable[type[File], platformDir]
local_variable[type[File], installDir]
if[binary_operation[member[.installDir], !=, literal[null]]] begin[{]
assign[member[.platformDir], ClassCreator(arguments=[MemberReference(member=installDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PLATFORM_DIR, 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))]
else begin[{]
None
end[}]
if[binary_operation[member[.platformDir], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Platform Directory not found")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.platformDir]]
end[}]
END[}]
|
Keyword[public] identifier[File] identifier[getCorePlatformDir] operator[SEP] operator[SEP] {
identifier[File] identifier[platformDir] operator[=] Other[null] operator[SEP] identifier[File] identifier[installDir] operator[=] identifier[Utils] operator[SEP] identifier[getInstallDir] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[installDir] operator[!=] Other[null] operator[SEP] {
identifier[platformDir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[installDir] , identifier[PLATFORM_DIR] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[platformDir] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[platformDir] operator[SEP]
}
|
private KeyManager[] createKeyManagers(ContextAware context)
throws NoSuchProviderException, NoSuchAlgorithmException,
UnrecoverableKeyException, KeyStoreException {
if (getKeyStore() == null) return null;
KeyStore keyStore = getKeyStore().createKeyStore();
context.addInfo(
"key store of type '" + keyStore.getType()
+ "' provider '" + keyStore.getProvider()
+ "': " + getKeyStore().getLocation());
KeyManagerFactory kmf = getKeyManagerFactory().createKeyManagerFactory();
context.addInfo("key manager algorithm '" + kmf.getAlgorithm()
+ "' provider '" + kmf.getProvider() + "'");
char[] passphrase = getKeyStore().getPassword().toCharArray();
kmf.init(keyStore, passphrase);
return kmf.getKeyManagers();
}
|
class class_name[name] begin[{]
method[createKeyManagers, return_type[type[KeyManager]], modifier[private], parameter[context]] begin[{]
if[binary_operation[call[.getKeyStore, parameter[]], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[KeyStore], keyStore]
call[context.addInfo, parameter[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["key store of type '"], +, call[keyStore.getType, parameter[]]], +, literal["' provider '"]], +, call[keyStore.getProvider, parameter[]]], +, literal["': "]], +, call[.getKeyStore, parameter[]]]]]
local_variable[type[KeyManagerFactory], kmf]
call[context.addInfo, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["key manager algorithm '"], +, call[kmf.getAlgorithm, parameter[]]], +, literal["' provider '"]], +, call[kmf.getProvider, parameter[]]], +, literal["'"]]]]
local_variable[type[char], passphrase]
call[kmf.init, parameter[member[.keyStore], member[.passphrase]]]
return[call[kmf.getKeyManagers, parameter[]]]
end[}]
END[}]
|
Keyword[private] identifier[KeyManager] operator[SEP] operator[SEP] identifier[createKeyManagers] operator[SEP] identifier[ContextAware] identifier[context] operator[SEP] Keyword[throws] identifier[NoSuchProviderException] , identifier[NoSuchAlgorithmException] , identifier[UnrecoverableKeyException] , identifier[KeyStoreException] {
Keyword[if] operator[SEP] identifier[getKeyStore] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[KeyStore] identifier[keyStore] operator[=] identifier[getKeyStore] operator[SEP] operator[SEP] operator[SEP] identifier[createKeyStore] operator[SEP] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[addInfo] operator[SEP] literal[String] operator[+] identifier[keyStore] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[keyStore] operator[SEP] identifier[getProvider] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[getKeyStore] operator[SEP] operator[SEP] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[KeyManagerFactory] identifier[kmf] operator[=] identifier[getKeyManagerFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createKeyManagerFactory] operator[SEP] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[addInfo] operator[SEP] literal[String] operator[+] identifier[kmf] operator[SEP] identifier[getAlgorithm] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[kmf] operator[SEP] identifier[getProvider] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[passphrase] operator[=] identifier[getKeyStore] operator[SEP] operator[SEP] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] identifier[kmf] operator[SEP] identifier[init] operator[SEP] identifier[keyStore] , identifier[passphrase] operator[SEP] operator[SEP] Keyword[return] identifier[kmf] operator[SEP] identifier[getKeyManagers] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String canonicalise(final InetSocketAddress localData, final InetSocketAddress remoteData)
{
final StringBuilder builder = new StringBuilder(48);
builder.append("UDP-");
toHex(builder, localData.getAddress().getAddress())
.append('-')
.append(localData.getPort());
builder.append('-');
toHex(builder, remoteData.getAddress().getAddress())
.append('-')
.append(remoteData.getPort());
return builder.toString();
}
|
class class_name[name] begin[{]
method[canonicalise, return_type[type[String]], modifier[public static], parameter[localData, remoteData]] begin[{]
local_variable[type[StringBuilder], builder]
call[builder.append, parameter[literal["UDP-"]]]
call[.toHex, parameter[member[.builder], call[localData.getAddress, parameter[]]]]
call[builder.append, parameter[literal['-']]]
call[.toHex, parameter[member[.builder], call[remoteData.getAddress, parameter[]]]]
return[call[builder.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[canonicalise] operator[SEP] Keyword[final] identifier[InetSocketAddress] identifier[localData] , Keyword[final] identifier[InetSocketAddress] identifier[remoteData] operator[SEP] {
Keyword[final] identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] Other[48] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[toHex] operator[SEP] identifier[builder] , identifier[localData] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[localData] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[toHex] operator[SEP] identifier[builder] , identifier[remoteData] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[remoteData] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void run() {
try {
this.keepOn = true;
try {
this.serverSocket = this.openServerSocket();
} catch (final IOException e) {
throw new RuntimeException(e);
}
while (this.keepOn) {
try {
final Socket clientSocket = this.serverSocket.accept();
final POP3Handler pop3Handler = (POP3Handler) this.handler.clone();
pop3Handler.setClientSocket(clientSocket);
new Thread(pop3Handler).start();
} catch (final IOException e) {
//e.printStackTrace();
}
}
} finally {
this.quit();
}
}
|
class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=keepOn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=serverSocket, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=openServerSocket, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None), WhileStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=serverSocket, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=accept, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=clientSocket)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Socket, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=handler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=clone, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=POP3Handler, sub_type=None)), name=pop3Handler)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=POP3Handler, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=clientSocket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setClientSocket, postfix_operators=[], prefix_operators=[], qualifier=pop3Handler, selectors=[], type_arguments=None), label=None), StatementExpression(expression=ClassCreator(arguments=[MemberReference(member=pop3Handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=start, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Thread, sub_type=None)), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)]), condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=keepOn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), label=None)], catches=None, finally_block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=quit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[keepOn] operator[=] literal[boolean] operator[SEP] Keyword[try] {
Keyword[this] operator[SEP] identifier[serverSocket] operator[=] Keyword[this] operator[SEP] identifier[openServerSocket] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] Keyword[this] operator[SEP] identifier[keepOn] operator[SEP] {
Keyword[try] {
Keyword[final] identifier[Socket] identifier[clientSocket] operator[=] Keyword[this] operator[SEP] identifier[serverSocket] operator[SEP] identifier[accept] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[POP3Handler] identifier[pop3Handler] operator[=] operator[SEP] identifier[POP3Handler] operator[SEP] Keyword[this] operator[SEP] identifier[handler] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[pop3Handler] operator[SEP] identifier[setClientSocket] operator[SEP] identifier[clientSocket] operator[SEP] operator[SEP] Keyword[new] identifier[Thread] operator[SEP] identifier[pop3Handler] operator[SEP] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[e] operator[SEP] {
}
}
}
Keyword[finally] {
Keyword[this] operator[SEP] identifier[quit] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void xmlWriteOn(FormattedWriter writer) throws IOException
{
super.xmlWriteOn(writer);
writer.newLine();
writer.taggedValue("subscriberID", _subState.getSubscriberID());
writer.newLine();
writer.startTag("topics");
writer.indent();
String[] topics = _subState.getTopics();
if (topics != null)
{
for (int i = 0; i < topics.length; i++)
{
writer.newLine();
writer.taggedValue("topic", topics[i]);
}
}
writer.outdent();
writer.newLine();
writer.endTag("topics");
writer.newLine();
writer.taggedValue("toBeDeleted", toBeDeleted);
}
|
class class_name[name] begin[{]
method[xmlWriteOn, return_type[void], modifier[public], parameter[writer]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=xmlWriteOn, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[writer.newLine, parameter[]]
call[writer.taggedValue, parameter[literal["subscriberID"], call[_subState.getSubscriberID, parameter[]]]]
call[writer.newLine, parameter[]]
call[writer.startTag, parameter[literal["topics"]]]
call[writer.indent, parameter[]]
local_variable[type[String], topics]
if[binary_operation[member[.topics], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=newLine, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="topic"), MemberReference(member=topics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=taggedValue, postfix_operators=[], prefix_operators=[], qualifier=writer, 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=topics, 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[}]
call[writer.outdent, parameter[]]
call[writer.newLine, parameter[]]
call[writer.endTag, parameter[literal["topics"]]]
call[writer.newLine, parameter[]]
call[writer.taggedValue, parameter[literal["toBeDeleted"], member[.toBeDeleted]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[xmlWriteOn] operator[SEP] identifier[FormattedWriter] identifier[writer] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[super] operator[SEP] identifier[xmlWriteOn] operator[SEP] identifier[writer] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[taggedValue] operator[SEP] literal[String] , identifier[_subState] operator[SEP] identifier[getSubscriberID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[startTag] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[indent] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[topics] operator[=] identifier[_subState] operator[SEP] identifier[getTopics] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[topics] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[topics] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[taggedValue] operator[SEP] literal[String] , identifier[topics] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[writer] operator[SEP] identifier[outdent] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[endTag] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[newLine] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[taggedValue] operator[SEP] literal[String] , identifier[toBeDeleted] operator[SEP] operator[SEP]
}
|
public Closeable onCandlesticksEvent(final BiConsumer<BitfinexCandlestickSymbol, Collection<BitfinexCandle>> listener) {
candlesConsumers.offer(listener);
return () -> candlesConsumers.remove(listener);
}
|
class class_name[name] begin[{]
method[onCandlesticksEvent, return_type[type[Closeable]], modifier[public], parameter[listener]] begin[{]
call[candlesConsumers.offer, parameter[member[.listener]]]
return[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=candlesConsumers, selectors=[], type_arguments=None), parameters=[])]
end[}]
END[}]
|
Keyword[public] identifier[Closeable] identifier[onCandlesticksEvent] operator[SEP] Keyword[final] identifier[BiConsumer] operator[<] identifier[BitfinexCandlestickSymbol] , identifier[Collection] operator[<] identifier[BitfinexCandle] operator[>] operator[>] identifier[listener] operator[SEP] {
identifier[candlesConsumers] operator[SEP] identifier[offer] operator[SEP] identifier[listener] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] operator[->] identifier[candlesConsumers] operator[SEP] identifier[remove] operator[SEP] identifier[listener] operator[SEP] operator[SEP]
}
|
public final void setPreviewShape(@NonNull final PreviewShape previewShape) {
Condition.INSTANCE.ensureNotNull(previewShape, "The preview shape may not be null");
this.previewShape = previewShape;
if (previewLoader != null) {
previewLoader.setShape(previewShape);
}
adaptPreviewView();
}
|
class class_name[name] begin[{]
method[setPreviewShape, return_type[void], modifier[final public], parameter[previewShape]] begin[{]
call[Condition.INSTANCE.ensureNotNull, parameter[member[.previewShape], literal["The preview shape may not be null"]]]
assign[THIS[member[None.previewShape]], member[.previewShape]]
if[binary_operation[member[.previewLoader], !=, literal[null]]] begin[{]
call[previewLoader.setShape, parameter[member[.previewShape]]]
else begin[{]
None
end[}]
call[.adaptPreviewView, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[setPreviewShape] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[PreviewShape] identifier[previewShape] operator[SEP] {
identifier[Condition] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[ensureNotNull] operator[SEP] identifier[previewShape] , literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[previewShape] operator[=] identifier[previewShape] operator[SEP] Keyword[if] operator[SEP] identifier[previewLoader] operator[!=] Other[null] operator[SEP] {
identifier[previewLoader] operator[SEP] identifier[setShape] operator[SEP] identifier[previewShape] operator[SEP] operator[SEP]
}
identifier[adaptPreviewView] operator[SEP] operator[SEP] operator[SEP]
}
|
public VaadinForHeroku withFilterDefinition(final FilterDefinitionBuilder... filterDefs){
checkVarArgsArguments(filterDefs);
this.filterDefinitions.addAll(Arrays.asList(filterDefs));
return self();
}
|
class class_name[name] begin[{]
method[withFilterDefinition, return_type[type[VaadinForHeroku]], modifier[public], parameter[filterDefs]] begin[{]
call[.checkVarArgsArguments, parameter[member[.filterDefs]]]
THIS[member[None.filterDefinitions]call[None.addAll, parameter[call[Arrays.asList, parameter[member[.filterDefs]]]]]]
return[call[.self, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[VaadinForHeroku] identifier[withFilterDefinition] operator[SEP] Keyword[final] identifier[FilterDefinitionBuilder] operator[...] identifier[filterDefs] operator[SEP] {
identifier[checkVarArgsArguments] operator[SEP] identifier[filterDefs] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[filterDefinitions] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[filterDefs] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[self] operator[SEP] operator[SEP] operator[SEP]
}
|
public byte[] compHandshakeData(CommsConnection conn, int version, byte[] data) {
try {
return SchemaManager.receiveHandshake(conn, data);
} catch (Exception ex) {
FFDCFilter.processException(ex, "compData", "96", this);
return null;
}
}
|
class class_name[name] begin[{]
method[compHandshakeData, return_type[type[byte]], modifier[public], parameter[conn, version, data]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=receiveHandshake, postfix_operators=[], prefix_operators=[], qualifier=SchemaManager, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="compData"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="96"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, 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=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[compHandshakeData] operator[SEP] identifier[CommsConnection] identifier[conn] , Keyword[int] identifier[version] , Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[SchemaManager] operator[SEP] identifier[receiveHandshake] operator[SEP] identifier[conn] , identifier[data] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[ex] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
public void dndOff() throws WorkspaceApiException {
try {
ApiSuccessResponse response = this.voiceApi.setDNDOff(null);
throwIfNotOk("dndOff", response);
} catch (ApiException e) {
throw new WorkspaceApiException("dndOff failed.", e);
}
}
|
class class_name[name] begin[{]
method[dndOff, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=voiceApi, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setDNDOff, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ApiSuccessResponse, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dndOff"), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=throwIfNotOk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dndOff failed."), 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=WorkspaceApiException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ApiException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[dndOff] operator[SEP] operator[SEP] Keyword[throws] identifier[WorkspaceApiException] {
Keyword[try] {
identifier[ApiSuccessResponse] identifier[response] operator[=] Keyword[this] operator[SEP] identifier[voiceApi] operator[SEP] identifier[setDNDOff] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[throwIfNotOk] operator[SEP] literal[String] , identifier[response] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ApiException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WorkspaceApiException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
private void loadCollisionGroups(MapTileCollision mapCollision, Media groupsConfig)
{
Verbose.info(INFO_LOAD_GROUPS, groupsConfig.getFile().getPath());
this.groupsConfig = groupsConfig;
final Xml nodeGroups = new Xml(groupsConfig);
final CollisionGroupConfig config = CollisionGroupConfig.imports(nodeGroups, mapCollision);
loadCollisionGroups(config);
}
|
class class_name[name] begin[{]
method[loadCollisionGroups, return_type[void], modifier[private], parameter[mapCollision, groupsConfig]] begin[{]
call[Verbose.info, parameter[member[.INFO_LOAD_GROUPS], call[groupsConfig.getFile, parameter[]]]]
assign[THIS[member[None.groupsConfig]], member[.groupsConfig]]
local_variable[type[Xml], nodeGroups]
local_variable[type[CollisionGroupConfig], config]
call[.loadCollisionGroups, parameter[member[.config]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[loadCollisionGroups] operator[SEP] identifier[MapTileCollision] identifier[mapCollision] , identifier[Media] identifier[groupsConfig] operator[SEP] {
identifier[Verbose] operator[SEP] identifier[info] operator[SEP] identifier[INFO_LOAD_GROUPS] , identifier[groupsConfig] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[groupsConfig] operator[=] identifier[groupsConfig] operator[SEP] Keyword[final] identifier[Xml] identifier[nodeGroups] operator[=] Keyword[new] identifier[Xml] operator[SEP] identifier[groupsConfig] operator[SEP] operator[SEP] Keyword[final] identifier[CollisionGroupConfig] identifier[config] operator[=] identifier[CollisionGroupConfig] operator[SEP] identifier[imports] operator[SEP] identifier[nodeGroups] , identifier[mapCollision] operator[SEP] operator[SEP] identifier[loadCollisionGroups] operator[SEP] identifier[config] operator[SEP] operator[SEP]
}
|
private void clearEntityAttributes(CmsEntity entity) {
for (CmsEntityAttribute attribute : entity.getAttributes()) {
if (attribute.isComplexValue()) {
for (CmsEntity child : attribute.getComplexValues()) {
clearEntityAttributes(child);
removeEntity(child.getId());
}
}
entity.removeAttributeSilent(attribute.getAttributeName());
}
}
|
class class_name[name] begin[{]
method[clearEntityAttributes, return_type[void], modifier[private], parameter[entity]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isComplexValue, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=clearEntityAttributes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=child, selectors=[], type_arguments=None)], member=removeEntity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getComplexValues, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=child)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsEntity, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAttributeName, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[], type_arguments=None)], member=removeAttributeSilent, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAttributes, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=attribute)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsEntityAttribute, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[clearEntityAttributes] operator[SEP] identifier[CmsEntity] identifier[entity] operator[SEP] {
Keyword[for] operator[SEP] identifier[CmsEntityAttribute] identifier[attribute] operator[:] identifier[entity] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[attribute] operator[SEP] identifier[isComplexValue] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[CmsEntity] identifier[child] operator[:] identifier[attribute] operator[SEP] identifier[getComplexValues] operator[SEP] operator[SEP] operator[SEP] {
identifier[clearEntityAttributes] operator[SEP] identifier[child] operator[SEP] operator[SEP] identifier[removeEntity] operator[SEP] identifier[child] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[entity] operator[SEP] identifier[removeAttributeSilent] operator[SEP] identifier[attribute] operator[SEP] identifier[getAttributeName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void setCacheFiles(URI[] files, Configuration conf) {
String sfiles = StringUtils.uriToString(files);
conf.set("mapred.cache.files", sfiles);
}
|
class class_name[name] begin[{]
method[setCacheFiles, return_type[void], modifier[public static], parameter[files, conf]] begin[{]
local_variable[type[String], sfiles]
call[conf.set, parameter[literal["mapred.cache.files"], member[.sfiles]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[setCacheFiles] operator[SEP] identifier[URI] operator[SEP] operator[SEP] identifier[files] , identifier[Configuration] identifier[conf] operator[SEP] {
identifier[String] identifier[sfiles] operator[=] identifier[StringUtils] operator[SEP] identifier[uriToString] operator[SEP] identifier[files] operator[SEP] operator[SEP] identifier[conf] operator[SEP] identifier[set] operator[SEP] literal[String] , identifier[sfiles] operator[SEP] operator[SEP]
}
|
private void writeObject(ObjectOutputStream out) throws IOException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "writeObject : " + this);
throw new NotSerializableException("This entity manager is not serializable");
}
|
class class_name[name] begin[{]
method[writeObject, return_type[void], modifier[private], parameter[out]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[literal["writeObject : "], +, THIS[]]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This entity manager is not serializable")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotSerializableException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[writeObject] operator[SEP] identifier[ObjectOutputStream] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] Keyword[this] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NotSerializableException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@Override
public AbstractMessage nextElement()
{
if (endOfQueueReached)
throw new NoSuchElementException();
try
{
checkNotClosed();
AbstractMessage msg = fetchNext();
if (msg != null)
{
nextMessage = null; // Consume fetched message
// Make sure the message is fully deserialized and marked as read-only
msg.ensureDeserializationLevel(MessageSerializationLevel.FULL);
msg.markAsReadOnly();
return msg;
}
throw new NoSuchElementException();
}
catch (NoSuchElementException e)
{
throw e;
}
catch (JMSException e)
{
throw new IllegalStateException(e.toString());
}
}
|
class class_name[name] begin[{]
method[nextElement, return_type[type[AbstractMessage]], modifier[public], parameter[]] begin[{]
if[member[.endOfQueueReached]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchElementException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=checkNotClosed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=fetchNext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AbstractMessage, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=nextMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FULL, postfix_operators=[], prefix_operators=[], qualifier=MessageSerializationLevel, selectors=[])], member=ensureDeserializationLevel, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=markAsReadOnly, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ThrowStatement(expression=ClassCreator(arguments=[], 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)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchElementException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], 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)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JMSException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[AbstractMessage] identifier[nextElement] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[endOfQueueReached] operator[SEP] Keyword[throw] Keyword[new] identifier[NoSuchElementException] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[checkNotClosed] operator[SEP] operator[SEP] operator[SEP] identifier[AbstractMessage] identifier[msg] operator[=] identifier[fetchNext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[msg] operator[!=] Other[null] operator[SEP] {
identifier[nextMessage] operator[=] Other[null] operator[SEP] identifier[msg] operator[SEP] identifier[ensureDeserializationLevel] operator[SEP] identifier[MessageSerializationLevel] operator[SEP] identifier[FULL] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[markAsReadOnly] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[msg] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[NoSuchElementException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchElementException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JMSException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static Counter getCounter(TaskInputOutputContext context,
String groupName, String counterName) {
return (Counter) invoke(GET_COUNTER_METHOD, context, groupName, counterName);
}
|
class class_name[name] begin[{]
method[getCounter, return_type[type[Counter]], modifier[public static], parameter[context, groupName, counterName]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=GET_COUNTER_METHOD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=groupName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=counterName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Counter, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Counter] identifier[getCounter] operator[SEP] identifier[TaskInputOutputContext] identifier[context] , identifier[String] identifier[groupName] , identifier[String] identifier[counterName] operator[SEP] {
Keyword[return] operator[SEP] identifier[Counter] operator[SEP] identifier[invoke] operator[SEP] identifier[GET_COUNTER_METHOD] , identifier[context] , identifier[groupName] , identifier[counterName] operator[SEP] operator[SEP]
}
|
@Override
public SearchResult getUsers(String pattern, int limit) throws RegistryException {
if (pattern == null) {
throw new IllegalArgumentException("pattern is null");
}
if (pattern.isEmpty()) {
throw new IllegalArgumentException("pattern is an empty String");
}
if (limit >= 0 && user.matches(pattern)) {
List<String> list = new ArrayList<String>();
list.add(user);
return new SearchResult(list, false);
} else {
return new SearchResult();
}
}
|
class class_name[name] begin[{]
method[getUsers, return_type[type[SearchResult]], modifier[public], parameter[pattern, limit]] begin[{]
if[binary_operation[member[.pattern], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="pattern is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[pattern.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="pattern is an empty String")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.limit], >=, literal[0]], &&, call[user.matches, parameter[member[.pattern]]]]] begin[{]
local_variable[type[List], list]
call[list.add, parameter[member[.user]]]
return[ClassCreator(arguments=[MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SearchResult, sub_type=None))]
else begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SearchResult, sub_type=None))]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[SearchResult] identifier[getUsers] operator[SEP] identifier[String] identifier[pattern] , Keyword[int] identifier[limit] operator[SEP] Keyword[throws] identifier[RegistryException] {
Keyword[if] operator[SEP] identifier[pattern] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[pattern] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[limit] operator[>=] Other[0] operator[&&] identifier[user] operator[SEP] identifier[matches] operator[SEP] identifier[pattern] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[user] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[SearchResult] operator[SEP] identifier[list] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[SearchResult] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private String removePathFromUrl(String url) {
String path = extractPathFromUrl(url);
int end = url.indexOf(path);
return url.substring(0, end);
// Alternative: return url.replaceAll("(?<=:[0-9]{1,5})/.*", "")), assume url contains port number
}
|
class class_name[name] begin[{]
method[removePathFromUrl, return_type[type[String]], modifier[private], parameter[url]] begin[{]
local_variable[type[String], path]
local_variable[type[int], end]
return[call[url.substring, parameter[literal[0], member[.end]]]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[removePathFromUrl] operator[SEP] identifier[String] identifier[url] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[extractPathFromUrl] operator[SEP] identifier[url] operator[SEP] operator[SEP] Keyword[int] identifier[end] operator[=] identifier[url] operator[SEP] identifier[indexOf] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[return] identifier[url] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[end] operator[SEP] operator[SEP]
}
|
public final void updateOwner(final Map<String, Object> pAddParam,
final WageTaxLine pEntity) throws Exception {
String query =
"select sum(ITSTOTAL) as ITSTOTAL from WAGETAXLINE"
+ " join TAX on TAX.ITSID = WAGETAXLINE.TAX"
+ " where TAX.ITSTYPE=3 and ITSOWNER="
+ pEntity.getItsOwner().getItsId();
Double total = getSrvDatabase().evalDoubleResult(query, "ITSTOTAL");
if (total == null) {
total = 0d;
}
pEntity.getItsOwner().setTotalTaxesEmployee(BigDecimal.valueOf(total)
.setScale(getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getPricePrecision(), getSrvAccSettings()
.lazyGetAccSettings(pAddParam).getRoundingMode()));
query =
"select sum(ITSTOTAL) as ITSTOTAL from WAGETAXLINE"
+ " join TAX on TAX.ITSID = WAGETAXLINE.TAX"
+ " where TAX.ITSTYPE=4 and ITSOWNER="
+ pEntity.getItsOwner().getItsId();
total = getSrvDatabase().evalDoubleResult(query, "ITSTOTAL");
if (total == null) {
total = 0d;
}
pEntity.getItsOwner().setTotalTaxesEmployer(BigDecimal.valueOf(total)
.setScale(getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getPricePrecision(), getSrvAccSettings()
.lazyGetAccSettings(pAddParam).getRoundingMode()));
pEntity.getItsOwner().setNetWage(pEntity.getItsOwner()
.getItsTotal().subtract(pEntity.getItsOwner()
.getTotalTaxesEmployee()));
getSrvOrm().updateEntity(pAddParam, pEntity.getItsOwner());
}
|
class class_name[name] begin[{]
method[updateOwner, return_type[void], modifier[final public], parameter[pAddParam, pEntity]] begin[{]
local_variable[type[String], query]
local_variable[type[Double], total]
if[binary_operation[member[.total], ==, literal[null]]] begin[{]
assign[member[.total], literal[0d]]
else begin[{]
None
end[}]
call[pEntity.getItsOwner, parameter[]]
assign[member[.query], binary_operation[binary_operation[binary_operation[literal["select sum(ITSTOTAL) as ITSTOTAL from WAGETAXLINE"], +, literal[" join TAX on TAX.ITSID = WAGETAXLINE.TAX"]], +, literal[" where TAX.ITSTYPE=4 and ITSOWNER="]], +, call[pEntity.getItsOwner, parameter[]]]]
assign[member[.total], call[.getSrvDatabase, parameter[]]]
if[binary_operation[member[.total], ==, literal[null]]] begin[{]
assign[member[.total], literal[0d]]
else begin[{]
None
end[}]
call[pEntity.getItsOwner, parameter[]]
call[pEntity.getItsOwner, parameter[]]
call[.getSrvOrm, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[updateOwner] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[pAddParam] , Keyword[final] identifier[WageTaxLine] identifier[pEntity] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[String] identifier[query] operator[=] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] identifier[pEntity] operator[SEP] identifier[getItsOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getItsId] operator[SEP] operator[SEP] operator[SEP] identifier[Double] identifier[total] operator[=] identifier[getSrvDatabase] operator[SEP] operator[SEP] operator[SEP] identifier[evalDoubleResult] operator[SEP] identifier[query] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[total] operator[==] Other[null] operator[SEP] {
identifier[total] operator[=] literal[Float] operator[SEP]
}
identifier[pEntity] operator[SEP] identifier[getItsOwner] operator[SEP] operator[SEP] operator[SEP] identifier[setTotalTaxesEmployee] operator[SEP] identifier[BigDecimal] operator[SEP] identifier[valueOf] operator[SEP] identifier[total] operator[SEP] operator[SEP] identifier[setScale] operator[SEP] identifier[getSrvAccSettings] operator[SEP] operator[SEP] operator[SEP] identifier[lazyGetAccSettings] operator[SEP] identifier[pAddParam] operator[SEP] operator[SEP] identifier[getPricePrecision] operator[SEP] operator[SEP] , identifier[getSrvAccSettings] operator[SEP] operator[SEP] operator[SEP] identifier[lazyGetAccSettings] operator[SEP] identifier[pAddParam] operator[SEP] operator[SEP] identifier[getRoundingMode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[query] operator[=] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] identifier[pEntity] operator[SEP] identifier[getItsOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getItsId] operator[SEP] operator[SEP] operator[SEP] identifier[total] operator[=] identifier[getSrvDatabase] operator[SEP] operator[SEP] operator[SEP] identifier[evalDoubleResult] operator[SEP] identifier[query] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[total] operator[==] Other[null] operator[SEP] {
identifier[total] operator[=] literal[Float] operator[SEP]
}
identifier[pEntity] operator[SEP] identifier[getItsOwner] operator[SEP] operator[SEP] operator[SEP] identifier[setTotalTaxesEmployer] operator[SEP] identifier[BigDecimal] operator[SEP] identifier[valueOf] operator[SEP] identifier[total] operator[SEP] operator[SEP] identifier[setScale] operator[SEP] identifier[getSrvAccSettings] operator[SEP] operator[SEP] operator[SEP] identifier[lazyGetAccSettings] operator[SEP] identifier[pAddParam] operator[SEP] operator[SEP] identifier[getPricePrecision] operator[SEP] operator[SEP] , identifier[getSrvAccSettings] operator[SEP] operator[SEP] operator[SEP] identifier[lazyGetAccSettings] operator[SEP] identifier[pAddParam] operator[SEP] operator[SEP] identifier[getRoundingMode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pEntity] operator[SEP] identifier[getItsOwner] operator[SEP] operator[SEP] operator[SEP] identifier[setNetWage] operator[SEP] identifier[pEntity] operator[SEP] identifier[getItsOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getItsTotal] operator[SEP] operator[SEP] operator[SEP] identifier[subtract] operator[SEP] identifier[pEntity] operator[SEP] identifier[getItsOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getTotalTaxesEmployee] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getSrvOrm] operator[SEP] operator[SEP] operator[SEP] identifier[updateEntity] operator[SEP] identifier[pAddParam] , identifier[pEntity] operator[SEP] identifier[getItsOwner] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public ScheduleExpression getSchedule()
{
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "getSchedule: " + this);
// Determine if the calling bean is in a state that allows timer service
// method access - throws IllegalStateException if not allowed.
checkTimerAccess();
// Determine if this timer is considered cancelled for the current
// thread/transaction - throws NoSuchObjectLocalException if cancelled.
checkIfCancelled();
if (!isCalendarTimer()) {
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getSchedule: IllegalStateException : Timer is not a calendar-based timer");
throw new IllegalStateException("Timer is not a calendar-based timer");
}
ScheduleExpression result = ivContainer.ivObjectCopier.copy(ivParsedScheduleExpression.getSchedule()); // d587232, RTC102299
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "getSchedule: " + ScheduleExpressionParser.toString(result));
return result;
}
|
class class_name[name] begin[{]
method[getSchedule, return_type[type[ScheduleExpression]], modifier[public], parameter[]] begin[{]
local_variable[type[boolean], isTraceOn]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[member[.tc], binary_operation[literal["getSchedule: "], +, THIS[]]]]
else begin[{]
None
end[}]
call[.checkTimerAccess, parameter[]]
call[.checkIfCancelled, parameter[]]
if[call[.isCalendarTimer, parameter[]]] begin[{]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getSchedule: IllegalStateException : Timer is not a calendar-based timer"]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Timer is not a calendar-based timer")], 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[ScheduleExpression], result]
if[binary_operation[member[.isTraceOn], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], binary_operation[literal["getSchedule: "], +, call[ScheduleExpressionParser.toString, parameter[member[.result]]]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ScheduleExpression] identifier[getSchedule] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[isTraceOn] operator[=] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[+] Keyword[this] operator[SEP] operator[SEP] identifier[checkTimerAccess] operator[SEP] operator[SEP] operator[SEP] identifier[checkIfCancelled] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isCalendarTimer] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ScheduleExpression] identifier[result] operator[=] identifier[ivContainer] operator[SEP] identifier[ivObjectCopier] operator[SEP] identifier[copy] operator[SEP] identifier[ivParsedScheduleExpression] operator[SEP] identifier[getSchedule] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isTraceOn] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[ScheduleExpressionParser] operator[SEP] identifier[toString] operator[SEP] identifier[result] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public static final Assignment fromSortedArrays(int[] vars, Object[] values) {
// Verify that the assignment is sorted and contains no duplicate values.
for (int i = 1; i < vars.length; i++) {
Preconditions.checkArgument(vars[i - 1] < vars[i], "Illegal assignment variable nums: %s %s",
vars[i - 1], vars[i]);
}
return new Assignment(vars, values);
}
|
class class_name[name] begin[{]
method[fromSortedArrays, return_type[type[Assignment]], modifier[final public static], parameter[vars, values]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=vars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), operandr=MemberReference(member=vars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=<), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal assignment variable nums: %s %s"), MemberReference(member=vars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), MemberReference(member=vars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=checkArgument, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, 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=vars, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=vars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=values, 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=Assignment, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[final] identifier[Assignment] identifier[fromSortedArrays] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[vars] , identifier[Object] operator[SEP] operator[SEP] identifier[values] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[vars] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[vars] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[<] identifier[vars] operator[SEP] identifier[i] operator[SEP] , literal[String] , identifier[vars] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] , identifier[vars] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Assignment] operator[SEP] identifier[vars] , identifier[values] operator[SEP] operator[SEP]
}
|
@Override
public void render(final ActionRequest actionRequest, final Object resultValue) {
final PermRedirect redirectResult;
if (resultValue == null) {
redirectResult = PermRedirect.to(StringPool.SLASH);
} else {
if (resultValue instanceof String) {
redirectResult = PermRedirect.to((String)resultValue);
}
else {
redirectResult = (PermRedirect) resultValue;
}
}
final String resultBasePath = actionRequest.getActionRuntime().getResultBasePath();
final String redirectValue = redirectResult.path();
final String resultPath;
if (redirectValue.startsWith("http://") || redirectValue.startsWith("https://")) {
resultPath = redirectValue;
}
else {
resultPath = resultMapper.resolveResultPathString(resultBasePath, redirectValue);
}
final HttpServletRequest request = actionRequest.getHttpServletRequest();
final HttpServletResponse response = actionRequest.getHttpServletResponse();
String path = beanTemplateParser.parseWithBean(resultPath, actionRequest.getAction());
DispatcherUtil.redirectPermanent(request, response, path);
}
|
class class_name[name] begin[{]
method[render, return_type[void], modifier[public], parameter[actionRequest, resultValue]] begin[{]
local_variable[type[PermRedirect], redirectResult]
if[binary_operation[member[.resultValue], ==, literal[null]]] begin[{]
assign[member[.redirectResult], call[PermRedirect.to, parameter[member[StringPool.SLASH]]]]
else begin[{]
if[binary_operation[member[.resultValue], instanceof, type[String]]] begin[{]
assign[member[.redirectResult], call[PermRedirect.to, parameter[Cast(expression=MemberReference(member=resultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]]]
else begin[{]
assign[member[.redirectResult], Cast(expression=MemberReference(member=resultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PermRedirect, sub_type=None))]
end[}]
end[}]
local_variable[type[String], resultBasePath]
local_variable[type[String], redirectValue]
local_variable[type[String], resultPath]
if[binary_operation[call[redirectValue.startsWith, parameter[literal["http://"]]], ||, call[redirectValue.startsWith, parameter[literal["https://"]]]]] begin[{]
assign[member[.resultPath], member[.redirectValue]]
else begin[{]
assign[member[.resultPath], call[resultMapper.resolveResultPathString, parameter[member[.resultBasePath], member[.redirectValue]]]]
end[}]
local_variable[type[HttpServletRequest], request]
local_variable[type[HttpServletResponse], response]
local_variable[type[String], path]
call[DispatcherUtil.redirectPermanent, parameter[member[.request], member[.response], member[.path]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[render] operator[SEP] Keyword[final] identifier[ActionRequest] identifier[actionRequest] , Keyword[final] identifier[Object] identifier[resultValue] operator[SEP] {
Keyword[final] identifier[PermRedirect] identifier[redirectResult] operator[SEP] Keyword[if] operator[SEP] identifier[resultValue] operator[==] Other[null] operator[SEP] {
identifier[redirectResult] operator[=] identifier[PermRedirect] operator[SEP] identifier[to] operator[SEP] identifier[StringPool] operator[SEP] identifier[SLASH] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[resultValue] Keyword[instanceof] identifier[String] operator[SEP] {
identifier[redirectResult] operator[=] identifier[PermRedirect] operator[SEP] identifier[to] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[resultValue] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[redirectResult] operator[=] operator[SEP] identifier[PermRedirect] operator[SEP] identifier[resultValue] operator[SEP]
}
}
Keyword[final] identifier[String] identifier[resultBasePath] operator[=] identifier[actionRequest] operator[SEP] identifier[getActionRuntime] operator[SEP] operator[SEP] operator[SEP] identifier[getResultBasePath] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[redirectValue] operator[=] identifier[redirectResult] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[resultPath] operator[SEP] Keyword[if] operator[SEP] identifier[redirectValue] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[redirectValue] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[resultPath] operator[=] identifier[redirectValue] operator[SEP]
}
Keyword[else] {
identifier[resultPath] operator[=] identifier[resultMapper] operator[SEP] identifier[resolveResultPathString] operator[SEP] identifier[resultBasePath] , identifier[redirectValue] operator[SEP] operator[SEP]
}
Keyword[final] identifier[HttpServletRequest] identifier[request] operator[=] identifier[actionRequest] operator[SEP] identifier[getHttpServletRequest] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[HttpServletResponse] identifier[response] operator[=] identifier[actionRequest] operator[SEP] identifier[getHttpServletResponse] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[path] operator[=] identifier[beanTemplateParser] operator[SEP] identifier[parseWithBean] operator[SEP] identifier[resultPath] , identifier[actionRequest] operator[SEP] identifier[getAction] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[DispatcherUtil] operator[SEP] identifier[redirectPermanent] operator[SEP] identifier[request] , identifier[response] , identifier[path] operator[SEP] operator[SEP]
}
|
@Override
public AnnotationDefinition convert(BELAnnotationDefinition bad) {
if (bad == null) {
return null;
}
AnnotationDefinition ad = CommonModelFactory.getInstance()
.createAnnotationDefinition(bad.getName());
switch (bad.getAnnotationType()) {
case LIST:
ad.setType(AnnotationType.ENUMERATION);
ad.setEnums(bad.getList());
break;
case PATTERN:
ad.setType(AnnotationType.REGULAR_EXPRESSION);
ad.setValue(bad.getValue());
break;
case URL:
ad.setType(null);
ad.setURL(bad.getValue());
break;
default:
throw new InvalidArgument("BELAnnotationType '"
+ bad.getAnnotationType() + "' not known.");
}
return ad;
}
|
class class_name[name] begin[{]
method[convert, return_type[type[AnnotationDefinition]], modifier[public], parameter[bad]] begin[{]
if[binary_operation[member[.bad], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[AnnotationDefinition], ad]
SwitchStatement(cases=[SwitchStatementCase(case=['LIST'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ENUMERATION, postfix_operators=[], prefix_operators=[], qualifier=AnnotationType, selectors=[])], member=setType, postfix_operators=[], prefix_operators=[], qualifier=ad, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getList, postfix_operators=[], prefix_operators=[], qualifier=bad, selectors=[], type_arguments=None)], member=setEnums, postfix_operators=[], prefix_operators=[], qualifier=ad, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['PATTERN'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=REGULAR_EXPRESSION, postfix_operators=[], prefix_operators=[], qualifier=AnnotationType, selectors=[])], member=setType, postfix_operators=[], prefix_operators=[], qualifier=ad, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=bad, selectors=[], type_arguments=None)], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=ad, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['URL'], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setType, postfix_operators=[], prefix_operators=[], qualifier=ad, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=bad, selectors=[], type_arguments=None)], member=setURL, postfix_operators=[], prefix_operators=[], qualifier=ad, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BELAnnotationType '"), operandr=MethodInvocation(arguments=[], member=getAnnotationType, postfix_operators=[], prefix_operators=[], qualifier=bad, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' not known."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidArgument, sub_type=None)), label=None)])], expression=MethodInvocation(arguments=[], member=getAnnotationType, postfix_operators=[], prefix_operators=[], qualifier=bad, selectors=[], type_arguments=None), label=None)
return[member[.ad]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[AnnotationDefinition] identifier[convert] operator[SEP] identifier[BELAnnotationDefinition] identifier[bad] operator[SEP] {
Keyword[if] operator[SEP] identifier[bad] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[AnnotationDefinition] identifier[ad] operator[=] identifier[CommonModelFactory] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[createAnnotationDefinition] operator[SEP] identifier[bad] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[bad] operator[SEP] identifier[getAnnotationType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[LIST] operator[:] identifier[ad] operator[SEP] identifier[setType] operator[SEP] identifier[AnnotationType] operator[SEP] identifier[ENUMERATION] operator[SEP] operator[SEP] identifier[ad] operator[SEP] identifier[setEnums] operator[SEP] identifier[bad] operator[SEP] identifier[getList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[PATTERN] operator[:] identifier[ad] operator[SEP] identifier[setType] operator[SEP] identifier[AnnotationType] operator[SEP] identifier[REGULAR_EXPRESSION] operator[SEP] operator[SEP] identifier[ad] operator[SEP] identifier[setValue] operator[SEP] identifier[bad] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[URL] operator[:] identifier[ad] operator[SEP] identifier[setType] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[ad] operator[SEP] identifier[setURL] operator[SEP] identifier[bad] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[InvalidArgument] operator[SEP] literal[String] operator[+] identifier[bad] operator[SEP] identifier[getAnnotationType] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ad] operator[SEP]
}
|
@Override
public void onResume() {
super.onResume();
getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent keyEvent) {
return keyCode != KeyEvent.ACTION_DOWN;
}
});
}
|
class class_name[name] begin[{]
method[onResume, return_type[void], modifier[public], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=onResume, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[.getDialog, parameter[]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onResume] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[onResume] operator[SEP] operator[SEP] operator[SEP] identifier[getDialog] operator[SEP] operator[SEP] operator[SEP] identifier[setOnKeyListener] operator[SEP] Keyword[new] identifier[DialogInterface] operator[SEP] identifier[OnKeyListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[onKey] operator[SEP] identifier[DialogInterface] identifier[dialog] , Keyword[int] identifier[keyCode] , identifier[KeyEvent] identifier[keyEvent] operator[SEP] {
Keyword[return] identifier[keyCode] operator[!=] identifier[KeyEvent] operator[SEP] identifier[ACTION_DOWN] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Override
public void reset(final long mNodeKey) {
super.reset(mNodeKey);
if (mArgs != null) {
for (AbsAxis ax : mArgs) {
ax.reset(mNodeKey);
}
}
}
|
class class_name[name] begin[{]
method[reset, return_type[void], modifier[public], parameter[mNodeKey]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=mNodeKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reset, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
if[binary_operation[member[.mArgs], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mNodeKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reset, postfix_operators=[], prefix_operators=[], qualifier=ax, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=mArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ax)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AbsAxis, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[reset] operator[SEP] Keyword[final] Keyword[long] identifier[mNodeKey] operator[SEP] {
Keyword[super] operator[SEP] identifier[reset] operator[SEP] identifier[mNodeKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mArgs] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[AbsAxis] identifier[ax] operator[:] identifier[mArgs] operator[SEP] {
identifier[ax] operator[SEP] identifier[reset] operator[SEP] identifier[mNodeKey] operator[SEP] operator[SEP]
}
}
}
|
public QueueReference build(Map<String, String> params) throws IOException {
return build(params, null,false);
}
|
class class_name[name] begin[{]
method[build, return_type[type[QueueReference]], modifier[public], parameter[params]] begin[{]
return[call[.build, parameter[member[.params], literal[null], literal[false]]]]
end[}]
END[}]
|
Keyword[public] identifier[QueueReference] identifier[build] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[build] operator[SEP] identifier[params] , Other[null] , literal[boolean] operator[SEP] operator[SEP]
}
|
public List<B> getOutcomesByProbability(A first) {
if (counts.containsKey(first)) {
Map<B, Double> sortedMap = MapUtils.reverse(MapUtils.sortByValue(counts.get(first)));
return Lists.newArrayList(sortedMap.keySet());
}
return Collections.emptyList();
}
|
class class_name[name] begin[{]
method[getOutcomesByProbability, return_type[type[List]], modifier[public], parameter[first]] begin[{]
if[call[counts.containsKey, parameter[member[.first]]]] begin[{]
local_variable[type[Map], sortedMap]
return[call[Lists.newArrayList, parameter[call[sortedMap.keySet, parameter[]]]]]
else begin[{]
None
end[}]
return[call[Collections.emptyList, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[B] operator[>] identifier[getOutcomesByProbability] operator[SEP] identifier[A] identifier[first] operator[SEP] {
Keyword[if] operator[SEP] identifier[counts] operator[SEP] identifier[containsKey] operator[SEP] identifier[first] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[B] , identifier[Double] operator[>] identifier[sortedMap] operator[=] identifier[MapUtils] operator[SEP] identifier[reverse] operator[SEP] identifier[MapUtils] operator[SEP] identifier[sortByValue] operator[SEP] identifier[counts] operator[SEP] identifier[get] operator[SEP] identifier[first] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] identifier[sortedMap] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
|
@BackpressureSupport(BackpressureKind.FULL)
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Flowable<T> concatArrayEager(SingleSource<? extends T>... sources) {
return Flowable.fromArray(sources).concatMapEager(SingleInternalHelper.<T>toFlowable());
}
|
class class_name[name] begin[{]
method[concatArrayEager, return_type[type[Flowable]], modifier[public static], parameter[sources]] begin[{]
return[call[Flowable.fromArray, parameter[member[.sources]]]]
end[}]
END[}]
|
annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[FULL] operator[SEP] annotation[@] identifier[CheckReturnValue] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Flowable] operator[<] identifier[T] operator[>] identifier[concatArrayEager] operator[SEP] identifier[SingleSource] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] operator[...] identifier[sources] operator[SEP] {
Keyword[return] identifier[Flowable] operator[SEP] identifier[fromArray] operator[SEP] identifier[sources] operator[SEP] operator[SEP] identifier[concatMapEager] operator[SEP] identifier[SingleInternalHelper] operator[SEP] operator[<] identifier[T] operator[>] identifier[toFlowable] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
void delay(long alreadyElapsed) {
recorder.recordValue(alreadyElapsed);
if (distribution != null) {
long nextPermitted = Math.round(distribution.sample() * 1000000000.0);
if (nextPermitted > alreadyElapsed) {
LockSupport.parkNanos(nextPermitted - alreadyElapsed);
}
}
}
|
class class_name[name] begin[{]
method[delay, return_type[void], modifier[default], parameter[alreadyElapsed]] begin[{]
call[recorder.recordValue, parameter[member[.alreadyElapsed]]]
if[binary_operation[member[.distribution], !=, literal[null]]] begin[{]
local_variable[type[long], nextPermitted]
if[binary_operation[member[.nextPermitted], >, member[.alreadyElapsed]]] begin[{]
call[LockSupport.parkNanos, parameter[binary_operation[member[.nextPermitted], -, member[.alreadyElapsed]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[void] identifier[delay] operator[SEP] Keyword[long] identifier[alreadyElapsed] operator[SEP] {
identifier[recorder] operator[SEP] identifier[recordValue] operator[SEP] identifier[alreadyElapsed] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[distribution] operator[!=] Other[null] operator[SEP] {
Keyword[long] identifier[nextPermitted] operator[=] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[distribution] operator[SEP] identifier[sample] operator[SEP] operator[SEP] operator[*] literal[Float] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nextPermitted] operator[>] identifier[alreadyElapsed] operator[SEP] {
identifier[LockSupport] operator[SEP] identifier[parkNanos] operator[SEP] identifier[nextPermitted] operator[-] identifier[alreadyElapsed] operator[SEP] operator[SEP]
}
}
}
|
static SessionPool createPool(SpannerOptions spannerOptions, DatabaseId db, SpannerImpl spanner) {
return createPool(
spannerOptions.getSessionPoolOptions(),
((GrpcTransportOptions) spannerOptions.getTransportOptions()).getExecutorFactory(),
db,
spanner);
}
|
class class_name[name] begin[{]
method[createPool, return_type[type[SessionPool]], modifier[static], parameter[spannerOptions, db, spanner]] begin[{]
return[call[.createPool, parameter[call[spannerOptions.getSessionPoolOptions, parameter[]], Cast(expression=MethodInvocation(arguments=[], member=getTransportOptions, postfix_operators=[], prefix_operators=[], qualifier=spannerOptions, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=GrpcTransportOptions, sub_type=None)), member[.db], member[.spanner]]]]
end[}]
END[}]
|
Keyword[static] identifier[SessionPool] identifier[createPool] operator[SEP] identifier[SpannerOptions] identifier[spannerOptions] , identifier[DatabaseId] identifier[db] , identifier[SpannerImpl] identifier[spanner] operator[SEP] {
Keyword[return] identifier[createPool] operator[SEP] identifier[spannerOptions] operator[SEP] identifier[getSessionPoolOptions] operator[SEP] operator[SEP] , operator[SEP] operator[SEP] identifier[GrpcTransportOptions] operator[SEP] identifier[spannerOptions] operator[SEP] identifier[getTransportOptions] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getExecutorFactory] operator[SEP] operator[SEP] , identifier[db] , identifier[spanner] operator[SEP] operator[SEP]
}
|
private int binaryFirstSearch() {
int low = 0;
int high = count;
int mid = 0;
int compare = 0;
int found = count;
while (low < high) {
mid = (low + high) / 2;
compare = compare(mid);
if (compare < 0) {
high = mid;
} else if (compare > 0) {
low = mid + 1;
} else {
high = mid;
found = mid;
}
}
return found == count ? -1
: found;
}
|
class class_name[name] begin[{]
method[binaryFirstSearch, return_type[type[int]], modifier[private], parameter[]] begin[{]
local_variable[type[int], low]
local_variable[type[int], high]
local_variable[type[int], mid]
local_variable[type[int], compare]
local_variable[type[int], found]
while[binary_operation[member[.low], <, member[.high]]] begin[{]
assign[member[.mid], binary_operation[binary_operation[member[.low], +, member[.high]], /, literal[2]]]
assign[member[.compare], call[.compare, parameter[member[.mid]]]]
if[binary_operation[member[.compare], <, literal[0]]] begin[{]
assign[member[.high], member[.mid]]
else begin[{]
if[binary_operation[member[.compare], >, literal[0]]] begin[{]
assign[member[.low], binary_operation[member[.mid], +, literal[1]]]
else begin[{]
assign[member[.high], member[.mid]]
assign[member[.found], member[.mid]]
end[}]
end[}]
end[}]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=found, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), if_false=MemberReference(member=found, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1))]
end[}]
END[}]
|
Keyword[private] Keyword[int] identifier[binaryFirstSearch] operator[SEP] operator[SEP] {
Keyword[int] identifier[low] operator[=] Other[0] operator[SEP] Keyword[int] identifier[high] operator[=] identifier[count] operator[SEP] Keyword[int] identifier[mid] operator[=] Other[0] operator[SEP] Keyword[int] identifier[compare] operator[=] Other[0] operator[SEP] Keyword[int] identifier[found] operator[=] identifier[count] operator[SEP] Keyword[while] operator[SEP] identifier[low] operator[<] identifier[high] operator[SEP] {
identifier[mid] operator[=] operator[SEP] identifier[low] operator[+] identifier[high] operator[SEP] operator[/] Other[2] operator[SEP] identifier[compare] operator[=] identifier[compare] operator[SEP] identifier[mid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[compare] operator[<] Other[0] operator[SEP] {
identifier[high] operator[=] identifier[mid] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[compare] operator[>] Other[0] operator[SEP] {
identifier[low] operator[=] identifier[mid] operator[+] Other[1] operator[SEP]
}
Keyword[else] {
identifier[high] operator[=] identifier[mid] operator[SEP] identifier[found] operator[=] identifier[mid] operator[SEP]
}
}
Keyword[return] identifier[found] operator[==] identifier[count] operator[?] operator[-] Other[1] operator[:] identifier[found] operator[SEP]
}
|
public void serviceName_transferCredits_POST(String serviceName, Double credits, String smsAccountTarget) throws IOException {
String qPath = "/sms/{serviceName}/transferCredits";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "credits", credits);
addBody(o, "smsAccountTarget", smsAccountTarget);
exec(qPath, "POST", sb.toString(), o);
}
|
class class_name[name] begin[{]
method[serviceName_transferCredits_POST, return_type[void], modifier[public], parameter[serviceName, credits, smsAccountTarget]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[HashMap], o]
call[.addBody, parameter[member[.o], literal["credits"], member[.credits]]]
call[.addBody, parameter[member[.o], literal["smsAccountTarget"], member[.smsAccountTarget]]]
call[.exec, parameter[member[.qPath], literal["POST"], call[sb.toString, parameter[]], member[.o]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[serviceName_transferCredits_POST] operator[SEP] identifier[String] identifier[serviceName] , identifier[Double] identifier[credits] , identifier[String] identifier[smsAccountTarget] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[serviceName] operator[SEP] operator[SEP] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[o] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[credits] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[smsAccountTarget] operator[SEP] operator[SEP] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[o] operator[SEP] operator[SEP]
}
|
private static int toWidth(int style) {
switch (style) {
case Calendar.SHORT_FORMAT:
case Calendar.SHORT_STANDALONE:
return DateFormatSymbols.ABBREVIATED;
case Calendar.NARROW_FORMAT:
case Calendar.NARROW_STANDALONE:
return DateFormatSymbols.NARROW;
case Calendar.LONG_FORMAT:
case Calendar.LONG_STANDALONE:
return DateFormatSymbols.WIDE;
default:
throw new IllegalArgumentException("Invalid style: " + style);
}
}
|
class class_name[name] begin[{]
method[toWidth, return_type[type[int]], modifier[private static], parameter[style]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=SHORT_FORMAT, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MemberReference(member=SHORT_STANDALONE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[ReturnStatement(expression=MemberReference(member=ABBREVIATED, postfix_operators=[], prefix_operators=[], qualifier=DateFormatSymbols, selectors=[]), label=None)]), SwitchStatementCase(case=[MemberReference(member=NARROW_FORMAT, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MemberReference(member=NARROW_STANDALONE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[ReturnStatement(expression=MemberReference(member=NARROW, postfix_operators=[], prefix_operators=[], qualifier=DateFormatSymbols, selectors=[]), label=None)]), SwitchStatementCase(case=[MemberReference(member=LONG_FORMAT, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[]), MemberReference(member=LONG_STANDALONE, postfix_operators=[], prefix_operators=[], qualifier=Calendar, selectors=[])], statements=[ReturnStatement(expression=MemberReference(member=WIDE, postfix_operators=[], prefix_operators=[], qualifier=DateFormatSymbols, selectors=[]), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid style: "), operandr=MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)])], expression=MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[int] identifier[toWidth] operator[SEP] Keyword[int] identifier[style] operator[SEP] {
Keyword[switch] operator[SEP] identifier[style] operator[SEP] {
Keyword[case] identifier[Calendar] operator[SEP] identifier[SHORT_FORMAT] operator[:] Keyword[case] identifier[Calendar] operator[SEP] identifier[SHORT_STANDALONE] operator[:] Keyword[return] identifier[DateFormatSymbols] operator[SEP] identifier[ABBREVIATED] operator[SEP] Keyword[case] identifier[Calendar] operator[SEP] identifier[NARROW_FORMAT] operator[:] Keyword[case] identifier[Calendar] operator[SEP] identifier[NARROW_STANDALONE] operator[:] Keyword[return] identifier[DateFormatSymbols] operator[SEP] identifier[NARROW] operator[SEP] Keyword[case] identifier[Calendar] operator[SEP] identifier[LONG_FORMAT] operator[:] Keyword[case] identifier[Calendar] operator[SEP] identifier[LONG_STANDALONE] operator[:] Keyword[return] identifier[DateFormatSymbols] operator[SEP] identifier[WIDE] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[style] operator[SEP] operator[SEP]
}
}
|
@Override
public AddTagsResult addTags(AddTagsRequest request) {
request = beforeClientExecution(request);
return executeAddTags(request);
}
|
class class_name[name] begin[{]
method[addTags, return_type[type[AddTagsResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeAddTags, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[AddTagsResult] identifier[addTags] operator[SEP] identifier[AddTagsRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeAddTags] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public void removeActiveMessages(int messageCount)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "removeActiveMessages", Integer.valueOf(messageCount));
boolean resumeConsumers = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "maxActiveMessagePrepareReadLock.lock(): " + maxActiveMessagePrepareLock);
// Take a read lock on the prepare to ensure the set isn't in the process
// of suspending itself.
maxActiveMessagePrepareReadLock.lock();
try
{
// Lock down the active message count
synchronized(maxActiveMessageLock)
{
// Decrement the count
currentActiveMessages -= messageCount;
// We should never go negative, if we do something has gone wrong - FFDC
if(currentActiveMessages < 0)
{
SIErrorException e = new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.JSConsumerSet.removeActiveMessages",
"1:677:1.16",
Integer.valueOf(preparedActiveMessages),
Integer.valueOf(currentActiveMessages),
Integer.valueOf(maxActiveMessages),
Boolean.valueOf(consumerSetSuspended)
},
null));
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.JSConsumerSet.removeActiveMessages",
"1:688:1.16",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.JSConsumerSet.removeActiveMessages",
"1:695:1.16" });
}
// If the set is currently suspended then we'll check to see if
// we've fallen below the threashold
if(consumerSetSuspended)
{
// The threashold that we resume a set is potentially a few messages
// below the max, so we don't constantly switch from suspended to resumed
if(currentActiveMessages == (resumeThreshold - messageCount))
{
// Reset the consumerSet flag to make any inquiring consumers aware
// of the current state.
consumerSetSuspended = false;
// Now we need to resume any currently suspended consumers. We can't
// do this while we hold the maxActiveMessageLock as the resume will
// need to take the LCP lock for each consumer. Instead we release
// this lock and perform the resume under the consumerList lock to
// prevent the list changing. We're also reliant on each consumer being
// resumed re-checking with us that we're still resumed (as we no
// longer hold the maxActiveMessageLock at the time of the resume - so
// some other consumer could have got in and caused us to suspend again)
resumeConsumers = true;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Active Messages: current: " + currentActiveMessages +
", prepared: " + preparedActiveMessages +
", maximum: " + maxActiveMessages +
" (suspended: " + consumerSetSuspended + ")");
} // synchronized
}
finally
{
// Release the read lock
maxActiveMessagePrepareReadLock.unlock();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "maxActiveMessagePrepareReadLock.unlock(): " + maxActiveMessagePrepareLock);
}
// Now we've release the lock, resume the consumers if needed
if(resumeConsumers)
resumeConsumers();
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "removeActiveMessages");
}
|
class class_name[name] begin[{]
method[removeActiveMessages, return_type[void], modifier[public], parameter[messageCount]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["removeActiveMessages"], call[Integer.valueOf, parameter[member[.messageCount]]]]]
else begin[{]
None
end[}]
local_variable[type[boolean], resumeConsumers]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[SibTr.debug, parameter[member[.tc], binary_operation[literal["maxActiveMessagePrepareReadLock.lock(): "], +, member[.maxActiveMessagePrepareLock]]]]
else begin[{]
None
end[}]
call[maxActiveMessagePrepareReadLock.lock, parameter[]]
TryStatement(block=[SynchronizedStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=-=, value=MemberReference(member=messageCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=currentActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTERNAL_MESSAGING_ERROR_CWSIP0001"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.JSConsumerSet.removeActiveMessages"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:677:1.16"), MethodInvocation(arguments=[MemberReference(member=preparedActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=currentActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=maxActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=consumerSetSuspended, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=nls, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SIErrorException, sub_type=None)), name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SIErrorException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.JSConsumerSet.removeActiveMessages"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:688:1.16"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTERNAL_MESSAGING_ERROR_CWSIP0001"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.JSConsumerSet.removeActiveMessages"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:695:1.16")]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=error, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MemberReference(member=consumerSetSuspended, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=currentActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=resumeThreshold, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=messageCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=consumerSetSuspended, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=resumeConsumers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Active Messages: current: "), operandr=MemberReference(member=currentActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", prepared: "), operator=+), operandr=MemberReference(member=preparedActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", maximum: "), operator=+), operandr=MemberReference(member=maxActiveMessages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" (suspended: "), operator=+), operandr=MemberReference(member=consumerSetSuspended, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None))], label=None, lock=MemberReference(member=maxActiveMessageLock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=maxActiveMessagePrepareReadLock, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="maxActiveMessagePrepareReadLock.unlock(): "), operandr=MemberReference(member=maxActiveMessagePrepareLock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None))], label=None, resources=None)
if[member[.resumeConsumers]] begin[{]
call[.resumeConsumers, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["removeActiveMessages"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[removeActiveMessages] operator[SEP] Keyword[int] identifier[messageCount] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[messageCount] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[resumeConsumers] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[maxActiveMessagePrepareLock] operator[SEP] operator[SEP] identifier[maxActiveMessagePrepareReadLock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[synchronized] operator[SEP] identifier[maxActiveMessageLock] operator[SEP] {
identifier[currentActiveMessages] operator[-=] identifier[messageCount] operator[SEP] Keyword[if] operator[SEP] identifier[currentActiveMessages] operator[<] Other[0] operator[SEP] {
identifier[SIErrorException] identifier[e] operator[=] Keyword[new] identifier[SIErrorException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , literal[String] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[preparedActiveMessages] operator[SEP] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[currentActiveMessages] operator[SEP] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[maxActiveMessages] operator[SEP] , identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[consumerSetSuspended] operator[SEP]
} , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[consumerSetSuspended] operator[SEP] {
Keyword[if] operator[SEP] identifier[currentActiveMessages] operator[==] operator[SEP] identifier[resumeThreshold] operator[-] identifier[messageCount] operator[SEP] operator[SEP] {
identifier[consumerSetSuspended] operator[=] literal[boolean] operator[SEP] identifier[resumeConsumers] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[currentActiveMessages] operator[+] literal[String] operator[+] identifier[preparedActiveMessages] operator[+] literal[String] operator[+] identifier[maxActiveMessages] operator[+] literal[String] operator[+] identifier[consumerSetSuspended] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[maxActiveMessagePrepareReadLock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[maxActiveMessagePrepareLock] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[resumeConsumers] operator[SEP] identifier[resumeConsumers] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({ "unchecked", "rawtypes" })
public void activate() throws InvalidStateException {
if (!this.state.isInactive()) {
throw new InvalidStateException("entity " + name + " is in state: "
+ this.state);
}
this.state = ResourceAdaptorEntityState.ACTIVE;
// if slee is running then activate ra object
if (sleeContainer.getSleeState() == SleeState.RUNNING) {
if (setFTContext) {
setFTContext = false;
if (object.isFaultTolerant()) {
// set fault tolerant context, it is a ft ra
try {
this.ftResourceAdaptorContext = new FaultTolerantResourceAdaptorContextImpl(name,sleeContainer,(FaultTolerantResourceAdaptor) object.getResourceAdaptorObject());
object.setFaultTolerantResourceAdaptorContext(ftResourceAdaptorContext);
}
catch (Throwable t) {
logger.error("Got exception invoking setFaultTolerantResourceAdaptorContext(...) for entity "+name, t);
}
}
}
try {
object.raActive();
}
catch (Throwable t) {
logger.error("Got exception invoking raActive() for entity "+name, t);
}
}
}
|
class class_name[name] begin[{]
method[activate, return_type[void], modifier[public], parameter[]] begin[{]
if[THIS[member[None.state]call[None.isInactive, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="entity "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is in state: "), operator=+), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=state, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[THIS[member[None.state]], member[ResourceAdaptorEntityState.ACTIVE]]
if[binary_operation[call[sleeContainer.getSleeState, parameter[]], ==, member[SleeState.RUNNING]]] begin[{]
if[member[.setFTContext]] begin[{]
assign[member[.setFTContext], literal[false]]
if[call[object.isFaultTolerant, parameter[]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ftResourceAdaptorContext, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sleeContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=MethodInvocation(arguments=[], member=getResourceAdaptorObject, postfix_operators=[], prefix_operators=[], qualifier=object, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FaultTolerantResourceAdaptor, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FaultTolerantResourceAdaptorContextImpl, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ftResourceAdaptorContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setFaultTolerantResourceAdaptorContext, postfix_operators=[], prefix_operators=[], qualifier=object, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Got exception invoking setFaultTolerantResourceAdaptorContext(...) for entity "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=raActive, postfix_operators=[], prefix_operators=[], qualifier=object, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Got exception invoking raActive() for entity "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] Keyword[public] Keyword[void] identifier[activate] operator[SEP] operator[SEP] Keyword[throws] identifier[InvalidStateException] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[state] operator[SEP] identifier[isInactive] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidStateException] operator[SEP] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[state] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[state] operator[=] identifier[ResourceAdaptorEntityState] operator[SEP] identifier[ACTIVE] operator[SEP] Keyword[if] operator[SEP] identifier[sleeContainer] operator[SEP] identifier[getSleeState] operator[SEP] operator[SEP] operator[==] identifier[SleeState] operator[SEP] identifier[RUNNING] operator[SEP] {
Keyword[if] operator[SEP] identifier[setFTContext] operator[SEP] {
identifier[setFTContext] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[object] operator[SEP] identifier[isFaultTolerant] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[ftResourceAdaptorContext] operator[=] Keyword[new] identifier[FaultTolerantResourceAdaptorContextImpl] operator[SEP] identifier[name] , identifier[sleeContainer] , operator[SEP] identifier[FaultTolerantResourceAdaptor] operator[SEP] identifier[object] operator[SEP] identifier[getResourceAdaptorObject] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[object] operator[SEP] identifier[setFaultTolerantResourceAdaptorContext] operator[SEP] identifier[ftResourceAdaptorContext] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[name] , identifier[t] operator[SEP] operator[SEP]
}
}
}
Keyword[try] {
identifier[object] operator[SEP] identifier[raActive] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[name] , identifier[t] operator[SEP] operator[SEP]
}
}
}
|
public static String changeFormatAndTimeZoneToDefaultUtcFormat(
String dateFormat, String zoneId, String dateString) {
return JMOptional.getOptional(zoneId)
.map(zId -> getTimeAsDefaultUtcFormat(
changeTimestampToLong(dateFormat,
dateString, zoneId)))
.orElseGet(() -> changeFormatAndTimeZoneToDefaultUtcFormat(
dateFormat, dateString));
}
|
class class_name[name] begin[{]
method[changeFormatAndTimeZoneToDefaultUtcFormat, return_type[type[String]], modifier[public static], parameter[dateFormat, zoneId, dateString]] begin[{]
return[call[JMOptional.getOptional, parameter[member[.zoneId]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[changeFormatAndTimeZoneToDefaultUtcFormat] operator[SEP] identifier[String] identifier[dateFormat] , identifier[String] identifier[zoneId] , identifier[String] identifier[dateString] operator[SEP] {
Keyword[return] identifier[JMOptional] operator[SEP] identifier[getOptional] operator[SEP] identifier[zoneId] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[zId] operator[->] identifier[getTimeAsDefaultUtcFormat] operator[SEP] identifier[changeTimestampToLong] operator[SEP] identifier[dateFormat] , identifier[dateString] , identifier[zoneId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[orElseGet] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[changeFormatAndTimeZoneToDefaultUtcFormat] operator[SEP] identifier[dateFormat] , identifier[dateString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static File getParent(File file, int level) {
if (level < 1 || null == file) {
return file;
}
File parentFile;
try {
parentFile = file.getCanonicalFile().getParentFile();
} catch (IOException e) {
throw new IORuntimeException(e);
}
if (1 == level) {
return parentFile;
}
return getParent(parentFile, level - 1);
}
|
class class_name[name] begin[{]
method[getParent, return_type[type[File]], modifier[public static], parameter[file, level]] begin[{]
if[binary_operation[binary_operation[member[.level], <, literal[1]], ||, binary_operation[literal[null], ==, member[.file]]]] begin[{]
return[member[.file]]
else begin[{]
None
end[}]
local_variable[type[File], parentFile]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=parentFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getCanonicalFile, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[MethodInvocation(arguments=[], member=getParentFile, 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=[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=IORuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
if[binary_operation[literal[1], ==, member[.level]]] begin[{]
return[member[.parentFile]]
else begin[{]
None
end[}]
return[call[.getParent, parameter[member[.parentFile], binary_operation[member[.level], -, literal[1]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[File] identifier[getParent] operator[SEP] identifier[File] identifier[file] , Keyword[int] identifier[level] operator[SEP] {
Keyword[if] operator[SEP] identifier[level] operator[<] Other[1] operator[||] Other[null] operator[==] identifier[file] operator[SEP] {
Keyword[return] identifier[file] operator[SEP]
}
identifier[File] identifier[parentFile] operator[SEP] Keyword[try] {
identifier[parentFile] operator[=] identifier[file] operator[SEP] identifier[getCanonicalFile] operator[SEP] operator[SEP] operator[SEP] identifier[getParentFile] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IORuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Other[1] operator[==] identifier[level] operator[SEP] {
Keyword[return] identifier[parentFile] operator[SEP]
}
Keyword[return] identifier[getParent] operator[SEP] identifier[parentFile] , identifier[level] operator[-] Other[1] operator[SEP] operator[SEP]
}
|
protected EClient<HttpURLConnection> client() throws CadiException {
try {
if(uri==null) {
Item item = hman.loc.best();
if(item==null) {
throw new CadiException("No service available for " + hman.loc.toString());
}
uri = hman.loc.get(item);
}
return new HClient(ss,uri,connectionTimeout);
} catch (Exception e) {
throw new CadiException(e);
}
}
|
class class_name[name] begin[{]
method[client, return_type[type[EClient]], modifier[protected], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=uri, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=best, postfix_operators=[], prefix_operators=[], qualifier=hman.loc, selectors=[], type_arguments=None), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Item, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=item, 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="No service available for "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=hman.loc, 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=CadiException, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=hman.loc, selectors=[], type_arguments=None)), label=None)])), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=ss, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=connectionTimeout, 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=HClient, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CadiException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] identifier[EClient] operator[<] identifier[HttpURLConnection] operator[>] identifier[client] operator[SEP] operator[SEP] Keyword[throws] identifier[CadiException] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[uri] operator[==] Other[null] operator[SEP] {
identifier[Item] identifier[item] operator[=] identifier[hman] operator[SEP] identifier[loc] operator[SEP] identifier[best] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[item] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CadiException] operator[SEP] literal[String] operator[+] identifier[hman] operator[SEP] identifier[loc] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[uri] operator[=] identifier[hman] operator[SEP] identifier[loc] operator[SEP] identifier[get] operator[SEP] identifier[item] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[HClient] operator[SEP] identifier[ss] , identifier[uri] , identifier[connectionTimeout] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CadiException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public void setLoadPermissions(java.util.Collection<LoadPermission> loadPermissions) {
if (loadPermissions == null) {
this.loadPermissions = null;
return;
}
this.loadPermissions = new com.amazonaws.internal.SdkInternalList<LoadPermission>(loadPermissions);
}
|
class class_name[name] begin[{]
method[setLoadPermissions, return_type[void], modifier[public], parameter[loadPermissions]] begin[{]
if[binary_operation[member[.loadPermissions], ==, literal[null]]] begin[{]
assign[THIS[member[None.loadPermissions]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.loadPermissions]], ClassCreator(arguments=[MemberReference(member=loadPermissions, 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=LoadPermission, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setLoadPermissions] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[LoadPermission] operator[>] identifier[loadPermissions] operator[SEP] {
Keyword[if] operator[SEP] identifier[loadPermissions] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[loadPermissions] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[loadPermissions] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[LoadPermission] operator[>] operator[SEP] identifier[loadPermissions] operator[SEP] operator[SEP]
}
|
private boolean containsPlaceholders( final KojiArchiveInfo archive )
{
return contains( trimToEmpty( archive.getArtifactId() ), "${" )
|| contains( trimToEmpty( archive.getGroupId() ), "${" )
|| contains( trimToEmpty( archive.getVersion() ), "${" );
}
|
class class_name[name] begin[{]
method[containsPlaceholders, return_type[type[boolean]], modifier[private], parameter[archive]] begin[{]
return[binary_operation[binary_operation[call[.contains, parameter[call[.trimToEmpty, parameter[call[archive.getArtifactId, parameter[]]]], literal["${"]]], ||, call[.contains, parameter[call[.trimToEmpty, parameter[call[archive.getGroupId, parameter[]]]], literal["${"]]]], ||, call[.contains, parameter[call[.trimToEmpty, parameter[call[archive.getVersion, parameter[]]]], literal["${"]]]]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[containsPlaceholders] operator[SEP] Keyword[final] identifier[KojiArchiveInfo] identifier[archive] operator[SEP] {
Keyword[return] identifier[contains] operator[SEP] identifier[trimToEmpty] operator[SEP] identifier[archive] operator[SEP] identifier[getArtifactId] operator[SEP] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[||] identifier[contains] operator[SEP] identifier[trimToEmpty] operator[SEP] identifier[archive] operator[SEP] identifier[getGroupId] operator[SEP] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[||] identifier[contains] operator[SEP] identifier[trimToEmpty] operator[SEP] identifier[archive] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
|
private List<String> findMatchesWithLowestScore(final List<ScoredHost> scored) {
final int minScore = scored.get(0).score;
final ImmutableList.Builder<String> minScoreHosts = ImmutableList.builder();
for (final ScoredHost score : scored) {
if (score.score == minScore) {
minScoreHosts.add(score.host);
}
}
return minScoreHosts.build();
}
|
class class_name[name] begin[{]
method[findMatchesWithLowestScore, return_type[type[List]], modifier[private], parameter[scored]] begin[{]
local_variable[type[int], minScore]
local_variable[type[ImmutableList], minScoreHosts]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=score, postfix_operators=[], prefix_operators=[], qualifier=score, selectors=[]), operandr=MemberReference(member=minScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=score, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=minScoreHosts, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=scored, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=score)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ScoredHost, sub_type=None))), label=None)
return[call[minScoreHosts.build, parameter[]]]
end[}]
END[}]
|
Keyword[private] identifier[List] operator[<] identifier[String] operator[>] identifier[findMatchesWithLowestScore] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[ScoredHost] operator[>] identifier[scored] operator[SEP] {
Keyword[final] Keyword[int] identifier[minScore] operator[=] identifier[scored] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[score] operator[SEP] Keyword[final] identifier[ImmutableList] operator[SEP] identifier[Builder] operator[<] identifier[String] operator[>] identifier[minScoreHosts] operator[=] identifier[ImmutableList] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[ScoredHost] identifier[score] operator[:] identifier[scored] operator[SEP] {
Keyword[if] operator[SEP] identifier[score] operator[SEP] identifier[score] operator[==] identifier[minScore] operator[SEP] {
identifier[minScoreHosts] operator[SEP] identifier[add] operator[SEP] identifier[score] operator[SEP] identifier[host] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[minScoreHosts] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public static MutableTreeNode leftShift(MutableTreeNode self, MutableTreeNode node) {
self.insert(node, self.getChildCount());
return self;
}
|
class class_name[name] begin[{]
method[leftShift, return_type[type[MutableTreeNode]], modifier[public static], parameter[self, node]] begin[{]
call[self.insert, parameter[member[.node], call[self.getChildCount, parameter[]]]]
return[member[.self]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[MutableTreeNode] identifier[leftShift] operator[SEP] identifier[MutableTreeNode] identifier[self] , identifier[MutableTreeNode] identifier[node] operator[SEP] {
identifier[self] operator[SEP] identifier[insert] operator[SEP] identifier[node] , identifier[self] operator[SEP] identifier[getChildCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[self] operator[SEP]
}
|
@SuppressFBWarnings("PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS")
public void initServiceRegistryIfNecessary() {
val size = this.serviceRegistry.size();
LOGGER.trace("Service registry contains [{}] service definition(s)", size);
LOGGER.warn("Service registry [{}] will be auto-initialized from JSON service definitions. "
+ "This behavior is only useful for testing purposes and MAY NOT be appropriate for production. "
+ "Consider turning off this behavior via the setting [cas.serviceRegistry.initFromJson=false] "
+ "and explicitly register definitions in the services registry.", this.serviceRegistry.getName());
val servicesLoaded = this.jsonServiceRegistry.load();
LOGGER.debug("Loaded JSON services are [{}]", servicesLoaded.stream().map(RegisteredService::getName).collect(Collectors.joining(",")));
servicesLoaded
.forEach(r -> {
if (!findExistingMatchForService(r)) {
LOGGER.debug("Initializing service registry with the [{}] JSON service definition...", r.getName());
this.serviceRegistry.save(r);
}
});
this.servicesManager.load();
LOGGER.info("Service registry [{}] contains [{}] service definitions", this.serviceRegistry.getName(), this.servicesManager.count());
}
|
class class_name[name] begin[{]
method[initServiceRegistryIfNecessary, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[val], size]
call[LOGGER.trace, parameter[literal["Service registry contains [{}] service definition(s)"], member[.size]]]
call[LOGGER.warn, parameter[binary_operation[binary_operation[binary_operation[literal["Service registry [{}] will be auto-initialized from JSON service definitions. "], +, literal["This behavior is only useful for testing purposes and MAY NOT be appropriate for production. "]], +, literal["Consider turning off this behavior via the setting [cas.serviceRegistry.initFromJson=false] "]], +, literal["and explicitly register definitions in the services registry."]], THIS[member[None.serviceRegistry]call[None.getName, parameter[]]]]]
local_variable[type[val], servicesLoaded]
call[LOGGER.debug, parameter[literal["Loaded JSON services are [{}]"], call[servicesLoaded.stream, parameter[]]]]
call[servicesLoaded.forEach, parameter[LambdaExpression(body=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findExistingMatchForService, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Initializing service registry with the [{}] JSON service definition..."), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=serviceRegistry, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=save, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]))], parameters=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
THIS[member[None.servicesManager]call[None.load, parameter[]]]
call[LOGGER.info, parameter[literal["Service registry [{}] contains [{}] service definitions"], THIS[member[None.serviceRegistry]call[None.getName, parameter[]]], THIS[member[None.servicesManager]call[None.count, parameter[]]]]]
end[}]
END[}]
|
annotation[@] identifier[SuppressFBWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[initServiceRegistryIfNecessary] operator[SEP] operator[SEP] {
identifier[val] identifier[size] operator[=] Keyword[this] operator[SEP] identifier[serviceRegistry] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[size] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] , Keyword[this] operator[SEP] identifier[serviceRegistry] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[val] identifier[servicesLoaded] operator[=] Keyword[this] operator[SEP] identifier[jsonServiceRegistry] operator[SEP] identifier[load] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[servicesLoaded] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[RegisteredService] operator[::] identifier[getName] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[joining] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[servicesLoaded] operator[SEP] identifier[forEach] operator[SEP] identifier[r] operator[->] {
Keyword[if] operator[SEP] operator[!] identifier[findExistingMatchForService] operator[SEP] identifier[r] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[r] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[serviceRegistry] operator[SEP] identifier[save] operator[SEP] identifier[r] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[servicesManager] operator[SEP] identifier[load] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[serviceRegistry] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[servicesManager] operator[SEP] identifier[count] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public String principal() {
if (getSubject() != null) {
// Get the principal to print out
Object principal = getSubject().getPrincipal();
return principal.toString();
}
return "Guest";
}
|
class class_name[name] begin[{]
method[principal, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[.getSubject, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[Object], principal]
return[call[principal.toString, parameter[]]]
else begin[{]
None
end[}]
return[literal["Guest"]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[principal] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[getSubject] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[Object] identifier[principal] operator[=] identifier[getSubject] operator[SEP] operator[SEP] operator[SEP] identifier[getPrincipal] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[principal] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[String] operator[SEP]
}
|
public static Pattern newMustacheTagPattern(Configuration configuration) {
StringBuilder regex = new StringBuilder();
regex.append(Pattern.quote(configuration
.getStringPropertyValue(EngineConfigurationKey.START_DELIMITER)));
regex.append(".*?");
regex.append(Pattern.quote(configuration
.getStringPropertyValue(EngineConfigurationKey.END_DELIMITER)));
return Pattern.compile(regex.toString());
}
|
class class_name[name] begin[{]
method[newMustacheTagPattern, return_type[type[Pattern]], modifier[public static], parameter[configuration]] begin[{]
local_variable[type[StringBuilder], regex]
call[regex.append, parameter[call[Pattern.quote, parameter[call[configuration.getStringPropertyValue, parameter[member[EngineConfigurationKey.START_DELIMITER]]]]]]]
call[regex.append, parameter[literal[".*?"]]]
call[regex.append, parameter[call[Pattern.quote, parameter[call[configuration.getStringPropertyValue, parameter[member[EngineConfigurationKey.END_DELIMITER]]]]]]]
return[call[Pattern.compile, parameter[call[regex.toString, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Pattern] identifier[newMustacheTagPattern] operator[SEP] identifier[Configuration] identifier[configuration] operator[SEP] {
identifier[StringBuilder] identifier[regex] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[regex] operator[SEP] identifier[append] operator[SEP] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] identifier[configuration] operator[SEP] identifier[getStringPropertyValue] operator[SEP] identifier[EngineConfigurationKey] operator[SEP] identifier[START_DELIMITER] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[regex] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[regex] operator[SEP] identifier[append] operator[SEP] identifier[Pattern] operator[SEP] identifier[quote] operator[SEP] identifier[configuration] operator[SEP] identifier[getStringPropertyValue] operator[SEP] identifier[EngineConfigurationKey] operator[SEP] identifier[END_DELIMITER] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] identifier[regex] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void write(byte[] b, int off, int len) throws IOException
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"write", "Writing");
}
if (_observer != null)
_observer.alertFirstWrite();
_conn.write(b, off, len);
}
|
class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[b, off, len]] begin[{]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[logger.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[logger.logp, parameter[member[Level.FINE], member[.CLASS_NAME], literal["write"], literal["Writing"]]]
else begin[{]
None
end[}]
if[binary_operation[member[._observer], !=, literal[null]]] begin[{]
call[_observer.alertFirstWrite, parameter[]]
else begin[{]
None
end[}]
call[_conn.write, parameter[member[.b], member[.off], member[.len]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[write] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[b] , Keyword[int] identifier[off] , Keyword[int] identifier[len] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[_observer] operator[!=] Other[null] operator[SEP] identifier[_observer] operator[SEP] identifier[alertFirstWrite] operator[SEP] operator[SEP] operator[SEP] identifier[_conn] operator[SEP] identifier[write] operator[SEP] identifier[b] , identifier[off] , identifier[len] operator[SEP] operator[SEP]
}
|
@Override
public void run() // F73234
{
synchronized (this) // d601399
{
if (ivIsCanceled) // d583637
{
//if this instance has been canceled, we do no more processing.
// this also guarantees that a future alarm is not created.
return;
}
ivIsRunning = true; // F743-33394
}
try {
// Go through the list of beans and check to see if any of
// them needs to be removed
sweep();
} catch (Exception e) {
FFDCFilter.processException(e, CLASS_NAME + ".alarm", "226", this);
Tr.warning(tc, "UNEXPECTED_EXCEPTION_DURING_STATEFUL_BEAN_CLEANUP_CNTR0015W",
new Object[] { this, e }); //p111002.5
} finally {
synchronized (this) {
ivIsRunning = false; // F743-33394
if (ivIsCanceled) {
// The reaper was canceled while we were sweeping. Notify
// the canceling thread that we're done.
notify();
} else if (numObjects != 0) {
startAlarm(); // F743-33394
} else {
ivScheduledFuture = null; // F73234
}
}
}
}
|
class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[]] begin[{]
SYNCHRONIZED[THIS[]] BEGIN[{]
if[member[.ivIsCanceled]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[.ivIsRunning], literal[true]]
END[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=sweep, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".alarm"), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="226"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UNEXPECTED_EXCEPTION_DURING_STATEFUL_BEAN_CLEANUP_CNTR0015W"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=warning, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[SynchronizedStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ivIsRunning, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), IfStatement(condition=MemberReference(member=ivIsCanceled, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=numObjects, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ivScheduledFuture, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=startAlarm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=notify, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], label=None, lock=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]))], label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] identifier[ivIsCanceled] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[ivIsRunning] operator[=] literal[boolean] operator[SEP]
}
Keyword[try] {
identifier[sweep] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , identifier[CLASS_NAME] operator[+] literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
Keyword[this] , identifier[e]
} operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
identifier[ivIsRunning] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[ivIsCanceled] operator[SEP] {
identifier[notify] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[numObjects] operator[!=] Other[0] operator[SEP] {
identifier[startAlarm] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ivScheduledFuture] operator[=] Other[null] operator[SEP]
}
}
}
}
|
public static Field getField(String fieldName, Object object) {
return getField(fieldName, object.getClass());
}
|
class class_name[name] begin[{]
method[getField, return_type[type[Field]], modifier[public static], parameter[fieldName, object]] begin[{]
return[call[.getField, parameter[member[.fieldName], call[object.getClass, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Field] identifier[getField] operator[SEP] identifier[String] identifier[fieldName] , identifier[Object] identifier[object] operator[SEP] {
Keyword[return] identifier[getField] operator[SEP] identifier[fieldName] , identifier[object] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static int pitch_fr3( /* output: integer part of pitch period */
float exc[],int excs, /* input : excitation buffer */
float xn[],int xns, /* input : target vector */
float h[], int hs, /* input : impulse response of filters. */
int l_subfr, /* input : Length of frame to compute pitch */
int t0_min, /* input : minimum value in the searched range */
int t0_max, /* input : maximum value in the searched range */
int i_subfr, /* input : indicator for first subframe */
IntegerPointer pit_frac /* output: chosen fraction */
)
{
int i, frac;
int lag, t_min, t_max;
float max;
float corr_int;
float corr_v[] = new float[10+2*LD8KConstants.L_INTER4]; /* size: 2*L_INTER4+t0_max-t0_min+1 */
int corr;
/* Find interval to compute normalized correlation */
t_min = t0_min - LD8KConstants.L_INTER4;
t_max = t0_max + LD8KConstants.L_INTER4;
corr = -t_min; /* corr[t_min:t_max] */
/* Compute normalized correlation between target and filtered excitation */
norm_corr(exc, excs, xn, xns, h, hs, l_subfr, t_min, t_max, corr_v, corr);
/* find integer pitch */
max = corr_v[corr+t0_min];
lag = t0_min;
for(i= t0_min+1; i<=t0_max; i++)
{
if( corr_v[corr+i] >= max)
{
max = corr_v[corr+i];
lag = i;
}
}
/* If first subframe and lag > 84 do not search fractionnal pitch */
if( (i_subfr == 0) && (lag > 84) )
{
pit_frac.value = 0;
return(lag);
}
/* test the fractions around lag and choose the one which maximizes
the interpolated normalized correlation */
max = interpol_3(corr_v, corr+lag, -2);
frac = -2;
for (i = -1; i <= 2; i++)
{
corr_int = interpol_3(corr_v, corr+lag, i);
if(corr_int > max)
{
max = corr_int;
frac = i;
}
}
/* limit the fraction value in the interval [-1,0,1] */
if (frac == -2)
{
frac = 1;
lag -= 1;
}
if (frac == 2)
{
frac = -1;
lag += 1;
}
pit_frac.value = frac;
return lag;
}
|
class class_name[name] begin[{]
method[pitch_fr3, return_type[type[int]], modifier[public static], parameter[exc, excs, xn, xns, h, hs, l_subfr, t0_min, t0_max, i_subfr, pit_frac]] begin[{]
local_variable[type[int], i]
local_variable[type[int], lag]
local_variable[type[float], max]
local_variable[type[float], corr_int]
local_variable[type[float], corr_v]
local_variable[type[int], corr]
assign[member[.t_min], binary_operation[member[.t0_min], -, member[LD8KConstants.L_INTER4]]]
assign[member[.t_max], binary_operation[member[.t0_max], +, member[LD8KConstants.L_INTER4]]]
assign[member[.corr], member[.t_min]]
call[.norm_corr, parameter[member[.exc], member[.excs], member[.xn], member[.xns], member[.h], member[.hs], member[.l_subfr], member[.t_min], member[.t_max], member[.corr_v], member[.corr]]]
assign[member[.max], member[.corr_v]]
assign[member[.lag], member[.t0_min]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=corr_v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=corr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), operandr=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=corr_v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=corr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lag, 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=t0_max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=t0_min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))], update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[binary_operation[member[.i_subfr], ==, literal[0]], &&, binary_operation[member[.lag], >, literal[84]]]] begin[{]
assign[member[pit_frac.value], literal[0]]
return[member[.lag]]
else begin[{]
None
end[}]
assign[member[.max], call[.interpol_3, parameter[member[.corr_v], binary_operation[member[.corr], +, member[.lag]], literal[2]]]]
assign[member[.frac], literal[2]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=corr_int, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=corr_v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=corr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lag, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=interpol_3, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=corr_int, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=corr_int, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=frac, 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=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=<=), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1))], update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[member[.frac], ==, literal[2]]] begin[{]
assign[member[.frac], literal[1]]
assign[member[.lag], literal[1]]
else begin[{]
None
end[}]
if[binary_operation[member[.frac], ==, literal[2]]] begin[{]
assign[member[.frac], literal[1]]
assign[member[.lag], literal[1]]
else begin[{]
None
end[}]
assign[member[pit_frac.value], member[.frac]]
return[member[.lag]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[pitch_fr3] operator[SEP] Keyword[float] identifier[exc] operator[SEP] operator[SEP] , Keyword[int] identifier[excs] , Keyword[float] identifier[xn] operator[SEP] operator[SEP] , Keyword[int] identifier[xns] , Keyword[float] identifier[h] operator[SEP] operator[SEP] , Keyword[int] identifier[hs] , Keyword[int] identifier[l_subfr] , Keyword[int] identifier[t0_min] , Keyword[int] identifier[t0_max] , Keyword[int] identifier[i_subfr] , identifier[IntegerPointer] identifier[pit_frac] operator[SEP] {
Keyword[int] identifier[i] , identifier[frac] operator[SEP] Keyword[int] identifier[lag] , identifier[t_min] , identifier[t_max] operator[SEP] Keyword[float] identifier[max] operator[SEP] Keyword[float] identifier[corr_int] operator[SEP] Keyword[float] identifier[corr_v] operator[SEP] operator[SEP] operator[=] Keyword[new] Keyword[float] operator[SEP] Other[10] operator[+] Other[2] operator[*] identifier[LD8KConstants] operator[SEP] identifier[L_INTER4] operator[SEP] operator[SEP] Keyword[int] identifier[corr] operator[SEP] identifier[t_min] operator[=] identifier[t0_min] operator[-] identifier[LD8KConstants] operator[SEP] identifier[L_INTER4] operator[SEP] identifier[t_max] operator[=] identifier[t0_max] operator[+] identifier[LD8KConstants] operator[SEP] identifier[L_INTER4] operator[SEP] identifier[corr] operator[=] operator[-] identifier[t_min] operator[SEP] identifier[norm_corr] operator[SEP] identifier[exc] , identifier[excs] , identifier[xn] , identifier[xns] , identifier[h] , identifier[hs] , identifier[l_subfr] , identifier[t_min] , identifier[t_max] , identifier[corr_v] , identifier[corr] operator[SEP] operator[SEP] identifier[max] operator[=] identifier[corr_v] operator[SEP] identifier[corr] operator[+] identifier[t0_min] operator[SEP] operator[SEP] identifier[lag] operator[=] identifier[t0_min] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] identifier[t0_min] operator[+] Other[1] operator[SEP] identifier[i] operator[<=] identifier[t0_max] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[corr_v] operator[SEP] identifier[corr] operator[+] identifier[i] operator[SEP] operator[>=] identifier[max] operator[SEP] {
identifier[max] operator[=] identifier[corr_v] operator[SEP] identifier[corr] operator[+] identifier[i] operator[SEP] operator[SEP] identifier[lag] operator[=] identifier[i] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[SEP] identifier[i_subfr] operator[==] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[lag] operator[>] Other[84] operator[SEP] operator[SEP] {
identifier[pit_frac] operator[SEP] identifier[value] operator[=] Other[0] operator[SEP] Keyword[return] operator[SEP] identifier[lag] operator[SEP] operator[SEP]
}
identifier[max] operator[=] identifier[interpol_3] operator[SEP] identifier[corr_v] , identifier[corr] operator[+] identifier[lag] , operator[-] Other[2] operator[SEP] operator[SEP] identifier[frac] operator[=] operator[-] Other[2] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] operator[-] Other[1] operator[SEP] identifier[i] operator[<=] Other[2] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[corr_int] operator[=] identifier[interpol_3] operator[SEP] identifier[corr_v] , identifier[corr] operator[+] identifier[lag] , identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[corr_int] operator[>] identifier[max] operator[SEP] {
identifier[max] operator[=] identifier[corr_int] operator[SEP] identifier[frac] operator[=] identifier[i] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[frac] operator[==] operator[-] Other[2] operator[SEP] {
identifier[frac] operator[=] Other[1] operator[SEP] identifier[lag] operator[-=] Other[1] operator[SEP]
}
Keyword[if] operator[SEP] identifier[frac] operator[==] Other[2] operator[SEP] {
identifier[frac] operator[=] operator[-] Other[1] operator[SEP] identifier[lag] operator[+=] Other[1] operator[SEP]
}
identifier[pit_frac] operator[SEP] identifier[value] operator[=] identifier[frac] operator[SEP] Keyword[return] identifier[lag] operator[SEP]
}
|
public Observable<ServiceResponse<ManagementLockObjectInner>> createOrUpdateByScopeWithServiceResponseAsync(String scope, String lockName, ManagementLockObjectInner parameters) {
if (scope == null) {
throw new IllegalArgumentException("Parameter scope is required and cannot be null.");
}
if (lockName == null) {
throw new IllegalArgumentException("Parameter lockName is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(parameters);
return service.createOrUpdateByScope(scope, lockName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagementLockObjectInner>>>() {
@Override
public Observable<ServiceResponse<ManagementLockObjectInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ManagementLockObjectInner> clientResponse = createOrUpdateByScopeDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
|
class class_name[name] begin[{]
method[createOrUpdateByScopeWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[scope, lockName, parameters]] begin[{]
if[binary_operation[member[.scope], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter scope is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.lockName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter lockName is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.parameters], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter parameters is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.client]call[None.apiVersion, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.apiVersion() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[Validator.validate, parameter[member[.parameters]]]
return[call[service.createOrUpdateByScope, parameter[member[.scope], member[.lockName], member[.parameters], THIS[member[None.client]call[None.apiVersion, parameter[]]], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[ManagementLockObjectInner] operator[>] operator[>] identifier[createOrUpdateByScopeWithServiceResponseAsync] operator[SEP] identifier[String] identifier[scope] , identifier[String] identifier[lockName] , identifier[ManagementLockObjectInner] identifier[parameters] operator[SEP] {
Keyword[if] operator[SEP] identifier[scope] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lockName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[parameters] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Validator] operator[SEP] identifier[validate] operator[SEP] identifier[parameters] operator[SEP] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[createOrUpdateByScope] operator[SEP] identifier[scope] , identifier[lockName] , identifier[parameters] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[ManagementLockObjectInner] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[ManagementLockObjectInner] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[ManagementLockObjectInner] operator[>] identifier[clientResponse] operator[=] identifier[createOrUpdateByScopeDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] identifier[clientResponse] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static AppYaml parse(InputStream input) throws AppEngineException {
try {
// our needs are simple so just load using primitive objects
Yaml yaml = new Yaml(new SafeConstructor());
Map<String, ?> contents = (Map<String, ?>) yaml.load(input);
return new AppYaml(contents);
} catch (YAMLException ex) {
throw new AppEngineException("Malformed 'app.yaml'.", ex);
}
}
|
class class_name[name] begin[{]
method[parse, return_type[type[AppYaml]], modifier[public static], parameter[input]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SafeConstructor, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Yaml, sub_type=None)), name=yaml)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Yaml, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=load, postfix_operators=[], prefix_operators=[], qualifier=yaml, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Map, sub_type=None)), name=contents)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Map, sub_type=None)), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=contents, 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=AppYaml, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Malformed 'app.yaml'."), 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=AppEngineException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['YAMLException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] identifier[AppYaml] identifier[parse] operator[SEP] identifier[InputStream] identifier[input] operator[SEP] Keyword[throws] identifier[AppEngineException] {
Keyword[try] {
identifier[Yaml] identifier[yaml] operator[=] Keyword[new] identifier[Yaml] operator[SEP] Keyword[new] identifier[SafeConstructor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , operator[?] operator[>] identifier[contents] operator[=] operator[SEP] identifier[Map] operator[<] identifier[String] , operator[?] operator[>] operator[SEP] identifier[yaml] operator[SEP] identifier[load] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[AppYaml] operator[SEP] identifier[contents] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[YAMLException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AppEngineException] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
private void createSegment() throws IOException {
segmentsAttempted = 0;
bytesWritten = 0;
boolean success = false;
while (!success) {
Path path = workOutputPath.suffix(String.format(extensionFormat, segmentsCreated, segmentsAttempted));
FileSystem fs = path.getFileSystem(conf);
try {
// The o.a.h.mapred OutputFormats overwrite existing files, whereas
// the o.a.h.mapreduce OutputFormats don't overwrite. Bizarre...
// Here, overwrite if progress != null, i.e. if using mapred API.
FSDataOutputStream fsStream = (progress == null) ? fs.create(path, false): fs.create(path, progress);
byteStream = new CountingOutputStream(new BufferedOutputStream(fsStream));
dataStream = new DataOutputStream(codec == null ? byteStream : codec.createOutputStream(byteStream));
segmentsCreated++;
logger.info("Writing to output file: {}", path);
success = true;
} catch (IOException e) {
if (e.getMessage().startsWith("File already exists")) {
logger.warn("Tried to create file {} but it already exists; retrying.", path);
segmentsAttempted++; // retry
} else {
throw e;
}
}
}
}
|
class class_name[name] begin[{]
method[createSegment, return_type[void], modifier[private], parameter[]] begin[{]
assign[member[.segmentsAttempted], literal[0]]
assign[member[.bytesWritten], literal[0]]
local_variable[type[boolean], success]
while[member[.success]] begin[{]
local_variable[type[Path], path]
local_variable[type[FileSystem], fs]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=progress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=progress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=create, postfix_operators=[], prefix_operators=[], qualifier=fs, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=create, postfix_operators=[], prefix_operators=[], qualifier=fs, selectors=[], type_arguments=None)), name=fsStream)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FSDataOutputStream, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=byteStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=fsStream, 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=BufferedOutputStream, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CountingOutputStream, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=dataStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=codec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=byteStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createOutputStream, postfix_operators=[], prefix_operators=[], qualifier=codec, selectors=[], type_arguments=None), if_true=MemberReference(member=byteStream, 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=DataOutputStream, sub_type=None))), label=None), StatementExpression(expression=MemberReference(member=segmentsCreated, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Writing to output file: {}"), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=success, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="File already exists")], member=startsWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Tried to create file {} but it already exists; retrying."), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=segmentsAttempted, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[createSegment] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[segmentsAttempted] operator[=] Other[0] operator[SEP] identifier[bytesWritten] operator[=] Other[0] operator[SEP] Keyword[boolean] identifier[success] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[success] operator[SEP] {
identifier[Path] identifier[path] operator[=] identifier[workOutputPath] operator[SEP] identifier[suffix] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[extensionFormat] , identifier[segmentsCreated] , identifier[segmentsAttempted] operator[SEP] operator[SEP] operator[SEP] identifier[FileSystem] identifier[fs] operator[=] identifier[path] operator[SEP] identifier[getFileSystem] operator[SEP] identifier[conf] operator[SEP] operator[SEP] Keyword[try] {
identifier[FSDataOutputStream] identifier[fsStream] operator[=] operator[SEP] identifier[progress] operator[==] Other[null] operator[SEP] operator[?] identifier[fs] operator[SEP] identifier[create] operator[SEP] identifier[path] , literal[boolean] operator[SEP] operator[:] identifier[fs] operator[SEP] identifier[create] operator[SEP] identifier[path] , identifier[progress] operator[SEP] operator[SEP] identifier[byteStream] operator[=] Keyword[new] identifier[CountingOutputStream] operator[SEP] Keyword[new] identifier[BufferedOutputStream] operator[SEP] identifier[fsStream] operator[SEP] operator[SEP] operator[SEP] identifier[dataStream] operator[=] Keyword[new] identifier[DataOutputStream] operator[SEP] identifier[codec] operator[==] Other[null] operator[?] identifier[byteStream] operator[:] identifier[codec] operator[SEP] identifier[createOutputStream] operator[SEP] identifier[byteStream] operator[SEP] operator[SEP] operator[SEP] identifier[segmentsCreated] operator[++] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[path] operator[SEP] operator[SEP] identifier[success] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[path] operator[SEP] operator[SEP] identifier[segmentsAttempted] operator[++] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[e] operator[SEP]
}
}
}
}
|
private void checkVitalService(final Class service, final Throwable t) {
if (t != null) {
logger.error("Vital service {} failed to start with {}, aborting.", service.getSimpleName(), t.getMessage() );
System.err.println("Vital service " + service.getSimpleName() + " failed to start with " + t.getMessage() + ", aborting.");
} else {
logger.error("Vital service {} failed to start, aborting.", service.getSimpleName() );
System.err.println("Vital service " + service.getSimpleName() + " failed to start, aborting.");
}
System.exit(1);
}
|
class class_name[name] begin[{]
method[checkVitalService, return_type[void], modifier[private], parameter[service, t]] begin[{]
if[binary_operation[member[.t], !=, literal[null]]] begin[{]
call[logger.error, parameter[literal["Vital service {} failed to start with {}, aborting."], call[service.getSimpleName, parameter[]], call[t.getMessage, parameter[]]]]
call[System.err.println, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["Vital service "], +, call[service.getSimpleName, parameter[]]], +, literal[" failed to start with "]], +, call[t.getMessage, parameter[]]], +, literal[", aborting."]]]]
else begin[{]
call[logger.error, parameter[literal["Vital service {} failed to start, aborting."], call[service.getSimpleName, parameter[]]]]
call[System.err.println, parameter[binary_operation[binary_operation[literal["Vital service "], +, call[service.getSimpleName, parameter[]]], +, literal[" failed to start, aborting."]]]]
end[}]
call[System.exit, parameter[literal[1]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[checkVitalService] operator[SEP] Keyword[final] identifier[Class] identifier[service] , Keyword[final] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[service] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[t] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[service] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[t] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[service] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[service] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
|
public final String dumpConfiguration() {
if (properties.isEmpty())
return "No configuration settings stored";
StringBuilder response = new StringBuilder("TSD Configuration:\n");
response.append("File [" + config_location + "]\n");
int line = 0;
for (Map.Entry<String, String> entry : properties.entrySet()) {
if (line > 0) {
response.append("\n");
}
response.append("Key [" + entry.getKey() + "] Value [");
if (entry.getKey().toUpperCase().contains("PASS")) {
response.append("********");
} else {
response.append(entry.getValue());
}
response.append("]");
line++;
}
return response.toString();
}
|
class class_name[name] begin[{]
method[dumpConfiguration, return_type[type[String]], modifier[final public], parameter[]] begin[{]
if[call[properties.isEmpty, parameter[]]] begin[{]
return[literal["No configuration settings stored"]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], response]
call[response.append, parameter[binary_operation[binary_operation[literal["File ["], +, member[.config_location]], +, literal["]\n"]]]]
local_variable[type[int], line]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Key ["), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] Value ["), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=toUpperCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PASS")], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="********")], member=append, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]")], member=append, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=line, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[call[response.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[final] identifier[String] identifier[dumpConfiguration] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[String] operator[SEP] identifier[StringBuilder] identifier[response] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[config_location] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[line] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[>] identifier[entry] operator[:] identifier[properties] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[line] operator[>] Other[0] operator[SEP] {
identifier[response] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[response] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[response] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[response] operator[SEP] identifier[append] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[response] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[line] operator[++] operator[SEP]
}
Keyword[return] identifier[response] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@VisibleForTesting
C createServiceClient(Object soapClient, D adsServiceDescriptor, S adsSession) {
return adsServiceClientFactory.create(soapClient, adsServiceDescriptor, adsSession);
}
|
class class_name[name] begin[{]
method[createServiceClient, return_type[type[C]], modifier[default], parameter[soapClient, adsServiceDescriptor, adsSession]] begin[{]
return[call[adsServiceClientFactory.create, parameter[member[.soapClient], member[.adsServiceDescriptor], member[.adsSession]]]]
end[}]
END[}]
|
annotation[@] identifier[VisibleForTesting] identifier[C] identifier[createServiceClient] operator[SEP] identifier[Object] identifier[soapClient] , identifier[D] identifier[adsServiceDescriptor] , identifier[S] identifier[adsSession] operator[SEP] {
Keyword[return] identifier[adsServiceClientFactory] operator[SEP] identifier[create] operator[SEP] identifier[soapClient] , identifier[adsServiceDescriptor] , identifier[adsSession] operator[SEP] operator[SEP]
}
|
public static <II extends ImageGray<II>>
FastHessianFeatureDetector<II> fastHessian( @Nullable ConfigFastHessian config ) {
if( config == null )
config = new ConfigFastHessian();
config.checkValidity();
// ignore border is overwritten by Fast Hessian at detection time
NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(
new ConfigExtract(config.extractRadius, config.detectThreshold, 0, true));
return new FastHessianFeatureDetector<>(extractor, config.maxFeaturesPerScale,
config.initialSampleSize, config.initialSize, config.numberScalesPerOctave,
config.numberOfOctaves, config.scaleStepSize);
}
|
class class_name[name] begin[{]
method[fastHessian, return_type[type[FastHessianFeatureDetector]], modifier[public static], parameter[config]] begin[{]
if[binary_operation[member[.config], ==, literal[null]]] begin[{]
assign[member[.config], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConfigFastHessian, sub_type=None))]
else begin[{]
None
end[}]
call[config.checkValidity, parameter[]]
local_variable[type[NonMaxSuppression], extractor]
return[ClassCreator(arguments=[MemberReference(member=extractor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxFeaturesPerScale, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), MemberReference(member=initialSampleSize, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), MemberReference(member=initialSize, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), MemberReference(member=numberScalesPerOctave, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), MemberReference(member=numberOfOctaves, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), MemberReference(member=scaleStepSize, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=FastHessianFeatureDetector, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[II] Keyword[extends] identifier[ImageGray] operator[<] identifier[II] operator[>] operator[>] identifier[FastHessianFeatureDetector] operator[<] identifier[II] operator[>] identifier[fastHessian] operator[SEP] annotation[@] identifier[Nullable] identifier[ConfigFastHessian] identifier[config] operator[SEP] {
Keyword[if] operator[SEP] identifier[config] operator[==] Other[null] operator[SEP] identifier[config] operator[=] Keyword[new] identifier[ConfigFastHessian] operator[SEP] operator[SEP] operator[SEP] identifier[config] operator[SEP] identifier[checkValidity] operator[SEP] operator[SEP] operator[SEP] identifier[NonMaxSuppression] identifier[extractor] operator[=] identifier[FactoryFeatureExtractor] operator[SEP] identifier[nonmax] operator[SEP] Keyword[new] identifier[ConfigExtract] operator[SEP] identifier[config] operator[SEP] identifier[extractRadius] , identifier[config] operator[SEP] identifier[detectThreshold] , Other[0] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[FastHessianFeatureDetector] operator[<] operator[>] operator[SEP] identifier[extractor] , identifier[config] operator[SEP] identifier[maxFeaturesPerScale] , identifier[config] operator[SEP] identifier[initialSampleSize] , identifier[config] operator[SEP] identifier[initialSize] , identifier[config] operator[SEP] identifier[numberScalesPerOctave] , identifier[config] operator[SEP] identifier[numberOfOctaves] , identifier[config] operator[SEP] identifier[scaleStepSize] operator[SEP] operator[SEP]
}
|
@Override
public <T extends Endpoint> Strategy<T> create() {
return new XorShiftRandomStrategy<T>(broker, preferLocal);
}
|
class class_name[name] begin[{]
method[create, return_type[type[Strategy]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=broker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=preferLocal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=XorShiftRandomStrategy, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[Endpoint] operator[>] identifier[Strategy] operator[<] identifier[T] operator[>] identifier[create] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[XorShiftRandomStrategy] operator[<] identifier[T] operator[>] operator[SEP] identifier[broker] , identifier[preferLocal] operator[SEP] operator[SEP]
}
|
public void rollbackBreakIteration(List objectsToStore)
{
// now we mix up different api's and use PB-api too
log.info("rollbackBreakIteration");
/*
store list of objects, then get these objects with Iterator, start
iteration, then break
*/
storeObjects(objectsToStore);
TransactionExt tx = ((TransactionExt) getImplementation().currentTransaction());
// force writing to DB
tx.flush();
Class searchClass = objectsToStore.get(0).getClass();
PersistenceBroker broker = tx.getBroker();
Query q = new QueryByCriteria(searchClass);
// we get the iterator and step into the first found object
Iterator it = broker.getIteratorByQuery(q);
it.next();
/*
seems that some appServer expect that all used resources are closed before
the JTA-TXManager does call Synchronization#beforeCompletion(), so we have
to cleanup used resources. This could be done by call abort on odmg-api
*/
getImplementation().currentTransaction().abort();
// to notify the client about the failure we throw an exception
// if we don't throw such an exception the client don't get notified
// about the failure
throw new EJBException("## Testing of rollback behaviour - rollbackBreakIteration ##");
}
|
class class_name[name] begin[{]
method[rollbackBreakIteration, return_type[void], modifier[public], parameter[objectsToStore]] begin[{]
call[log.info, parameter[literal["rollbackBreakIteration"]]]
call[.storeObjects, parameter[member[.objectsToStore]]]
local_variable[type[TransactionExt], tx]
call[tx.flush, parameter[]]
local_variable[type[Class], searchClass]
local_variable[type[PersistenceBroker], broker]
local_variable[type[Query], q]
local_variable[type[Iterator], it]
call[it.next, parameter[]]
call[.getImplementation, parameter[]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="## Testing of rollback behaviour - rollbackBreakIteration ##")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EJBException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[rollbackBreakIteration] operator[SEP] identifier[List] identifier[objectsToStore] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[storeObjects] operator[SEP] identifier[objectsToStore] operator[SEP] operator[SEP] identifier[TransactionExt] identifier[tx] operator[=] operator[SEP] operator[SEP] identifier[TransactionExt] operator[SEP] identifier[getImplementation] operator[SEP] operator[SEP] operator[SEP] identifier[currentTransaction] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[tx] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[Class] identifier[searchClass] operator[=] identifier[objectsToStore] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[PersistenceBroker] identifier[broker] operator[=] identifier[tx] operator[SEP] identifier[getBroker] operator[SEP] operator[SEP] operator[SEP] identifier[Query] identifier[q] operator[=] Keyword[new] identifier[QueryByCriteria] operator[SEP] identifier[searchClass] operator[SEP] operator[SEP] identifier[Iterator] identifier[it] operator[=] identifier[broker] operator[SEP] identifier[getIteratorByQuery] operator[SEP] identifier[q] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[getImplementation] operator[SEP] operator[SEP] operator[SEP] identifier[currentTransaction] operator[SEP] operator[SEP] operator[SEP] identifier[abort] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[EJBException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public void shutdownNow() throws Exception {
this.server.stop();
this.server.destroy();
getFlowRunnerManager().shutdownNow();
this.mbeanRegistrationManager.closeMBeans();
}
|
class class_name[name] begin[{]
method[shutdownNow, return_type[void], modifier[public], parameter[]] begin[{]
THIS[member[None.server]call[None.stop, parameter[]]]
THIS[member[None.server]call[None.destroy, parameter[]]]
call[.getFlowRunnerManager, parameter[]]
THIS[member[None.mbeanRegistrationManager]call[None.closeMBeans, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[shutdownNow] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[this] operator[SEP] identifier[server] operator[SEP] identifier[stop] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[server] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP] identifier[getFlowRunnerManager] operator[SEP] operator[SEP] operator[SEP] identifier[shutdownNow] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[mbeanRegistrationManager] operator[SEP] identifier[closeMBeans] operator[SEP] operator[SEP] operator[SEP]
}
|
public PagedList<ExpressRouteCircuitInner> list() {
ServiceResponse<Page<ExpressRouteCircuitInner>> response = listSinglePageAsync().toBlocking().single();
return new PagedList<ExpressRouteCircuitInner>(response.body()) {
@Override
public Page<ExpressRouteCircuitInner> nextPage(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
|
class class_name[name] begin[{]
method[list, return_type[type[PagedList]], modifier[public], parameter[]] begin[{]
local_variable[type[ServiceResponse], response]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=body, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=nextPageLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listNextSinglePageAsync, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=toBlocking, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=single, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=body, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=nextPage, parameters=[FormalParameter(annotations=[], modifiers=set(), name=nextPageLink, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ExpressRouteCircuitInner, sub_type=None))], dimensions=[], name=Page, 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=ExpressRouteCircuitInner, sub_type=None))], dimensions=None, name=PagedList, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[PagedList] operator[<] identifier[ExpressRouteCircuitInner] operator[>] identifier[list] operator[SEP] operator[SEP] {
identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[ExpressRouteCircuitInner] operator[>] operator[>] identifier[response] operator[=] identifier[listSinglePageAsync] operator[SEP] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[PagedList] operator[<] identifier[ExpressRouteCircuitInner] operator[>] operator[SEP] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[ExpressRouteCircuitInner] operator[>] identifier[nextPage] operator[SEP] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listNextSinglePageAsync] operator[SEP] identifier[nextPageLink] 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]
}
} operator[SEP]
}
|
public boolean deleteMetric(Metric metric) {
String metricName = metric.getName();
checkMetricIsEmpty(metricName);
QueryPart<Metric> queryPart = new Query<Metric>("metrics")
.path(metricName, true);
return httpClientManager.updateMetaData(queryPart, delete());
}
|
class class_name[name] begin[{]
method[deleteMetric, return_type[type[boolean]], modifier[public], parameter[metric]] begin[{]
local_variable[type[String], metricName]
call[.checkMetricIsEmpty, parameter[member[.metricName]]]
local_variable[type[QueryPart], queryPart]
return[call[httpClientManager.updateMetaData, parameter[member[.queryPart], call[.delete, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[deleteMetric] operator[SEP] identifier[Metric] identifier[metric] operator[SEP] {
identifier[String] identifier[metricName] operator[=] identifier[metric] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[checkMetricIsEmpty] operator[SEP] identifier[metricName] operator[SEP] operator[SEP] identifier[QueryPart] operator[<] identifier[Metric] operator[>] identifier[queryPart] operator[=] Keyword[new] identifier[Query] operator[<] identifier[Metric] operator[>] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[path] operator[SEP] identifier[metricName] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[httpClientManager] operator[SEP] identifier[updateMetaData] operator[SEP] identifier[queryPart] , identifier[delete] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void dereferenceLocalisation(LocalizationPoint ptoPMessageItemStream)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "dereferenceLocalisation", ptoPMessageItemStream);
// Reset the reference to the local messages itemstream if it is being removed.
synchronized(_xmitQueuePoints)
{
_xmitQueuePoints.remove(ptoPMessageItemStream.getLocalizingMEUuid());
}
/*
* Remove the outputHandler from the set of OutputHandlers, if
* it exists.
*/
removeQueuePointOutputHandler(ptoPMessageItemStream.getLocalizingMEUuid());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "dereferenceLocalisation");
}
|
class class_name[name] begin[{]
method[dereferenceLocalisation, return_type[void], modifier[public], parameter[ptoPMessageItemStream]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["dereferenceLocalisation"], member[.ptoPMessageItemStream]]]
else begin[{]
None
end[}]
SYNCHRONIZED[member[._xmitQueuePoints]] BEGIN[{]
call[_xmitQueuePoints.remove, parameter[call[ptoPMessageItemStream.getLocalizingMEUuid, parameter[]]]]
END[}]
call[.removeQueuePointOutputHandler, parameter[call[ptoPMessageItemStream.getLocalizingMEUuid, parameter[]]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["dereferenceLocalisation"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[dereferenceLocalisation] operator[SEP] identifier[LocalizationPoint] identifier[ptoPMessageItemStream] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , identifier[ptoPMessageItemStream] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[_xmitQueuePoints] operator[SEP] {
identifier[_xmitQueuePoints] operator[SEP] identifier[remove] operator[SEP] identifier[ptoPMessageItemStream] operator[SEP] identifier[getLocalizingMEUuid] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[removeQueuePointOutputHandler] operator[SEP] identifier[ptoPMessageItemStream] operator[SEP] identifier[getLocalizingMEUuid] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
private void updateProgress() {
// Start panel data settings
HostProcess hp = getSelectedHostProcess();
if (scan.getHostProcesses() != null && hp != null) {
// Update the main table entries
model.updateValues(scan, hp);
if (scan.isStopped()) {
this.stopThread = true;
}
if (chart != null) {
ResponseCountSnapshot snapshot = scan.getRequestHistory();
while (snapshot != null) {
try {
Second second = new Second(snapshot.getDate());
this.seriesTotal.add(second, snapshot.getTotal());
this.series100.add(second, snapshot.getResp100());
this.series200.add(second, snapshot.getResp200());
this.series300.add(second, snapshot.getResp300());
this.series400.add(second, snapshot.getResp400());
this.series500.add(second, snapshot.getResp500());
snapshot = scan.getRequestHistory();
for (Plugin plugin : scan.getHostProcesses().get(0).getRunning()) {
if (!labelsAdded.contains(plugin.getName())) {
// Add a vertical line with the plugin name
ValueMarker vm = new ValueMarker(plugin.getTimeStarted().getTime());
double center = chart.getXYPlot().getRangeAxis().getRange().getCentralValue();
if (lastCentre != center) {
if (lastCentre != -1) {
// Move the existing labels so they stay in the centre
@SuppressWarnings("rawtypes")
List annotations = chart.getXYPlot().getAnnotations();
for (Object o: annotations) {
if (o instanceof XYTextAnnotation) {
XYTextAnnotation annotation = (XYTextAnnotation)o;
annotation.setY(center);
}
}
}
lastCentre = center;
}
XYTextAnnotation updateLabel =
new XYTextAnnotation(plugin.getName(),
plugin.getTimeStarted().getTime(), center);
updateLabel.setFont(FontUtils.getFont("Sans Serif"));
updateLabel.setRotationAnchor(TextAnchor.BASELINE_CENTER);
updateLabel.setTextAnchor(TextAnchor.BASELINE_CENTER);
updateLabel.setRotationAngle(-3.14 / 2);
updateLabel.setPaint(Color.black);
chart.getXYPlot().addDomainMarker(vm, Layer.BACKGROUND);
chart.getXYPlot().addAnnotation(updateLabel);
labelsAdded.add(plugin.getName());
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
snapshot = null;
}
}
}
}
}
|
class class_name[name] begin[{]
method[updateProgress, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[HostProcess], hp]
if[binary_operation[binary_operation[call[scan.getHostProcesses, parameter[]], !=, literal[null]], &&, binary_operation[member[.hp], !=, literal[null]]]] begin[{]
call[model.updateValues, parameter[member[.scan], member[.hp]]]
if[call[scan.isStopped, parameter[]]] begin[{]
assign[THIS[member[None.stopThread]], literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.chart], !=, literal[null]]] begin[{]
local_variable[type[ResponseCountSnapshot], snapshot]
while[binary_operation[member[.snapshot], !=, literal[null]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getDate, postfix_operators=[], prefix_operators=[], qualifier=snapshot, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Second, sub_type=None)), name=second)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Second, sub_type=None)), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=seriesTotal, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getTotal, postfix_operators=[], prefix_operators=[], qualifier=snapshot, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=series100, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResp100, postfix_operators=[], prefix_operators=[], qualifier=snapshot, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=series200, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResp200, postfix_operators=[], prefix_operators=[], qualifier=snapshot, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=series300, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResp300, postfix_operators=[], prefix_operators=[], qualifier=snapshot, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=series400, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResp400, postfix_operators=[], prefix_operators=[], qualifier=snapshot, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=series500, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=second, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResp500, postfix_operators=[], prefix_operators=[], qualifier=snapshot, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=snapshot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getRequestHistory, postfix_operators=[], prefix_operators=[], qualifier=scan, selectors=[], type_arguments=None)), label=None), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=plugin, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=labelsAdded, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTimeStarted, postfix_operators=[], prefix_operators=[], qualifier=plugin, selectors=[MethodInvocation(arguments=[], member=getTime, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ValueMarker, sub_type=None)), name=vm)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ValueMarker, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getXYPlot, postfix_operators=[], prefix_operators=[], qualifier=chart, selectors=[MethodInvocation(arguments=[], member=getRangeAxis, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getRange, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getCentralValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=center)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lastCentre, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=center, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lastCentre, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="rawtypes"), name=SuppressWarnings)], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getXYPlot, postfix_operators=[], prefix_operators=[], qualifier=chart, selectors=[MethodInvocation(arguments=[], member=getAnnotations, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=annotations)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=XYTextAnnotation, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=XYTextAnnotation, sub_type=None)), name=annotation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=XYTextAnnotation, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=center, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setY, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastCentre, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=center, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=plugin, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTimeStarted, postfix_operators=[], prefix_operators=[], qualifier=plugin, selectors=[MethodInvocation(arguments=[], member=getTime, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=center, 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=XYTextAnnotation, sub_type=None)), name=updateLabel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=XYTextAnnotation, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Sans Serif")], member=getFont, postfix_operators=[], prefix_operators=[], qualifier=FontUtils, selectors=[], type_arguments=None)], member=setFont, postfix_operators=[], prefix_operators=[], qualifier=updateLabel, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=BASELINE_CENTER, postfix_operators=[], prefix_operators=[], qualifier=TextAnchor, selectors=[])], member=setRotationAnchor, postfix_operators=[], prefix_operators=[], qualifier=updateLabel, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=BASELINE_CENTER, postfix_operators=[], prefix_operators=[], qualifier=TextAnchor, selectors=[])], member=setTextAnchor, postfix_operators=[], prefix_operators=[], qualifier=updateLabel, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=3.14), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/)], member=setRotationAngle, postfix_operators=[], prefix_operators=[], qualifier=updateLabel, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=black, postfix_operators=[], prefix_operators=[], qualifier=Color, selectors=[])], member=setPaint, postfix_operators=[], prefix_operators=[], qualifier=updateLabel, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getXYPlot, postfix_operators=[], prefix_operators=[], qualifier=chart, selectors=[MethodInvocation(arguments=[MemberReference(member=vm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=BACKGROUND, postfix_operators=[], prefix_operators=[], qualifier=Layer, selectors=[])], member=addDomainMarker, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getXYPlot, postfix_operators=[], prefix_operators=[], qualifier=chart, selectors=[MethodInvocation(arguments=[MemberReference(member=updateLabel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAnnotation, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=plugin, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=labelsAdded, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getHostProcesses, postfix_operators=[], prefix_operators=[], qualifier=scan, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getRunning, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=plugin)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Plugin, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=snapshot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[updateProgress] operator[SEP] operator[SEP] {
identifier[HostProcess] identifier[hp] operator[=] identifier[getSelectedHostProcess] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scan] operator[SEP] identifier[getHostProcesses] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[hp] operator[!=] Other[null] operator[SEP] {
identifier[model] operator[SEP] identifier[updateValues] operator[SEP] identifier[scan] , identifier[hp] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scan] operator[SEP] identifier[isStopped] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[stopThread] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[chart] operator[!=] Other[null] operator[SEP] {
identifier[ResponseCountSnapshot] identifier[snapshot] operator[=] identifier[scan] operator[SEP] identifier[getRequestHistory] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[snapshot] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[Second] identifier[second] operator[=] Keyword[new] identifier[Second] operator[SEP] identifier[snapshot] operator[SEP] identifier[getDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[seriesTotal] operator[SEP] identifier[add] operator[SEP] identifier[second] , identifier[snapshot] operator[SEP] identifier[getTotal] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[series100] operator[SEP] identifier[add] operator[SEP] identifier[second] , identifier[snapshot] operator[SEP] identifier[getResp100] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[series200] operator[SEP] identifier[add] operator[SEP] identifier[second] , identifier[snapshot] operator[SEP] identifier[getResp200] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[series300] operator[SEP] identifier[add] operator[SEP] identifier[second] , identifier[snapshot] operator[SEP] identifier[getResp300] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[series400] operator[SEP] identifier[add] operator[SEP] identifier[second] , identifier[snapshot] operator[SEP] identifier[getResp400] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[series500] operator[SEP] identifier[add] operator[SEP] identifier[second] , identifier[snapshot] operator[SEP] identifier[getResp500] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[snapshot] operator[=] identifier[scan] operator[SEP] identifier[getRequestHistory] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Plugin] identifier[plugin] operator[:] identifier[scan] operator[SEP] identifier[getHostProcesses] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getRunning] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[labelsAdded] operator[SEP] identifier[contains] operator[SEP] identifier[plugin] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[ValueMarker] identifier[vm] operator[=] Keyword[new] identifier[ValueMarker] operator[SEP] identifier[plugin] operator[SEP] identifier[getTimeStarted] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[center] operator[=] identifier[chart] operator[SEP] identifier[getXYPlot] operator[SEP] operator[SEP] operator[SEP] identifier[getRangeAxis] operator[SEP] operator[SEP] operator[SEP] identifier[getRange] operator[SEP] operator[SEP] operator[SEP] identifier[getCentralValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastCentre] operator[!=] identifier[center] operator[SEP] {
Keyword[if] operator[SEP] identifier[lastCentre] operator[!=] operator[-] Other[1] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[List] identifier[annotations] operator[=] identifier[chart] operator[SEP] identifier[getXYPlot] operator[SEP] operator[SEP] operator[SEP] identifier[getAnnotations] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[annotations] operator[SEP] {
Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[XYTextAnnotation] operator[SEP] {
identifier[XYTextAnnotation] identifier[annotation] operator[=] operator[SEP] identifier[XYTextAnnotation] operator[SEP] identifier[o] operator[SEP] identifier[annotation] operator[SEP] identifier[setY] operator[SEP] identifier[center] operator[SEP] operator[SEP]
}
}
}
identifier[lastCentre] operator[=] identifier[center] operator[SEP]
}
identifier[XYTextAnnotation] identifier[updateLabel] operator[=] Keyword[new] identifier[XYTextAnnotation] operator[SEP] identifier[plugin] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[plugin] operator[SEP] identifier[getTimeStarted] operator[SEP] operator[SEP] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] , identifier[center] operator[SEP] operator[SEP] identifier[updateLabel] operator[SEP] identifier[setFont] operator[SEP] identifier[FontUtils] operator[SEP] identifier[getFont] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[updateLabel] operator[SEP] identifier[setRotationAnchor] operator[SEP] identifier[TextAnchor] operator[SEP] identifier[BASELINE_CENTER] operator[SEP] operator[SEP] identifier[updateLabel] operator[SEP] identifier[setTextAnchor] operator[SEP] identifier[TextAnchor] operator[SEP] identifier[BASELINE_CENTER] operator[SEP] operator[SEP] identifier[updateLabel] operator[SEP] identifier[setRotationAngle] operator[SEP] operator[-] literal[Float] operator[/] Other[2] operator[SEP] operator[SEP] identifier[updateLabel] operator[SEP] identifier[setPaint] operator[SEP] identifier[Color] operator[SEP] identifier[black] operator[SEP] operator[SEP] identifier[chart] operator[SEP] identifier[getXYPlot] operator[SEP] operator[SEP] operator[SEP] identifier[addDomainMarker] operator[SEP] identifier[vm] , identifier[Layer] operator[SEP] identifier[BACKGROUND] operator[SEP] operator[SEP] identifier[chart] operator[SEP] identifier[getXYPlot] operator[SEP] operator[SEP] operator[SEP] identifier[addAnnotation] operator[SEP] identifier[updateLabel] operator[SEP] operator[SEP] identifier[labelsAdded] operator[SEP] identifier[add] operator[SEP] identifier[plugin] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP] identifier[snapshot] operator[=] Other[null] operator[SEP]
}
}
}
}
}
|
public String processOutbound(final HttpServletRequest request, final HttpServletResponse response,
final RewriteRule rule, final String url)
{
String result = url;
if ((rule != null) && rule.isOutbound() && rule.matches(url))
{
for (Processor p : processors)
{
result = p.processOutbound(request, response, rule, result);
}
}
return result;
}
|
class class_name[name] begin[{]
method[processOutbound, return_type[type[String]], modifier[public], parameter[request, response, rule, url]] begin[{]
local_variable[type[String], result]
if[binary_operation[binary_operation[binary_operation[member[.rule], !=, literal[null]], &&, call[rule.isOutbound, parameter[]]], &&, call[rule.matches, parameter[member[.url]]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processOutbound, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=processors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Processor, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[processOutbound] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[request] , Keyword[final] identifier[HttpServletResponse] identifier[response] , Keyword[final] identifier[RewriteRule] identifier[rule] , Keyword[final] identifier[String] identifier[url] operator[SEP] {
identifier[String] identifier[result] operator[=] identifier[url] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[rule] operator[!=] Other[null] operator[SEP] operator[&&] identifier[rule] operator[SEP] identifier[isOutbound] operator[SEP] operator[SEP] operator[&&] identifier[rule] operator[SEP] identifier[matches] operator[SEP] identifier[url] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Processor] identifier[p] operator[:] identifier[processors] operator[SEP] {
identifier[result] operator[=] identifier[p] operator[SEP] identifier[processOutbound] operator[SEP] identifier[request] , identifier[response] , identifier[rule] , identifier[result] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public void removeBlockQuotePrefix()
{
Line line = this.lines;
while (line != null)
{
if (!line.isEmpty)
{
if (line.value.charAt(line.leading) == '>')
{
int rem = line.leading + 1;
if (line.leading + 1 < line.value.length() && line.value.charAt(line.leading + 1) == ' ')
{
rem++;
}
line.value = line.value.substring(rem);
line.initLeading();
}
}
line = line.next;
}
}
|
class class_name[name] begin[{]
method[removeBlockQuotePrefix, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[Line], line]
while[binary_operation[member[.line], !=, literal[null]]] begin[{]
if[member[line.isEmpty]] begin[{]
if[binary_operation[call[line.value.charAt, parameter[member[line.leading]]], ==, literal['>']]] begin[{]
local_variable[type[int], rem]
if[binary_operation[binary_operation[binary_operation[member[line.leading], +, literal[1]], <, call[line.value.length, parameter[]]], &&, binary_operation[call[line.value.charAt, parameter[binary_operation[member[line.leading], +, literal[1]]]], ==, literal[' ']]]] begin[{]
member[.rem]
else begin[{]
None
end[}]
assign[member[line.value], call[line.value.substring, parameter[member[.rem]]]]
call[line.initLeading, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.line], member[line.next]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[removeBlockQuotePrefix] operator[SEP] operator[SEP] {
identifier[Line] identifier[line] operator[=] Keyword[this] operator[SEP] identifier[lines] operator[SEP] Keyword[while] operator[SEP] identifier[line] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[line] operator[SEP] identifier[isEmpty] operator[SEP] {
Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[value] operator[SEP] identifier[charAt] operator[SEP] identifier[line] operator[SEP] identifier[leading] operator[SEP] operator[==] literal[String] operator[SEP] {
Keyword[int] identifier[rem] operator[=] identifier[line] operator[SEP] identifier[leading] operator[+] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[leading] operator[+] Other[1] operator[<] identifier[line] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[&&] identifier[line] operator[SEP] identifier[value] operator[SEP] identifier[charAt] operator[SEP] identifier[line] operator[SEP] identifier[leading] operator[+] Other[1] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[rem] operator[++] operator[SEP]
}
identifier[line] operator[SEP] identifier[value] operator[=] identifier[line] operator[SEP] identifier[value] operator[SEP] identifier[substring] operator[SEP] identifier[rem] operator[SEP] operator[SEP] identifier[line] operator[SEP] identifier[initLeading] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[line] operator[=] identifier[line] operator[SEP] identifier[next] operator[SEP]
}
}
|
void triggerControlTask() {
migrationQueue.clear();
if (!node.getClusterService().isJoined()) {
logger.fine("Node is not joined, will not trigger ControlTask");
return;
}
if (!node.isMaster()) {
logger.fine("Node is not master, will not trigger ControlTask");
return;
}
migrationQueue.add(new ControlTask());
if (logger.isFinestEnabled()) {
logger.finest("Migration queue is cleared and control task is scheduled");
}
}
|
class class_name[name] begin[{]
method[triggerControlTask, return_type[void], modifier[default], parameter[]] begin[{]
call[migrationQueue.clear, parameter[]]
if[call[node.getClusterService, parameter[]]] begin[{]
call[logger.fine, parameter[literal["Node is not joined, will not trigger ControlTask"]]]
return[None]
else begin[{]
None
end[}]
if[call[node.isMaster, parameter[]]] begin[{]
call[logger.fine, parameter[literal["Node is not master, will not trigger ControlTask"]]]
return[None]
else begin[{]
None
end[}]
call[migrationQueue.add, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ControlTask, sub_type=None))]]
if[call[logger.isFinestEnabled, parameter[]]] begin[{]
call[logger.finest, parameter[literal["Migration queue is cleared and control task is scheduled"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[void] identifier[triggerControlTask] operator[SEP] operator[SEP] {
identifier[migrationQueue] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[node] operator[SEP] identifier[getClusterService] operator[SEP] operator[SEP] operator[SEP] identifier[isJoined] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[node] operator[SEP] identifier[isMaster] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[migrationQueue] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ControlTask] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isFinestEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[finest] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public List<Milestone> getMilestones(Object projectIdOrPath) throws GitLabApiException {
return (getMilestones(projectIdOrPath, getDefaultPerPage()).all());
}
|
class class_name[name] begin[{]
method[getMilestones, return_type[type[List]], modifier[public], parameter[projectIdOrPath]] begin[{]
return[call[.getMilestones, parameter[member[.projectIdOrPath], call[.getDefaultPerPage, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[Milestone] operator[>] identifier[getMilestones] operator[SEP] identifier[Object] identifier[projectIdOrPath] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[return] operator[SEP] identifier[getMilestones] operator[SEP] identifier[projectIdOrPath] , identifier[getDefaultPerPage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[all] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setSliderPosition(float x, float y) {
if (x > 255) {
x = 255;
}
if (x < 0) {
x = 0;
}
if (y > 255) {
y = 255;
}
if (y < 0) {
y = 0;
}
x -= 7;
y -= 7;
m_slider.getElement().getStyle().setLeft(x, Unit.PX);
m_slider.getElement().getStyle().setTop(y, Unit.PX);
}
|
class class_name[name] begin[{]
method[setSliderPosition, return_type[void], modifier[public], parameter[x, y]] begin[{]
if[binary_operation[member[.x], >, literal[255]]] begin[{]
assign[member[.x], literal[255]]
else begin[{]
None
end[}]
if[binary_operation[member[.x], <, literal[0]]] begin[{]
assign[member[.x], literal[0]]
else begin[{]
None
end[}]
if[binary_operation[member[.y], >, literal[255]]] begin[{]
assign[member[.y], literal[255]]
else begin[{]
None
end[}]
if[binary_operation[member[.y], <, literal[0]]] begin[{]
assign[member[.y], literal[0]]
else begin[{]
None
end[}]
assign[member[.x], literal[7]]
assign[member[.y], literal[7]]
call[m_slider.getElement, parameter[]]
call[m_slider.getElement, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setSliderPosition] operator[SEP] Keyword[float] identifier[x] , Keyword[float] identifier[y] operator[SEP] {
Keyword[if] operator[SEP] identifier[x] operator[>] Other[255] operator[SEP] {
identifier[x] operator[=] Other[255] operator[SEP]
}
Keyword[if] operator[SEP] identifier[x] operator[<] Other[0] operator[SEP] {
identifier[x] operator[=] Other[0] operator[SEP]
}
Keyword[if] operator[SEP] identifier[y] operator[>] Other[255] operator[SEP] {
identifier[y] operator[=] Other[255] operator[SEP]
}
Keyword[if] operator[SEP] identifier[y] operator[<] Other[0] operator[SEP] {
identifier[y] operator[=] Other[0] operator[SEP]
}
identifier[x] operator[-=] Other[7] operator[SEP] identifier[y] operator[-=] Other[7] operator[SEP] identifier[m_slider] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] operator[SEP] identifier[getStyle] operator[SEP] operator[SEP] operator[SEP] identifier[setLeft] operator[SEP] identifier[x] , identifier[Unit] operator[SEP] identifier[PX] operator[SEP] operator[SEP] identifier[m_slider] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] operator[SEP] identifier[getStyle] operator[SEP] operator[SEP] operator[SEP] identifier[setTop] operator[SEP] identifier[y] , identifier[Unit] operator[SEP] identifier[PX] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.