code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
public static QueryParameters updateTypesByName(QueryParameters original, QueryParameters source) {
QueryParameters updatedParams = new QueryParameters(original);
if (source != null) {
for (String sourceKey : source.keySet()) {
if (updatedParams.containsKey(sourceKey) == true) {
updatedParams.updateType(sourceKey, source.getType(sourceKey));
}
}
}
return updatedParams;
} | class class_name[name] begin[{]
method[updateTypesByName, return_type[type[QueryParameters]], modifier[public static], parameter[original, source]] begin[{]
local_variable[type[QueryParameters], updatedParams]
if[binary_operation[member[.source], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=sourceKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=updatedParams, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sourceKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=sourceKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getType, postfix_operators=[], prefix_operators=[], qualifier=source, selectors=[], type_arguments=None)], member=updateType, postfix_operators=[], prefix_operators=[], qualifier=updatedParams, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=source, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=sourceKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.updatedParams]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[QueryParameters] identifier[updateTypesByName] operator[SEP] identifier[QueryParameters] identifier[original] , identifier[QueryParameters] identifier[source] operator[SEP] {
identifier[QueryParameters] identifier[updatedParams] operator[=] Keyword[new] identifier[QueryParameters] operator[SEP] identifier[original] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[source] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[sourceKey] operator[:] identifier[source] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[updatedParams] operator[SEP] identifier[containsKey] operator[SEP] identifier[sourceKey] operator[SEP] operator[==] literal[boolean] operator[SEP] {
identifier[updatedParams] operator[SEP] identifier[updateType] operator[SEP] identifier[sourceKey] , identifier[source] operator[SEP] identifier[getType] operator[SEP] identifier[sourceKey] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[updatedParams] operator[SEP]
}
|
protected Connection getConnection(RevisionAPIConfiguration config) throws WikiApiException
{
Connection c;
try {
String driverDB = config.getDatabaseDriver();
Class.forName(driverDB);
c = DriverManager.getConnection(config.getJdbcURL(), config.getUser(), config.getPassword());
if (!c.isValid(5)) {
throw new WikiApiException("Connection could not be established.");
}
}
catch (SQLException | ClassNotFoundException e) {
throw new WikiApiException(e);
}
return c;
} | class class_name[name] begin[{]
method[getConnection, return_type[type[Connection]], modifier[protected], parameter[config]] begin[{]
local_variable[type[Connection], c]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDatabaseDriver, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), name=driverDB)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=driverDB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getJdbcURL, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getUser, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getPassword, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None)], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=DriverManager, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], member=isValid, postfix_operators=[], prefix_operators=['!'], qualifier=c, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Connection could not be established.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WikiApiException, 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=WikiApiException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException', 'ClassNotFoundException']))], finally_block=None, label=None, resources=None)
return[member[.c]]
end[}]
END[}] | Keyword[protected] identifier[Connection] identifier[getConnection] operator[SEP] identifier[RevisionAPIConfiguration] identifier[config] operator[SEP] Keyword[throws] identifier[WikiApiException] {
identifier[Connection] identifier[c] operator[SEP] Keyword[try] {
identifier[String] identifier[driverDB] operator[=] identifier[config] operator[SEP] identifier[getDatabaseDriver] operator[SEP] operator[SEP] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[driverDB] operator[SEP] operator[SEP] identifier[c] operator[=] identifier[DriverManager] operator[SEP] identifier[getConnection] operator[SEP] identifier[config] operator[SEP] identifier[getJdbcURL] operator[SEP] operator[SEP] , identifier[config] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] , identifier[config] operator[SEP] identifier[getPassword] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[c] operator[SEP] identifier[isValid] operator[SEP] Other[5] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WikiApiException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SQLException] operator[|] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WikiApiException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[c] operator[SEP]
}
|
public void marshall(DescribeEnvironmentStatusRequest describeEnvironmentStatusRequest, ProtocolMarshaller protocolMarshaller) {
if (describeEnvironmentStatusRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeEnvironmentStatusRequest.getEnvironmentId(), ENVIRONMENTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[describeEnvironmentStatusRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.describeEnvironmentStatusRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEnvironmentId, postfix_operators=[], prefix_operators=[], qualifier=describeEnvironmentStatusRequest, selectors=[], type_arguments=None), MemberReference(member=ENVIRONMENTID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[DescribeEnvironmentStatusRequest] identifier[describeEnvironmentStatusRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[describeEnvironmentStatusRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeEnvironmentStatusRequest] operator[SEP] identifier[getEnvironmentId] operator[SEP] operator[SEP] , identifier[ENVIRONMENTID_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@java.lang.Deprecated
public java.util.Map<java.lang.String, com.google.cloud.dataproc.v1beta2.LoggingConfig.Level>
getDriverLogLevels() {
return getDriverLogLevelsMap();
} | class class_name[name] begin[{]
method[getDriverLogLevels, return_type[type[java]], modifier[public], parameter[]] begin[{]
return[call[.getDriverLogLevelsMap, parameter[]]]
end[}]
END[}] | annotation[@] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[Deprecated] Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] , identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[cloud] operator[SEP] identifier[dataproc] operator[SEP] identifier[v1beta2] operator[SEP] identifier[LoggingConfig] operator[SEP] identifier[Level] operator[>] identifier[getDriverLogLevels] operator[SEP] operator[SEP] {
Keyword[return] identifier[getDriverLogLevelsMap] operator[SEP] operator[SEP] operator[SEP]
}
|
public static int rgbFromCmyk(float[] cmyk) {
float cyan = cmyk[0];
float magenta = cmyk[1];
float yellow = cmyk[2];
float black = cmyk[3];
int red = (int) ((1.0f - Math.min(1.0f, cyan * (1.0f - black) + black)) * 255);
int green = (int) ((1.0f - Math.min(1.0f, magenta * (1.0f - black) + black)) * 255);
int blue = (int) ((1.0f - Math.min(1.0f, yellow * (1.0f - black) + black)) * 255);
return ((0xff & red) << 16) + ((0xff & green) << 8) + (0xff & blue);
} | class class_name[name] begin[{]
method[rgbFromCmyk, return_type[type[int]], modifier[public static], parameter[cmyk]] begin[{]
local_variable[type[float], cyan]
local_variable[type[float], magenta]
local_variable[type[float], yellow]
local_variable[type[float], black]
local_variable[type[int], red]
local_variable[type[int], green]
local_variable[type[int], blue]
return[binary_operation[binary_operation[binary_operation[binary_operation[literal[0xff], &, member[.red]], <<, literal[16]], +, binary_operation[binary_operation[literal[0xff], &, member[.green]], <<, literal[8]]], +, binary_operation[literal[0xff], &, member[.blue]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[rgbFromCmyk] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[cmyk] operator[SEP] {
Keyword[float] identifier[cyan] operator[=] identifier[cmyk] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[float] identifier[magenta] operator[=] identifier[cmyk] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[float] identifier[yellow] operator[=] identifier[cmyk] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[float] identifier[black] operator[=] identifier[cmyk] operator[SEP] Other[3] operator[SEP] operator[SEP] Keyword[int] identifier[red] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] literal[Float] operator[-] identifier[Math] operator[SEP] identifier[min] operator[SEP] literal[Float] , identifier[cyan] operator[*] operator[SEP] literal[Float] operator[-] identifier[black] operator[SEP] operator[+] identifier[black] operator[SEP] operator[SEP] operator[*] Other[255] operator[SEP] operator[SEP] Keyword[int] identifier[green] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] literal[Float] operator[-] identifier[Math] operator[SEP] identifier[min] operator[SEP] literal[Float] , identifier[magenta] operator[*] operator[SEP] literal[Float] operator[-] identifier[black] operator[SEP] operator[+] identifier[black] operator[SEP] operator[SEP] operator[*] Other[255] operator[SEP] operator[SEP] Keyword[int] identifier[blue] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] literal[Float] operator[-] identifier[Math] operator[SEP] identifier[min] operator[SEP] literal[Float] , identifier[yellow] operator[*] operator[SEP] literal[Float] operator[-] identifier[black] operator[SEP] operator[+] identifier[black] operator[SEP] operator[SEP] operator[*] Other[255] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] literal[Integer] operator[&] identifier[red] operator[SEP] operator[<<] Other[16] operator[SEP] operator[+] operator[SEP] operator[SEP] literal[Integer] operator[&] identifier[green] operator[SEP] operator[<<] Other[8] operator[SEP] operator[+] operator[SEP] literal[Integer] operator[&] identifier[blue] operator[SEP] operator[SEP]
}
|
public IconRow getIconDefault(String featureTable, long featureId,
boolean tableIcon) {
return getIcon(featureTable, featureId, null, tableIcon);
} | class class_name[name] begin[{]
method[getIconDefault, return_type[type[IconRow]], modifier[public], parameter[featureTable, featureId, tableIcon]] begin[{]
return[call[.getIcon, parameter[member[.featureTable], member[.featureId], literal[null], member[.tableIcon]]]]
end[}]
END[}] | Keyword[public] identifier[IconRow] identifier[getIconDefault] operator[SEP] identifier[String] identifier[featureTable] , Keyword[long] identifier[featureId] , Keyword[boolean] identifier[tableIcon] operator[SEP] {
Keyword[return] identifier[getIcon] operator[SEP] identifier[featureTable] , identifier[featureId] , Other[null] , identifier[tableIcon] operator[SEP] operator[SEP]
}
|
public void setDomainNamePattern(String domainNamePattern) {
if (this.domainName != null) {
throw new IllegalStateException(
"Cannot set both domainName and domainNamePattern");
}
this.domainNamePattern = Pattern.compile(domainNamePattern,
Pattern.CASE_INSENSITIVE);
} | class class_name[name] begin[{]
method[setDomainNamePattern, return_type[void], modifier[public], parameter[domainNamePattern]] begin[{]
if[binary_operation[THIS[member[None.domainName]], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot set both domainName and domainNamePattern")], 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[THIS[member[None.domainNamePattern]], call[Pattern.compile, parameter[member[.domainNamePattern], member[Pattern.CASE_INSENSITIVE]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setDomainNamePattern] operator[SEP] identifier[String] identifier[domainNamePattern] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[domainName] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[domainNamePattern] operator[=] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] identifier[domainNamePattern] , identifier[Pattern] operator[SEP] identifier[CASE_INSENSITIVE] operator[SEP] operator[SEP]
}
|
private void addOwner(UNode ownerNode) {
String ownerName = ownerNode.getName();
SortedMap<String, RESTCommand> ownerMap = new TreeMap<>();
m_cmdsByOwnerMap.put(ownerName, ownerMap);
for (UNode cmdNode : ownerNode.getMemberList()) {
RESTCommand cmd = RESTCommand.fromUNode(cmdNode);
ownerMap.put(cmd.getName(), cmd);
}
} | class class_name[name] begin[{]
method[addOwner, return_type[void], modifier[private], parameter[ownerNode]] begin[{]
local_variable[type[String], ownerName]
local_variable[type[SortedMap], ownerMap]
call[m_cmdsByOwnerMap.put, parameter[member[.ownerName], member[.ownerMap]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=cmdNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromUNode, postfix_operators=[], prefix_operators=[], qualifier=RESTCommand, selectors=[], type_arguments=None), name=cmd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RESTCommand, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=cmd, selectors=[], type_arguments=None), MemberReference(member=cmd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=ownerMap, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getMemberList, postfix_operators=[], prefix_operators=[], qualifier=ownerNode, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=cmdNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=UNode, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addOwner] operator[SEP] identifier[UNode] identifier[ownerNode] operator[SEP] {
identifier[String] identifier[ownerName] operator[=] identifier[ownerNode] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[SortedMap] operator[<] identifier[String] , identifier[RESTCommand] operator[>] identifier[ownerMap] operator[=] Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[m_cmdsByOwnerMap] operator[SEP] identifier[put] operator[SEP] identifier[ownerName] , identifier[ownerMap] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[UNode] identifier[cmdNode] operator[:] identifier[ownerNode] operator[SEP] identifier[getMemberList] operator[SEP] operator[SEP] operator[SEP] {
identifier[RESTCommand] identifier[cmd] operator[=] identifier[RESTCommand] operator[SEP] identifier[fromUNode] operator[SEP] identifier[cmdNode] operator[SEP] operator[SEP] identifier[ownerMap] operator[SEP] identifier[put] operator[SEP] identifier[cmd] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[cmd] operator[SEP] operator[SEP]
}
}
|
public void redraw() {
Layers mapOverlays = clusterManager.getMapView().getLayerManager().getLayers();
if (clusterMarker != null && !clusterManager.getCurBounds().contains(center)
&& mapOverlays.contains(clusterMarker)) {
mapOverlays.remove(clusterMarker);
return;
}
if (clusterMarker != null
&& mapOverlays.size() > 0
&& !mapOverlays.contains(clusterMarker)
&& !clusterManager.isClustering) {
mapOverlays.add(1, clusterMarker);
}
} | class class_name[name] begin[{]
method[redraw, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[Layers], mapOverlays]
if[binary_operation[binary_operation[binary_operation[member[.clusterMarker], !=, literal[null]], &&, call[clusterManager.getCurBounds, parameter[]]], &&, call[mapOverlays.contains, parameter[member[.clusterMarker]]]]] begin[{]
call[mapOverlays.remove, parameter[member[.clusterMarker]]]
return[None]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.clusterMarker], !=, literal[null]], &&, binary_operation[call[mapOverlays.size, parameter[]], >, literal[0]]], &&, call[mapOverlays.contains, parameter[member[.clusterMarker]]]], &&, member[clusterManager.isClustering]]] begin[{]
call[mapOverlays.add, parameter[literal[1], member[.clusterMarker]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[redraw] operator[SEP] operator[SEP] {
identifier[Layers] identifier[mapOverlays] operator[=] identifier[clusterManager] operator[SEP] identifier[getMapView] operator[SEP] operator[SEP] operator[SEP] identifier[getLayerManager] operator[SEP] operator[SEP] operator[SEP] identifier[getLayers] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[clusterMarker] operator[!=] Other[null] operator[&&] operator[!] identifier[clusterManager] operator[SEP] identifier[getCurBounds] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[center] operator[SEP] operator[&&] identifier[mapOverlays] operator[SEP] identifier[contains] operator[SEP] identifier[clusterMarker] operator[SEP] operator[SEP] {
identifier[mapOverlays] operator[SEP] identifier[remove] operator[SEP] identifier[clusterMarker] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[clusterMarker] operator[!=] Other[null] operator[&&] identifier[mapOverlays] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[&&] operator[!] identifier[mapOverlays] operator[SEP] identifier[contains] operator[SEP] identifier[clusterMarker] operator[SEP] operator[&&] operator[!] identifier[clusterManager] operator[SEP] identifier[isClustering] operator[SEP] {
identifier[mapOverlays] operator[SEP] identifier[add] operator[SEP] Other[1] , identifier[clusterMarker] operator[SEP] operator[SEP]
}
}
|
private static synchronized String getFile(String name) {
if(Objects.isNullOrEmpty(baseDirectory)){
baseDirectory = Options.getStorage().getSystem("numberSequence.home", System.getProperty("user.home") + File.separator + ".s1-sequences");
}
File dir = new File(baseDirectory);
if(!dir.exists())
dir.mkdirs();
if(!dir.isDirectory())
throw new S1SystemError("Directory error: "+baseDirectory);
return dir.getAbsolutePath()+File.separator+name;
} | class class_name[name] begin[{]
method[getFile, return_type[type[String]], modifier[synchronized private static], parameter[name]] begin[{]
if[call[Objects.isNullOrEmpty, parameter[member[.baseDirectory]]]] begin[{]
assign[member[.baseDirectory], call[Options.getStorage, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[File], dir]
if[call[dir.exists, parameter[]]] begin[{]
call[dir.mkdirs, parameter[]]
else begin[{]
None
end[}]
if[call[dir.isDirectory, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Directory error: "), operandr=MemberReference(member=baseDirectory, 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=S1SystemError, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[binary_operation[binary_operation[call[dir.getAbsolutePath, parameter[]], +, member[File.separator]], +, member[.name]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[synchronized] identifier[String] identifier[getFile] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[Objects] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[baseDirectory] operator[SEP] operator[SEP] {
identifier[baseDirectory] operator[=] identifier[Options] operator[SEP] identifier[getStorage] operator[SEP] operator[SEP] operator[SEP] identifier[getSystem] operator[SEP] literal[String] , identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[+] identifier[File] operator[SEP] identifier[separator] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[File] identifier[dir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[baseDirectory] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[dir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] identifier[dir] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[dir] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[S1SystemError] operator[SEP] literal[String] operator[+] identifier[baseDirectory] operator[SEP] operator[SEP] Keyword[return] identifier[dir] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[+] identifier[File] operator[SEP] identifier[separator] operator[+] identifier[name] operator[SEP]
}
|
private List<CmsSearchIndexSource> searchIndexSources() {
CmsSearchManager manager = OpenCms.getSearchManager();
return new LinkedList<CmsSearchIndexSource>(manager.getSearchIndexSources().values());
} | class class_name[name] begin[{]
method[searchIndexSources, return_type[type[List]], modifier[private], parameter[]] begin[{]
local_variable[type[CmsSearchManager], manager]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getSearchIndexSources, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[MethodInvocation(arguments=[], member=values, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CmsSearchIndexSource, sub_type=None))], dimensions=None, name=LinkedList, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[CmsSearchIndexSource] operator[>] identifier[searchIndexSources] operator[SEP] operator[SEP] {
identifier[CmsSearchManager] identifier[manager] operator[=] identifier[OpenCms] operator[SEP] identifier[getSearchManager] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[LinkedList] operator[<] identifier[CmsSearchIndexSource] operator[>] operator[SEP] identifier[manager] operator[SEP] identifier[getSearchIndexSources] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <C extends Sequence<D>, D extends Compound> DistanceMatrix fractionalDissimilarity(
MultipleSequenceAlignment<C, D> msa) throws IOException {
Msa fMsa = ForesterWrapper.convert(msa);
DistanceMatrix DM = PairwiseDistanceCalculator
.calcFractionalDissimilarities(fMsa);
return DM;
} | class class_name[name] begin[{]
method[fractionalDissimilarity, return_type[type[DistanceMatrix]], modifier[public static], parameter[msa]] begin[{]
local_variable[type[Msa], fMsa]
local_variable[type[DistanceMatrix], DM]
return[member[.DM]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[C] Keyword[extends] identifier[Sequence] operator[<] identifier[D] operator[>] , identifier[D] Keyword[extends] identifier[Compound] operator[>] identifier[DistanceMatrix] identifier[fractionalDissimilarity] operator[SEP] identifier[MultipleSequenceAlignment] operator[<] identifier[C] , identifier[D] operator[>] identifier[msa] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Msa] identifier[fMsa] operator[=] identifier[ForesterWrapper] operator[SEP] identifier[convert] operator[SEP] identifier[msa] operator[SEP] operator[SEP] identifier[DistanceMatrix] identifier[DM] operator[=] identifier[PairwiseDistanceCalculator] operator[SEP] identifier[calcFractionalDissimilarities] operator[SEP] identifier[fMsa] operator[SEP] operator[SEP] Keyword[return] identifier[DM] operator[SEP]
}
|
public static List<Match> search(Match m, Pattern pattern)
{
assert pattern.getStartingClass().isAssignableFrom(m.get(0).getModelInterface());
return searchRecursive(m, pattern.getConstraints(), 0);
} | class class_name[name] begin[{]
method[search, return_type[type[List]], modifier[public static], parameter[m, pattern]] begin[{]
AssertStatement(condition=MethodInvocation(arguments=[], member=getStartingClass, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[MethodInvocation(arguments=[], member=getModelInterface, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None, value=None)
return[call[.searchRecursive, parameter[member[.m], call[pattern.getConstraints, parameter[]], literal[0]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Match] operator[>] identifier[search] operator[SEP] identifier[Match] identifier[m] , identifier[Pattern] identifier[pattern] operator[SEP] {
Keyword[assert] identifier[pattern] operator[SEP] identifier[getStartingClass] operator[SEP] operator[SEP] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[m] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getModelInterface] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[searchRecursive] operator[SEP] identifier[m] , identifier[pattern] operator[SEP] identifier[getConstraints] operator[SEP] operator[SEP] , Other[0] operator[SEP] operator[SEP]
}
|
public Buffer process(PacketOutputStream out, PacketInputStream in, AtomicInteger sequence) throws IOException, SQLException {
if (password == null || password.isEmpty()) {
out.writeEmptyPacket(sequence.incrementAndGet());
} else {
out.startPacket(sequence.incrementAndGet());
out.write(ed25519SignWithPassword(password, authData, passwordCharacterEncoding));
out.flush();
}
Buffer buffer = in.getPacket(true);
sequence.set(in.getLastPacketSeq());
return buffer;
} | class class_name[name] begin[{]
method[process, return_type[type[Buffer]], modifier[public], parameter[out, in, sequence]] begin[{]
if[binary_operation[binary_operation[member[.password], ==, literal[null]], ||, call[password.isEmpty, parameter[]]]] begin[{]
call[out.writeEmptyPacket, parameter[call[sequence.incrementAndGet, parameter[]]]]
else begin[{]
call[out.startPacket, parameter[call[sequence.incrementAndGet, parameter[]]]]
call[out.write, parameter[call[.ed25519SignWithPassword, parameter[member[.password], member[.authData], member[.passwordCharacterEncoding]]]]]
call[out.flush, parameter[]]
end[}]
local_variable[type[Buffer], buffer]
call[sequence.set, parameter[call[in.getLastPacketSeq, parameter[]]]]
return[member[.buffer]]
end[}]
END[}] | Keyword[public] identifier[Buffer] identifier[process] operator[SEP] identifier[PacketOutputStream] identifier[out] , identifier[PacketInputStream] identifier[in] , identifier[AtomicInteger] identifier[sequence] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SQLException] {
Keyword[if] operator[SEP] identifier[password] operator[==] Other[null] operator[||] identifier[password] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[out] operator[SEP] identifier[writeEmptyPacket] operator[SEP] identifier[sequence] operator[SEP] identifier[incrementAndGet] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[out] operator[SEP] identifier[startPacket] operator[SEP] identifier[sequence] operator[SEP] identifier[incrementAndGet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[ed25519SignWithPassword] operator[SEP] identifier[password] , identifier[authData] , identifier[passwordCharacterEncoding] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Buffer] identifier[buffer] operator[=] identifier[in] operator[SEP] identifier[getPacket] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[sequence] operator[SEP] identifier[set] operator[SEP] identifier[in] operator[SEP] identifier[getLastPacketSeq] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[buffer] operator[SEP]
}
|
public EClass getBDG() {
if (bdgEClass == null) {
bdgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(200);
}
return bdgEClass;
} | class class_name[name] begin[{]
method[getBDG, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.bdgEClass], ==, literal[null]]] begin[{]
assign[member[.bdgEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=200)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.bdgEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getBDG] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[bdgEClass] operator[==] Other[null] operator[SEP] {
identifier[bdgEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[AfplibPackage] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[200] operator[SEP] operator[SEP]
}
Keyword[return] identifier[bdgEClass] operator[SEP]
}
|
public final boolean roll(final LoggingEvent loggingEvent) {
for (int i = 0; i < this.fileRollables.length; i++) {
if (this.fileRollables[i].roll(loggingEvent)) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[roll, return_type[type[boolean]], modifier[final public], parameter[loggingEvent]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=fileRollables, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=loggingEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=roll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=fileRollables, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[boolean] identifier[roll] operator[SEP] Keyword[final] identifier[LoggingEvent] identifier[loggingEvent] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Keyword[this] operator[SEP] identifier[fileRollables] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[fileRollables] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[roll] operator[SEP] identifier[loggingEvent] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void create(String care, String openId, String text) {
String url = WxEndpoint.get("url.care.session.create");
Map<String, String> request = new HashMap<>();
request.put("kf_account", care);
request.put("openid", openId);
if(!(text == null || "".equals(text))) {
request.put("text", text);
}
String json = JsonMapper.nonEmptyMapper().toJson(request);
logger.debug("create session: {}", json);
wxClient.post(url, json);
} | class class_name[name] begin[{]
method[create, return_type[void], modifier[public], parameter[care, openId, text]] begin[{]
local_variable[type[String], url]
local_variable[type[Map], request]
call[request.put, parameter[literal["kf_account"], member[.care]]]
call[request.put, parameter[literal["openid"], member[.openId]]]
if[binary_operation[binary_operation[member[.text], ==, literal[null]], ||, literal[""]]] begin[{]
call[request.put, parameter[literal["text"], member[.text]]]
else begin[{]
None
end[}]
local_variable[type[String], json]
call[logger.debug, parameter[literal["create session: {}"], member[.json]]]
call[wxClient.post, parameter[member[.url], member[.json]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[create] operator[SEP] identifier[String] identifier[care] , identifier[String] identifier[openId] , identifier[String] identifier[text] operator[SEP] {
identifier[String] identifier[url] operator[=] identifier[WxEndpoint] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[request] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[care] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[openId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[text] operator[==] Other[null] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP] {
identifier[request] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[text] operator[SEP] operator[SEP]
}
identifier[String] identifier[json] operator[=] identifier[JsonMapper] operator[SEP] identifier[nonEmptyMapper] operator[SEP] operator[SEP] operator[SEP] identifier[toJson] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[json] operator[SEP] operator[SEP] identifier[wxClient] operator[SEP] identifier[post] operator[SEP] identifier[url] , identifier[json] operator[SEP] operator[SEP]
}
|
public static String encode(Object o) {
Type type = typeOf(o);
return type.encode(o);
} | class class_name[name] begin[{]
method[encode, return_type[type[String]], modifier[public static], parameter[o]] begin[{]
local_variable[type[Type], type]
return[call[type.encode, parameter[member[.o]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[encode] operator[SEP] identifier[Object] identifier[o] operator[SEP] {
identifier[Type] identifier[type] operator[=] identifier[typeOf] operator[SEP] identifier[o] operator[SEP] operator[SEP] Keyword[return] identifier[type] operator[SEP] identifier[encode] operator[SEP] identifier[o] operator[SEP] operator[SEP]
}
|
public Iterator<Entry<K, V>> iterator(int fetchSize, int partitionId, boolean prefetchValues) {
return new ClientMapPartitionIterator<K, V>(this, getContext(), fetchSize, partitionId, prefetchValues);
} | class class_name[name] begin[{]
method[iterator, return_type[type[Iterator]], modifier[public], parameter[fetchSize, partitionId, prefetchValues]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[], member=getContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=fetchSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=partitionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=prefetchValues, 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=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=ClientMapPartitionIterator, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Iterator] operator[<] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] operator[>] identifier[iterator] operator[SEP] Keyword[int] identifier[fetchSize] , Keyword[int] identifier[partitionId] , Keyword[boolean] identifier[prefetchValues] operator[SEP] {
Keyword[return] Keyword[new] identifier[ClientMapPartitionIterator] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] Keyword[this] , identifier[getContext] operator[SEP] operator[SEP] , identifier[fetchSize] , identifier[partitionId] , identifier[prefetchValues] operator[SEP] operator[SEP]
}
|
public static String decode(String value, Charset charset) {
try {
/* there is nothing special between uri and url decoding */
return URLDecoder.decode(value, charset.name());
} catch (UnsupportedEncodingException uee) {
/* since the encoding is not supported, return the original value */
return value;
}
} | class class_name[name] begin[{]
method[decode, return_type[type[String]], modifier[public static], parameter[value, charset]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=charset, selectors=[], type_arguments=None)], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=uee, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[decode] operator[SEP] identifier[String] identifier[value] , identifier[Charset] identifier[charset] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[value] , identifier[charset] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[uee] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
}
|
static <T> Iterable<T> prepend(Collection<T> coll, Iterable<T> rest) {
return (coll.size() == 0) ? rest : new CompoundIterable<T>(coll, rest);
} | class class_name[name] begin[{]
method[prepend, return_type[type[Iterable]], modifier[static], parameter[coll, rest]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=coll, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=ClassCreator(arguments=[MemberReference(member=coll, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rest, 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=CompoundIterable, sub_type=None)), if_true=MemberReference(member=rest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[static] operator[<] identifier[T] operator[>] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[prepend] operator[SEP] identifier[Collection] operator[<] identifier[T] operator[>] identifier[coll] , identifier[Iterable] operator[<] identifier[T] operator[>] identifier[rest] operator[SEP] {
Keyword[return] operator[SEP] identifier[coll] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[?] identifier[rest] operator[:] Keyword[new] identifier[CompoundIterable] operator[<] identifier[T] operator[>] operator[SEP] identifier[coll] , identifier[rest] operator[SEP] operator[SEP]
}
|
public static <T> Retryer<T> newInstance(Config config) {
config = config.withFallback(DEFAULTS);
RetryType type = RetryType.valueOf(config.getString(RETRY_TYPE).toUpperCase());
switch (type) {
case EXPONENTIAL:
return newExponentialRetryer(config);
case FIXED:
return newFixedRetryer(config);
default:
throw new IllegalArgumentException(type + " is not supported");
}
} | class class_name[name] begin[{]
method[newInstance, return_type[type[Retryer]], modifier[public static], parameter[config]] begin[{]
assign[member[.config], call[config.withFallback, parameter[member[.DEFAULTS]]]]
local_variable[type[RetryType], type]
SwitchStatement(cases=[SwitchStatementCase(case=['EXPONENTIAL'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newExponentialRetryer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['FIXED'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newFixedRetryer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is 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)])], expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Retryer] operator[<] identifier[T] operator[>] identifier[newInstance] operator[SEP] identifier[Config] identifier[config] operator[SEP] {
identifier[config] operator[=] identifier[config] operator[SEP] identifier[withFallback] operator[SEP] identifier[DEFAULTS] operator[SEP] operator[SEP] identifier[RetryType] identifier[type] operator[=] identifier[RetryType] operator[SEP] identifier[valueOf] operator[SEP] identifier[config] operator[SEP] identifier[getString] operator[SEP] identifier[RETRY_TYPE] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[EXPONENTIAL] operator[:] Keyword[return] identifier[newExponentialRetryer] operator[SEP] identifier[config] operator[SEP] operator[SEP] Keyword[case] identifier[FIXED] operator[:] Keyword[return] identifier[newFixedRetryer] operator[SEP] identifier[config] operator[SEP] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[type] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
private void checkJodaConstructor3() {
int COUNT = COUNT_SLOW;
DateTime dt = new DateTime(1972, 10, 1, 0, 0, 0, 0,
GJChronology.getInstance());
for (int i = 0; i < AVERAGE; i++) {
start("Joda", "new(YMD)");
for (int j = 0; j < COUNT; j++) {
dt = new DateTime(1972, 10, 1, 0, 0, 0, 0,
GJChronology.getInstance());
if (dt == null) {System.out.println("Anti optimise");}
}
end(COUNT);
}
} | class class_name[name] begin[{]
method[checkJodaConstructor3, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[int], COUNT]
local_variable[type[DateTime], dt]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Joda"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="new(YMD)")], member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=dt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1972), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MethodInvocation(arguments=[], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=GJChronology, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DateTime, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=dt, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Anti optimise")], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=COUNT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=COUNT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=end, 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=MemberReference(member=AVERAGE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[checkJodaConstructor3] operator[SEP] operator[SEP] {
Keyword[int] identifier[COUNT] operator[=] identifier[COUNT_SLOW] operator[SEP] identifier[DateTime] identifier[dt] operator[=] Keyword[new] identifier[DateTime] operator[SEP] Other[1972] , Other[10] , Other[1] , Other[0] , Other[0] , Other[0] , Other[0] , identifier[GJChronology] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[AVERAGE] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[start] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[COUNT] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[dt] operator[=] Keyword[new] identifier[DateTime] operator[SEP] Other[1972] , Other[10] , Other[1] , Other[0] , Other[0] , Other[0] , Other[0] , identifier[GJChronology] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dt] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[end] operator[SEP] identifier[COUNT] operator[SEP] operator[SEP]
}
}
|
@RequestMapping(value = "globals", method = RequestMethod.GET)
public Resources<GlobalPermission> getGlobalPermissions() {
return Resources.of(
accountService.getGlobalPermissions(),
uri(on(PermissionController.class).getGlobalPermissions())
).with("_globalRoles", uri(on(PermissionController.class).getGlobalRoles()));
} | class class_name[name] begin[{]
method[getGlobalPermissions, return_type[type[Resources]], modifier[public], parameter[]] begin[{]
return[call[Resources.of, parameter[call[accountService.getGlobalPermissions, parameter[]], call[.uri, parameter[call[.on, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PermissionController, sub_type=None))]]]]]]]
end[}]
END[}] | annotation[@] identifier[RequestMapping] operator[SEP] identifier[value] operator[=] literal[String] , identifier[method] operator[=] identifier[RequestMethod] operator[SEP] identifier[GET] operator[SEP] Keyword[public] identifier[Resources] operator[<] identifier[GlobalPermission] operator[>] identifier[getGlobalPermissions] operator[SEP] operator[SEP] {
Keyword[return] identifier[Resources] operator[SEP] identifier[of] operator[SEP] identifier[accountService] operator[SEP] identifier[getGlobalPermissions] operator[SEP] operator[SEP] , identifier[uri] operator[SEP] identifier[on] operator[SEP] identifier[PermissionController] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getGlobalPermissions] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[with] operator[SEP] literal[String] , identifier[uri] operator[SEP] identifier[on] operator[SEP] identifier[PermissionController] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getGlobalRoles] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean isLocaleIndependent() {
CmsFile file = getFile();
if (CmsResourceTypeXmlContainerPage.isContainerPage(file)
|| OpenCms.getResourceManager().matchResourceType(
CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME,
file.getTypeId())
|| OpenCms.getResourceManager().matchResourceType(
CmsResourceTypeXmlContainerPage.INHERIT_CONTAINER_CONFIG_TYPE_NAME,
file.getTypeId())) {
return true;
}
try {
I_CmsResourceType resourceType = OpenCms.getResourceManager().getResourceType(file);
if ((resourceType instanceof CmsResourceTypeLocaleIndependentXmlContent)
|| (resourceType instanceof CmsResourceTypeXmlAdeConfiguration)) {
return true;
}
} catch (Exception e) {
// ignore
}
return false;
} | class class_name[name] begin[{]
method[isLocaleIndependent, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[CmsFile], file]
if[binary_operation[binary_operation[call[CmsResourceTypeXmlContainerPage.isContainerPage, parameter[member[.file]]], ||, call[OpenCms.getResourceManager, parameter[]]], ||, call[OpenCms.getResourceManager, parameter[]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResourceManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResourceType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=resourceType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=I_CmsResourceType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=resourceType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CmsResourceTypeLocaleIndependentXmlContent, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=MemberReference(member=resourceType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CmsResourceTypeXmlAdeConfiguration, sub_type=None), operator=instanceof), operator=||), 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)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isLocaleIndependent] operator[SEP] operator[SEP] {
identifier[CmsFile] identifier[file] operator[=] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CmsResourceTypeXmlContainerPage] operator[SEP] identifier[isContainerPage] operator[SEP] identifier[file] operator[SEP] operator[||] identifier[OpenCms] operator[SEP] identifier[getResourceManager] operator[SEP] operator[SEP] operator[SEP] identifier[matchResourceType] operator[SEP] identifier[CmsResourceTypeXmlContainerPage] operator[SEP] identifier[GROUP_CONTAINER_TYPE_NAME] , identifier[file] operator[SEP] identifier[getTypeId] operator[SEP] operator[SEP] operator[SEP] operator[||] identifier[OpenCms] operator[SEP] identifier[getResourceManager] operator[SEP] operator[SEP] operator[SEP] identifier[matchResourceType] operator[SEP] identifier[CmsResourceTypeXmlContainerPage] operator[SEP] identifier[INHERIT_CONTAINER_CONFIG_TYPE_NAME] , identifier[file] operator[SEP] identifier[getTypeId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[try] {
identifier[I_CmsResourceType] identifier[resourceType] operator[=] identifier[OpenCms] operator[SEP] identifier[getResourceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getResourceType] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[resourceType] Keyword[instanceof] identifier[CmsResourceTypeLocaleIndependentXmlContent] operator[SEP] operator[||] operator[SEP] identifier[resourceType] Keyword[instanceof] identifier[CmsResourceTypeXmlAdeConfiguration] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:52:47+02:00", comments = "JAXB RI v2.2.11")
public void setStellplaetze(JAXBElement<Object> value) {
this.stellplaetze = value;
} | class class_name[name] begin[{]
method[setStellplaetze, return_type[void], modifier[public], parameter[value]] begin[{]
assign[THIS[member[None.stellplaetze]], member[.value]]
end[}]
END[}] | annotation[@] identifier[Generated] operator[SEP] identifier[value] operator[=] literal[String] , identifier[date] operator[=] literal[String] , identifier[comments] operator[=] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[setStellplaetze] operator[SEP] identifier[JAXBElement] operator[<] identifier[Object] operator[>] identifier[value] operator[SEP] {
Keyword[this] operator[SEP] identifier[stellplaetze] operator[=] identifier[value] operator[SEP]
}
|
public Iterator<IExecutionBridge> getJobsPage(final int _start,
final int _size)
{
final int min = Math.min(_size, this.executionBridges.size());
return new ArrayList<>(this.executionBridges.subList(_start, min)).iterator();
} | class class_name[name] begin[{]
method[getJobsPage, return_type[type[Iterator]], modifier[public], parameter[_start, _size]] begin[{]
local_variable[type[int], min]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=executionBridges, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=_start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=subList, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=iterator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Iterator] operator[<] identifier[IExecutionBridge] operator[>] identifier[getJobsPage] operator[SEP] Keyword[final] Keyword[int] identifier[_start] , Keyword[final] Keyword[int] identifier[_size] operator[SEP] {
Keyword[final] Keyword[int] identifier[min] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[_size] , Keyword[this] operator[SEP] identifier[executionBridges] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] Keyword[this] operator[SEP] identifier[executionBridges] operator[SEP] identifier[subList] operator[SEP] identifier[_start] , identifier[min] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP]
}
|
public void warn(Throwable throwable, String msg, Object[] argArray) {
logIfEnabled(Level.WARNING, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);
} | class class_name[name] begin[{]
method[warn, return_type[void], modifier[public], parameter[throwable, msg, argArray]] begin[{]
call[.logIfEnabled, parameter[member[Level.WARNING], member[.throwable], member[.msg], member[.UNKNOWN_ARG], member[.UNKNOWN_ARG], member[.UNKNOWN_ARG], member[.argArray]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[warn] operator[SEP] identifier[Throwable] identifier[throwable] , identifier[String] identifier[msg] , identifier[Object] operator[SEP] operator[SEP] identifier[argArray] operator[SEP] {
identifier[logIfEnabled] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] , identifier[throwable] , identifier[msg] , identifier[UNKNOWN_ARG] , identifier[UNKNOWN_ARG] , identifier[UNKNOWN_ARG] , identifier[argArray] operator[SEP] operator[SEP]
}
|
public static double getAngle(double xDiff, double yDiff) {
double angle = 0;
// logger.debug("getAngle->xDiff: " + xDiff);
// logger.debug("getAngle->yDiff: " + yDiff);
if (xDiff >= 0 && yDiff >= 0) {
angle = Math.atan(yDiff / xDiff);
} else if (xDiff < 0 && yDiff >= 0) {
angle = Math.PI + Math.atan(yDiff / xDiff);
} else if (xDiff < 0 && yDiff < 0) {
angle = Math.PI + Math.atan(yDiff / xDiff);
} else if (xDiff >= 0 && yDiff < 0) {
angle = 2 * Math.PI + Math.atan(yDiff / xDiff);
}
return angle;
} | class class_name[name] begin[{]
method[getAngle, return_type[type[double]], modifier[public static], parameter[xDiff, yDiff]] begin[{]
local_variable[type[double], angle]
if[binary_operation[binary_operation[member[.xDiff], >=, literal[0]], &&, binary_operation[member[.yDiff], >=, literal[0]]]] begin[{]
assign[member[.angle], call[Math.atan, parameter[binary_operation[member[.yDiff], /, member[.xDiff]]]]]
else begin[{]
if[binary_operation[binary_operation[member[.xDiff], <, literal[0]], &&, binary_operation[member[.yDiff], >=, literal[0]]]] begin[{]
assign[member[.angle], binary_operation[member[Math.PI], +, call[Math.atan, parameter[binary_operation[member[.yDiff], /, member[.xDiff]]]]]]
else begin[{]
if[binary_operation[binary_operation[member[.xDiff], <, literal[0]], &&, binary_operation[member[.yDiff], <, literal[0]]]] begin[{]
assign[member[.angle], binary_operation[member[Math.PI], +, call[Math.atan, parameter[binary_operation[member[.yDiff], /, member[.xDiff]]]]]]
else begin[{]
if[binary_operation[binary_operation[member[.xDiff], >=, literal[0]], &&, binary_operation[member[.yDiff], <, literal[0]]]] begin[{]
assign[member[.angle], binary_operation[binary_operation[literal[2], *, member[Math.PI]], +, call[Math.atan, parameter[binary_operation[member[.yDiff], /, member[.xDiff]]]]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
return[member[.angle]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[getAngle] operator[SEP] Keyword[double] identifier[xDiff] , Keyword[double] identifier[yDiff] operator[SEP] {
Keyword[double] identifier[angle] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[xDiff] operator[>=] Other[0] operator[&&] identifier[yDiff] operator[>=] Other[0] operator[SEP] {
identifier[angle] operator[=] identifier[Math] operator[SEP] identifier[atan] operator[SEP] identifier[yDiff] operator[/] identifier[xDiff] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[xDiff] operator[<] Other[0] operator[&&] identifier[yDiff] operator[>=] Other[0] operator[SEP] {
identifier[angle] operator[=] identifier[Math] operator[SEP] identifier[PI] operator[+] identifier[Math] operator[SEP] identifier[atan] operator[SEP] identifier[yDiff] operator[/] identifier[xDiff] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[xDiff] operator[<] Other[0] operator[&&] identifier[yDiff] operator[<] Other[0] operator[SEP] {
identifier[angle] operator[=] identifier[Math] operator[SEP] identifier[PI] operator[+] identifier[Math] operator[SEP] identifier[atan] operator[SEP] identifier[yDiff] operator[/] identifier[xDiff] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[xDiff] operator[>=] Other[0] operator[&&] identifier[yDiff] operator[<] Other[0] operator[SEP] {
identifier[angle] operator[=] Other[2] operator[*] identifier[Math] operator[SEP] identifier[PI] operator[+] identifier[Math] operator[SEP] identifier[atan] operator[SEP] identifier[yDiff] operator[/] identifier[xDiff] operator[SEP] operator[SEP]
}
Keyword[return] identifier[angle] operator[SEP]
}
|
@Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
parentSbbEntityID = (SbbEntityID) in.readObject();
parentChildRelation = in.readUTF();
childID = in.readUTF();
} | class class_name[name] begin[{]
method[readExternal, return_type[void], modifier[public], parameter[in]] begin[{]
assign[member[.parentSbbEntityID], Cast(expression=MethodInvocation(arguments=[], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SbbEntityID, sub_type=None))]
assign[member[.parentChildRelation], call[in.readUTF, parameter[]]]
assign[member[.childID], call[in.readUTF, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[readExternal] operator[SEP] identifier[ObjectInput] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ClassNotFoundException] {
identifier[parentSbbEntityID] operator[=] operator[SEP] identifier[SbbEntityID] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP] identifier[parentChildRelation] operator[=] identifier[in] operator[SEP] identifier[readUTF] operator[SEP] operator[SEP] operator[SEP] identifier[childID] operator[=] identifier[in] operator[SEP] identifier[readUTF] operator[SEP] operator[SEP] operator[SEP]
}
|
public GetAuthorizersResult withItems(Authorizer... items) {
if (this.items == null) {
setItems(new java.util.ArrayList<Authorizer>(items.length));
}
for (Authorizer ele : items) {
this.items.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withItems, return_type[type[GetAuthorizersResult]], modifier[public], parameter[items]] begin[{]
if[binary_operation[THIS[member[None.items]], ==, literal[null]]] begin[{]
call[.setItems, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=items, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Authorizer, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=items, 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=items, 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=Authorizer, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[GetAuthorizersResult] identifier[withItems] operator[SEP] identifier[Authorizer] operator[...] identifier[items] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[items] operator[==] Other[null] operator[SEP] {
identifier[setItems] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[Authorizer] operator[>] operator[SEP] identifier[items] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Authorizer] identifier[ele] operator[:] identifier[items] operator[SEP] {
Keyword[this] operator[SEP] identifier[items] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public Long getRecordIdFromObject(final UUID objectId, final ObjectType objectType, final TenantContext context) {
try {
if (objectBelongsToTheRightTenant(objectId, objectType, context)) {
return nonEntityDao.retrieveRecordIdFromObject(objectId, objectType, recordIdCacheController);
} else {
return null;
}
} catch (final ObjectDoesNotExist e) {
return null;
}
} | class class_name[name] begin[{]
method[getRecordIdFromObject, return_type[type[Long]], modifier[public], parameter[objectId, objectType, context]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=objectId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=objectType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=objectBelongsToTheRightTenant, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=objectId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=objectType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recordIdCacheController, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=retrieveRecordIdFromObject, postfix_operators=[], prefix_operators=[], qualifier=nonEntityDao, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ObjectDoesNotExist']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Long] identifier[getRecordIdFromObject] operator[SEP] Keyword[final] identifier[UUID] identifier[objectId] , Keyword[final] identifier[ObjectType] identifier[objectType] , Keyword[final] identifier[TenantContext] identifier[context] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[objectBelongsToTheRightTenant] operator[SEP] identifier[objectId] , identifier[objectType] , identifier[context] operator[SEP] operator[SEP] {
Keyword[return] identifier[nonEntityDao] operator[SEP] identifier[retrieveRecordIdFromObject] operator[SEP] identifier[objectId] , identifier[objectType] , identifier[recordIdCacheController] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[ObjectDoesNotExist] identifier[e] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public static <T> Iterable<T> skip(Iterable<T> iterable, int n)
{
return new SkipIterable<T>(iterable, n);
} | class class_name[name] begin[{]
method[skip, return_type[type[Iterable]], modifier[public static], parameter[iterable, n]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=iterable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=n, 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=SkipIterable, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[skip] operator[SEP] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[iterable] , Keyword[int] identifier[n] operator[SEP] {
Keyword[return] Keyword[new] identifier[SkipIterable] operator[<] identifier[T] operator[>] operator[SEP] identifier[iterable] , identifier[n] operator[SEP] operator[SEP]
}
|
private void setupScanner(Scanner scanner, Resource resource) {
if (resource.getIncludes() == null || resource.getIncludes().isEmpty()) {
scanner.setIncludes(DEFAULT_FILE_EXTENSIONS);
} else {
scanner.setIncludes(resource.getIncludes().toArray(new String[] {}));
}
if (resource.getExcludes() == null || resource.getExcludes().isEmpty()) {
scanner.setExcludes(IGNORED_FOLDERS_AND_FILES);
} else {
scanner.setExcludes(mergeAndConvert(resource.getExcludes(), IGNORED_FOLDERS_AND_FILES));
}
// adds exclusions like SVN or GIT files
scanner.addDefaultExcludes();
} | class class_name[name] begin[{]
method[setupScanner, return_type[void], modifier[private], parameter[scanner, resource]] begin[{]
if[binary_operation[binary_operation[call[resource.getIncludes, parameter[]], ==, literal[null]], ||, call[resource.getIncludes, parameter[]]]] begin[{]
call[scanner.setIncludes, parameter[member[.DEFAULT_FILE_EXTENSIONS]]]
else begin[{]
call[scanner.setIncludes, parameter[call[resource.getIncludes, parameter[]]]]
end[}]
if[binary_operation[binary_operation[call[resource.getExcludes, parameter[]], ==, literal[null]], ||, call[resource.getExcludes, parameter[]]]] begin[{]
call[scanner.setExcludes, parameter[member[.IGNORED_FOLDERS_AND_FILES]]]
else begin[{]
call[scanner.setExcludes, parameter[call[.mergeAndConvert, parameter[call[resource.getExcludes, parameter[]], member[.IGNORED_FOLDERS_AND_FILES]]]]]
end[}]
call[scanner.addDefaultExcludes, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setupScanner] operator[SEP] identifier[Scanner] identifier[scanner] , identifier[Resource] identifier[resource] operator[SEP] {
Keyword[if] operator[SEP] identifier[resource] operator[SEP] identifier[getIncludes] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[resource] operator[SEP] identifier[getIncludes] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[scanner] operator[SEP] identifier[setIncludes] operator[SEP] identifier[DEFAULT_FILE_EXTENSIONS] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[scanner] operator[SEP] identifier[setIncludes] operator[SEP] identifier[resource] operator[SEP] identifier[getIncludes] operator[SEP] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
} operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[resource] operator[SEP] identifier[getExcludes] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[resource] operator[SEP] identifier[getExcludes] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[scanner] operator[SEP] identifier[setExcludes] operator[SEP] identifier[IGNORED_FOLDERS_AND_FILES] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[scanner] operator[SEP] identifier[setExcludes] operator[SEP] identifier[mergeAndConvert] operator[SEP] identifier[resource] operator[SEP] identifier[getExcludes] operator[SEP] operator[SEP] , identifier[IGNORED_FOLDERS_AND_FILES] operator[SEP] operator[SEP] operator[SEP]
}
identifier[scanner] operator[SEP] identifier[addDefaultExcludes] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public int compareTo(YearWeek other) {
int cmp = (year - other.year);
if (cmp == 0) {
cmp = (week - other.week);
}
return cmp;
} | class class_name[name] begin[{]
method[compareTo, return_type[type[int]], modifier[public], parameter[other]] begin[{]
local_variable[type[int], cmp]
if[binary_operation[member[.cmp], ==, literal[0]]] begin[{]
assign[member[.cmp], binary_operation[member[.week], -, member[other.week]]]
else begin[{]
None
end[}]
return[member[.cmp]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compareTo] operator[SEP] identifier[YearWeek] identifier[other] operator[SEP] {
Keyword[int] identifier[cmp] operator[=] operator[SEP] identifier[year] operator[-] identifier[other] operator[SEP] identifier[year] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmp] operator[==] Other[0] operator[SEP] {
identifier[cmp] operator[=] operator[SEP] identifier[week] operator[-] identifier[other] operator[SEP] identifier[week] operator[SEP] operator[SEP]
}
Keyword[return] identifier[cmp] operator[SEP]
}
|
public static String getName(String resource) {
if ("/".equals(resource)) {
return "/";
}
// remove the last char, for a folder this will be "/", for a file it does not matter
String parent = (resource.substring(0, resource.length() - 1));
// now as the name does not end with "/", check for the last "/" which is the parent folder name
return resource.substring(parent.lastIndexOf('/') + 1);
} | class class_name[name] begin[{]
method[getName, return_type[type[String]], modifier[public static], parameter[resource]] begin[{]
if[literal["/"]] begin[{]
return[literal["/"]]
else begin[{]
None
end[}]
local_variable[type[String], parent]
return[call[resource.substring, parameter[binary_operation[call[parent.lastIndexOf, parameter[literal['/']]], +, literal[1]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getName] operator[SEP] identifier[String] identifier[resource] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[resource] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
identifier[String] identifier[parent] operator[=] operator[SEP] identifier[resource] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[resource] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[resource] operator[SEP] identifier[substring] operator[SEP] identifier[parent] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP]
}
|
public Request browseFromAsync(final @NonNull String cursor, @Nullable CompletionHandler completionHandler) {
return browseFromAsync(cursor, /* requestOptions: */ null, completionHandler);
} | class class_name[name] begin[{]
method[browseFromAsync, return_type[type[Request]], modifier[public], parameter[cursor, completionHandler]] begin[{]
return[call[.browseFromAsync, parameter[member[.cursor], literal[null], member[.completionHandler]]]]
end[}]
END[}] | Keyword[public] identifier[Request] identifier[browseFromAsync] operator[SEP] Keyword[final] annotation[@] identifier[NonNull] identifier[String] identifier[cursor] , annotation[@] identifier[Nullable] identifier[CompletionHandler] identifier[completionHandler] operator[SEP] {
Keyword[return] identifier[browseFromAsync] operator[SEP] identifier[cursor] , Other[null] , identifier[completionHandler] operator[SEP] operator[SEP]
}
|
public CmsI18nInfo getI18nInfo(HttpServletRequest req, CmsUser user, CmsProject project, String resource) {
CmsI18nInfo i18nInfo = null;
// check if this is a request against a Workplace folder
if (OpenCms.getSiteManager().isWorkplaceRequest(req)) {
// The list of configured localized workplace folders
List<String> wpLocalizedFolders = OpenCms.getWorkplaceManager().getLocalizedFolders();
for (int i = wpLocalizedFolders.size() - 1; i >= 0; i--) {
if (resource.startsWith(wpLocalizedFolders.get(i))) {
// use the workplace locale handler for this resource
i18nInfo = OpenCms.getWorkplaceManager().getI18nInfo(req, user, project, resource);
break;
}
}
}
if (i18nInfo == null) {
// use default locale handler
i18nInfo = m_localeHandler.getI18nInfo(req, user, project, resource);
}
// check the request for special parameters overriding the locale handler
Locale locale = null;
String encoding = null;
if (req != null) {
String localeParam = req.getParameter(CmsLocaleManager.PARAMETER_LOCALE);
// check request for parameters
if (localeParam != null) {
// "__locale" parameter found in request
locale = CmsLocaleManager.getLocale(localeParam);
}
// check for "__encoding" parameter in request
encoding = req.getParameter(CmsLocaleManager.PARAMETER_ENCODING);
}
// merge values from request with values from locale handler
if (locale == null) {
locale = i18nInfo.getLocale();
}
if (encoding == null) {
encoding = i18nInfo.getEncoding();
}
// still some values might be "null"
if (locale == null) {
locale = getDefaultLocale();
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_LOCALE_NOT_FOUND_1, locale));
}
}
if (encoding == null) {
encoding = OpenCms.getSystemInfo().getDefaultEncoding();
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_ENCODING_NOT_FOUND_1, encoding));
}
}
// return the merged values
return new CmsI18nInfo(locale, encoding);
} | class class_name[name] begin[{]
method[getI18nInfo, return_type[type[CmsI18nInfo]], modifier[public], parameter[req, user, project, resource]] begin[{]
local_variable[type[CmsI18nInfo], i18nInfo]
if[call[OpenCms.getSiteManager, parameter[]]] begin[{]
local_variable[type[List], wpLocalizedFolders]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=wpLocalizedFolders, selectors=[], type_arguments=None)], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=i18nInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getWorkplaceManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MemberReference(member=req, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=project, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getI18nInfo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=wpLocalizedFolders, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), 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[}]
if[binary_operation[member[.i18nInfo], ==, literal[null]]] begin[{]
assign[member[.i18nInfo], call[m_localeHandler.getI18nInfo, parameter[member[.req], member[.user], member[.project], member[.resource]]]]
else begin[{]
None
end[}]
local_variable[type[Locale], locale]
local_variable[type[String], encoding]
if[binary_operation[member[.req], !=, literal[null]]] begin[{]
local_variable[type[String], localeParam]
if[binary_operation[member[.localeParam], !=, literal[null]]] begin[{]
assign[member[.locale], call[CmsLocaleManager.getLocale, parameter[member[.localeParam]]]]
else begin[{]
None
end[}]
assign[member[.encoding], call[req.getParameter, parameter[member[CmsLocaleManager.PARAMETER_ENCODING]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.locale], ==, literal[null]]] begin[{]
assign[member[.locale], call[i18nInfo.getLocale, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[member[.encoding], ==, literal[null]]] begin[{]
assign[member[.encoding], call[i18nInfo.getEncoding, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[member[.locale], ==, literal[null]]] begin[{]
assign[member[.locale], call[.getDefaultLocale, parameter[]]]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[call[Messages.get, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.encoding], ==, literal[null]]] begin[{]
assign[member[.encoding], call[OpenCms.getSystemInfo, parameter[]]]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[call[Messages.get, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=locale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=encoding, 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=CmsI18nInfo, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[CmsI18nInfo] identifier[getI18nInfo] operator[SEP] identifier[HttpServletRequest] identifier[req] , identifier[CmsUser] identifier[user] , identifier[CmsProject] identifier[project] , identifier[String] identifier[resource] operator[SEP] {
identifier[CmsI18nInfo] identifier[i18nInfo] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getSiteManager] operator[SEP] operator[SEP] operator[SEP] identifier[isWorkplaceRequest] operator[SEP] identifier[req] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[wpLocalizedFolders] operator[=] identifier[OpenCms] operator[SEP] identifier[getWorkplaceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getLocalizedFolders] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[wpLocalizedFolders] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[i] operator[>=] Other[0] operator[SEP] identifier[i] operator[--] operator[SEP] {
Keyword[if] operator[SEP] identifier[resource] operator[SEP] identifier[startsWith] operator[SEP] identifier[wpLocalizedFolders] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
identifier[i18nInfo] operator[=] identifier[OpenCms] operator[SEP] identifier[getWorkplaceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getI18nInfo] operator[SEP] identifier[req] , identifier[user] , identifier[project] , identifier[resource] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[i18nInfo] operator[==] Other[null] operator[SEP] {
identifier[i18nInfo] operator[=] identifier[m_localeHandler] operator[SEP] identifier[getI18nInfo] operator[SEP] identifier[req] , identifier[user] , identifier[project] , identifier[resource] operator[SEP] operator[SEP]
}
identifier[Locale] identifier[locale] operator[=] Other[null] operator[SEP] identifier[String] identifier[encoding] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[req] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[localeParam] operator[=] identifier[req] operator[SEP] identifier[getParameter] operator[SEP] identifier[CmsLocaleManager] operator[SEP] identifier[PARAMETER_LOCALE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[localeParam] operator[!=] Other[null] operator[SEP] {
identifier[locale] operator[=] identifier[CmsLocaleManager] operator[SEP] identifier[getLocale] operator[SEP] identifier[localeParam] operator[SEP] operator[SEP]
}
identifier[encoding] operator[=] identifier[req] operator[SEP] identifier[getParameter] operator[SEP] identifier[CmsLocaleManager] operator[SEP] identifier[PARAMETER_ENCODING] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[locale] operator[==] Other[null] operator[SEP] {
identifier[locale] operator[=] identifier[i18nInfo] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[encoding] operator[==] Other[null] operator[SEP] {
identifier[encoding] operator[=] identifier[i18nInfo] operator[SEP] identifier[getEncoding] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[locale] operator[==] Other[null] operator[SEP] {
identifier[locale] operator[=] identifier[getDefaultLocale] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[LOG_LOCALE_NOT_FOUND_1] , identifier[locale] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[encoding] operator[==] Other[null] operator[SEP] {
identifier[encoding] operator[=] identifier[OpenCms] operator[SEP] identifier[getSystemInfo] operator[SEP] operator[SEP] operator[SEP] identifier[getDefaultEncoding] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[LOG_ENCODING_NOT_FOUND_1] , identifier[encoding] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[CmsI18nInfo] operator[SEP] identifier[locale] , identifier[encoding] operator[SEP] operator[SEP]
}
|
private void compileDatabaseNode(
VoltCompilerReader cannonicalDDLIfAny,
Database previousDBIfAny,
final List<VoltCompilerReader> ddlReaderList,
final InMemoryJarfile jarOutput)
throws VoltCompilerException
{
final ArrayList<Class<?>> classDependencies = new ArrayList<>();
final VoltDDLElementTracker voltDdlTracker = new VoltDDLElementTracker(this);
Database db = initCatalogDatabase(m_catalog);
// shutdown and make a new hsqldb
HSQLInterface hsql = HSQLInterface.loadHsqldb(ParameterizationInfo.getParamStateManager());
compileDatabase(db, hsql, voltDdlTracker, cannonicalDDLIfAny, previousDBIfAny, ddlReaderList, classDependencies,
DdlProceduresToLoad.ALL_DDL_PROCEDURES, jarOutput);
} | class class_name[name] begin[{]
method[compileDatabaseNode, return_type[void], modifier[private], parameter[cannonicalDDLIfAny, previousDBIfAny, ddlReaderList, jarOutput]] begin[{]
local_variable[type[ArrayList], classDependencies]
local_variable[type[VoltDDLElementTracker], voltDdlTracker]
local_variable[type[Database], db]
local_variable[type[HSQLInterface], hsql]
call[.compileDatabase, parameter[member[.db], member[.hsql], member[.voltDdlTracker], member[.cannonicalDDLIfAny], member[.previousDBIfAny], member[.ddlReaderList], member[.classDependencies], member[DdlProceduresToLoad.ALL_DDL_PROCEDURES], member[.jarOutput]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[compileDatabaseNode] operator[SEP] identifier[VoltCompilerReader] identifier[cannonicalDDLIfAny] , identifier[Database] identifier[previousDBIfAny] , Keyword[final] identifier[List] operator[<] identifier[VoltCompilerReader] operator[>] identifier[ddlReaderList] , Keyword[final] identifier[InMemoryJarfile] identifier[jarOutput] operator[SEP] Keyword[throws] identifier[VoltCompilerException] {
Keyword[final] identifier[ArrayList] operator[<] identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[classDependencies] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[VoltDDLElementTracker] identifier[voltDdlTracker] operator[=] Keyword[new] identifier[VoltDDLElementTracker] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[Database] identifier[db] operator[=] identifier[initCatalogDatabase] operator[SEP] identifier[m_catalog] operator[SEP] operator[SEP] identifier[HSQLInterface] identifier[hsql] operator[=] identifier[HSQLInterface] operator[SEP] identifier[loadHsqldb] operator[SEP] identifier[ParameterizationInfo] operator[SEP] identifier[getParamStateManager] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[compileDatabase] operator[SEP] identifier[db] , identifier[hsql] , identifier[voltDdlTracker] , identifier[cannonicalDDLIfAny] , identifier[previousDBIfAny] , identifier[ddlReaderList] , identifier[classDependencies] , identifier[DdlProceduresToLoad] operator[SEP] identifier[ALL_DDL_PROCEDURES] , identifier[jarOutput] operator[SEP] operator[SEP]
}
|
long calculateTruncationOffset(SegmentProperties info, long highestCopiedOffset) {
long truncateOffset = -1;
if (highestCopiedOffset > 0) {
// Due to the nature of compaction (all entries are copied in order of their original versions), if we encounter
// any copied Table Entries then the highest explicit version defined on any of them is where we can truncate.
truncateOffset = highestCopiedOffset;
} else if (this.indexReader.getLastIndexedOffset(info) >= info.getLength()) {
// Did not encounter any copied entries. If we were able to index the whole segment, then we should be safe
// to truncate at wherever the compaction last finished.
truncateOffset = this.indexReader.getCompactionOffset(info);
}
if (truncateOffset <= info.getStartOffset()) {
// The segment is already truncated at the compaction offset; no need for more.
truncateOffset = -1;
}
return truncateOffset;
} | class class_name[name] begin[{]
method[calculateTruncationOffset, return_type[type[long]], modifier[default], parameter[info, highestCopiedOffset]] begin[{]
local_variable[type[long], truncateOffset]
if[binary_operation[member[.highestCopiedOffset], >, literal[0]]] begin[{]
assign[member[.truncateOffset], member[.highestCopiedOffset]]
else begin[{]
if[binary_operation[THIS[member[None.indexReader]call[None.getLastIndexedOffset, parameter[member[.info]]]], >=, call[info.getLength, parameter[]]]] begin[{]
assign[member[.truncateOffset], THIS[member[None.indexReader]call[None.getCompactionOffset, parameter[member[.info]]]]]
else begin[{]
None
end[}]
end[}]
if[binary_operation[member[.truncateOffset], <=, call[info.getStartOffset, parameter[]]]] begin[{]
assign[member[.truncateOffset], literal[1]]
else begin[{]
None
end[}]
return[member[.truncateOffset]]
end[}]
END[}] | Keyword[long] identifier[calculateTruncationOffset] operator[SEP] identifier[SegmentProperties] identifier[info] , Keyword[long] identifier[highestCopiedOffset] operator[SEP] {
Keyword[long] identifier[truncateOffset] operator[=] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[highestCopiedOffset] operator[>] Other[0] operator[SEP] {
identifier[truncateOffset] operator[=] identifier[highestCopiedOffset] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[indexReader] operator[SEP] identifier[getLastIndexedOffset] operator[SEP] identifier[info] operator[SEP] operator[>=] identifier[info] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] {
identifier[truncateOffset] operator[=] Keyword[this] operator[SEP] identifier[indexReader] operator[SEP] identifier[getCompactionOffset] operator[SEP] identifier[info] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[truncateOffset] operator[<=] identifier[info] operator[SEP] identifier[getStartOffset] operator[SEP] operator[SEP] operator[SEP] {
identifier[truncateOffset] operator[=] operator[-] Other[1] operator[SEP]
}
Keyword[return] identifier[truncateOffset] operator[SEP]
}
|
public boolean isGroupContainer(CmsObject cms) throws CmsException {
if (m_resource == null) {
initResource(cms);
}
return CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME.equals(
OpenCms.getResourceManager().getResourceType(m_resource).getTypeName());
} | class class_name[name] begin[{]
method[isGroupContainer, return_type[type[boolean]], modifier[public], parameter[cms]] begin[{]
if[binary_operation[member[.m_resource], ==, literal[null]]] begin[{]
call[.initResource, parameter[member[.cms]]]
else begin[{]
None
end[}]
return[call[CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME.equals, parameter[call[OpenCms.getResourceManager, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isGroupContainer] operator[SEP] identifier[CmsObject] identifier[cms] operator[SEP] Keyword[throws] identifier[CmsException] {
Keyword[if] operator[SEP] identifier[m_resource] operator[==] Other[null] operator[SEP] {
identifier[initResource] operator[SEP] identifier[cms] operator[SEP] operator[SEP]
}
Keyword[return] identifier[CmsResourceTypeXmlContainerPage] operator[SEP] identifier[GROUP_CONTAINER_TYPE_NAME] operator[SEP] identifier[equals] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getResourceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getResourceType] operator[SEP] identifier[m_resource] operator[SEP] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private String buildUrlName(final String host, final String port) {
try {
return "tango://" + TangoUrl.getCanonicalName(host) + ":" + port;
}
catch (DevFailed e) {
return "tango://" + host + ":" + port;
}
} | class class_name[name] begin[{]
method[buildUrlName, return_type[type[String]], modifier[private], parameter[host, port]] begin[{]
TryStatement(block=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="tango://"), operandr=MethodInvocation(arguments=[MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCanonicalName, postfix_operators=[], prefix_operators=[], qualifier=TangoUrl, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+), operandr=MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="tango://"), operandr=MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+), operandr=MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['DevFailed']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] identifier[String] identifier[buildUrlName] operator[SEP] Keyword[final] identifier[String] identifier[host] , Keyword[final] identifier[String] identifier[port] operator[SEP] {
Keyword[try] {
Keyword[return] literal[String] operator[+] identifier[TangoUrl] operator[SEP] identifier[getCanonicalName] operator[SEP] identifier[host] operator[SEP] operator[+] literal[String] operator[+] identifier[port] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[DevFailed] identifier[e] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[host] operator[+] literal[String] operator[+] identifier[port] operator[SEP]
}
}
|
public static boolean hasAnnotation(final List<AnnotationInstance> annotations, final String annotationClaszName) {
final DotName annotationName = DotName.createSimple(annotationClaszName);
for (final AnnotationInstance annotation : annotations) {
if (annotation.name().equals(annotationName)) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[hasAnnotation, return_type[type[boolean]], modifier[public static], parameter[annotations, annotationClaszName]] begin[{]
local_variable[type[DotName], annotationName]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=annotation, selectors=[MethodInvocation(arguments=[MemberReference(member=annotationName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=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=annotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=annotation)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AnnotationInstance, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[hasAnnotation] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[AnnotationInstance] operator[>] identifier[annotations] , Keyword[final] identifier[String] identifier[annotationClaszName] operator[SEP] {
Keyword[final] identifier[DotName] identifier[annotationName] operator[=] identifier[DotName] operator[SEP] identifier[createSimple] operator[SEP] identifier[annotationClaszName] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[AnnotationInstance] identifier[annotation] operator[:] identifier[annotations] operator[SEP] {
Keyword[if] operator[SEP] identifier[annotation] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[annotationName] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public IfcAddressTypeEnum createIfcAddressTypeEnumFromString(EDataType eDataType, String initialValue) {
IfcAddressTypeEnum result = IfcAddressTypeEnum.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} | class class_name[name] begin[{]
method[createIfcAddressTypeEnumFromString, return_type[type[IfcAddressTypeEnum]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[IfcAddressTypeEnum], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[IfcAddressTypeEnum] identifier[createIfcAddressTypeEnumFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[IfcAddressTypeEnum] identifier[result] operator[=] identifier[IfcAddressTypeEnum] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
void progress(int cur, int max) {
StringBuilder out = new StringBuilder();
if (lastProgress != null) {
char[] back = new char[lastProgress.length()];
Arrays.fill(back, '\b');
out.append(back);
}
String progress =
cur + "/" + (max == -1 ? "?" : "" + max) + " "
+ (max == -1 ? "(??%)"
: "(" + cur * 100 / (max == 0 ? 1 : max) + "%)");
if (cur >= max && max != -1) {
progress += " " + loc("done") + SEPARATOR;
lastProgress = null;
} else {
lastProgress = progress;
}
out.append(progress);
getOutputStream().print(out.toString());
getOutputStream().flush();
} | class class_name[name] begin[{]
method[progress, return_type[void], modifier[default], parameter[cur, max]] begin[{]
local_variable[type[StringBuilder], out]
if[binary_operation[member[.lastProgress], !=, literal[null]]] begin[{]
local_variable[type[char], back]
call[Arrays.fill, parameter[member[.back], literal['\b']]]
call[out.append, parameter[member[.back]]]
else begin[{]
None
end[}]
local_variable[type[String], progress]
if[binary_operation[binary_operation[member[.cur], >=, member[.max]], &&, binary_operation[member[.max], !=, literal[1]]]] begin[{]
assign[member[.progress], binary_operation[binary_operation[literal[" "], +, call[.loc, parameter[literal["done"]]]], +, member[.SEPARATOR]]]
assign[member[.lastProgress], literal[null]]
else begin[{]
assign[member[.lastProgress], member[.progress]]
end[}]
call[out.append, parameter[member[.progress]]]
call[.getOutputStream, parameter[]]
call[.getOutputStream, parameter[]]
end[}]
END[}] | Keyword[void] identifier[progress] operator[SEP] Keyword[int] identifier[cur] , Keyword[int] identifier[max] operator[SEP] {
identifier[StringBuilder] identifier[out] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastProgress] operator[!=] Other[null] operator[SEP] {
Keyword[char] operator[SEP] operator[SEP] identifier[back] operator[=] Keyword[new] Keyword[char] operator[SEP] identifier[lastProgress] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[fill] operator[SEP] identifier[back] , literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[back] operator[SEP] operator[SEP]
}
identifier[String] identifier[progress] operator[=] identifier[cur] operator[+] literal[String] operator[+] operator[SEP] identifier[max] operator[==] operator[-] Other[1] operator[?] literal[String] operator[:] literal[String] operator[+] identifier[max] operator[SEP] operator[+] literal[String] operator[+] operator[SEP] identifier[max] operator[==] operator[-] Other[1] operator[?] literal[String] operator[:] literal[String] operator[+] identifier[cur] operator[*] Other[100] operator[/] operator[SEP] identifier[max] operator[==] Other[0] operator[?] Other[1] operator[:] identifier[max] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cur] operator[>=] identifier[max] operator[&&] identifier[max] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[progress] operator[+=] literal[String] operator[+] identifier[loc] operator[SEP] literal[String] operator[SEP] operator[+] identifier[SEPARATOR] operator[SEP] identifier[lastProgress] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
identifier[lastProgress] operator[=] identifier[progress] operator[SEP]
}
identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[progress] operator[SEP] operator[SEP] identifier[getOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[print] operator[SEP] identifier[out] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
|
private void handleMsgIdCall(FunctionNode fn, MsgFallbackGroupNode msgNode) {
ExprNode msgIdNode;
long primaryMsgId = MsgUtils.computeMsgIdForDualFormat(msgNode.getChild(0));
if (msgNode.numChildren() == 1) {
// easy peasy
msgIdNode = createMsgIdNode(primaryMsgId, fn.getSourceLocation());
} else {
long fallbackMsgId = MsgUtils.computeMsgIdForDualFormat(msgNode.getChild(1));
ConditionalOpNode condOpNode = new ConditionalOpNode(fn.getSourceLocation());
FunctionNode isPrimaryMsgInUse =
new FunctionNode(
Identifier.create(
BuiltinFunction.IS_PRIMARY_MSG_IN_USE.getName(), fn.getSourceLocation()),
BuiltinFunction.IS_PRIMARY_MSG_IN_USE,
fn.getSourceLocation());
// We add the varRef, and the 2 message ids to the funcitonnode as arguments so they are
// trivial to access in the backends. This is a little hacky however since we never generate
// code for these things.
// We could formalize the hack by providing a way to stash arbitrary data in the FunctionNode
// and then just pack this up in a non-AST datastructure.
isPrimaryMsgInUse.addChild(fn.getChild(0).copy(new CopyState()));
isPrimaryMsgInUse.addChild(new IntegerNode(primaryMsgId, fn.getSourceLocation()));
isPrimaryMsgInUse.addChild(new IntegerNode(fallbackMsgId, fn.getSourceLocation()));
condOpNode.addChild(isPrimaryMsgInUse);
condOpNode.addChild(createMsgIdNode(primaryMsgId, fn.getSourceLocation()));
condOpNode.addChild(createMsgIdNode(fallbackMsgId, fn.getSourceLocation()));
msgIdNode = condOpNode;
}
// We need to generate a record literal
// This map literal has 2 keys: 'id' and 'msg'
RecordLiteralNode recordLiteral =
new RecordLiteralNode(
Identifier.create("record", fn.getSourceLocation()),
ImmutableList.of(
Identifier.create("id", fn.getSourceLocation()),
Identifier.create("msg", fn.getSourceLocation())),
fn.getSourceLocation());
recordLiteral.addChildren(ImmutableList.of(msgIdNode, fn.getChild(0).copy(new CopyState())));
fn.getParent().replaceChild(fn, recordLiteral);
} | class class_name[name] begin[{]
method[handleMsgIdCall, return_type[void], modifier[private], parameter[fn, msgNode]] begin[{]
local_variable[type[ExprNode], msgIdNode]
local_variable[type[long], primaryMsgId]
if[binary_operation[call[msgNode.numChildren, parameter[]], ==, literal[1]]] begin[{]
assign[member[.msgIdNode], call[.createMsgIdNode, parameter[member[.primaryMsgId], call[fn.getSourceLocation, parameter[]]]]]
else begin[{]
local_variable[type[long], fallbackMsgId]
local_variable[type[ConditionalOpNode], condOpNode]
local_variable[type[FunctionNode], isPrimaryMsgInUse]
call[isPrimaryMsgInUse.addChild, parameter[call[fn.getChild, parameter[literal[0]]]]]
call[isPrimaryMsgInUse.addChild, parameter[ClassCreator(arguments=[MemberReference(member=primaryMsgId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getSourceLocation, postfix_operators=[], prefix_operators=[], qualifier=fn, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IntegerNode, sub_type=None))]]
call[isPrimaryMsgInUse.addChild, parameter[ClassCreator(arguments=[MemberReference(member=fallbackMsgId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getSourceLocation, postfix_operators=[], prefix_operators=[], qualifier=fn, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IntegerNode, sub_type=None))]]
call[condOpNode.addChild, parameter[member[.isPrimaryMsgInUse]]]
call[condOpNode.addChild, parameter[call[.createMsgIdNode, parameter[member[.primaryMsgId], call[fn.getSourceLocation, parameter[]]]]]]
call[condOpNode.addChild, parameter[call[.createMsgIdNode, parameter[member[.fallbackMsgId], call[fn.getSourceLocation, parameter[]]]]]]
assign[member[.msgIdNode], member[.condOpNode]]
end[}]
local_variable[type[RecordLiteralNode], recordLiteral]
call[recordLiteral.addChildren, parameter[call[ImmutableList.of, parameter[member[.msgIdNode], call[fn.getChild, parameter[literal[0]]]]]]]
call[fn.getParent, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[handleMsgIdCall] operator[SEP] identifier[FunctionNode] identifier[fn] , identifier[MsgFallbackGroupNode] identifier[msgNode] operator[SEP] {
identifier[ExprNode] identifier[msgIdNode] operator[SEP] Keyword[long] identifier[primaryMsgId] operator[=] identifier[MsgUtils] operator[SEP] identifier[computeMsgIdForDualFormat] operator[SEP] identifier[msgNode] operator[SEP] identifier[getChild] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[msgNode] operator[SEP] identifier[numChildren] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[msgIdNode] operator[=] identifier[createMsgIdNode] operator[SEP] identifier[primaryMsgId] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[long] identifier[fallbackMsgId] operator[=] identifier[MsgUtils] operator[SEP] identifier[computeMsgIdForDualFormat] operator[SEP] identifier[msgNode] operator[SEP] identifier[getChild] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[ConditionalOpNode] identifier[condOpNode] operator[=] Keyword[new] identifier[ConditionalOpNode] operator[SEP] identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[FunctionNode] identifier[isPrimaryMsgInUse] operator[=] Keyword[new] identifier[FunctionNode] operator[SEP] identifier[Identifier] operator[SEP] identifier[create] operator[SEP] identifier[BuiltinFunction] operator[SEP] identifier[IS_PRIMARY_MSG_IN_USE] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] , identifier[BuiltinFunction] operator[SEP] identifier[IS_PRIMARY_MSG_IN_USE] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[isPrimaryMsgInUse] operator[SEP] identifier[addChild] operator[SEP] identifier[fn] operator[SEP] identifier[getChild] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[copy] operator[SEP] Keyword[new] identifier[CopyState] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[isPrimaryMsgInUse] operator[SEP] identifier[addChild] operator[SEP] Keyword[new] identifier[IntegerNode] operator[SEP] identifier[primaryMsgId] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[isPrimaryMsgInUse] operator[SEP] identifier[addChild] operator[SEP] Keyword[new] identifier[IntegerNode] operator[SEP] identifier[fallbackMsgId] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[condOpNode] operator[SEP] identifier[addChild] operator[SEP] identifier[isPrimaryMsgInUse] operator[SEP] operator[SEP] identifier[condOpNode] operator[SEP] identifier[addChild] operator[SEP] identifier[createMsgIdNode] operator[SEP] identifier[primaryMsgId] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[condOpNode] operator[SEP] identifier[addChild] operator[SEP] identifier[createMsgIdNode] operator[SEP] identifier[fallbackMsgId] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[msgIdNode] operator[=] identifier[condOpNode] operator[SEP]
}
identifier[RecordLiteralNode] identifier[recordLiteral] operator[=] Keyword[new] identifier[RecordLiteralNode] operator[SEP] identifier[Identifier] operator[SEP] identifier[create] operator[SEP] literal[String] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] , identifier[ImmutableList] operator[SEP] identifier[of] operator[SEP] identifier[Identifier] operator[SEP] identifier[create] operator[SEP] literal[String] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] , identifier[Identifier] operator[SEP] identifier[create] operator[SEP] literal[String] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] , identifier[fn] operator[SEP] identifier[getSourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[recordLiteral] operator[SEP] identifier[addChildren] operator[SEP] identifier[ImmutableList] operator[SEP] identifier[of] operator[SEP] identifier[msgIdNode] , identifier[fn] operator[SEP] identifier[getChild] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[copy] operator[SEP] Keyword[new] identifier[CopyState] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[fn] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[replaceChild] operator[SEP] identifier[fn] , identifier[recordLiteral] operator[SEP] operator[SEP]
}
|
private void validateResource(Patient thePatient) {
/*
* Our server will have a rule that patients must have a family name or we will reject them
*/
if (thePatient.getNameFirstRep().getFamilyFirstRep().isEmpty()) {
OperationOutcome outcome = new OperationOutcome();
outcome.addIssue().setSeverity(IssueSeverityEnum.FATAL).setDetails("No family name provided, Patient resources must have at least one family name.");
throw new UnprocessableEntityException(outcome);
}
} | class class_name[name] begin[{]
method[validateResource, return_type[void], modifier[private], parameter[thePatient]] begin[{]
if[call[thePatient.getNameFirstRep, parameter[]]] begin[{]
local_variable[type[OperationOutcome], outcome]
call[outcome.addIssue, parameter[]]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=outcome, 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=UnprocessableEntityException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[validateResource] operator[SEP] identifier[Patient] identifier[thePatient] operator[SEP] {
Keyword[if] operator[SEP] identifier[thePatient] operator[SEP] identifier[getNameFirstRep] operator[SEP] operator[SEP] operator[SEP] identifier[getFamilyFirstRep] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[OperationOutcome] identifier[outcome] operator[=] Keyword[new] identifier[OperationOutcome] operator[SEP] operator[SEP] operator[SEP] identifier[outcome] operator[SEP] identifier[addIssue] operator[SEP] operator[SEP] operator[SEP] identifier[setSeverity] operator[SEP] identifier[IssueSeverityEnum] operator[SEP] identifier[FATAL] operator[SEP] operator[SEP] identifier[setDetails] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[UnprocessableEntityException] operator[SEP] identifier[outcome] operator[SEP] operator[SEP]
}
}
|
public static void main(String[] args) {
if (args.length == 0) {
System.out.println(
"Usage: SplittingBAMIndex [splitting BAM indices...]\n\n"+
"Writes a few statistics about each splitting BAM index.");
return;
}
for (String arg : args) {
final File f = new File(arg);
if (f.isFile() && f.canRead()) {
try {
System.err.printf("%s:\n", f);
final SplittingBAMIndex bi = new SplittingBAMIndex(f);
if (bi.size() == 1) {
System.err.printf("\t0 alignments\n" +
"\tassociated BAM file size %d\n", bi.bamSize());
} else {
final long first = bi.first();
final long last = bi.last();
System.err.printf(
"\t%d alignments\n" +
"\tfirst is at %#06x in BGZF block at %#014x\n" +
"\tlast is at %#06x in BGZF block at %#014x\n" +
"\tassociated BAM file size %d\n",
bi.size(),
first & 0xffff, first >>> 16,
last & 0xffff, last >>> 16,
bi.bamSize());
}
} catch (IOException e) {
System.err.printf("Failed to read %s!\n", f);
e.printStackTrace();
}
} else
System.err.printf("%s does not look like a readable file!\n", f);
}
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
if[binary_operation[member[args.length], ==, literal[0]]] begin[{]
call[System.out.println, parameter[binary_operation[literal["Usage: SplittingBAMIndex [splitting BAM indices...]\n\n"], +, literal["Writes a few statistics about each splitting BAM index."]]]]
return[None]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=arg, 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)), name=f)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isFile, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=canRead, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), operator=&&), else_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s does not look like a readable file!\n"), MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s:\n"), MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=f, 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=SplittingBAMIndex, sub_type=None)), name=bi)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=SplittingBAMIndex, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=bi, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=first, postfix_operators=[], prefix_operators=[], qualifier=bi, selectors=[], type_arguments=None), name=first)], modifiers={'final'}, type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=last, postfix_operators=[], prefix_operators=[], qualifier=bi, selectors=[], type_arguments=None), name=last)], modifiers={'final'}, type=BasicType(dimensions=[], name=long)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\t%d alignments\n"), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\tfirst is at %#06x in BGZF block at %#014x\n"), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\tlast is at %#06x in BGZF block at %#014x\n"), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\tassociated BAM file size %d\n"), operator=+), MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=bi, selectors=[], type_arguments=None), BinaryOperation(operandl=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xffff), operator=&), BinaryOperation(operandl=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=>>>), BinaryOperation(operandl=MemberReference(member=last, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xffff), operator=&), BinaryOperation(operandl=MemberReference(member=last, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=>>>), MethodInvocation(arguments=[], member=bamSize, postfix_operators=[], prefix_operators=[], qualifier=bi, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\t0 alignments\n"), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\tassociated BAM file size %d\n"), operator=+), MethodInvocation(arguments=[], member=bamSize, postfix_operators=[], prefix_operators=[], qualifier=bi, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to read %s!\n"), MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=arg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] {
Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[arg] operator[:] identifier[args] operator[SEP] {
Keyword[final] identifier[File] identifier[f] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[arg] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[f] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[&&] identifier[f] operator[SEP] identifier[canRead] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[f] operator[SEP] operator[SEP] Keyword[final] identifier[SplittingBAMIndex] identifier[bi] operator[=] Keyword[new] identifier[SplittingBAMIndex] operator[SEP] identifier[f] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bi] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[printf] operator[SEP] literal[String] operator[+] literal[String] , identifier[bi] operator[SEP] identifier[bamSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] Keyword[long] identifier[first] operator[=] identifier[bi] operator[SEP] identifier[first] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[last] operator[=] identifier[bi] operator[SEP] identifier[last] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[printf] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] , identifier[bi] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[first] operator[&] literal[Integer] , identifier[first] operator[>] operator[>] operator[>] Other[16] , identifier[last] operator[&] literal[Integer] , identifier[last] operator[>] operator[>] operator[>] Other[16] , identifier[bi] operator[SEP] identifier[bamSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[f] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[f] operator[SEP] operator[SEP]
}
}
|
private String escapeUnrecognizedCharacters(String s) {
// TODO(yitingwang) Move this method to a suitable place
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
// From the SingleEscapeCharacter grammar production.
case '\b':
case '\f':
case '\n':
case '\r':
case '\t':
case '\\':
case '\"':
case '\'':
case '$':
case '`':
case '\u2028':
case '\u2029':
sb.append(c);
break;
default:
if ((outputCharsetEncoder != null && outputCharsetEncoder.canEncode(c))
|| (c > 0x1f && c < 0x7f)) {
// If we're given an outputCharsetEncoder, then check if the character can be
// represented in this character set. If no charsetEncoder provided - pass straight
// Latin characters through, and escape the rest. Doing the explicit character check is
// measurably faster than using the CharsetEncoder.
sb.append(c);
} else {
// Other characters can be misinterpreted by some JS parsers,
// or perhaps mangled by proxies along the way,
// so we play it safe and Unicode escape them.
Util.appendHexJavaScriptRepresentation(sb, c);
}
}
}
return sb.toString();
} | class class_name[name] begin[{]
method[escapeUnrecognizedCharacters, return_type[type[String]], modifier[private], parameter[s]] begin[{]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\b'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\f'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\r'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\t'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\"'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\''), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='$'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='`'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='
'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='
')], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=outputCharsetEncoder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=canEncode, postfix_operators=[], prefix_operators=[], qualifier=outputCharsetEncoder, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x1f), operator=>), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x7f), operator=<), operator=&&), operator=||), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=appendHexJavaScriptRepresentation, postfix_operators=[], prefix_operators=[], qualifier=Util, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))])], expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[escapeUnrecognizedCharacters] operator[SEP] identifier[String] identifier[s] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[s] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[c] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[if] operator[SEP] operator[SEP] identifier[outputCharsetEncoder] operator[!=] Other[null] operator[&&] identifier[outputCharsetEncoder] operator[SEP] identifier[canEncode] operator[SEP] identifier[c] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[c] operator[>] literal[Integer] operator[&&] identifier[c] operator[<] literal[Integer] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Util] operator[SEP] identifier[appendHexJavaScriptRepresentation] operator[SEP] identifier[sb] , identifier[c] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected void putVariables(Map<String, String> variables) {
variables.put(ScopeFormat.SCOPE_TASK_VERTEX_ID, vertexId.toString());
variables.put(ScopeFormat.SCOPE_TASK_NAME, taskName);
variables.put(ScopeFormat.SCOPE_TASK_ATTEMPT_ID, executionId.toString());
variables.put(ScopeFormat.SCOPE_TASK_ATTEMPT_NUM, String.valueOf(attemptNumber));
variables.put(ScopeFormat.SCOPE_TASK_SUBTASK_INDEX, String.valueOf(subtaskIndex));
} | class class_name[name] begin[{]
method[putVariables, return_type[void], modifier[protected], parameter[variables]] begin[{]
call[variables.put, parameter[member[ScopeFormat.SCOPE_TASK_VERTEX_ID], call[vertexId.toString, parameter[]]]]
call[variables.put, parameter[member[ScopeFormat.SCOPE_TASK_NAME], member[.taskName]]]
call[variables.put, parameter[member[ScopeFormat.SCOPE_TASK_ATTEMPT_ID], call[executionId.toString, parameter[]]]]
call[variables.put, parameter[member[ScopeFormat.SCOPE_TASK_ATTEMPT_NUM], call[String.valueOf, parameter[member[.attemptNumber]]]]]
call[variables.put, parameter[member[ScopeFormat.SCOPE_TASK_SUBTASK_INDEX], call[String.valueOf, parameter[member[.subtaskIndex]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[putVariables] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[variables] operator[SEP] {
identifier[variables] operator[SEP] identifier[put] operator[SEP] identifier[ScopeFormat] operator[SEP] identifier[SCOPE_TASK_VERTEX_ID] , identifier[vertexId] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[variables] operator[SEP] identifier[put] operator[SEP] identifier[ScopeFormat] operator[SEP] identifier[SCOPE_TASK_NAME] , identifier[taskName] operator[SEP] operator[SEP] identifier[variables] operator[SEP] identifier[put] operator[SEP] identifier[ScopeFormat] operator[SEP] identifier[SCOPE_TASK_ATTEMPT_ID] , identifier[executionId] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[variables] operator[SEP] identifier[put] operator[SEP] identifier[ScopeFormat] operator[SEP] identifier[SCOPE_TASK_ATTEMPT_NUM] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[attemptNumber] operator[SEP] operator[SEP] operator[SEP] identifier[variables] operator[SEP] identifier[put] operator[SEP] identifier[ScopeFormat] operator[SEP] identifier[SCOPE_TASK_SUBTASK_INDEX] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[subtaskIndex] operator[SEP] operator[SEP] operator[SEP]
}
|
protected static File createTemporaryFile(@Nonnull final File file) {
Check.notNull(file, "file");
final File tempFile = new File(file.getParent(), file.getName() + ".temp");
// remove orphaned temporary file
deleteFile(tempFile);
return tempFile;
} | class class_name[name] begin[{]
method[createTemporaryFile, return_type[type[File]], modifier[static protected], parameter[file]] begin[{]
call[Check.notNull, parameter[member[.file], literal["file"]]]
local_variable[type[File], tempFile]
call[.deleteFile, parameter[member[.tempFile]]]
return[member[.tempFile]]
end[}]
END[}] | Keyword[protected] Keyword[static] identifier[File] identifier[createTemporaryFile] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[File] identifier[file] operator[SEP] {
identifier[Check] operator[SEP] identifier[notNull] operator[SEP] identifier[file] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[File] identifier[tempFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[file] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] , identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[deleteFile] operator[SEP] identifier[tempFile] operator[SEP] operator[SEP] Keyword[return] identifier[tempFile] operator[SEP]
}
|
public static byte[] add(byte[] arr, int n) {
int index = binarySearch(arr, n);
byte[] arr2 = new byte[arr.length + 4];
System.arraycopy(arr, 0, arr2, 0, index);
System.arraycopy(arr, index, arr2, index + 4, arr.length - index);
Bytes.setInt(arr2, n, index);
return arr2;
} | class class_name[name] begin[{]
method[add, return_type[type[byte]], modifier[public static], parameter[arr, n]] begin[{]
local_variable[type[int], index]
local_variable[type[byte], arr2]
call[System.arraycopy, parameter[member[.arr], literal[0], member[.arr2], literal[0], member[.index]]]
call[System.arraycopy, parameter[member[.arr], member[.index], member[.arr2], binary_operation[member[.index], +, literal[4]], binary_operation[member[arr.length], -, member[.index]]]]
call[Bytes.setInt, parameter[member[.arr2], member[.n], member[.index]]]
return[member[.arr2]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[add] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[arr] , Keyword[int] identifier[n] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[binarySearch] operator[SEP] identifier[arr] , identifier[n] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[arr2] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[arr] operator[SEP] identifier[length] operator[+] Other[4] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[arr] , Other[0] , identifier[arr2] , Other[0] , identifier[index] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[arr] , identifier[index] , identifier[arr2] , identifier[index] operator[+] Other[4] , identifier[arr] operator[SEP] identifier[length] operator[-] identifier[index] operator[SEP] operator[SEP] identifier[Bytes] operator[SEP] identifier[setInt] operator[SEP] identifier[arr2] , identifier[n] , identifier[index] operator[SEP] operator[SEP] Keyword[return] identifier[arr2] operator[SEP]
}
|
public static void getMethods(Class superclass, Class[] interfaces, List methods)
{
getMethods(superclass, interfaces, methods, null, null);
} | class class_name[name] begin[{]
method[getMethods, return_type[void], modifier[public static], parameter[superclass, interfaces, methods]] begin[{]
call[.getMethods, parameter[member[.superclass], member[.interfaces], member[.methods], literal[null], literal[null]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[getMethods] operator[SEP] identifier[Class] identifier[superclass] , identifier[Class] operator[SEP] operator[SEP] identifier[interfaces] , identifier[List] identifier[methods] operator[SEP] {
identifier[getMethods] operator[SEP] identifier[superclass] , identifier[interfaces] , identifier[methods] , Other[null] , Other[null] operator[SEP] operator[SEP]
}
|
public static RuntimeException initCause(RuntimeException ex,
Throwable cause)
{
if (Throwable_initCause != null) {
Object[] args = { cause };
try {
Throwable_initCause.invoke(ex, args);
} catch (Exception e) {
// Ignore any exceptions
}
}
return ex;
} | class class_name[name] begin[{]
method[initCause, return_type[type[RuntimeException]], modifier[public static], parameter[ex, cause]] begin[{]
if[binary_operation[member[.Throwable_initCause], !=, literal[null]]] begin[{]
local_variable[type[Object], args]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=Throwable_initCause, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.ex]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[RuntimeException] identifier[initCause] operator[SEP] identifier[RuntimeException] identifier[ex] , identifier[Throwable] identifier[cause] operator[SEP] {
Keyword[if] operator[SEP] identifier[Throwable_initCause] operator[!=] Other[null] operator[SEP] {
identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[=] {
identifier[cause]
} operator[SEP] Keyword[try] {
identifier[Throwable_initCause] operator[SEP] identifier[invoke] operator[SEP] identifier[ex] , identifier[args] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
Keyword[return] identifier[ex] operator[SEP]
}
|
public Observable<ServiceResponse<ControllerConnectionDetailsListInner>> listConnectionDetailsWithServiceResponseAsync(String resourceGroupName, String name) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listConnectionDetails(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ControllerConnectionDetailsListInner>>>() {
@Override
public Observable<ServiceResponse<ControllerConnectionDetailsListInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ControllerConnectionDetailsListInner> clientResponse = listConnectionDetailsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} | class class_name[name] begin[{]
method[listConnectionDetailsWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, name]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.subscriptionId, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.subscriptionId() 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[.resourceGroupName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter resourceGroupName 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[.name], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter name 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[}]
return[call[service.listConnectionDetails, parameter[THIS[member[None.client]call[None.subscriptionId, parameter[]]], member[.resourceGroupName], member[.name], 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[ControllerConnectionDetailsListInner] operator[>] operator[>] identifier[listConnectionDetailsWithServiceResponseAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[resourceGroupName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[name] 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]
}
Keyword[return] identifier[service] operator[SEP] identifier[listConnectionDetails] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[subscriptionId] operator[SEP] operator[SEP] , identifier[resourceGroupName] , identifier[name] , 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[ControllerConnectionDetailsListInner] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[ControllerConnectionDetailsListInner] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[ControllerConnectionDetailsListInner] operator[>] identifier[clientResponse] operator[=] identifier[listConnectionDetailsDelegate] 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]
}
|
public LayoutScroller.ScrollableList getPageScrollable() {
return new LayoutScroller.ScrollableList() {
@Override
public int getScrollingItemsCount() {
return MultiPageWidget.super.getScrollingItemsCount();
}
@Override
public float getViewPortWidth() {
return MultiPageWidget.super.getViewPortWidth();
}
@Override
public float getViewPortHeight() {
return MultiPageWidget.super.getViewPortHeight();
}
@Override
public float getViewPortDepth() {
return MultiPageWidget.super.getViewPortDepth();
}
@Override
public boolean scrollToPosition(int pos, final LayoutScroller.OnScrollListener listener) {
return MultiPageWidget.super.scrollToPosition(pos, listener);
}
@Override
public boolean scrollByOffset(float xOffset, float yOffset, float zOffset,
final LayoutScroller.OnScrollListener listener) {
return MultiPageWidget.super.scrollByOffset(xOffset, yOffset, zOffset, listener);
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
MultiPageWidget.super.registerDataSetObserver(observer);
}
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
MultiPageWidget.super.unregisterDataSetObserver(observer);
}
@Override
public int getCurrentPosition() {
return MultiPageWidget.super.getCurrentPosition();
}
};
} | class class_name[name] begin[{]
method[getPageScrollable, return_type[type[LayoutScroller]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=MultiPageWidget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[], member=getScrollingItemsCount, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=getScrollingItemsCount, parameters=[], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=MultiPageWidget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[], member=getViewPortWidth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=getViewPortWidth, parameters=[], return_type=BasicType(dimensions=[], name=float), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=MultiPageWidget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[], member=getViewPortHeight, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=getViewPortHeight, parameters=[], return_type=BasicType(dimensions=[], name=float), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=MultiPageWidget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[], member=getViewPortDepth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=getViewPortDepth, parameters=[], return_type=BasicType(dimensions=[], name=float), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=MultiPageWidget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=scrollToPosition, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=scrollToPosition, parameters=[FormalParameter(annotations=[], modifiers=set(), name=pos, type=BasicType(dimensions=[], name=int), varargs=False), FormalParameter(annotations=[], modifiers={'final'}, name=listener, type=ReferenceType(arguments=None, dimensions=[], name=LayoutScroller, sub_type=ReferenceType(arguments=None, dimensions=None, name=OnScrollListener, sub_type=None)), varargs=False)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=MultiPageWidget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[MemberReference(member=xOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=yOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=zOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=listener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=scrollByOffset, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=scrollByOffset, parameters=[FormalParameter(annotations=[], modifiers=set(), name=xOffset, type=BasicType(dimensions=[], name=float), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=yOffset, type=BasicType(dimensions=[], name=float), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=zOffset, type=BasicType(dimensions=[], name=float), varargs=False), FormalParameter(annotations=[], modifiers={'final'}, name=listener, type=ReferenceType(arguments=None, dimensions=[], name=LayoutScroller, sub_type=ReferenceType(arguments=None, dimensions=None, name=OnScrollListener, sub_type=None)), varargs=False)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MemberReference(member=MultiPageWidget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[MemberReference(member=observer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=registerDataSetObserver, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=registerDataSetObserver, parameters=[FormalParameter(annotations=[], modifiers=set(), name=observer, type=ReferenceType(arguments=None, dimensions=[], name=DataSetObserver, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MemberReference(member=MultiPageWidget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[MemberReference(member=observer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unregisterDataSetObserver, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=unregisterDataSetObserver, parameters=[FormalParameter(annotations=[], modifiers=set(), name=observer, type=ReferenceType(arguments=None, dimensions=[], name=DataSetObserver, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=MultiPageWidget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[SuperMethodInvocation(arguments=[], member=getCurrentPosition, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=getCurrentPosition, parameters=[], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LayoutScroller, sub_type=ReferenceType(arguments=None, dimensions=None, name=ScrollableList, sub_type=None)))]
end[}]
END[}] | Keyword[public] identifier[LayoutScroller] operator[SEP] identifier[ScrollableList] identifier[getPageScrollable] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[LayoutScroller] operator[SEP] identifier[ScrollableList] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[getScrollingItemsCount] operator[SEP] operator[SEP] {
Keyword[return] identifier[MultiPageWidget] operator[SEP] Keyword[super] operator[SEP] identifier[getScrollingItemsCount] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[float] identifier[getViewPortWidth] operator[SEP] operator[SEP] {
Keyword[return] identifier[MultiPageWidget] operator[SEP] Keyword[super] operator[SEP] identifier[getViewPortWidth] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[float] identifier[getViewPortHeight] operator[SEP] operator[SEP] {
Keyword[return] identifier[MultiPageWidget] operator[SEP] Keyword[super] operator[SEP] identifier[getViewPortHeight] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[float] identifier[getViewPortDepth] operator[SEP] operator[SEP] {
Keyword[return] identifier[MultiPageWidget] operator[SEP] Keyword[super] operator[SEP] identifier[getViewPortDepth] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[scrollToPosition] operator[SEP] Keyword[int] identifier[pos] , Keyword[final] identifier[LayoutScroller] operator[SEP] identifier[OnScrollListener] identifier[listener] operator[SEP] {
Keyword[return] identifier[MultiPageWidget] operator[SEP] Keyword[super] operator[SEP] identifier[scrollToPosition] operator[SEP] identifier[pos] , identifier[listener] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[scrollByOffset] operator[SEP] Keyword[float] identifier[xOffset] , Keyword[float] identifier[yOffset] , Keyword[float] identifier[zOffset] , Keyword[final] identifier[LayoutScroller] operator[SEP] identifier[OnScrollListener] identifier[listener] operator[SEP] {
Keyword[return] identifier[MultiPageWidget] operator[SEP] Keyword[super] operator[SEP] identifier[scrollByOffset] operator[SEP] identifier[xOffset] , identifier[yOffset] , identifier[zOffset] , identifier[listener] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[registerDataSetObserver] operator[SEP] identifier[DataSetObserver] identifier[observer] operator[SEP] {
identifier[MultiPageWidget] operator[SEP] Keyword[super] operator[SEP] identifier[registerDataSetObserver] operator[SEP] identifier[observer] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[unregisterDataSetObserver] operator[SEP] identifier[DataSetObserver] identifier[observer] operator[SEP] {
identifier[MultiPageWidget] operator[SEP] Keyword[super] operator[SEP] identifier[unregisterDataSetObserver] operator[SEP] identifier[observer] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[getCurrentPosition] operator[SEP] operator[SEP] {
Keyword[return] identifier[MultiPageWidget] operator[SEP] Keyword[super] operator[SEP] identifier[getCurrentPosition] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
@Override
protected void denyImportDeclaration(ImportDeclaration importDeclaration) {
LOG.debug("CXFImporter destroy a proxy for " + importDeclaration);
ServiceRegistration serviceRegistration = map.get(importDeclaration);
serviceRegistration.unregister();
// set the importDeclaration has unhandled
super.unhandleImportDeclaration(importDeclaration);
map.remove(importDeclaration);
} | class class_name[name] begin[{]
method[denyImportDeclaration, return_type[void], modifier[protected], parameter[importDeclaration]] begin[{]
call[LOG.debug, parameter[binary_operation[literal["CXFImporter destroy a proxy for "], +, member[.importDeclaration]]]]
local_variable[type[ServiceRegistration], serviceRegistration]
call[serviceRegistration.unregister, parameter[]]
SuperMethodInvocation(arguments=[MemberReference(member=importDeclaration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unhandleImportDeclaration, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[map.remove, parameter[member[.importDeclaration]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[denyImportDeclaration] operator[SEP] identifier[ImportDeclaration] identifier[importDeclaration] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[importDeclaration] operator[SEP] operator[SEP] identifier[ServiceRegistration] identifier[serviceRegistration] operator[=] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[importDeclaration] operator[SEP] operator[SEP] identifier[serviceRegistration] operator[SEP] identifier[unregister] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[unhandleImportDeclaration] operator[SEP] identifier[importDeclaration] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[remove] operator[SEP] identifier[importDeclaration] operator[SEP] operator[SEP]
}
|
private MethodSpec makeSetValue() {
MethodSpec.Builder setter = MethodSpec.methodBuilder("setValue")
.addModifiers(context.publicFinalModifiers())
.addParameter(vTypeVar, "value")
.addParameter(vRefQueueType, "referenceQueue");
if (isStrongValues()) {
setter.addStatement("$T.UNSAFE.putObject(this, $N, $N)",
UNSAFE_ACCESS, offsetName("value"), "value");
} else {
setter.addStatement("(($T<V>) getValueReference()).clear()", Reference.class);
setter.addStatement("$T.UNSAFE.putObject(this, $N, new $T($L, $N, referenceQueue))",
UNSAFE_ACCESS, offsetName("value"), valueReferenceType(), "getKeyReference()", "value");
}
return setter.build();
} | class class_name[name] begin[{]
method[makeSetValue, return_type[type[MethodSpec]], modifier[private], parameter[]] begin[{]
local_variable[type[MethodSpec], setter]
if[call[.isStrongValues, parameter[]]] begin[{]
call[setter.addStatement, parameter[literal["$T.UNSAFE.putObject(this, $N, $N)"], member[.UNSAFE_ACCESS], call[.offsetName, parameter[literal["value"]]], literal["value"]]]
else begin[{]
call[setter.addStatement, parameter[literal["(($T<V>) getValueReference()).clear()"], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Reference, sub_type=None))]]
call[setter.addStatement, parameter[literal["$T.UNSAFE.putObject(this, $N, new $T($L, $N, referenceQueue))"], member[.UNSAFE_ACCESS], call[.offsetName, parameter[literal["value"]]], call[.valueReferenceType, parameter[]], literal["getKeyReference()"], literal["value"]]]
end[}]
return[call[setter.build, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[MethodSpec] identifier[makeSetValue] operator[SEP] operator[SEP] {
identifier[MethodSpec] operator[SEP] identifier[Builder] identifier[setter] operator[=] identifier[MethodSpec] operator[SEP] identifier[methodBuilder] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[addModifiers] operator[SEP] identifier[context] operator[SEP] identifier[publicFinalModifiers] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[addParameter] operator[SEP] identifier[vTypeVar] , literal[String] operator[SEP] operator[SEP] identifier[addParameter] operator[SEP] identifier[vRefQueueType] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isStrongValues] operator[SEP] operator[SEP] operator[SEP] {
identifier[setter] operator[SEP] identifier[addStatement] operator[SEP] literal[String] , identifier[UNSAFE_ACCESS] , identifier[offsetName] operator[SEP] literal[String] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[setter] operator[SEP] identifier[addStatement] operator[SEP] literal[String] , identifier[Reference] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[setter] operator[SEP] identifier[addStatement] operator[SEP] literal[String] , identifier[UNSAFE_ACCESS] , identifier[offsetName] operator[SEP] literal[String] operator[SEP] , identifier[valueReferenceType] operator[SEP] operator[SEP] , literal[String] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[setter] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Object fromJSON(String jsonString){
List<Token> tokens = Derulo.toTokens(jsonString);
return fromJSON(tokens);
} | class class_name[name] begin[{]
method[fromJSON, return_type[type[Object]], modifier[public static], parameter[jsonString]] begin[{]
local_variable[type[List], tokens]
return[call[.fromJSON, parameter[member[.tokens]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[fromJSON] operator[SEP] identifier[String] identifier[jsonString] operator[SEP] {
identifier[List] operator[<] identifier[Token] operator[>] identifier[tokens] operator[=] identifier[Derulo] operator[SEP] identifier[toTokens] operator[SEP] identifier[jsonString] operator[SEP] operator[SEP] Keyword[return] identifier[fromJSON] operator[SEP] identifier[tokens] operator[SEP] operator[SEP]
}
|
public SDVariable mmul(String name, SDVariable other, @NonNull MMulTranspose mMulTranspose) {
return sameDiff.mmul(name, this, other, mMulTranspose);
} | class class_name[name] begin[{]
method[mmul, return_type[type[SDVariable]], modifier[public], parameter[name, other, mMulTranspose]] begin[{]
return[call[sameDiff.mmul, parameter[member[.name], THIS[], member[.other], member[.mMulTranspose]]]]
end[}]
END[}] | Keyword[public] identifier[SDVariable] identifier[mmul] operator[SEP] identifier[String] identifier[name] , identifier[SDVariable] identifier[other] , annotation[@] identifier[NonNull] identifier[MMulTranspose] identifier[mMulTranspose] operator[SEP] {
Keyword[return] identifier[sameDiff] operator[SEP] identifier[mmul] operator[SEP] identifier[name] , Keyword[this] , identifier[other] , identifier[mMulTranspose] operator[SEP] operator[SEP]
}
|
protected void loadInternal(Set<K> keys, Iterable<Data> dataKeys, boolean replaceExistingValues) {
if (dataKeys == null) {
dataKeys = convertToData(keys);
}
Map<Integer, List<Data>> partitionIdToKeys = getPartitionIdToKeysMap(dataKeys);
Iterable<Entry<Integer, List<Data>>> entries = partitionIdToKeys.entrySet();
for (Entry<Integer, List<Data>> entry : entries) {
Integer partitionId = entry.getKey();
List<Data> correspondingKeys = entry.getValue();
Operation operation = createLoadAllOperation(correspondingKeys, replaceExistingValues);
operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
}
waitUntilLoaded();
} | class class_name[name] begin[{]
method[loadInternal, return_type[void], modifier[protected], parameter[keys, dataKeys, replaceExistingValues]] begin[{]
if[binary_operation[member[.dataKeys], ==, literal[null]]] begin[{]
assign[member[.dataKeys], call[.convertToData, parameter[member[.keys]]]]
else begin[{]
None
end[}]
local_variable[type[Map], partitionIdToKeys]
local_variable[type[Iterable], entries]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=partitionId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=correspondingKeys)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Data, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=correspondingKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=replaceExistingValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createLoadAllOperation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=operation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Operation, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SERVICE_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=partitionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invokeOnPartition, postfix_operators=[], prefix_operators=[], qualifier=operationService, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=entries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Data, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
call[.waitUntilLoaded, parameter[]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[loadInternal] operator[SEP] identifier[Set] operator[<] identifier[K] operator[>] identifier[keys] , identifier[Iterable] operator[<] identifier[Data] operator[>] identifier[dataKeys] , Keyword[boolean] identifier[replaceExistingValues] operator[SEP] {
Keyword[if] operator[SEP] identifier[dataKeys] operator[==] Other[null] operator[SEP] {
identifier[dataKeys] operator[=] identifier[convertToData] operator[SEP] identifier[keys] operator[SEP] operator[SEP]
}
identifier[Map] operator[<] identifier[Integer] , identifier[List] operator[<] identifier[Data] operator[>] operator[>] identifier[partitionIdToKeys] operator[=] identifier[getPartitionIdToKeysMap] operator[SEP] identifier[dataKeys] operator[SEP] operator[SEP] identifier[Iterable] operator[<] identifier[Entry] operator[<] identifier[Integer] , identifier[List] operator[<] identifier[Data] operator[>] operator[>] operator[>] identifier[entries] operator[=] identifier[partitionIdToKeys] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[Integer] , identifier[List] operator[<] identifier[Data] operator[>] operator[>] identifier[entry] operator[:] identifier[entries] operator[SEP] {
identifier[Integer] identifier[partitionId] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Data] operator[>] identifier[correspondingKeys] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[Operation] identifier[operation] operator[=] identifier[createLoadAllOperation] operator[SEP] identifier[correspondingKeys] , identifier[replaceExistingValues] operator[SEP] operator[SEP] identifier[operationService] operator[SEP] identifier[invokeOnPartition] operator[SEP] identifier[SERVICE_NAME] , identifier[operation] , identifier[partitionId] operator[SEP] operator[SEP]
}
identifier[waitUntilLoaded] operator[SEP] operator[SEP] operator[SEP]
}
|
public Duration<U> multipliedBy(int factor) {
if (
this.isEmpty()
|| (factor == 1)
) {
return this;
} else if (factor == 0) {
return ofZero();
} else if (factor == -1) {
return new Duration<>(this, true);
}
List<Item<U>> newItems = new ArrayList<>(this.count());
int scalar = Math.abs(factor);
for (int i = 0, n = this.count(); i < n; i++) {
Item<U> item = this.getTotalLength().get(i);
newItems.add(
Item.of(
MathUtils.safeMultiply(item.getAmount(), scalar),
item.getUnit()
)
);
}
return new Duration<>(
newItems,
((factor < 0) != this.isNegative())
);
} | class class_name[name] begin[{]
method[multipliedBy, return_type[type[Duration]], modifier[public], parameter[factor]] begin[{]
if[binary_operation[THIS[call[None.isEmpty, parameter[]]], ||, binary_operation[member[.factor], ==, literal[1]]]] begin[{]
return[THIS[]]
else begin[{]
if[binary_operation[member[.factor], ==, literal[0]]] begin[{]
return[call[.ofZero, parameter[]]]
else begin[{]
if[binary_operation[member[.factor], ==, literal[1]]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=Duration, sub_type=None))]
else begin[{]
None
end[}]
end[}]
end[}]
local_variable[type[List], newItems]
local_variable[type[int], scalar]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getTotalLength, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=item)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=U, sub_type=None))], dimensions=[], name=Item, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAmount, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), MemberReference(member=scalar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeMultiply, postfix_operators=[], prefix_operators=[], qualifier=MathUtils, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getUnit, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None)], member=of, postfix_operators=[], prefix_operators=[], qualifier=Item, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=newItems, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i), VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=count, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=n)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=newItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=factor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=isNegative, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=!=)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=Duration, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Duration] operator[<] identifier[U] operator[>] identifier[multipliedBy] operator[SEP] Keyword[int] identifier[factor] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[factor] operator[==] Other[1] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[factor] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[ofZero] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[factor] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] Keyword[new] identifier[Duration] operator[<] operator[>] operator[SEP] Keyword[this] , literal[boolean] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[Item] operator[<] identifier[U] operator[>] operator[>] identifier[newItems] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] Keyword[this] operator[SEP] identifier[count] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[scalar] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[factor] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[n] operator[=] Keyword[this] operator[SEP] identifier[count] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[<] identifier[n] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Item] operator[<] identifier[U] operator[>] identifier[item] operator[=] Keyword[this] operator[SEP] identifier[getTotalLength] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[newItems] operator[SEP] identifier[add] operator[SEP] identifier[Item] operator[SEP] identifier[of] operator[SEP] identifier[MathUtils] operator[SEP] identifier[safeMultiply] operator[SEP] identifier[item] operator[SEP] identifier[getAmount] operator[SEP] operator[SEP] , identifier[scalar] operator[SEP] , identifier[item] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Duration] operator[<] operator[>] operator[SEP] identifier[newItems] , operator[SEP] operator[SEP] identifier[factor] operator[<] Other[0] operator[SEP] operator[!=] Keyword[this] operator[SEP] identifier[isNegative] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T, P> void forEachWith(
Iterable<T> iterable,
Procedure2<? super T, ? super P> procedure,
P parameter)
{
if (iterable instanceof InternalIterable)
{
((InternalIterable<T>) iterable).forEachWith(procedure, parameter);
}
else if (iterable instanceof ArrayList)
{
ArrayListIterate.forEachWith((ArrayList<T>) iterable, procedure, parameter);
}
else if (iterable instanceof List)
{
ListIterate.forEachWith((List<T>) iterable, procedure, parameter);
}
else if (iterable != null)
{
IterableIterate.forEachWith(iterable, procedure, parameter);
}
else
{
throw new IllegalArgumentException("Cannot perform a forEachWith on null");
}
} | class class_name[name] begin[{]
method[forEachWith, return_type[void], modifier[public static], parameter[iterable, procedure, parameter]] begin[{]
if[binary_operation[member[.iterable], instanceof, type[InternalIterable]]] begin[{]
Cast(expression=MemberReference(member=iterable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=InternalIterable, sub_type=None))
else begin[{]
if[binary_operation[member[.iterable], instanceof, type[ArrayList]]] begin[{]
call[ArrayListIterate.forEachWith, parameter[Cast(expression=MemberReference(member=iterable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ArrayList, sub_type=None)), member[.procedure], member[.parameter]]]
else begin[{]
if[binary_operation[member[.iterable], instanceof, type[List]]] begin[{]
call[ListIterate.forEachWith, parameter[Cast(expression=MemberReference(member=iterable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=List, sub_type=None)), member[.procedure], member[.parameter]]]
else begin[{]
if[binary_operation[member[.iterable], !=, literal[null]]] begin[{]
call[IterableIterate.forEachWith, parameter[member[.iterable], member[.procedure], member[.parameter]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot perform a forEachWith on 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)
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[P] operator[>] Keyword[void] identifier[forEachWith] operator[SEP] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[iterable] , identifier[Procedure2] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[super] identifier[P] operator[>] identifier[procedure] , identifier[P] identifier[parameter] operator[SEP] {
Keyword[if] operator[SEP] identifier[iterable] Keyword[instanceof] identifier[InternalIterable] operator[SEP] {
operator[SEP] operator[SEP] identifier[InternalIterable] operator[<] identifier[T] operator[>] operator[SEP] identifier[iterable] operator[SEP] operator[SEP] identifier[forEachWith] operator[SEP] identifier[procedure] , identifier[parameter] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[iterable] Keyword[instanceof] identifier[ArrayList] operator[SEP] {
identifier[ArrayListIterate] operator[SEP] identifier[forEachWith] operator[SEP] operator[SEP] identifier[ArrayList] operator[<] identifier[T] operator[>] operator[SEP] identifier[iterable] , identifier[procedure] , identifier[parameter] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[iterable] Keyword[instanceof] identifier[List] operator[SEP] {
identifier[ListIterate] operator[SEP] identifier[forEachWith] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] operator[SEP] identifier[iterable] , identifier[procedure] , identifier[parameter] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[iterable] operator[!=] Other[null] operator[SEP] {
identifier[IterableIterate] operator[SEP] identifier[forEachWith] operator[SEP] identifier[iterable] , identifier[procedure] , identifier[parameter] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public void importAssetsFromGit(ProgressMonitor... monitors) throws IOException {
if (inProgress)
throw new IOException("Asset import already in progress...");
try {
inProgress = true;
getOut().println("Importing from Git into: " + getProjectDir() + "...(branch: " + branch + ")(Hard Reset: " + (hardReset ? "YES)" : "NO)"));
// Check Asset inconsistencies
Vercheck vercheck = new Vercheck();
vercheck.setConfigLoc(getConfigLoc());
vercheck.setAssetLoc(getAssetLoc());
vercheck.setGitRoot(getGitRoot());
vercheck.setForImport(true);
vercheck.setDebug(true);
vercheck.run();
if (vercheck.getErrorCount() > 0) {
throw new IOException("Asset version conflict(s). See log for details");
}
// Perform import (Git pull)
versionControl.hardCheckout(branch, hardReset);
// Clear cached previous asset revisions
versionControl.clear();
// Capture new Refs in ASSET_REF after import (Git pull) and insert/update VALUE table
Checkpoint checkpoint = new Checkpoint(getEngineAssetRoot(), versionControl, versionControl.getCommit(), pooledConn);
try {
checkpoint.updateRefs(true);
}
catch (SQLException ex) {
throw new IOException(ex.getMessage(), ex);
}
}
catch (Throwable ex) {
if (ex instanceof IOException)
throw (IOException)ex;
else
throw new IOException(ex.getMessage(), ex);
}
finally {
inProgress = false;
}
} | class class_name[name] begin[{]
method[importAssetsFromGit, return_type[void], modifier[public], parameter[monitors]] begin[{]
if[member[.inProgress]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Asset import already in progress...")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=inProgress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Importing from Git into: "), operandr=MethodInvocation(arguments=[], member=getProjectDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="...(branch: "), operator=+), operandr=MemberReference(member=branch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")(Hard Reset: "), operator=+), operandr=TernaryExpression(condition=MemberReference(member=hardReset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="NO)"), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="YES)")), operator=+)], member=println, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Vercheck, sub_type=None)), name=vercheck)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Vercheck, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getConfigLoc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setConfigLoc, postfix_operators=[], prefix_operators=[], qualifier=vercheck, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAssetLoc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setAssetLoc, postfix_operators=[], prefix_operators=[], qualifier=vercheck, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getGitRoot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=setGitRoot, postfix_operators=[], prefix_operators=[], qualifier=vercheck, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setForImport, postfix_operators=[], prefix_operators=[], qualifier=vercheck, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setDebug, postfix_operators=[], prefix_operators=[], qualifier=vercheck, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=run, postfix_operators=[], prefix_operators=[], qualifier=vercheck, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getErrorCount, postfix_operators=[], prefix_operators=[], qualifier=vercheck, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Asset version conflict(s). See log for details")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=branch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hardReset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hardCheckout, postfix_operators=[], prefix_operators=[], qualifier=versionControl, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=versionControl, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getEngineAssetRoot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=versionControl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getCommit, postfix_operators=[], prefix_operators=[], qualifier=versionControl, selectors=[], type_arguments=None), MemberReference(member=pooledConn, 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=Checkpoint, sub_type=None)), name=checkpoint)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Checkpoint, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=updateRefs, postfix_operators=[], prefix_operators=[], qualifier=checkpoint, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['SQLException']))], finally_block=None, label=None, resources=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=IOException, sub_type=None), operator=instanceof), else_statement=ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None), label=None, then_statement=ThrowStatement(expression=Cast(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IOException, sub_type=None)), label=None))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Throwable']))], finally_block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=inProgress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[importAssetsFromGit] operator[SEP] identifier[ProgressMonitor] operator[...] identifier[monitors] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[inProgress] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[inProgress] operator[=] literal[boolean] operator[SEP] identifier[getOut] operator[SEP] operator[SEP] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[getProjectDir] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[branch] operator[+] literal[String] operator[+] operator[SEP] identifier[hardReset] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[Vercheck] identifier[vercheck] operator[=] Keyword[new] identifier[Vercheck] operator[SEP] operator[SEP] operator[SEP] identifier[vercheck] operator[SEP] identifier[setConfigLoc] operator[SEP] identifier[getConfigLoc] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[vercheck] operator[SEP] identifier[setAssetLoc] operator[SEP] identifier[getAssetLoc] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[vercheck] operator[SEP] identifier[setGitRoot] operator[SEP] identifier[getGitRoot] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[vercheck] operator[SEP] identifier[setForImport] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[vercheck] operator[SEP] identifier[setDebug] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[vercheck] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vercheck] operator[SEP] identifier[getErrorCount] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[versionControl] operator[SEP] identifier[hardCheckout] operator[SEP] identifier[branch] , identifier[hardReset] operator[SEP] operator[SEP] identifier[versionControl] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[Checkpoint] identifier[checkpoint] operator[=] Keyword[new] identifier[Checkpoint] operator[SEP] identifier[getEngineAssetRoot] operator[SEP] operator[SEP] , identifier[versionControl] , identifier[versionControl] operator[SEP] identifier[getCommit] operator[SEP] operator[SEP] , identifier[pooledConn] operator[SEP] operator[SEP] Keyword[try] {
identifier[checkpoint] operator[SEP] identifier[updateRefs] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] identifier[ex] Keyword[instanceof] identifier[IOException] operator[SEP] Keyword[throw] operator[SEP] identifier[IOException] operator[SEP] identifier[ex] operator[SEP] Keyword[else] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[inProgress] operator[=] literal[boolean] operator[SEP]
}
}
|
public IfcCommunicationsApplianceTypeEnum createIfcCommunicationsApplianceTypeEnumFromString(EDataType eDataType,
String initialValue) {
IfcCommunicationsApplianceTypeEnum result = IfcCommunicationsApplianceTypeEnum.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} | class class_name[name] begin[{]
method[createIfcCommunicationsApplianceTypeEnumFromString, return_type[type[IfcCommunicationsApplianceTypeEnum]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[IfcCommunicationsApplianceTypeEnum], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[IfcCommunicationsApplianceTypeEnum] identifier[createIfcCommunicationsApplianceTypeEnumFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[IfcCommunicationsApplianceTypeEnum] identifier[result] operator[=] identifier[IfcCommunicationsApplianceTypeEnum] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public static InputColumn<?> getIdentifyingInputColumn(final ComponentJob componentJob) {
final ComponentDescriptor<?> descriptor = componentJob.getDescriptor();
final Set<ConfiguredPropertyDescriptor> inputProperties = descriptor.getConfiguredPropertiesForInput(false);
if (inputProperties.size() != 1) {
return null;
}
final ConfiguredPropertyDescriptor inputProperty = inputProperties.iterator().next();
final Object input = componentJob.getConfiguration().getProperty(inputProperty);
if (input instanceof InputColumn) {
return (InputColumn<?>) input;
} else if (input instanceof InputColumn[]) {
final InputColumn<?>[] inputColumns = (InputColumn[]) input;
if (inputColumns.length != 1) {
return null;
}
return inputColumns[0];
}
return null;
} | class class_name[name] begin[{]
method[getIdentifyingInputColumn, return_type[type[InputColumn]], modifier[public static], parameter[componentJob]] begin[{]
local_variable[type[ComponentDescriptor], descriptor]
local_variable[type[Set], inputProperties]
if[binary_operation[call[inputProperties.size, parameter[]], !=, literal[1]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[ConfiguredPropertyDescriptor], inputProperty]
local_variable[type[Object], input]
if[binary_operation[member[.input], instanceof, type[InputColumn]]] begin[{]
return[Cast(expression=MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=InputColumn, sub_type=None))]
else begin[{]
if[binary_operation[member[.input], instanceof, type[InputColumn]]] begin[{]
local_variable[type[InputColumn], inputColumns]
if[binary_operation[member[inputColumns.length], !=, literal[1]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[member[.inputColumns]]
else begin[{]
None
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InputColumn] operator[<] operator[?] operator[>] identifier[getIdentifyingInputColumn] operator[SEP] Keyword[final] identifier[ComponentJob] identifier[componentJob] operator[SEP] {
Keyword[final] identifier[ComponentDescriptor] operator[<] operator[?] operator[>] identifier[descriptor] operator[=] identifier[componentJob] operator[SEP] identifier[getDescriptor] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[ConfiguredPropertyDescriptor] operator[>] identifier[inputProperties] operator[=] identifier[descriptor] operator[SEP] identifier[getConfiguredPropertiesForInput] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[inputProperties] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] Other[1] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[final] identifier[ConfiguredPropertyDescriptor] identifier[inputProperty] operator[=] identifier[inputProperties] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Object] identifier[input] operator[=] identifier[componentJob] operator[SEP] identifier[getConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getProperty] operator[SEP] identifier[inputProperty] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[input] Keyword[instanceof] identifier[InputColumn] operator[SEP] {
Keyword[return] operator[SEP] identifier[InputColumn] operator[<] operator[?] operator[>] operator[SEP] identifier[input] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[input] Keyword[instanceof] identifier[InputColumn] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[InputColumn] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[inputColumns] operator[=] operator[SEP] identifier[InputColumn] operator[SEP] operator[SEP] operator[SEP] identifier[input] operator[SEP] Keyword[if] operator[SEP] identifier[inputColumns] operator[SEP] identifier[length] operator[!=] Other[1] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[inputColumns] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public static void localListenByLine( int port,
Map<String, SocketAction> actions,
ExecutorService service) {
localListen(port, actions, service, SocketAtom.class);
} | class class_name[name] begin[{]
method[localListenByLine, return_type[void], modifier[public static], parameter[port, actions, service]] begin[{]
call[.localListen, parameter[member[.port], member[.actions], member[.service], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SocketAtom, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[localListenByLine] operator[SEP] Keyword[int] identifier[port] , identifier[Map] operator[<] identifier[String] , identifier[SocketAction] operator[>] identifier[actions] , identifier[ExecutorService] identifier[service] operator[SEP] {
identifier[localListen] operator[SEP] identifier[port] , identifier[actions] , identifier[service] , identifier[SocketAtom] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public <R> R download(String uri,
ContentHandler<BasicHttpResponse, R> handler)
throws RedmineException {
final URI requestUri = configurator.addAPIKey(uri);
final HttpGet request = new HttpGet(requestUri);
if (onBehalfOfUser != null) {
request.addHeader("X-Redmine-Switch-User", onBehalfOfUser);
}
return errorCheckingCommunicator.sendRequest(request, handler);
} | class class_name[name] begin[{]
method[download, return_type[type[R]], modifier[public], parameter[uri, handler]] begin[{]
local_variable[type[URI], requestUri]
local_variable[type[HttpGet], request]
if[binary_operation[member[.onBehalfOfUser], !=, literal[null]]] begin[{]
call[request.addHeader, parameter[literal["X-Redmine-Switch-User"], member[.onBehalfOfUser]]]
else begin[{]
None
end[}]
return[call[errorCheckingCommunicator.sendRequest, parameter[member[.request], member[.handler]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[R] operator[>] identifier[R] identifier[download] operator[SEP] identifier[String] identifier[uri] , identifier[ContentHandler] operator[<] identifier[BasicHttpResponse] , identifier[R] operator[>] identifier[handler] operator[SEP] Keyword[throws] identifier[RedmineException] {
Keyword[final] identifier[URI] identifier[requestUri] operator[=] identifier[configurator] operator[SEP] identifier[addAPIKey] operator[SEP] identifier[uri] operator[SEP] operator[SEP] Keyword[final] identifier[HttpGet] identifier[request] operator[=] Keyword[new] identifier[HttpGet] operator[SEP] identifier[requestUri] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[onBehalfOfUser] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[addHeader] operator[SEP] literal[String] , identifier[onBehalfOfUser] operator[SEP] operator[SEP]
}
Keyword[return] identifier[errorCheckingCommunicator] operator[SEP] identifier[sendRequest] operator[SEP] identifier[request] , identifier[handler] operator[SEP] operator[SEP]
}
|
public Navigate animate(@Nullable Transitions transition) {
if (application != null) {
throw new IllegalArgumentException(
"You can't animate activity transition when using application context");
}
this.transition = transition;
return this;
} | class class_name[name] begin[{]
method[animate, return_type[type[Navigate]], modifier[public], parameter[transition]] begin[{]
if[binary_operation[member[.application], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="You can't animate activity transition when using application context")], 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[}]
assign[THIS[member[None.transition]], member[.transition]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Navigate] identifier[animate] operator[SEP] annotation[@] identifier[Nullable] identifier[Transitions] identifier[transition] operator[SEP] {
Keyword[if] operator[SEP] identifier[application] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[transition] operator[=] identifier[transition] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
protected Object resolveExistsResource(String exp, Map<String, ? extends Object> contextMap, LaContainer container,
Class<?> resultType) {
if (exp.startsWith(EXISTS_BEGIN) && exp.endsWith(EXISTS_END)) {
final String path = exp.substring(EXISTS_BEGIN.length(), exp.lastIndexOf(EXISTS_END));
if (!path.contains(SQ)) {
return LdiResourceUtil.exists(path);
}
}
return null;
} | class class_name[name] begin[{]
method[resolveExistsResource, return_type[type[Object]], modifier[protected], parameter[exp, contextMap, container, resultType]] begin[{]
if[binary_operation[call[exp.startsWith, parameter[member[.EXISTS_BEGIN]]], &&, call[exp.endsWith, parameter[member[.EXISTS_END]]]]] begin[{]
local_variable[type[String], path]
if[call[path.contains, parameter[member[.SQ]]]] begin[{]
return[call[LdiResourceUtil.exists, parameter[member[.path]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[protected] identifier[Object] identifier[resolveExistsResource] operator[SEP] identifier[String] identifier[exp] , identifier[Map] operator[<] identifier[String] , operator[?] Keyword[extends] identifier[Object] operator[>] identifier[contextMap] , identifier[LaContainer] identifier[container] , identifier[Class] operator[<] operator[?] operator[>] identifier[resultType] operator[SEP] {
Keyword[if] operator[SEP] identifier[exp] operator[SEP] identifier[startsWith] operator[SEP] identifier[EXISTS_BEGIN] operator[SEP] operator[&&] identifier[exp] operator[SEP] identifier[endsWith] operator[SEP] identifier[EXISTS_END] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[path] operator[=] identifier[exp] operator[SEP] identifier[substring] operator[SEP] identifier[EXISTS_BEGIN] operator[SEP] identifier[length] operator[SEP] operator[SEP] , identifier[exp] operator[SEP] identifier[lastIndexOf] operator[SEP] identifier[EXISTS_END] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[path] operator[SEP] identifier[contains] operator[SEP] identifier[SQ] operator[SEP] operator[SEP] {
Keyword[return] identifier[LdiResourceUtil] operator[SEP] identifier[exists] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
final void start() {
_enabled = true;
_ignoredSegs.clear();
_executor = Executors.newSingleThreadExecutor(new DaemonThreadFactory());
_executor.execute(this);
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[final], parameter[]] begin[{]
assign[member[._enabled], literal[true]]
call[_ignoredSegs.clear, parameter[]]
assign[member[._executor], call[Executors.newSingleThreadExecutor, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DaemonThreadFactory, sub_type=None))]]]
call[_executor.execute, parameter[THIS[]]]
end[}]
END[}] | Keyword[final] Keyword[void] identifier[start] operator[SEP] operator[SEP] {
identifier[_enabled] operator[=] literal[boolean] operator[SEP] identifier[_ignoredSegs] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[_executor] operator[=] identifier[Executors] operator[SEP] identifier[newSingleThreadExecutor] operator[SEP] Keyword[new] identifier[DaemonThreadFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[_executor] operator[SEP] identifier[execute] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
|
public static DynArray newArray(ExecutionContext context) {
JSFunction ctor = (JSFunction) context.getGlobalContext().getObject().get(context, "__Builtin_Array");
return (DynArray) context.construct((Object) null, ctor);
} | class class_name[name] begin[{]
method[newArray, return_type[type[DynArray]], modifier[public static], parameter[context]] begin[{]
local_variable[type[JSFunction], ctor]
return[Cast(expression=MethodInvocation(arguments=[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), MemberReference(member=ctor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=construct, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=DynArray, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DynArray] identifier[newArray] operator[SEP] identifier[ExecutionContext] identifier[context] operator[SEP] {
identifier[JSFunction] identifier[ctor] operator[=] operator[SEP] identifier[JSFunction] operator[SEP] identifier[context] operator[SEP] identifier[getGlobalContext] operator[SEP] operator[SEP] operator[SEP] identifier[getObject] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[context] , literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[DynArray] operator[SEP] identifier[context] operator[SEP] identifier[construct] operator[SEP] operator[SEP] identifier[Object] operator[SEP] Other[null] , identifier[ctor] operator[SEP] operator[SEP]
}
|
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
managed_device_responses result = (managed_device_responses) service.get_payload_formatter().string_to_resource(managed_device_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.managed_device_response_array);
}
managed_device[] result_managed_device = new managed_device[result.managed_device_response_array.length];
for(int i = 0; i < result.managed_device_response_array.length; i++)
{
result_managed_device[i] = result.managed_device_response_array[i].managed_device[0];
}
return result_managed_device;
} | class class_name[name] begin[{]
method[get_nitro_bulk_response, return_type[type[base_resource]], modifier[protected], parameter[service, response]] begin[{]
local_variable[type[managed_device_responses], result]
if[binary_operation[member[result.errorcode], !=, literal[0]]] begin[{]
if[binary_operation[member[result.errorcode], ==, member[.SESSION_NOT_EXISTS]]] begin[{]
call[service.clear_session, parameter[]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), MemberReference(member=errorcode, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), Cast(expression=MemberReference(member=managed_device_response_array, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[]), type=ReferenceType(arguments=None, dimensions=[None], name=base_response, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=nitro_exception, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[managed_device], result_managed_device]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result_managed_device, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=managed_device_response_array, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=managed_device, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])), 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=result.managed_device_response_array, 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[.result_managed_device]]
end[}]
END[}] | Keyword[protected] identifier[base_resource] operator[SEP] operator[SEP] identifier[get_nitro_bulk_response] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[response] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[managed_device_responses] identifier[result] operator[=] operator[SEP] identifier[managed_device_responses] operator[SEP] identifier[service] operator[SEP] identifier[get_payload_formatter] operator[SEP] operator[SEP] operator[SEP] identifier[string_to_resource] operator[SEP] identifier[managed_device_responses] operator[SEP] Keyword[class] , identifier[response] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[errorcode] operator[!=] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[errorcode] operator[==] identifier[SESSION_NOT_EXISTS] operator[SEP] identifier[service] operator[SEP] identifier[clear_session] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[nitro_exception] operator[SEP] identifier[result] operator[SEP] identifier[message] , identifier[result] operator[SEP] identifier[errorcode] , operator[SEP] identifier[base_response] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[managed_device_response_array] operator[SEP] operator[SEP]
}
identifier[managed_device] operator[SEP] operator[SEP] identifier[result_managed_device] operator[=] Keyword[new] identifier[managed_device] operator[SEP] identifier[result] operator[SEP] identifier[managed_device_response_array] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[result] operator[SEP] identifier[managed_device_response_array] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result_managed_device] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[result] operator[SEP] identifier[managed_device_response_array] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[managed_device] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result_managed_device] operator[SEP]
}
|
public int run() {
try {
if ( compile )
{
compile();
}
String separator = "/";
String cpseperator = ":";
if (System.getProperty("os.name").contains("indows")){
separator = "\\";
cpseperator = ";";
}
String s = fileName.replace(separator, ".");
if ( ".java".equals(s.substring(s.length()-5)))
{
s = s.substring(0, s.length()-5); // .java Entfernen
}
else
{
s = s.substring(0, s.length() - 6); // .class entfernen
}
String localClasspath = classpath;
if (compileFolder != null)
localClasspath = localClasspath + cpseperator + compileFolder;
String command = "java -cp "+localClasspath;
if (libraryPath != null && libraryPath!= "")
command += "-Djava.library.path="+libraryPath;
command = command + " de.kopeme.testrunner.PerformanceTestRunner " + s;
// System.out.println(command);
Process p = Runtime.getRuntime().exec(command);
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
BufferedWriter bw = null;
// System.out.println("ExternalOutputFile: " + externalOutputFile);
if ( externalOutputFile != null && externalOutputFile != "")
{
File output = new File(externalOutputFile);
try {
bw = new BufferedWriter( new FileWriter(output));
} catch (IOException e1) {
// TODO Automatisch generierter Erfassungsblock
e1.printStackTrace();
}
}
while ( (line = br.readLine()) != null )
{
if ( bw == null)
{
System.out.println(line);
}
else
{
bw.write(line+"\n");
}
}
br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
while ( (line = br.readLine()) != null )
{
if ( bw == null)
{
System.out.println(line);
}
else
{
bw.write(line+"\n");
}
}
if ( bw != null )
bw.close();
int returnValue = p.waitFor();
// System.out.println("Returnvalue: " + returnValue);
return returnValue;
} catch (IOException e) {
// TODO Automatisch generierter Erfassungsblock
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Automatisch generierter Erfassungsblock
e.printStackTrace();
}
return 1;
} | class class_name[name] begin[{]
method[run, return_type[type[int]], modifier[public], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=MemberReference(member=compile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=compile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), name=separator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), name=cpseperator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="os.name")], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="indows")], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=cpseperator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=";")), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".")], member=replace, postfix_operators=[], prefix_operators=[], qualifier=fileName, selectors=[], type_arguments=None), name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value=".java"), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=classpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=localClasspath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=compileFolder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=localClasspath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=localClasspath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cpseperator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=compileFolder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java -cp "), operandr=MemberReference(member=localClasspath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=command)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=libraryPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=libraryPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), operator=!=), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=command, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-Djava.library.path="), operandr=MemberReference(member=libraryPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=command, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=command, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" de.kopeme.testrunner.PerformanceTestRunner "), operator=+), operandr=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRuntime, postfix_operators=[], prefix_operators=[], qualifier=Runtime, selectors=[MethodInvocation(arguments=[MemberReference(member=command, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exec, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Process, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)), name=br)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=bw)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BufferedWriter, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=externalOutputFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=externalOutputFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=externalOutputFile, 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)), name=output)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=output, 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=FileWriter, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedWriter, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e1, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['IOException']))], finally_block=None, label=None, resources=None)])), WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n"), operator=+)], member=write, postfix_operators=[], prefix_operators=[], qualifier=bw, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]))]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=br, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=br, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getErrorStream, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None))), label=None), WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n"), operator=+)], member=write, postfix_operators=[], prefix_operators=[], qualifier=bw, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]))]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=br, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=bw, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=waitFor, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), name=returnValue)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ReturnStatement(expression=MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
return[literal[1]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[run] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[compile] operator[SEP] {
identifier[compile] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[separator] operator[=] literal[String] operator[SEP] identifier[String] identifier[cpseperator] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[separator] operator[=] literal[String] operator[SEP] identifier[cpseperator] operator[=] literal[String] operator[SEP]
}
identifier[String] identifier[s] operator[=] identifier[fileName] operator[SEP] identifier[replace] operator[SEP] identifier[separator] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] identifier[substring] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[5] operator[SEP] operator[SEP] operator[SEP] {
identifier[s] operator[=] identifier[s] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[5] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[s] operator[=] identifier[s] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[6] operator[SEP] operator[SEP]
}
identifier[String] identifier[localClasspath] operator[=] identifier[classpath] operator[SEP] Keyword[if] operator[SEP] identifier[compileFolder] operator[!=] Other[null] operator[SEP] identifier[localClasspath] operator[=] identifier[localClasspath] operator[+] identifier[cpseperator] operator[+] identifier[compileFolder] operator[SEP] identifier[String] identifier[command] operator[=] literal[String] operator[+] identifier[localClasspath] operator[SEP] Keyword[if] operator[SEP] identifier[libraryPath] operator[!=] Other[null] operator[&&] identifier[libraryPath] operator[!=] literal[String] operator[SEP] identifier[command] operator[+=] literal[String] operator[+] identifier[libraryPath] operator[SEP] identifier[command] operator[=] identifier[command] operator[+] literal[String] operator[+] identifier[s] operator[SEP] identifier[Process] identifier[p] operator[=] identifier[Runtime] operator[SEP] identifier[getRuntime] operator[SEP] operator[SEP] operator[SEP] identifier[exec] operator[SEP] identifier[command] operator[SEP] operator[SEP] identifier[BufferedReader] identifier[br] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[p] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[line] operator[SEP] identifier[BufferedWriter] identifier[bw] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[externalOutputFile] operator[!=] Other[null] operator[&&] identifier[externalOutputFile] operator[!=] literal[String] operator[SEP] {
identifier[File] identifier[output] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[externalOutputFile] operator[SEP] operator[SEP] Keyword[try] {
identifier[bw] operator[=] Keyword[new] identifier[BufferedWriter] operator[SEP] Keyword[new] identifier[FileWriter] operator[SEP] identifier[output] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e1] operator[SEP] {
identifier[e1] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[br] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[bw] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[bw] operator[SEP] identifier[write] operator[SEP] identifier[line] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
identifier[br] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[p] operator[SEP] identifier[getErrorStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[br] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[bw] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[bw] operator[SEP] identifier[write] operator[SEP] identifier[line] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[bw] operator[!=] Other[null] operator[SEP] identifier[bw] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[returnValue] operator[=] identifier[p] operator[SEP] identifier[waitFor] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[returnValue] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[1] operator[SEP]
}
|
@Override
public void onAdd(Response response) {
String message = gson.toJson(response);
try {
ActiveMqUtils.sendMessage(message, buildQueueNames(response), environment);
} catch (JMSException e) {
logger.error("Failed to send response message to output queue.", e);
}
} | class class_name[name] begin[{]
method[onAdd, return_type[void], modifier[public], parameter[response]] begin[{]
local_variable[type[String], message]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildQueueNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=environment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendMessage, postfix_operators=[], prefix_operators=[], qualifier=ActiveMqUtils, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to send response message to output queue."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JMSException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onAdd] operator[SEP] identifier[Response] identifier[response] operator[SEP] {
identifier[String] identifier[message] operator[=] identifier[gson] operator[SEP] identifier[toJson] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[try] {
identifier[ActiveMqUtils] operator[SEP] identifier[sendMessage] operator[SEP] identifier[message] , identifier[buildQueueNames] operator[SEP] identifier[response] operator[SEP] , identifier[environment] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JMSException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Override
@JsonIgnore
public Set<String> getPossibleUserAttributeNames(final IPersonAttributeDaoFilter filter) {
final Set<String> rslt = new LinkedHashSet<>();
for (final AttributeRule rule : this.rules) {
final Set<String> possibleUserAttributeNames = rule.getPossibleUserAttributeNames();
rslt.addAll(possibleUserAttributeNames);
}
return rslt;
} | class class_name[name] begin[{]
method[getPossibleUserAttributeNames, return_type[type[Set]], modifier[public], parameter[filter]] begin[{]
local_variable[type[Set], rslt]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPossibleUserAttributeNames, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None), name=possibleUserAttributeNames)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=possibleUserAttributeNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=rslt, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=rules, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=rule)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=AttributeRule, sub_type=None))), label=None)
return[member[.rslt]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[JsonIgnore] Keyword[public] identifier[Set] operator[<] identifier[String] operator[>] identifier[getPossibleUserAttributeNames] operator[SEP] Keyword[final] identifier[IPersonAttributeDaoFilter] identifier[filter] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[rslt] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[AttributeRule] identifier[rule] operator[:] Keyword[this] operator[SEP] identifier[rules] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[possibleUserAttributeNames] operator[=] identifier[rule] operator[SEP] identifier[getPossibleUserAttributeNames] operator[SEP] operator[SEP] operator[SEP] identifier[rslt] operator[SEP] identifier[addAll] operator[SEP] identifier[possibleUserAttributeNames] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rslt] operator[SEP]
}
|
protected void printFailureHeader(PdfTemplate template, float x, float y) {
Font f = DebugHelper.debugFontLink(template, getSettings());
Chunk c = new Chunk(getSettings().getProperty("failures in report, see end of report", "failureheader"), f);
ColumnText.showTextAligned(template, Element.ALIGN_LEFT, new Phrase(c), x, y, 0);
} | class class_name[name] begin[{]
method[printFailureHeader, return_type[void], modifier[protected], parameter[template, x, y]] begin[{]
local_variable[type[Font], f]
local_variable[type[Chunk], c]
call[ColumnText.showTextAligned, parameter[member[.template], member[Element.ALIGN_LEFT], ClassCreator(arguments=[MemberReference(member=c, 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=Phrase, sub_type=None)), member[.x], member[.y], literal[0]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[printFailureHeader] operator[SEP] identifier[PdfTemplate] identifier[template] , Keyword[float] identifier[x] , Keyword[float] identifier[y] operator[SEP] {
identifier[Font] identifier[f] operator[=] identifier[DebugHelper] operator[SEP] identifier[debugFontLink] operator[SEP] identifier[template] , identifier[getSettings] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Chunk] identifier[c] operator[=] Keyword[new] identifier[Chunk] operator[SEP] identifier[getSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getProperty] operator[SEP] literal[String] , literal[String] operator[SEP] , identifier[f] operator[SEP] operator[SEP] identifier[ColumnText] operator[SEP] identifier[showTextAligned] operator[SEP] identifier[template] , identifier[Element] operator[SEP] identifier[ALIGN_LEFT] , Keyword[new] identifier[Phrase] operator[SEP] identifier[c] operator[SEP] , identifier[x] , identifier[y] , Other[0] operator[SEP] operator[SEP]
}
|
public InstanceID registerTaskManager(
TaskManagerGateway taskManagerGateway,
TaskManagerLocation taskManagerLocation,
HardwareDescription resources,
int numberOfSlots) {
synchronized (this.lock) {
if (this.isShutdown) {
throw new IllegalStateException("InstanceManager is shut down.");
}
Instance prior = registeredHostsByResource.get(taskManagerLocation.getResourceID());
if (prior != null) {
throw new IllegalStateException("Registration attempt from TaskManager at "
+ taskManagerLocation.addressString() +
". This connection is already registered under ID " + prior.getId());
}
boolean wasDead = this.deadHosts.remove(taskManagerLocation.getResourceID());
if (wasDead) {
LOG.info("Registering TaskManager at " + taskManagerLocation.addressString() +
" which was marked as dead earlier because of a heart-beat timeout.");
}
InstanceID instanceID = new InstanceID();
Instance host = new Instance(
taskManagerGateway,
taskManagerLocation,
instanceID,
resources,
numberOfSlots);
registeredHostsById.put(instanceID, host);
registeredHostsByResource.put(taskManagerLocation.getResourceID(), host);
totalNumberOfAliveTaskSlots += numberOfSlots;
if (LOG.isInfoEnabled()) {
LOG.info(String.format("Registered TaskManager at %s (%s) as %s. " +
"Current number of registered hosts is %d. " +
"Current number of alive task slots is %d.",
taskManagerLocation.getHostname(),
taskManagerGateway.getAddress(),
instanceID,
registeredHostsById.size(),
totalNumberOfAliveTaskSlots));
}
host.reportHeartBeat();
// notify all listeners (for example the scheduler)
notifyNewInstance(host);
return instanceID;
}
} | class class_name[name] begin[{]
method[registerTaskManager, return_type[type[InstanceID]], modifier[public], parameter[taskManagerGateway, taskManagerLocation, resources, numberOfSlots]] begin[{]
SYNCHRONIZED[THIS[member[None.lock]]] BEGIN[{]
if[THIS[member[None.isShutdown]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="InstanceManager is shut down.")], 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[Instance], prior]
if[binary_operation[member[.prior], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Registration attempt from TaskManager at "), operandr=MethodInvocation(arguments=[], member=addressString, postfix_operators=[], prefix_operators=[], qualifier=taskManagerLocation, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=". This connection is already registered under ID "), operator=+), operandr=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=prior, 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=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[boolean], wasDead]
if[member[.wasDead]] begin[{]
call[LOG.info, parameter[binary_operation[binary_operation[literal["Registering TaskManager at "], +, call[taskManagerLocation.addressString, parameter[]]], +, literal[" which was marked as dead earlier because of a heart-beat timeout."]]]]
else begin[{]
None
end[}]
local_variable[type[InstanceID], instanceID]
local_variable[type[Instance], host]
call[registeredHostsById.put, parameter[member[.instanceID], member[.host]]]
call[registeredHostsByResource.put, parameter[call[taskManagerLocation.getResourceID, parameter[]], member[.host]]]
assign[member[.totalNumberOfAliveTaskSlots], member[.numberOfSlots]]
if[call[LOG.isInfoEnabled, parameter[]]] begin[{]
call[LOG.info, parameter[call[String.format, parameter[binary_operation[binary_operation[literal["Registered TaskManager at %s (%s) as %s. "], +, literal["Current number of registered hosts is %d. "]], +, literal["Current number of alive task slots is %d."]], call[taskManagerLocation.getHostname, parameter[]], call[taskManagerGateway.getAddress, parameter[]], member[.instanceID], call[registeredHostsById.size, parameter[]], member[.totalNumberOfAliveTaskSlots]]]]]
else begin[{]
None
end[}]
call[host.reportHeartBeat, parameter[]]
call[.notifyNewInstance, parameter[member[.host]]]
return[member[.instanceID]]
END[}]
end[}]
END[}] | Keyword[public] identifier[InstanceID] identifier[registerTaskManager] operator[SEP] identifier[TaskManagerGateway] identifier[taskManagerGateway] , identifier[TaskManagerLocation] identifier[taskManagerLocation] , identifier[HardwareDescription] identifier[resources] , Keyword[int] identifier[numberOfSlots] operator[SEP] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] identifier[lock] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[isShutdown] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Instance] identifier[prior] operator[=] identifier[registeredHostsByResource] operator[SEP] identifier[get] operator[SEP] identifier[taskManagerLocation] operator[SEP] identifier[getResourceID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[prior] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[taskManagerLocation] operator[SEP] identifier[addressString] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[prior] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[wasDead] operator[=] Keyword[this] operator[SEP] identifier[deadHosts] operator[SEP] identifier[remove] operator[SEP] identifier[taskManagerLocation] operator[SEP] identifier[getResourceID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[wasDead] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[taskManagerLocation] operator[SEP] identifier[addressString] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[InstanceID] identifier[instanceID] operator[=] Keyword[new] identifier[InstanceID] operator[SEP] operator[SEP] operator[SEP] identifier[Instance] identifier[host] operator[=] Keyword[new] identifier[Instance] operator[SEP] identifier[taskManagerGateway] , identifier[taskManagerLocation] , identifier[instanceID] , identifier[resources] , identifier[numberOfSlots] operator[SEP] operator[SEP] identifier[registeredHostsById] operator[SEP] identifier[put] operator[SEP] identifier[instanceID] , identifier[host] operator[SEP] operator[SEP] identifier[registeredHostsByResource] operator[SEP] identifier[put] operator[SEP] identifier[taskManagerLocation] operator[SEP] identifier[getResourceID] operator[SEP] operator[SEP] , identifier[host] operator[SEP] operator[SEP] identifier[totalNumberOfAliveTaskSlots] operator[+=] identifier[numberOfSlots] operator[SEP] Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] , identifier[taskManagerLocation] operator[SEP] identifier[getHostname] operator[SEP] operator[SEP] , identifier[taskManagerGateway] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] , identifier[instanceID] , identifier[registeredHostsById] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[totalNumberOfAliveTaskSlots] operator[SEP] operator[SEP] operator[SEP]
}
identifier[host] operator[SEP] identifier[reportHeartBeat] operator[SEP] operator[SEP] operator[SEP] identifier[notifyNewInstance] operator[SEP] identifier[host] operator[SEP] operator[SEP] Keyword[return] identifier[instanceID] operator[SEP]
}
}
|
public void addBiasParam(@NonNull String paramKey, @NonNull long... paramShape) {
Preconditions.checkArgument(paramShape.length > 0, "Provided mia- parameter shape is"
+ " invalid: length 0 provided for shape. Parameter: " + paramKey);
biasParams.put(paramKey, paramShape);
paramsList = null;
weightParamsList = null;
biasParamsList = null;
} | class class_name[name] begin[{]
method[addBiasParam, return_type[void], modifier[public], parameter[paramKey, paramShape]] begin[{]
call[Preconditions.checkArgument, parameter[binary_operation[member[paramShape.length], >, literal[0]], binary_operation[binary_operation[literal["Provided mia- parameter shape is"], +, literal[" invalid: length 0 provided for shape. Parameter: "]], +, member[.paramKey]]]]
call[biasParams.put, parameter[member[.paramKey], member[.paramShape]]]
assign[member[.paramsList], literal[null]]
assign[member[.weightParamsList], literal[null]]
assign[member[.biasParamsList], literal[null]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addBiasParam] operator[SEP] annotation[@] identifier[NonNull] identifier[String] identifier[paramKey] , annotation[@] identifier[NonNull] Keyword[long] operator[...] identifier[paramShape] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[paramShape] operator[SEP] identifier[length] operator[>] Other[0] , literal[String] operator[+] literal[String] operator[+] identifier[paramKey] operator[SEP] operator[SEP] identifier[biasParams] operator[SEP] identifier[put] operator[SEP] identifier[paramKey] , identifier[paramShape] operator[SEP] operator[SEP] identifier[paramsList] operator[=] Other[null] operator[SEP] identifier[weightParamsList] operator[=] Other[null] operator[SEP] identifier[biasParamsList] operator[=] Other[null] operator[SEP]
}
|
@Nullable
@CheckReturnValue
public static String trimStartAndEnd (@Nullable final String sSrc, @Nullable final String sValueToTrim)
{
return trimStartAndEnd (sSrc, sValueToTrim, sValueToTrim);
} | class class_name[name] begin[{]
method[trimStartAndEnd, return_type[type[String]], modifier[public static], parameter[sSrc, sValueToTrim]] begin[{]
return[call[.trimStartAndEnd, parameter[member[.sSrc], member[.sValueToTrim], member[.sValueToTrim]]]]
end[}]
END[}] | annotation[@] identifier[Nullable] annotation[@] identifier[CheckReturnValue] Keyword[public] Keyword[static] identifier[String] identifier[trimStartAndEnd] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[sSrc] , annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[sValueToTrim] operator[SEP] {
Keyword[return] identifier[trimStartAndEnd] operator[SEP] identifier[sSrc] , identifier[sValueToTrim] , identifier[sValueToTrim] operator[SEP] operator[SEP]
}
|
public void setItems(java.util.Collection<RestApi> items) {
if (items == null) {
this.items = null;
return;
}
this.items = new java.util.ArrayList<RestApi>(items);
} | class class_name[name] begin[{]
method[setItems, return_type[void], modifier[public], parameter[items]] begin[{]
if[binary_operation[member[.items], ==, literal[null]]] begin[{]
assign[THIS[member[None.items]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.items]], ClassCreator(arguments=[MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RestApi, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setItems] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[RestApi] operator[>] identifier[items] operator[SEP] {
Keyword[if] operator[SEP] identifier[items] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[items] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[items] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[RestApi] operator[>] operator[SEP] identifier[items] operator[SEP] operator[SEP]
}
|
public void assignProvidedProperties(final ComponentDescriptor<?> descriptor, final Object component) {
final Set<ProvidedPropertyDescriptor> providedDescriptors = descriptor.getProvidedProperties();
for (final ProvidedPropertyDescriptor providedDescriptor : providedDescriptors) {
final InjectionPoint<Object> injectionPoint = new PropertyInjectionPoint(providedDescriptor, component);
final Object value = _injectionManager.getInstance(injectionPoint);
providedDescriptor.setValue(component, value);
}
} | class class_name[name] begin[{]
method[assignProvidedProperties, return_type[void], modifier[public], parameter[descriptor, component]] begin[{]
local_variable[type[Set], providedDescriptors]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=providedDescriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=component, 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=PropertyInjectionPoint, sub_type=None)), name=injectionPoint)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=InjectionPoint, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=injectionPoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=_injectionManager, selectors=[], type_arguments=None), name=value)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=providedDescriptor, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=providedDescriptors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=providedDescriptor)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ProvidedPropertyDescriptor, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[assignProvidedProperties] operator[SEP] Keyword[final] identifier[ComponentDescriptor] operator[<] operator[?] operator[>] identifier[descriptor] , Keyword[final] identifier[Object] identifier[component] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[ProvidedPropertyDescriptor] operator[>] identifier[providedDescriptors] operator[=] identifier[descriptor] operator[SEP] identifier[getProvidedProperties] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[ProvidedPropertyDescriptor] identifier[providedDescriptor] operator[:] identifier[providedDescriptors] operator[SEP] {
Keyword[final] identifier[InjectionPoint] operator[<] identifier[Object] operator[>] identifier[injectionPoint] operator[=] Keyword[new] identifier[PropertyInjectionPoint] operator[SEP] identifier[providedDescriptor] , identifier[component] operator[SEP] operator[SEP] Keyword[final] identifier[Object] identifier[value] operator[=] identifier[_injectionManager] operator[SEP] identifier[getInstance] operator[SEP] identifier[injectionPoint] operator[SEP] operator[SEP] identifier[providedDescriptor] operator[SEP] identifier[setValue] operator[SEP] identifier[component] , identifier[value] operator[SEP] operator[SEP]
}
}
|
public static boolean isExpectedException(final Class<? extends Exception> expectedClass,
final String expectedMessage, final Exception ex) {
if (!isExpectedType(expectedClass, ex)) {
return false;
}
if ((expectedClass != null) && (expectedMessage != null) && (ex != null)) {
return Objects.equals(expectedMessage, ex.getMessage());
}
return true;
} | class class_name[name] begin[{]
method[isExpectedException, return_type[type[boolean]], modifier[public static], parameter[expectedClass, expectedMessage, ex]] begin[{]
if[call[.isExpectedType, parameter[member[.expectedClass], member[.ex]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.expectedClass], !=, literal[null]], &&, binary_operation[member[.expectedMessage], !=, literal[null]]], &&, binary_operation[member[.ex], !=, literal[null]]]] begin[{]
return[call[Objects.equals, parameter[member[.expectedMessage], call[ex.getMessage, parameter[]]]]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isExpectedException] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Exception] operator[>] identifier[expectedClass] , Keyword[final] identifier[String] identifier[expectedMessage] , Keyword[final] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isExpectedType] operator[SEP] identifier[expectedClass] , identifier[ex] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[expectedClass] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[expectedMessage] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[ex] operator[!=] Other[null] operator[SEP] operator[SEP] {
Keyword[return] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[expectedMessage] , identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
protected void addPathValue(Document doc, String fieldName, Object pathString)
{
doc.add(createFieldWithoutNorms(fieldName, pathString.toString(), PropertyType.PATH));
} | class class_name[name] begin[{]
method[addPathValue, return_type[void], modifier[protected], parameter[doc, fieldName, pathString]] begin[{]
call[doc.add, parameter[call[.createFieldWithoutNorms, parameter[member[.fieldName], call[pathString.toString, parameter[]], member[PropertyType.PATH]]]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[addPathValue] operator[SEP] identifier[Document] identifier[doc] , identifier[String] identifier[fieldName] , identifier[Object] identifier[pathString] operator[SEP] {
identifier[doc] operator[SEP] identifier[add] operator[SEP] identifier[createFieldWithoutNorms] operator[SEP] identifier[fieldName] , identifier[pathString] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[PropertyType] operator[SEP] identifier[PATH] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void moveFile(File srcFile, File destFile) throws IOException {
if (srcFile == null) {
throw new NullPointerException("Source must not be null");
}
if (destFile == null) {
throw new NullPointerException("Destination must not be null");
}
if (!srcFile.exists()) {
throw new FileNotFoundException("Source '" + srcFile + "' does not exist");
}
if (srcFile.isDirectory()) {
throw new IOException("Source '" + srcFile + "' is a directory");
}
if (destFile.exists()) {
throw new FileExistsException("Destination '" + destFile + "' already exists");
}
if (destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' is a directory");
}
boolean rename = srcFile.renameTo(destFile);
if (!rename) {
copyFile( srcFile, destFile );
if (!srcFile.delete()) {
FileUtils.deleteQuietly(destFile);
throw new IOException("Failed to delete original file '" + srcFile +
"' after copy to '" + destFile + "'");
}
}
} | class class_name[name] begin[{]
method[moveFile, return_type[void], modifier[public static], parameter[srcFile, destFile]] begin[{]
if[binary_operation[member[.srcFile], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Source must not be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.destFile], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Destination must not be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[srcFile.exists, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Source '"), operandr=MemberReference(member=srcFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' does not exist"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileNotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[srcFile.isDirectory, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Source '"), operandr=MemberReference(member=srcFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is a directory"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[destFile.exists, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Destination '"), operandr=MemberReference(member=destFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' already exists"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileExistsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[destFile.isDirectory, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Destination '"), operandr=MemberReference(member=destFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is a directory"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[boolean], rename]
if[member[.rename]] begin[{]
call[.copyFile, parameter[member[.srcFile], member[.destFile]]]
if[call[srcFile.delete, parameter[]]] begin[{]
call[FileUtils.deleteQuietly, parameter[member[.destFile]]]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to delete original file '"), operandr=MemberReference(member=srcFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' after copy to '"), operator=+), operandr=MemberReference(member=destFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[moveFile] operator[SEP] identifier[File] identifier[srcFile] , identifier[File] identifier[destFile] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[srcFile] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[destFile] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[srcFile] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FileNotFoundException] operator[SEP] literal[String] operator[+] identifier[srcFile] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[srcFile] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[srcFile] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[destFile] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FileExistsException] operator[SEP] literal[String] operator[+] identifier[destFile] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[destFile] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[destFile] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[rename] operator[=] identifier[srcFile] operator[SEP] identifier[renameTo] operator[SEP] identifier[destFile] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[rename] operator[SEP] {
identifier[copyFile] operator[SEP] identifier[srcFile] , identifier[destFile] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[srcFile] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] {
identifier[FileUtils] operator[SEP] identifier[deleteQuietly] operator[SEP] identifier[destFile] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[srcFile] operator[+] literal[String] operator[+] identifier[destFile] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
|
public void paint (Graphics2D gfx, int layer, Shape clip)
{
for (int ii = 0, nn = _media.size(); ii < nn; ii++) {
AbstractMedia media = _media.get(ii);
int order = media.getRenderOrder();
try {
if (((layer == ALL) || (layer == FRONT && order >= 0) ||
(layer == BACK && order < 0)) && clip.intersects(media.getBounds())) {
media.paint(gfx);
}
} catch (Exception e) {
log.warning("Failed to render media", "media", media, e);
}
}
} | class class_name[name] begin[{]
method[paint, return_type[void], modifier[public], parameter[gfx, layer, clip]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=_media, selectors=[], type_arguments=None), name=media)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AbstractMedia, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRenderOrder, postfix_operators=[], prefix_operators=[], qualifier=media, selectors=[], type_arguments=None), name=order)], modifiers=set(), type=BasicType(dimensions=[], name=int)), TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=layer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ALL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=layer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=FRONT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=order, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), operator=&&), operator=||), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=layer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=BACK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=order, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), operator=&&), operator=||), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBounds, postfix_operators=[], prefix_operators=[], qualifier=media, selectors=[], type_arguments=None)], member=intersects, postfix_operators=[], prefix_operators=[], qualifier=clip, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gfx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=paint, postfix_operators=[], prefix_operators=[], qualifier=media, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to render media"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="media"), MemberReference(member=media, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warning, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=ii), VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=_media, selectors=[], type_arguments=None), name=nn)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ii, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[paint] operator[SEP] identifier[Graphics2D] identifier[gfx] , Keyword[int] identifier[layer] , identifier[Shape] identifier[clip] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[ii] operator[=] Other[0] , identifier[nn] operator[=] identifier[_media] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[ii] operator[<] identifier[nn] operator[SEP] identifier[ii] operator[++] operator[SEP] {
identifier[AbstractMedia] identifier[media] operator[=] identifier[_media] operator[SEP] identifier[get] operator[SEP] identifier[ii] operator[SEP] operator[SEP] Keyword[int] identifier[order] operator[=] identifier[media] operator[SEP] identifier[getRenderOrder] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[layer] operator[==] identifier[ALL] operator[SEP] operator[||] operator[SEP] identifier[layer] operator[==] identifier[FRONT] operator[&&] identifier[order] operator[>=] Other[0] operator[SEP] operator[||] operator[SEP] identifier[layer] operator[==] identifier[BACK] operator[&&] identifier[order] operator[<] Other[0] operator[SEP] operator[SEP] operator[&&] identifier[clip] operator[SEP] identifier[intersects] operator[SEP] identifier[media] operator[SEP] identifier[getBounds] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[media] operator[SEP] identifier[paint] operator[SEP] identifier[gfx] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[warning] operator[SEP] literal[String] , literal[String] , identifier[media] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
@Pure
public N getChildAt(IcosepQuadTreeZone zone) {
if (zone == IcosepQuadTreeZone.ICOSEP) {
return this.nicosep;
}
return getChildAt(zone.toQuadTreeZone());
} | class class_name[name] begin[{]
method[getChildAt, return_type[type[N]], modifier[public], parameter[zone]] begin[{]
if[binary_operation[member[.zone], ==, member[IcosepQuadTreeZone.ICOSEP]]] begin[{]
return[THIS[member[None.nicosep]]]
else begin[{]
None
end[}]
return[call[.getChildAt, parameter[call[zone.toQuadTreeZone, parameter[]]]]]
end[}]
END[}] | annotation[@] identifier[Pure] Keyword[public] identifier[N] identifier[getChildAt] operator[SEP] identifier[IcosepQuadTreeZone] identifier[zone] operator[SEP] {
Keyword[if] operator[SEP] identifier[zone] operator[==] identifier[IcosepQuadTreeZone] operator[SEP] identifier[ICOSEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[nicosep] operator[SEP]
}
Keyword[return] identifier[getChildAt] operator[SEP] identifier[zone] operator[SEP] identifier[toQuadTreeZone] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
static double luma( double color ) {
long argb = Double.doubleToRawLongBits( color );
double r = ((argb >> 32) & 0xFFFF) / (double)0xFF00;
double g = ((argb >> 16) & 0xFFFF) / (double)0xFF00;
double b = ((argb) & 0xFFFF) / (double)0xFF00;
r = (r <= 0.03928) ? r / 12.92 : Math.pow( ((r + 0.055) / 1.055), 2.4 );
g = (g <= 0.03928) ? g / 12.92 : Math.pow( ((g + 0.055) / 1.055), 2.4 );
b = (b <= 0.03928) ? b / 12.92 : Math.pow( ((b + 0.055) / 1.055), 2.4 );
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
} | class class_name[name] begin[{]
method[luma, return_type[type[double]], modifier[static], parameter[color]] begin[{]
local_variable[type[long], argb]
local_variable[type[double], r]
local_variable[type[double], g]
local_variable[type[double], b]
assign[member[.r], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.03928), operator=<=), if_false=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.055), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.055), operator=/), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2.4)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=12.92), operator=/))]
assign[member[.g], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.03928), operator=<=), if_false=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.055), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.055), operator=/), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2.4)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=12.92), operator=/))]
assign[member[.b], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.03928), operator=<=), if_false=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.055), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.055), operator=/), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2.4)], member=pow, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=12.92), operator=/))]
return[binary_operation[binary_operation[binary_operation[literal[0.2126], *, member[.r]], +, binary_operation[literal[0.7152], *, member[.g]]], +, binary_operation[literal[0.0722], *, member[.b]]]]
end[}]
END[}] | Keyword[static] Keyword[double] identifier[luma] operator[SEP] Keyword[double] identifier[color] operator[SEP] {
Keyword[long] identifier[argb] operator[=] identifier[Double] operator[SEP] identifier[doubleToRawLongBits] operator[SEP] identifier[color] operator[SEP] operator[SEP] Keyword[double] identifier[r] operator[=] operator[SEP] operator[SEP] identifier[argb] operator[>] operator[>] Other[32] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[/] operator[SEP] Keyword[double] operator[SEP] literal[Integer] operator[SEP] Keyword[double] identifier[g] operator[=] operator[SEP] operator[SEP] identifier[argb] operator[>] operator[>] Other[16] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[/] operator[SEP] Keyword[double] operator[SEP] literal[Integer] operator[SEP] Keyword[double] identifier[b] operator[=] operator[SEP] operator[SEP] identifier[argb] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[/] operator[SEP] Keyword[double] operator[SEP] literal[Integer] operator[SEP] identifier[r] operator[=] operator[SEP] identifier[r] operator[<=] literal[Float] operator[SEP] operator[?] identifier[r] operator[/] literal[Float] operator[:] identifier[Math] operator[SEP] identifier[pow] operator[SEP] operator[SEP] operator[SEP] identifier[r] operator[+] literal[Float] operator[SEP] operator[/] literal[Float] operator[SEP] , literal[Float] operator[SEP] operator[SEP] identifier[g] operator[=] operator[SEP] identifier[g] operator[<=] literal[Float] operator[SEP] operator[?] identifier[g] operator[/] literal[Float] operator[:] identifier[Math] operator[SEP] identifier[pow] operator[SEP] operator[SEP] operator[SEP] identifier[g] operator[+] literal[Float] operator[SEP] operator[/] literal[Float] operator[SEP] , literal[Float] operator[SEP] operator[SEP] identifier[b] operator[=] operator[SEP] identifier[b] operator[<=] literal[Float] operator[SEP] operator[?] identifier[b] operator[/] literal[Float] operator[:] identifier[Math] operator[SEP] identifier[pow] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[+] literal[Float] operator[SEP] operator[/] literal[Float] operator[SEP] , literal[Float] operator[SEP] operator[SEP] Keyword[return] literal[Float] operator[*] identifier[r] operator[+] literal[Float] operator[*] identifier[g] operator[+] literal[Float] operator[*] identifier[b] operator[SEP]
}
|
public static void remove(Registry registry, Id id) {
Object obj = registry.state().get(id);
if (obj instanceof AbstractMeterState) {
registry.state().remove(id, obj);
}
} | class class_name[name] begin[{]
method[remove, return_type[void], modifier[public static], parameter[registry, id]] begin[{]
local_variable[type[Object], obj]
if[binary_operation[member[.obj], instanceof, type[AbstractMeterState]]] begin[{]
call[registry.state, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[remove] operator[SEP] identifier[Registry] identifier[registry] , identifier[Id] identifier[id] operator[SEP] {
identifier[Object] identifier[obj] operator[=] identifier[registry] operator[SEP] identifier[state] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[obj] Keyword[instanceof] identifier[AbstractMeterState] operator[SEP] {
identifier[registry] operator[SEP] identifier[state] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[id] , identifier[obj] operator[SEP] operator[SEP]
}
}
|
public final <T> T parse(Class<T> destinationClass) throws IOException {
return parse(destinationClass, null);
} | class class_name[name] begin[{]
method[parse, return_type[type[T]], modifier[final public], parameter[destinationClass]] begin[{]
return[call[.parse, parameter[member[.destinationClass], literal[null]]]]
end[}]
END[}] | Keyword[public] Keyword[final] operator[<] identifier[T] operator[>] identifier[T] identifier[parse] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[destinationClass] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[parse] operator[SEP] identifier[destinationClass] , Other[null] operator[SEP] operator[SEP]
}
|
@Override
public IntegerMapper build(String field) {
return new IntegerMapper(field, column, validated, boost);
} | class class_name[name] begin[{]
method[build, return_type[type[IntegerMapper]], modifier[public], parameter[field]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=column, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=validated, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=boost, 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=IntegerMapper, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[IntegerMapper] identifier[build] operator[SEP] identifier[String] identifier[field] operator[SEP] {
Keyword[return] Keyword[new] identifier[IntegerMapper] operator[SEP] identifier[field] , identifier[column] , identifier[validated] , identifier[boost] operator[SEP] operator[SEP]
}
|
public void stop(boolean completeClear) {
final String methodName = "stop()";
if (this.invalidationBuffer.isBackgroundInvalidationInProgress()) {
this.invalidationBuffer.setLoopOnce(true);
if (this.invalidationBuffer.isCleanupPending()) {
this.invalidationBuffer.resetCleanupPending();
}
this.cod.waitForCleanupComplete();
this.invalidationBuffer.setLoopOnce(false);
}
if (completeClear) {
this.invalidationBuffer.clear(HTODInvalidationBuffer.EXPLICIT_BUFFER);
this.invalidationBuffer.clear(HTODInvalidationBuffer.SCAN_BUFFER);
this.invalidationBuffer.clear(HTODInvalidationBuffer.GC_BUFFER);
} else {
this.invalidationBuffer.clear(HTODInvalidationBuffer.SCAN_BUFFER);
this.invalidationBuffer.clear(HTODInvalidationBuffer.GC_BUFFER);
this.cod.valueSet = this.invalidationBuffer.getAndRemoveFromExplicitBuffer();
if (this.cod.valueSet != null && this.cod.valueSet.size() > 0) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName, "cacheName=" + this.cacheName + " offload explicit buffer size=" + this.cod.valueSet.size());
}
}
} | class class_name[name] begin[{]
method[stop, return_type[void], modifier[public], parameter[completeClear]] begin[{]
local_variable[type[String], methodName]
if[THIS[member[None.invalidationBuffer]call[None.isBackgroundInvalidationInProgress, parameter[]]]] begin[{]
THIS[member[None.invalidationBuffer]call[None.setLoopOnce, parameter[literal[true]]]]
if[THIS[member[None.invalidationBuffer]call[None.isCleanupPending, parameter[]]]] begin[{]
THIS[member[None.invalidationBuffer]call[None.resetCleanupPending, parameter[]]]
else begin[{]
None
end[}]
THIS[member[None.cod]call[None.waitForCleanupComplete, parameter[]]]
THIS[member[None.invalidationBuffer]call[None.setLoopOnce, parameter[literal[false]]]]
else begin[{]
None
end[}]
if[member[.completeClear]] begin[{]
THIS[member[None.invalidationBuffer]call[None.clear, parameter[member[HTODInvalidationBuffer.EXPLICIT_BUFFER]]]]
THIS[member[None.invalidationBuffer]call[None.clear, parameter[member[HTODInvalidationBuffer.SCAN_BUFFER]]]]
THIS[member[None.invalidationBuffer]call[None.clear, parameter[member[HTODInvalidationBuffer.GC_BUFFER]]]]
else begin[{]
THIS[member[None.invalidationBuffer]call[None.clear, parameter[member[HTODInvalidationBuffer.SCAN_BUFFER]]]]
THIS[member[None.invalidationBuffer]call[None.clear, parameter[member[HTODInvalidationBuffer.GC_BUFFER]]]]
assign[THIS[member[None.cod]member[None.valueSet]], THIS[member[None.invalidationBuffer]call[None.getAndRemoveFromExplicitBuffer, parameter[]]]]
if[binary_operation[binary_operation[THIS[member[None.cod]member[None.valueSet]], !=, literal[null]], &&, binary_operation[THIS[member[None.cod]member[None.valueSet]call[None.size, parameter[]]], >, literal[0]]]] begin[{]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], member[.methodName], binary_operation[binary_operation[binary_operation[literal["cacheName="], +, THIS[member[None.cacheName]]], +, literal[" offload explicit buffer size="]], +, THIS[member[None.cod]member[None.valueSet]call[None.size, parameter[]]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[stop] operator[SEP] Keyword[boolean] identifier[completeClear] operator[SEP] {
Keyword[final] identifier[String] identifier[methodName] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[isBackgroundInvalidationInProgress] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[setLoopOnce] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[isCleanupPending] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[resetCleanupPending] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[cod] operator[SEP] identifier[waitForCleanupComplete] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[setLoopOnce] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[completeClear] operator[SEP] {
Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[clear] operator[SEP] identifier[HTODInvalidationBuffer] operator[SEP] identifier[EXPLICIT_BUFFER] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[clear] operator[SEP] identifier[HTODInvalidationBuffer] operator[SEP] identifier[SCAN_BUFFER] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[clear] operator[SEP] identifier[HTODInvalidationBuffer] operator[SEP] identifier[GC_BUFFER] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[clear] operator[SEP] identifier[HTODInvalidationBuffer] operator[SEP] identifier[SCAN_BUFFER] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[clear] operator[SEP] identifier[HTODInvalidationBuffer] operator[SEP] identifier[GC_BUFFER] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[cod] operator[SEP] identifier[valueSet] operator[=] Keyword[this] operator[SEP] identifier[invalidationBuffer] operator[SEP] identifier[getAndRemoveFromExplicitBuffer] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[cod] operator[SEP] identifier[valueSet] operator[!=] Other[null] operator[&&] Keyword[this] operator[SEP] identifier[cod] operator[SEP] identifier[valueSet] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , identifier[methodName] , literal[String] operator[+] Keyword[this] operator[SEP] identifier[cacheName] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[cod] operator[SEP] identifier[valueSet] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public CreateRouteRequest withRequestParameters(java.util.Map<String, ParameterConstraints> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | class class_name[name] begin[{]
method[withRequestParameters, return_type[type[CreateRouteRequest]], modifier[public], parameter[requestParameters]] begin[{]
call[.setRequestParameters, parameter[member[.requestParameters]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CreateRouteRequest] identifier[withRequestParameters] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[ParameterConstraints] operator[>] identifier[requestParameters] operator[SEP] {
identifier[setRequestParameters] operator[SEP] identifier[requestParameters] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public alluxio.grpc.TtlAction getTtlAction() {
alluxio.grpc.TtlAction result = alluxio.grpc.TtlAction.valueOf(ttlAction_);
return result == null ? alluxio.grpc.TtlAction.DELETE : result;
} | class class_name[name] begin[{]
method[getTtlAction, return_type[type[alluxio]], modifier[public], parameter[]] begin[{]
local_variable[type[alluxio], result]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=DELETE, postfix_operators=[], prefix_operators=[], qualifier=alluxio.grpc.TtlAction, selectors=[]))]
end[}]
END[}] | Keyword[public] identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[TtlAction] identifier[getTtlAction] operator[SEP] operator[SEP] {
identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[TtlAction] identifier[result] operator[=] identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[TtlAction] operator[SEP] identifier[valueOf] operator[SEP] identifier[ttlAction_] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[==] Other[null] operator[?] identifier[alluxio] operator[SEP] identifier[grpc] operator[SEP] identifier[TtlAction] operator[SEP] identifier[DELETE] operator[:] identifier[result] operator[SEP]
}
|
private static String unsignedIntToString(int x, int radix)
{
long asLong = x & INT_MASK;
return Long.toString(asLong, radix);
} | class class_name[name] begin[{]
method[unsignedIntToString, return_type[type[String]], modifier[private static], parameter[x, radix]] begin[{]
local_variable[type[long], asLong]
return[call[Long.toString, parameter[member[.asLong], member[.radix]]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[unsignedIntToString] operator[SEP] Keyword[int] identifier[x] , Keyword[int] identifier[radix] operator[SEP] {
Keyword[long] identifier[asLong] operator[=] identifier[x] operator[&] identifier[INT_MASK] operator[SEP] Keyword[return] identifier[Long] operator[SEP] identifier[toString] operator[SEP] identifier[asLong] , identifier[radix] operator[SEP] operator[SEP]
}
|
@VisibleForTesting
String getOverridenHost() {
URI uri = GrpcUtil.authorityToUri(defaultAuthority);
if (uri.getHost() != null) {
return uri.getHost();
}
return defaultAuthority;
} | class class_name[name] begin[{]
method[getOverridenHost, return_type[type[String]], modifier[default], parameter[]] begin[{]
local_variable[type[URI], uri]
if[binary_operation[call[uri.getHost, parameter[]], !=, literal[null]]] begin[{]
return[call[uri.getHost, parameter[]]]
else begin[{]
None
end[}]
return[member[.defaultAuthority]]
end[}]
END[}] | annotation[@] identifier[VisibleForTesting] identifier[String] identifier[getOverridenHost] operator[SEP] operator[SEP] {
identifier[URI] identifier[uri] operator[=] identifier[GrpcUtil] operator[SEP] identifier[authorityToUri] operator[SEP] identifier[defaultAuthority] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uri] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[uri] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[defaultAuthority] operator[SEP]
}
|
private List<Map<String, String>> marshall(IPermission[] data) {
// Assertions.
if (data == null) {
String msg = "Argument 'data' cannot be null";
throw new IllegalArgumentException(msg);
}
List<Map<String, String>> rslt = new ArrayList<Map<String, String>>(data.length);
for (IPermission p : data) {
JsonEntityBean bean = getEntityBean(p.getPrincipal());
Map<String, String> entry = new HashMap<String, String>();
entry.put("owner", p.getOwner());
entry.put("principalType", bean.getEntityTypeAsString());
entry.put("principalName", bean.getName());
entry.put("principalKey", p.getPrincipal());
entry.put("activity", p.getActivity());
entry.put("target", p.getTarget());
entry.put("permissionType", p.getType());
/*
* Attempt to find a name for this target through the permission
* target provider registry. If none can be found, just use
* the target key.
*/
String targetName = null;
try {
// attempt to get the target provider for this activity
IPermissionActivity activity =
permissionOwnerDao.getPermissionActivity(p.getOwner(), p.getActivity());
entry.put("activityName", activity.getName());
IPermissionOwner owner = permissionOwnerDao.getPermissionOwner(p.getOwner());
entry.put("ownerName", owner.getName());
String providerKey = activity.getTargetProviderKey();
IPermissionTargetProvider provider =
targetProviderRegistry.getTargetProvider(providerKey);
// get the target from the provider
IPermissionTarget target = provider.getTarget(p.getTarget());
targetName = target.getName();
} catch (RuntimeException e) {
// likely a result of a null activity or provider
log.trace("Failed to resolve target name", e);
}
if (targetName == null) {
targetName = p.getTarget();
}
entry.put("targetName", targetName);
rslt.add(entry);
}
return rslt;
} | class class_name[name] begin[{]
method[marshall, return_type[type[List]], modifier[private], parameter[data]] begin[{]
if[binary_operation[member[.data], ==, literal[null]]] begin[{]
local_variable[type[String], msg]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[List], rslt]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPrincipal, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], member=getEntityBean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=bean)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonEntityBean, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None)), name=entry)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="owner"), MethodInvocation(arguments=[], member=getOwner, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="principalType"), MethodInvocation(arguments=[], member=getEntityTypeAsString, postfix_operators=[], prefix_operators=[], qualifier=bean, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="principalName"), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=bean, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="principalKey"), MethodInvocation(arguments=[], member=getPrincipal, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="activity"), MethodInvocation(arguments=[], member=getActivity, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="target"), MethodInvocation(arguments=[], member=getTarget, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="permissionType"), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=targetName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOwner, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getActivity, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], member=getPermissionActivity, postfix_operators=[], prefix_operators=[], qualifier=permissionOwnerDao, selectors=[], type_arguments=None), name=activity)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IPermissionActivity, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="activityName"), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=activity, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOwner, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], member=getPermissionOwner, postfix_operators=[], prefix_operators=[], qualifier=permissionOwnerDao, selectors=[], type_arguments=None), name=owner)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IPermissionOwner, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ownerName"), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=owner, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTargetProviderKey, postfix_operators=[], prefix_operators=[], qualifier=activity, selectors=[], type_arguments=None), name=providerKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=providerKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTargetProvider, postfix_operators=[], prefix_operators=[], qualifier=targetProviderRegistry, selectors=[], type_arguments=None), name=provider)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IPermissionTargetProvider, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTarget, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)], member=getTarget, postfix_operators=[], prefix_operators=[], qualifier=provider, selectors=[], type_arguments=None), name=target)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IPermissionTarget, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=targetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=target, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to resolve target name"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=trace, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RuntimeException']))], finally_block=None, label=None, resources=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=targetName, 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=targetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getTarget, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="targetName"), MemberReference(member=targetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=rslt, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=data, 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=IPermission, sub_type=None))), label=None)
return[member[.rslt]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[marshall] operator[SEP] identifier[IPermission] operator[SEP] operator[SEP] identifier[data] operator[SEP] {
Keyword[if] operator[SEP] identifier[data] operator[==] Other[null] operator[SEP] {
identifier[String] identifier[msg] operator[=] literal[String] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[rslt] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] operator[SEP] identifier[data] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[IPermission] identifier[p] operator[:] identifier[data] operator[SEP] {
identifier[JsonEntityBean] identifier[bean] operator[=] identifier[getEntityBean] operator[SEP] identifier[p] operator[SEP] identifier[getPrincipal] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[entry] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[p] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[bean] operator[SEP] identifier[getEntityTypeAsString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[bean] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[p] operator[SEP] identifier[getPrincipal] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[p] operator[SEP] identifier[getActivity] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[p] operator[SEP] identifier[getTarget] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[p] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[targetName] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[IPermissionActivity] identifier[activity] operator[=] identifier[permissionOwnerDao] operator[SEP] identifier[getPermissionActivity] operator[SEP] identifier[p] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] , identifier[p] operator[SEP] identifier[getActivity] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[activity] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[IPermissionOwner] identifier[owner] operator[=] identifier[permissionOwnerDao] operator[SEP] identifier[getPermissionOwner] operator[SEP] identifier[p] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[owner] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[providerKey] operator[=] identifier[activity] operator[SEP] identifier[getTargetProviderKey] operator[SEP] operator[SEP] operator[SEP] identifier[IPermissionTargetProvider] identifier[provider] operator[=] identifier[targetProviderRegistry] operator[SEP] identifier[getTargetProvider] operator[SEP] identifier[providerKey] operator[SEP] operator[SEP] identifier[IPermissionTarget] identifier[target] operator[=] identifier[provider] operator[SEP] identifier[getTarget] operator[SEP] identifier[p] operator[SEP] identifier[getTarget] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[targetName] operator[=] identifier[target] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[targetName] operator[==] Other[null] operator[SEP] {
identifier[targetName] operator[=] identifier[p] operator[SEP] identifier[getTarget] operator[SEP] operator[SEP] operator[SEP]
}
identifier[entry] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[targetName] operator[SEP] operator[SEP] identifier[rslt] operator[SEP] identifier[add] operator[SEP] identifier[entry] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rslt] operator[SEP]
}
|
private void _emitMarkedLines (final MarkdownHCStack aOut, final Line aLines)
{
final StringBuilder aIn = new StringBuilder ();
Line aLine = aLines;
while (aLine != null)
{
if (!aLine.m_bIsEmpty)
{
aIn.append (aLine.m_sValue.substring (aLine.m_nLeading, aLine.m_sValue.length () - aLine.m_nTrailing));
if (aLine.m_nTrailing >= 2 && !m_bConvertNewline2Br)
aIn.append ("<br />");
}
if (aLine.m_aNext != null)
{
aIn.append ('\n');
if (m_bConvertNewline2Br)
aIn.append ("<br />");
}
aLine = aLine.m_aNext;
}
_recursiveEmitLine (aOut, aIn.toString (), 0, EMarkToken.NONE);
} | class class_name[name] begin[{]
method[_emitMarkedLines, return_type[void], modifier[private], parameter[aOut, aLines]] begin[{]
local_variable[type[StringBuilder], aIn]
local_variable[type[Line], aLine]
while[binary_operation[member[.aLine], !=, literal[null]]] begin[{]
if[member[aLine.m_bIsEmpty]] begin[{]
call[aIn.append, parameter[call[aLine.m_sValue.substring, parameter[member[aLine.m_nLeading], binary_operation[call[aLine.m_sValue.length, parameter[]], -, member[aLine.m_nTrailing]]]]]]
if[binary_operation[binary_operation[member[aLine.m_nTrailing], >=, literal[2]], &&, member[.m_bConvertNewline2Br]]] begin[{]
call[aIn.append, parameter[literal["<br />"]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[aLine.m_aNext], !=, literal[null]]] begin[{]
call[aIn.append, parameter[literal['\n']]]
if[member[.m_bConvertNewline2Br]] begin[{]
call[aIn.append, parameter[literal["<br />"]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.aLine], member[aLine.m_aNext]]
end[}]
call[._recursiveEmitLine, parameter[member[.aOut], call[aIn.toString, parameter[]], literal[0], member[EMarkToken.NONE]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[_emitMarkedLines] operator[SEP] Keyword[final] identifier[MarkdownHCStack] identifier[aOut] , Keyword[final] identifier[Line] identifier[aLines] operator[SEP] {
Keyword[final] identifier[StringBuilder] identifier[aIn] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[Line] identifier[aLine] operator[=] identifier[aLines] operator[SEP] Keyword[while] operator[SEP] identifier[aLine] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[aLine] operator[SEP] identifier[m_bIsEmpty] operator[SEP] {
identifier[aIn] operator[SEP] identifier[append] operator[SEP] identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[substring] operator[SEP] identifier[aLine] operator[SEP] identifier[m_nLeading] , identifier[aLine] operator[SEP] identifier[m_sValue] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[aLine] operator[SEP] identifier[m_nTrailing] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[aLine] operator[SEP] identifier[m_nTrailing] operator[>=] Other[2] operator[&&] operator[!] identifier[m_bConvertNewline2Br] operator[SEP] identifier[aIn] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[aLine] operator[SEP] identifier[m_aNext] operator[!=] Other[null] operator[SEP] {
identifier[aIn] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_bConvertNewline2Br] operator[SEP] identifier[aIn] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[aLine] operator[=] identifier[aLine] operator[SEP] identifier[m_aNext] operator[SEP]
}
identifier[_recursiveEmitLine] operator[SEP] identifier[aOut] , identifier[aIn] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[0] , identifier[EMarkToken] operator[SEP] identifier[NONE] operator[SEP] operator[SEP]
}
|
private OriginalMapping getOriginalMappingForEntry(Entry entry) {
if (entry.getSourceFileId() == UNMAPPED) {
return null;
} else {
// Adjust the line/column here to be start at 1.
Builder x = OriginalMapping.newBuilder()
.setOriginalFile(sources[entry.getSourceFileId()])
.setLineNumber(entry.getSourceLine() + 1)
.setColumnPosition(entry.getSourceColumn() + 1);
if (entry.getNameId() != UNMAPPED) {
x.setIdentifier(names[entry.getNameId()]);
}
return x.build();
}
} | class class_name[name] begin[{]
method[getOriginalMappingForEntry, return_type[type[OriginalMapping]], modifier[private], parameter[entry]] begin[{]
if[binary_operation[call[entry.getSourceFileId, parameter[]], ==, member[.UNMAPPED]]] begin[{]
return[literal[null]]
else begin[{]
local_variable[type[Builder], x]
if[binary_operation[call[entry.getNameId, parameter[]], !=, member[.UNMAPPED]]] begin[{]
call[x.setIdentifier, parameter[member[.names]]]
else begin[{]
None
end[}]
return[call[x.build, parameter[]]]
end[}]
end[}]
END[}] | Keyword[private] identifier[OriginalMapping] identifier[getOriginalMappingForEntry] operator[SEP] identifier[Entry] identifier[entry] operator[SEP] {
Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[getSourceFileId] operator[SEP] operator[SEP] operator[==] identifier[UNMAPPED] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
identifier[Builder] identifier[x] operator[=] identifier[OriginalMapping] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setOriginalFile] operator[SEP] identifier[sources] operator[SEP] identifier[entry] operator[SEP] identifier[getSourceFileId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setLineNumber] operator[SEP] identifier[entry] operator[SEP] identifier[getSourceLine] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] identifier[setColumnPosition] operator[SEP] identifier[entry] operator[SEP] identifier[getSourceColumn] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[getNameId] operator[SEP] operator[SEP] operator[!=] identifier[UNMAPPED] operator[SEP] {
identifier[x] operator[SEP] identifier[setIdentifier] operator[SEP] identifier[names] operator[SEP] identifier[entry] operator[SEP] identifier[getNameId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[x] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public URL findResourceURL(String resourcePath, String versionRange)
{
//if (ClassServiceBootstrap.repositoryAdmin == null)
// return null;
URL url = this.getResourceFromBundle(null, resourcePath, versionRange);
if (url == null) {
Object resource = this.deployThisResource(ClassFinderActivator.getPackageName(resourcePath, true), versionRange, false);
if (resource != null)
url = this.getResourceFromBundle(resource, resourcePath, versionRange);
}
return url;
} | class class_name[name] begin[{]
method[findResourceURL, return_type[type[URL]], modifier[public], parameter[resourcePath, versionRange]] begin[{]
local_variable[type[URL], url]
if[binary_operation[member[.url], ==, literal[null]]] begin[{]
local_variable[type[Object], resource]
if[binary_operation[member[.resource], !=, literal[null]]] begin[{]
assign[member[.url], THIS[call[None.getResourceFromBundle, parameter[member[.resource], member[.resourcePath], member[.versionRange]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.url]]
end[}]
END[}] | Keyword[public] identifier[URL] identifier[findResourceURL] operator[SEP] identifier[String] identifier[resourcePath] , identifier[String] identifier[versionRange] operator[SEP] {
identifier[URL] identifier[url] operator[=] Keyword[this] operator[SEP] identifier[getResourceFromBundle] operator[SEP] Other[null] , identifier[resourcePath] , identifier[versionRange] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[url] operator[==] Other[null] operator[SEP] {
identifier[Object] identifier[resource] operator[=] Keyword[this] operator[SEP] identifier[deployThisResource] operator[SEP] identifier[ClassFinderActivator] operator[SEP] identifier[getPackageName] operator[SEP] identifier[resourcePath] , literal[boolean] operator[SEP] , identifier[versionRange] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resource] operator[!=] Other[null] operator[SEP] identifier[url] operator[=] Keyword[this] operator[SEP] identifier[getResourceFromBundle] operator[SEP] identifier[resource] , identifier[resourcePath] , identifier[versionRange] operator[SEP] operator[SEP]
}
Keyword[return] identifier[url] operator[SEP]
}
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.