code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static void registerSubscription(Subscription subscription) {
mSubscriptions.add(subscription);
if (isConnected()) {
executeQuery(subscription.getQuery());
}
}
|
class class_name[name] begin[{]
method[registerSubscription, return_type[void], modifier[public static], parameter[subscription]] begin[{]
call[mSubscriptions.add, parameter[member[.subscription]]]
if[call[.isConnected, parameter[]]] begin[{]
call[.executeQuery, parameter[call[subscription.getQuery, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[registerSubscription] operator[SEP] identifier[Subscription] identifier[subscription] operator[SEP] {
identifier[mSubscriptions] operator[SEP] identifier[add] operator[SEP] identifier[subscription] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isConnected] operator[SEP] operator[SEP] operator[SEP] {
identifier[executeQuery] operator[SEP] identifier[subscription] operator[SEP] identifier[getQuery] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static xen_nsvpx_image[] get_filtered(nitro_service service, String filter) throws Exception
{
xen_nsvpx_image obj = new xen_nsvpx_image();
options option = new options();
option.set_filter(filter);
xen_nsvpx_image[] response = (xen_nsvpx_image[]) obj.getfiltered(service, option);
return response;
}
|
class class_name[name] begin[{]
method[get_filtered, return_type[type[xen_nsvpx_image]], modifier[public static], parameter[service, filter]] begin[{]
local_variable[type[xen_nsvpx_image], obj]
local_variable[type[options], option]
call[option.set_filter, parameter[member[.filter]]]
local_variable[type[xen_nsvpx_image], response]
return[member[.response]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[xen_nsvpx_image] operator[SEP] operator[SEP] identifier[get_filtered] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[filter] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[xen_nsvpx_image] identifier[obj] operator[=] Keyword[new] identifier[xen_nsvpx_image] operator[SEP] operator[SEP] operator[SEP] identifier[options] identifier[option] operator[=] Keyword[new] identifier[options] operator[SEP] operator[SEP] operator[SEP] identifier[option] operator[SEP] identifier[set_filter] operator[SEP] identifier[filter] operator[SEP] operator[SEP] identifier[xen_nsvpx_image] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[xen_nsvpx_image] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[getfiltered] operator[SEP] identifier[service] , identifier[option] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
protected URL getStylesheetURL() {
URL url = this.getClass().getClassLoader().getResource(getStylesheetLocation());
if (url == null) {
try {
if (getStylesheetLocation().startsWith("http://")) {
return new URL(getStylesheetLocation());
}
return new File(getStylesheetLocation()).toURI().toURL();
} catch (MalformedURLException mue) {
return null;
}
} else {
return url;
}
}
|
class class_name[name] begin[{]
method[getStylesheetURL, return_type[type[URL]], modifier[protected], parameter[]] begin[{]
local_variable[type[URL], url]
if[binary_operation[member[.url], ==, literal[null]]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=getStylesheetLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="http://")], member=startsWith, 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=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getStylesheetLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URL, sub_type=None)), label=None)])), ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getStylesheetLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=toURI, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toURL, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=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=mue, types=['MalformedURLException']))], finally_block=None, label=None, resources=None)
else begin[{]
return[member[.url]]
end[}]
end[}]
END[}]
|
Keyword[protected] identifier[URL] identifier[getStylesheetURL] operator[SEP] operator[SEP] {
identifier[URL] identifier[url] operator[=] Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] identifier[getResource] operator[SEP] identifier[getStylesheetLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[url] operator[==] Other[null] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[getStylesheetLocation] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[URL] operator[SEP] identifier[getStylesheetLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[File] operator[SEP] identifier[getStylesheetLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] identifier[toURL] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MalformedURLException] identifier[mue] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
Keyword[else] {
Keyword[return] identifier[url] operator[SEP]
}
}
|
private String getDataInsertStatement(String table) throws SQLException {
StringBuilder sql = new StringBuilder();
ResultSet rs = stmt.executeQuery("SELECT * FROM " + "`" + table + "`;");
//move to the last row to get max rows returned
rs.last();
int rowCount = rs.getRow();
//there are no records just return empty string
if(rowCount <= 0) {
return sql.toString();
}
sql.append("\n--").append("\n-- Inserts of ").append(table).append("\n--\n\n");
//temporarily disable foreign key constraint
sql.append("\n/*!40000 ALTER TABLE `").append(table).append("` DISABLE KEYS */;\n");
sql.append("\n--\n")
.append(MysqlBaseService.SQL_START_PATTERN).append(" table insert : ").append(table)
.append("\n--\n");
sql.append("INSERT INTO `").append(table).append("`(");
ResultSetMetaData metaData = rs.getMetaData();
int columnCount = metaData.getColumnCount();
//generate the column names that are present
//in the returned result set
//at this point the insert is INSERT INTO (`col1`, `col2`, ...)
for(int i = 0; i < columnCount; i++) {
sql.append("`")
.append(metaData.getColumnName( i + 1))
.append("`, ");
}
//remove the last whitespace and comma
sql.deleteCharAt(sql.length() - 1).deleteCharAt(sql.length() - 1).append(") VALUES \n");
//now we're going to build the values for data insertion
rs.beforeFirst();
while(rs.next()) {
sql.append("(");
for(int i = 0; i < columnCount; i++) {
int columnType = metaData.getColumnType(i + 1);
int columnIndex = i + 1;
//this is the part where the values are processed based on their type
if(Objects.isNull(rs.getObject(columnIndex))) {
sql.append("").append(rs.getObject(columnIndex)).append(", ");
}
else if( columnType == Types.INTEGER || columnType == Types.TINYINT || columnType == Types.BIT) {
sql.append(rs.getInt(columnIndex)).append(", ");
}
else {
String val = rs.getString(columnIndex);
//escape the single quotes that might be in the value
val = val.replace("'", "\\'");
sql.append("'").append(val).append("', ");
}
}
//now that we're done with a row
//let's remove the last whitespace and comma
sql.deleteCharAt(sql.length() - 1).deleteCharAt(sql.length() - 1);
//if this is the last row, just append a closing
//parenthesis otherwise append a closing parenthesis and a comma
//for the next set of values
if(rs.isLast()) {
sql.append(")");
} else {
sql.append("),\n");
}
}
//now that we are done processing the entire row
//let's add the terminator
sql.append(";");
sql.append("\n--\n")
.append(MysqlBaseService.SQL_END_PATTERN).append(" table insert : ").append(table)
.append("\n--\n");
//enable FK constraint
sql.append("\n/*!40000 ALTER TABLE `").append(table).append("` ENABLE KEYS */;\n");
return sql.toString();
}
|
class class_name[name] begin[{]
method[getDataInsertStatement, return_type[type[String]], modifier[private], parameter[table]] begin[{]
local_variable[type[StringBuilder], sql]
local_variable[type[ResultSet], rs]
call[rs.last, parameter[]]
local_variable[type[int], rowCount]
if[binary_operation[member[.rowCount], <=, literal[0]]] begin[{]
return[call[sql.toString, parameter[]]]
else begin[{]
None
end[}]
call[sql.append, parameter[literal["\n--"]]]
call[sql.append, parameter[literal["\n/*!40000 ALTER TABLE `"]]]
call[sql.append, parameter[literal["\n--\n"]]]
call[sql.append, parameter[literal["INSERT INTO `"]]]
local_variable[type[ResultSetMetaData], metaData]
local_variable[type[int], columnCount]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="`")], member=append, postfix_operators=[], prefix_operators=[], qualifier=sql, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=metaData, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="`, ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=columnCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[sql.deleteCharAt, parameter[binary_operation[call[sql.length, parameter[]], -, literal[1]]]]
call[rs.beforeFirst, parameter[]]
while[call[rs.next, parameter[]]] begin[{]
call[sql.append, parameter[literal["("]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=getColumnType, postfix_operators=[], prefix_operators=[], qualifier=metaData, selectors=[], type_arguments=None), name=columnType)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=columnIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None)], member=isNull, postfix_operators=[], prefix_operators=[], qualifier=Objects, selectors=[], type_arguments=None), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=columnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=INTEGER, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=columnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=TINYINT, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), operator===), operator=||), operandr=BinaryOperation(operandl=MemberReference(member=columnType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=BIT, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[]), operator===), operator=||), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), name=val)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\'")], member=replace, postfix_operators=[], prefix_operators=[], qualifier=val, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'")], member=append, postfix_operators=[], prefix_operators=[], qualifier=sql, selectors=[MethodInvocation(arguments=[MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="', ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sql, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=append, postfix_operators=[], prefix_operators=[], qualifier=sql, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObject, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", ")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=columnCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[sql.deleteCharAt, parameter[binary_operation[call[sql.length, parameter[]], -, literal[1]]]]
if[call[rs.isLast, parameter[]]] begin[{]
call[sql.append, parameter[literal[")"]]]
else begin[{]
call[sql.append, parameter[literal["),\n"]]]
end[}]
end[}]
call[sql.append, parameter[literal[";"]]]
call[sql.append, parameter[literal["\n--\n"]]]
call[sql.append, parameter[literal["\n/*!40000 ALTER TABLE `"]]]
return[call[sql.toString, parameter[]]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[getDataInsertStatement] operator[SEP] identifier[String] identifier[table] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[StringBuilder] identifier[sql] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[ResultSet] identifier[rs] operator[=] identifier[stmt] operator[SEP] identifier[executeQuery] operator[SEP] literal[String] operator[+] literal[String] operator[+] identifier[table] operator[+] literal[String] operator[SEP] operator[SEP] identifier[rs] operator[SEP] identifier[last] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[rowCount] operator[=] identifier[rs] operator[SEP] identifier[getRow] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rowCount] operator[<=] Other[0] operator[SEP] {
Keyword[return] identifier[sql] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[table] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[table] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[MysqlBaseService] operator[SEP] identifier[SQL_START_PATTERN] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[table] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[table] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ResultSetMetaData] identifier[metaData] operator[=] identifier[rs] operator[SEP] identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[columnCount] operator[=] identifier[metaData] operator[SEP] identifier[getColumnCount] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[columnCount] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[metaData] operator[SEP] identifier[getColumnName] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[sql] operator[SEP] identifier[deleteCharAt] operator[SEP] identifier[sql] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[deleteCharAt] operator[SEP] identifier[sql] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[rs] operator[SEP] identifier[beforeFirst] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[rs] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[columnCount] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[columnType] operator[=] identifier[metaData] operator[SEP] identifier[getColumnType] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[columnIndex] operator[=] identifier[i] operator[+] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[Objects] operator[SEP] identifier[isNull] operator[SEP] identifier[rs] operator[SEP] identifier[getObject] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] operator[SEP] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[rs] operator[SEP] identifier[getObject] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[columnType] operator[==] identifier[Types] operator[SEP] identifier[INTEGER] operator[||] identifier[columnType] operator[==] identifier[Types] operator[SEP] identifier[TINYINT] operator[||] identifier[columnType] operator[==] identifier[Types] operator[SEP] identifier[BIT] operator[SEP] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] identifier[rs] operator[SEP] identifier[getInt] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[val] operator[=] identifier[rs] operator[SEP] identifier[getString] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] identifier[val] operator[=] identifier[val] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[val] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[sql] operator[SEP] identifier[deleteCharAt] operator[SEP] identifier[sql] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[deleteCharAt] operator[SEP] identifier[sql] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rs] operator[SEP] identifier[isLast] operator[SEP] operator[SEP] operator[SEP] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[MysqlBaseService] operator[SEP] identifier[SQL_END_PATTERN] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[table] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[table] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[sql] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@NullSafe
@SuppressWarnings("all")
public static boolean areAllNull(Object... values) {
for (Object value : nullSafeArray(values)) {
if (value != null) {
return false;
}
}
return true;
}
|
class class_name[name] begin[{]
method[areAllNull, return_type[type[boolean]], modifier[public static], parameter[values]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nullSafeArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[literal[true]]
end[}]
END[}]
|
annotation[@] identifier[NullSafe] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] Keyword[boolean] identifier[areAllNull] operator[SEP] identifier[Object] operator[...] identifier[values] operator[SEP] {
Keyword[for] operator[SEP] identifier[Object] identifier[value] operator[:] identifier[nullSafeArray] operator[SEP] identifier[values] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public final Reliability getReliability() {
/* Get the byte value and get the corresponding Reliability instance */
Byte rType = (Byte)jmo.getField(ControlAccess.RELIABILITY);
return Reliability.getReliability(rType);
}
|
class class_name[name] begin[{]
method[getReliability, return_type[type[Reliability]], modifier[final public], parameter[]] begin[{]
local_variable[type[Byte], rType]
return[call[Reliability.getReliability, parameter[member[.rType]]]]
end[}]
END[}]
|
Keyword[public] Keyword[final] identifier[Reliability] identifier[getReliability] operator[SEP] operator[SEP] {
identifier[Byte] identifier[rType] operator[=] operator[SEP] identifier[Byte] operator[SEP] identifier[jmo] operator[SEP] identifier[getField] operator[SEP] identifier[ControlAccess] operator[SEP] identifier[RELIABILITY] operator[SEP] operator[SEP] Keyword[return] identifier[Reliability] operator[SEP] identifier[getReliability] operator[SEP] identifier[rType] operator[SEP] operator[SEP]
}
|
public void sessionOpened(IoSession session) throws Exception {
SingleSessionIoHandler handler = (SingleSessionIoHandler) session
.getAttribute(HANDLER);
handler.sessionOpened();
}
|
class class_name[name] begin[{]
method[sessionOpened, return_type[void], modifier[public], parameter[session]] begin[{]
local_variable[type[SingleSessionIoHandler], handler]
call[handler.sessionOpened, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[sessionOpened] operator[SEP] identifier[IoSession] identifier[session] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[SingleSessionIoHandler] identifier[handler] operator[=] operator[SEP] identifier[SingleSessionIoHandler] operator[SEP] identifier[session] operator[SEP] identifier[getAttribute] operator[SEP] identifier[HANDLER] operator[SEP] operator[SEP] identifier[handler] operator[SEP] identifier[sessionOpened] operator[SEP] operator[SEP] operator[SEP]
}
|
public static boolean matchesWithoutPrefixes(String value1, String prefix1,
String value2, String prefix2) {
if (!value1.startsWith(prefix1)) {
return false;
}
value1 = value1.substring(prefix1.length());
if (!value2.startsWith(prefix2)) {
return false;
}
value2 = value2.substring(prefix2.length());
return value1.equals(value2);
}
|
class class_name[name] begin[{]
method[matchesWithoutPrefixes, return_type[type[boolean]], modifier[public static], parameter[value1, prefix1, value2, prefix2]] begin[{]
if[call[value1.startsWith, parameter[member[.prefix1]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.value1], call[value1.substring, parameter[call[prefix1.length, parameter[]]]]]
if[call[value2.startsWith, parameter[member[.prefix2]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.value2], call[value2.substring, parameter[call[prefix2.length, parameter[]]]]]
return[call[value1.equals, parameter[member[.value2]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[matchesWithoutPrefixes] operator[SEP] identifier[String] identifier[value1] , identifier[String] identifier[prefix1] , identifier[String] identifier[value2] , identifier[String] identifier[prefix2] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[value1] operator[SEP] identifier[startsWith] operator[SEP] identifier[prefix1] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[value1] operator[=] identifier[value1] operator[SEP] identifier[substring] operator[SEP] identifier[prefix1] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[value2] operator[SEP] identifier[startsWith] operator[SEP] identifier[prefix2] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[value2] operator[=] identifier[value2] operator[SEP] identifier[substring] operator[SEP] identifier[prefix2] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[value1] operator[SEP] identifier[equals] operator[SEP] identifier[value2] operator[SEP] operator[SEP]
}
|
public final void removeCloseListener(@NonNull final CloseListener listener) {
Condition.INSTANCE.ensureNotNull(listener, "The listener may not be null");
listeners.remove(listener);
}
|
class class_name[name] begin[{]
method[removeCloseListener, return_type[void], modifier[final public], parameter[listener]] begin[{]
call[Condition.INSTANCE.ensureNotNull, parameter[member[.listener], literal["The listener may not be null"]]]
call[listeners.remove, parameter[member[.listener]]]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[removeCloseListener] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[CloseListener] identifier[listener] operator[SEP] {
identifier[Condition] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[ensureNotNull] operator[SEP] identifier[listener] , literal[String] operator[SEP] operator[SEP] identifier[listeners] operator[SEP] identifier[remove] operator[SEP] identifier[listener] operator[SEP] operator[SEP]
}
|
@InterfaceAudience.Public
public boolean isGone() {
boolean wasRemovedFromChannel = false;
Object removed = getProperty("_removed");
if (removed != null) {
Boolean removedBoolean = (Boolean) removed;
wasRemovedFromChannel = removedBoolean.booleanValue();
}
return isDeletion() || wasRemovedFromChannel;
}
|
class class_name[name] begin[{]
method[isGone, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[boolean], wasRemovedFromChannel]
local_variable[type[Object], removed]
if[binary_operation[member[.removed], !=, literal[null]]] begin[{]
local_variable[type[Boolean], removedBoolean]
assign[member[.wasRemovedFromChannel], call[removedBoolean.booleanValue, parameter[]]]
else begin[{]
None
end[}]
return[binary_operation[call[.isDeletion, parameter[]], ||, member[.wasRemovedFromChannel]]]
end[}]
END[}]
|
annotation[@] identifier[InterfaceAudience] operator[SEP] identifier[Public] Keyword[public] Keyword[boolean] identifier[isGone] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[wasRemovedFromChannel] operator[=] literal[boolean] operator[SEP] identifier[Object] identifier[removed] operator[=] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[removed] operator[!=] Other[null] operator[SEP] {
identifier[Boolean] identifier[removedBoolean] operator[=] operator[SEP] identifier[Boolean] operator[SEP] identifier[removed] operator[SEP] identifier[wasRemovedFromChannel] operator[=] identifier[removedBoolean] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[isDeletion] operator[SEP] operator[SEP] operator[||] identifier[wasRemovedFromChannel] operator[SEP]
}
|
public EnvironmentResourceDescription withAutoScalingGroups(AutoScalingGroup... autoScalingGroups) {
if (this.autoScalingGroups == null) {
setAutoScalingGroups(new com.amazonaws.internal.SdkInternalList<AutoScalingGroup>(autoScalingGroups.length));
}
for (AutoScalingGroup ele : autoScalingGroups) {
this.autoScalingGroups.add(ele);
}
return this;
}
|
class class_name[name] begin[{]
method[withAutoScalingGroups, return_type[type[EnvironmentResourceDescription]], modifier[public], parameter[autoScalingGroups]] begin[{]
if[binary_operation[THIS[member[None.autoScalingGroups]], ==, literal[null]]] begin[{]
call[.setAutoScalingGroups, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=autoScalingGroups, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AutoScalingGroup, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=autoScalingGroups, 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=autoScalingGroups, 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=AutoScalingGroup, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[EnvironmentResourceDescription] identifier[withAutoScalingGroups] operator[SEP] identifier[AutoScalingGroup] operator[...] identifier[autoScalingGroups] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[autoScalingGroups] operator[==] Other[null] operator[SEP] {
identifier[setAutoScalingGroups] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[AutoScalingGroup] operator[>] operator[SEP] identifier[autoScalingGroups] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[AutoScalingGroup] identifier[ele] operator[:] identifier[autoScalingGroups] operator[SEP] {
Keyword[this] operator[SEP] identifier[autoScalingGroups] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static Matcher newClass(final String className) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
if (!node.isNew()) {
return false;
}
JSType providedJsType = getJsType(metadata, className);
if (providedJsType == null) {
return false;
}
JSType jsType = node.getJSType();
if (jsType == null) {
return false;
}
jsType = jsType.restrictByNotNullOrUndefined();
return areTypesEquivalentIgnoringGenerics(jsType, providedJsType);
}
};
}
|
class class_name[name] begin[{]
method[newClass, return_type[type[Matcher]], modifier[public static], parameter[className]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[], member=isNew, postfix_operators=[], prefix_operators=['!'], qualifier=node, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=metadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getJsType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=providedJsType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JSType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=providedJsType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getJSType, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), name=jsType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JSType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jsType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=jsType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=restrictByNotNullOrUndefined, postfix_operators=[], prefix_operators=[], qualifier=jsType, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=jsType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=providedJsType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=areTypesEquivalentIgnoringGenerics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=matches, parameters=[FormalParameter(annotations=[], modifiers=set(), name=node, type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=metadata, type=ReferenceType(arguments=None, dimensions=[], name=NodeMetadata, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Matcher, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Matcher] identifier[newClass] operator[SEP] Keyword[final] identifier[String] identifier[className] operator[SEP] {
Keyword[return] Keyword[new] identifier[Matcher] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[matches] operator[SEP] identifier[Node] identifier[node] , identifier[NodeMetadata] identifier[metadata] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[node] operator[SEP] identifier[isNew] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[JSType] identifier[providedJsType] operator[=] identifier[getJsType] operator[SEP] identifier[metadata] , identifier[className] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[providedJsType] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[JSType] identifier[jsType] operator[=] identifier[node] operator[SEP] identifier[getJSType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsType] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[jsType] operator[=] identifier[jsType] operator[SEP] identifier[restrictByNotNullOrUndefined] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[areTypesEquivalentIgnoringGenerics] operator[SEP] identifier[jsType] , identifier[providedJsType] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public static String expandTemplate(String s, Properties params) {
String result;
if( params == null || params.size() < 1 ) {
result = s;
} else {
StringBuffer sb = new StringBuffer();
Pattern pattern = Pattern.compile( "\\{\\{\\s*\\S+\\s*\\}\\}" );
Matcher m = pattern.matcher( s );
while( m.find()) {
String raw = m.group();
String varName = m.group().replace('{', ' ').replace('}', ' ').trim();
String val = params.getProperty(varName);
val = (val == null ? raw : val.trim());
m.appendReplacement(sb, val);
}
m.appendTail( sb );
result = sb.toString();
}
return result;
}
|
class class_name[name] begin[{]
method[expandTemplate, return_type[type[String]], modifier[public static], parameter[s, params]] begin[{]
local_variable[type[String], result]
if[binary_operation[binary_operation[member[.params], ==, literal[null]], ||, binary_operation[call[params.size, parameter[]], <, literal[1]]]] begin[{]
assign[member[.result], member[.s]]
else begin[{]
local_variable[type[StringBuffer], sb]
local_variable[type[Pattern], pattern]
local_variable[type[Matcher], m]
while[call[m.find, parameter[]]] begin[{]
local_variable[type[String], raw]
local_variable[type[String], varName]
local_variable[type[String], val]
assign[member[.val], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=val, selectors=[], type_arguments=None), if_true=MemberReference(member=raw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
call[m.appendReplacement, parameter[member[.sb], member[.val]]]
end[}]
call[m.appendTail, parameter[member[.sb]]]
assign[member[.result], call[sb.toString, parameter[]]]
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[expandTemplate] operator[SEP] identifier[String] identifier[s] , identifier[Properties] identifier[params] operator[SEP] {
identifier[String] identifier[result] operator[SEP] Keyword[if] operator[SEP] identifier[params] operator[==] Other[null] operator[||] identifier[params] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] Other[1] operator[SEP] {
identifier[result] operator[=] identifier[s] operator[SEP]
}
Keyword[else] {
identifier[StringBuffer] identifier[sb] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] operator[SEP] identifier[Pattern] identifier[pattern] operator[=] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Matcher] identifier[m] operator[=] identifier[pattern] operator[SEP] identifier[matcher] operator[SEP] identifier[s] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[m] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[raw] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[varName] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[val] operator[=] identifier[params] operator[SEP] identifier[getProperty] operator[SEP] identifier[varName] operator[SEP] operator[SEP] identifier[val] operator[=] operator[SEP] identifier[val] operator[==] Other[null] operator[?] identifier[raw] operator[:] identifier[val] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m] operator[SEP] identifier[appendReplacement] operator[SEP] identifier[sb] , identifier[val] operator[SEP] operator[SEP]
}
identifier[m] operator[SEP] identifier[appendTail] operator[SEP] identifier[sb] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static void multAddTransB(double realAlpha , double imagAlpha , ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c )
{
// TODO add a matrix vectory multiply here
MatrixMatrixMult_ZDRM.multAddTransB(realAlpha,imagAlpha,a,b,c);
}
|
class class_name[name] begin[{]
method[multAddTransB, return_type[void], modifier[public static], parameter[realAlpha, imagAlpha, a, b, c]] begin[{]
call[MatrixMatrixMult_ZDRM.multAddTransB, parameter[member[.realAlpha], member[.imagAlpha], member[.a], member[.b], member[.c]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[multAddTransB] operator[SEP] Keyword[double] identifier[realAlpha] , Keyword[double] identifier[imagAlpha] , identifier[ZMatrixRMaj] identifier[a] , identifier[ZMatrixRMaj] identifier[b] , identifier[ZMatrixRMaj] identifier[c] operator[SEP] {
identifier[MatrixMatrixMult_ZDRM] operator[SEP] identifier[multAddTransB] operator[SEP] identifier[realAlpha] , identifier[imagAlpha] , identifier[a] , identifier[b] , identifier[c] operator[SEP] operator[SEP]
}
|
private void move1() {
if (node == null)
return;
if (position >= reference.size()) {
node = null;
return;
}
node = node.links[reference.codeAt(position++)];
}
|
class class_name[name] begin[{]
method[move1, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.node], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.position], >=, call[reference.size, parameter[]]]] begin[{]
assign[member[.node], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[member[.node], member[node.links]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[move1] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[node] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP] Keyword[if] operator[SEP] identifier[position] operator[>=] identifier[reference] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[node] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
identifier[node] operator[=] identifier[node] operator[SEP] identifier[links] operator[SEP] identifier[reference] operator[SEP] identifier[codeAt] operator[SEP] identifier[position] operator[++] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setEnumParameter(EnumParameterType newEnumParameter) {
((FeatureMap.Internal)getMixed()).set(BpsimPackage.Literals.DOCUMENT_ROOT__ENUM_PARAMETER, newEnumParameter);
}
|
class class_name[name] begin[{]
method[setEnumParameter, return_type[void], modifier[public], parameter[newEnumParameter]] begin[{]
Cast(expression=MethodInvocation(arguments=[], member=getMixed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=FeatureMap, sub_type=ReferenceType(arguments=None, dimensions=None, name=Internal, sub_type=None)))
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setEnumParameter] operator[SEP] identifier[EnumParameterType] identifier[newEnumParameter] operator[SEP] {
operator[SEP] operator[SEP] identifier[FeatureMap] operator[SEP] identifier[Internal] operator[SEP] identifier[getMixed] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[BpsimPackage] operator[SEP] identifier[Literals] operator[SEP] identifier[DOCUMENT_ROOT__ENUM_PARAMETER] , identifier[newEnumParameter] operator[SEP] operator[SEP]
}
|
public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
String label, boolean strong, boolean isProperty) {
return getDocLink(context, classDoc, doc, new StringContent(check(label)), strong, isProperty);
}
|
class class_name[name] begin[{]
method[getDocLink, return_type[type[Content]], modifier[public], parameter[context, classDoc, doc, label, strong, isProperty]] begin[{]
return[call[.getDocLink, parameter[member[.context], member[.classDoc], member[.doc], ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=label, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=check, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringContent, sub_type=None)), member[.strong], member[.isProperty]]]]
end[}]
END[}]
|
Keyword[public] identifier[Content] identifier[getDocLink] operator[SEP] identifier[LinkInfoImpl] operator[SEP] identifier[Kind] identifier[context] , identifier[ClassDoc] identifier[classDoc] , identifier[MemberDoc] identifier[doc] , identifier[String] identifier[label] , Keyword[boolean] identifier[strong] , Keyword[boolean] identifier[isProperty] operator[SEP] {
Keyword[return] identifier[getDocLink] operator[SEP] identifier[context] , identifier[classDoc] , identifier[doc] , Keyword[new] identifier[StringContent] operator[SEP] identifier[check] operator[SEP] identifier[label] operator[SEP] operator[SEP] , identifier[strong] , identifier[isProperty] operator[SEP] operator[SEP]
}
|
public Observable<ServiceResponse<List<Iteration>>> getIterationsWithServiceResponseAsync(UUID projectId) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
return service.getIterations(projectId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<Iteration>>>>() {
@Override
public Observable<ServiceResponse<List<Iteration>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<Iteration>> clientResponse = getIterationsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
|
class class_name[name] begin[{]
method[getIterationsWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[projectId]] begin[{]
if[binary_operation[member[.projectId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter projectId 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.apiKey, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.apiKey() 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.getIterations, parameter[member[.projectId], THIS[member[None.client]call[None.apiKey, 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[List] operator[<] identifier[Iteration] operator[>] operator[>] operator[>] identifier[getIterationsWithServiceResponseAsync] operator[SEP] identifier[UUID] identifier[projectId] operator[SEP] {
Keyword[if] operator[SEP] identifier[projectId] 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[apiKey] 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[getIterations] operator[SEP] identifier[projectId] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiKey] 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[List] operator[<] identifier[Iteration] operator[>] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[Iteration] operator[>] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[Iteration] operator[>] operator[>] identifier[clientResponse] operator[=] identifier[getIterationsDelegate] 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 static Waehrung of(Currency currency) {
String key = currency.getCurrencyCode();
return CACHE.computeIfAbsent(key, t -> new Waehrung(currency));
}
|
class class_name[name] begin[{]
method[of, return_type[type[Waehrung]], modifier[public static], parameter[currency]] begin[{]
local_variable[type[String], key]
return[call[CACHE.computeIfAbsent, parameter[member[.key], LambdaExpression(body=ClassCreator(arguments=[MemberReference(member=currency, 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=Waehrung, sub_type=None)), parameters=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Waehrung] identifier[of] operator[SEP] identifier[Currency] identifier[currency] operator[SEP] {
identifier[String] identifier[key] operator[=] identifier[currency] operator[SEP] identifier[getCurrencyCode] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[CACHE] operator[SEP] identifier[computeIfAbsent] operator[SEP] identifier[key] , identifier[t] operator[->] Keyword[new] identifier[Waehrung] operator[SEP] identifier[currency] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<JsonObject> executeParametrizedStatement(String statement, List<Object> parameters) {
JsonArray positionalParams = JsonArray.from(parameters);
ParameterizedN1qlQuery query = N1qlQuery.parameterized(statement, positionalParams);
return executeQuery(query);
}
|
class class_name[name] begin[{]
method[executeParametrizedStatement, return_type[type[List]], modifier[public], parameter[statement, parameters]] begin[{]
local_variable[type[JsonArray], positionalParams]
local_variable[type[ParameterizedN1qlQuery], query]
return[call[.executeQuery, parameter[member[.query]]]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[JsonObject] operator[>] identifier[executeParametrizedStatement] operator[SEP] identifier[String] identifier[statement] , identifier[List] operator[<] identifier[Object] operator[>] identifier[parameters] operator[SEP] {
identifier[JsonArray] identifier[positionalParams] operator[=] identifier[JsonArray] operator[SEP] identifier[from] operator[SEP] identifier[parameters] operator[SEP] operator[SEP] identifier[ParameterizedN1qlQuery] identifier[query] operator[=] identifier[N1qlQuery] operator[SEP] identifier[parameterized] operator[SEP] identifier[statement] , identifier[positionalParams] operator[SEP] operator[SEP] Keyword[return] identifier[executeQuery] operator[SEP] identifier[query] operator[SEP] operator[SEP]
}
|
public static Map<String, SupervisorInfo> get_all_SupervisorInfo(
StormClusterState stormClusterState, RunnableCallback callback) throws Exception {
Map<String, SupervisorInfo> rtn = new TreeMap<>();
// get /ZK/supervisors
List<String> supervisorIds = stormClusterState.supervisors(callback);
// ignore any supervisors in blacklist
List<String> blacklist = stormClusterState.get_blacklist();
if (supervisorIds != null) {
for (Iterator<String> iter = supervisorIds.iterator(); iter.hasNext(); ) {
String supervisorId = iter.next();
// get /supervisors/supervisorid
SupervisorInfo supervisorInfo = stormClusterState.supervisor_info(supervisorId);
if (supervisorInfo == null) {
LOG.warn("Failed to get SupervisorInfo of " + supervisorId);
} else if (blacklist.contains(supervisorInfo.getHostName())) {
LOG.warn(" hostname:" + supervisorInfo.getHostName() + " is in blacklist");
} else {
rtn.put(supervisorId, supervisorInfo);
}
}
} else {
LOG.info("No alive supervisor");
}
return rtn;
}
|
class class_name[name] begin[{]
method[get_all_SupervisorInfo, return_type[type[Map]], modifier[public static], parameter[stormClusterState, callback]] begin[{]
local_variable[type[Map], rtn]
local_variable[type[List], supervisorIds]
local_variable[type[List], blacklist]
if[binary_operation[member[.supervisorIds], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), name=supervisorId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=supervisorId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=supervisor_info, postfix_operators=[], prefix_operators=[], qualifier=stormClusterState, selectors=[], type_arguments=None), name=supervisorInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SupervisorInfo, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=supervisorInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getHostName, postfix_operators=[], prefix_operators=[], qualifier=supervisorInfo, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=[], qualifier=blacklist, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=supervisorId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=supervisorInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=rtn, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" hostname:"), operandr=MethodInvocation(arguments=[], member=getHostName, postfix_operators=[], prefix_operators=[], qualifier=supervisorInfo, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is in blacklist"), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, 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="Failed to get SupervisorInfo of "), operandr=MemberReference(member=supervisorId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=supervisorIds, selectors=[], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
else begin[{]
call[LOG.info, parameter[literal["No alive supervisor"]]]
end[}]
return[member[.rtn]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[SupervisorInfo] operator[>] identifier[get_all_SupervisorInfo] operator[SEP] identifier[StormClusterState] identifier[stormClusterState] , identifier[RunnableCallback] identifier[callback] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Map] operator[<] identifier[String] , identifier[SupervisorInfo] operator[>] identifier[rtn] operator[=] Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[supervisorIds] operator[=] identifier[stormClusterState] operator[SEP] identifier[supervisors] operator[SEP] identifier[callback] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[blacklist] operator[=] identifier[stormClusterState] operator[SEP] identifier[get_blacklist] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[supervisorIds] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[iter] operator[=] identifier[supervisorIds] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[supervisorId] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[SupervisorInfo] identifier[supervisorInfo] operator[=] identifier[stormClusterState] operator[SEP] identifier[supervisor_info] operator[SEP] identifier[supervisorId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[supervisorInfo] operator[==] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[supervisorId] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[blacklist] operator[SEP] identifier[contains] operator[SEP] identifier[supervisorInfo] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[supervisorInfo] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[rtn] operator[SEP] identifier[put] operator[SEP] identifier[supervisorId] , identifier[supervisorInfo] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rtn] operator[SEP]
}
|
private ZooKeeper createZooKeeperClient() throws IOException {
ZooClientConfig config = getZookeeperClientConfig();
return new ZooKeeper(config.getUrl(), config.getTimeout(), getConnectionWatcher());
}
|
class class_name[name] begin[{]
method[createZooKeeperClient, return_type[type[ZooKeeper]], modifier[private], parameter[]] begin[{]
local_variable[type[ZooClientConfig], config]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getUrl, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTimeout, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getConnectionWatcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ZooKeeper, sub_type=None))]
end[}]
END[}]
|
Keyword[private] identifier[ZooKeeper] identifier[createZooKeeperClient] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[ZooClientConfig] identifier[config] operator[=] identifier[getZookeeperClientConfig] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ZooKeeper] operator[SEP] identifier[config] operator[SEP] identifier[getUrl] operator[SEP] operator[SEP] , identifier[config] operator[SEP] identifier[getTimeout] operator[SEP] operator[SEP] , identifier[getConnectionWatcher] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private List<DockerConnectionDetector.DockerHostProvider> getDefaultDockerHostProviders(DockerAccessContext dockerAccessContext, Logger log) {
DockerMachineConfiguration config = dockerAccessContext.getMachine();
if (dockerAccessContext.isSkipMachine()) {
config = null;
} else if (config == null) {
Properties projectProps = dockerAccessContext.getProjectProperties();
if (projectProps.containsKey(DockerMachineConfiguration.DOCKER_MACHINE_NAME_PROP)) {
config = new DockerMachineConfiguration(
projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_NAME_PROP),
projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_AUTO_CREATE_PROP),
projectProps.getProperty(DockerMachineConfiguration.DOCKER_MACHINE_REGENERATE_CERTS_AFTER_START_PROP));
}
}
List<DockerConnectionDetector.DockerHostProvider> ret = new ArrayList<>();
ret.add(new DockerMachine(log, config));
return ret;
}
|
class class_name[name] begin[{]
method[getDefaultDockerHostProviders, return_type[type[List]], modifier[private], parameter[dockerAccessContext, log]] begin[{]
local_variable[type[DockerMachineConfiguration], config]
if[call[dockerAccessContext.isSkipMachine, parameter[]]] begin[{]
assign[member[.config], literal[null]]
else begin[{]
if[binary_operation[member[.config], ==, literal[null]]] begin[{]
local_variable[type[Properties], projectProps]
if[call[projectProps.containsKey, parameter[member[DockerMachineConfiguration.DOCKER_MACHINE_NAME_PROP]]]] begin[{]
assign[member[.config], ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=DOCKER_MACHINE_NAME_PROP, postfix_operators=[], prefix_operators=[], qualifier=DockerMachineConfiguration, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=projectProps, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=DOCKER_MACHINE_AUTO_CREATE_PROP, postfix_operators=[], prefix_operators=[], qualifier=DockerMachineConfiguration, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=projectProps, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=DOCKER_MACHINE_REGENERATE_CERTS_AFTER_START_PROP, postfix_operators=[], prefix_operators=[], qualifier=DockerMachineConfiguration, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=projectProps, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DockerMachineConfiguration, sub_type=None))]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
local_variable[type[List], ret]
call[ret.add, parameter[ClassCreator(arguments=[MemberReference(member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=config, 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=DockerMachine, sub_type=None))]]
return[member[.ret]]
end[}]
END[}]
|
Keyword[private] identifier[List] operator[<] identifier[DockerConnectionDetector] operator[SEP] identifier[DockerHostProvider] operator[>] identifier[getDefaultDockerHostProviders] operator[SEP] identifier[DockerAccessContext] identifier[dockerAccessContext] , identifier[Logger] identifier[log] operator[SEP] {
identifier[DockerMachineConfiguration] identifier[config] operator[=] identifier[dockerAccessContext] operator[SEP] identifier[getMachine] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dockerAccessContext] operator[SEP] identifier[isSkipMachine] operator[SEP] operator[SEP] operator[SEP] {
identifier[config] operator[=] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[config] operator[==] Other[null] operator[SEP] {
identifier[Properties] identifier[projectProps] operator[=] identifier[dockerAccessContext] operator[SEP] identifier[getProjectProperties] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[projectProps] operator[SEP] identifier[containsKey] operator[SEP] identifier[DockerMachineConfiguration] operator[SEP] identifier[DOCKER_MACHINE_NAME_PROP] operator[SEP] operator[SEP] {
identifier[config] operator[=] Keyword[new] identifier[DockerMachineConfiguration] operator[SEP] identifier[projectProps] operator[SEP] identifier[getProperty] operator[SEP] identifier[DockerMachineConfiguration] operator[SEP] identifier[DOCKER_MACHINE_NAME_PROP] operator[SEP] , identifier[projectProps] operator[SEP] identifier[getProperty] operator[SEP] identifier[DockerMachineConfiguration] operator[SEP] identifier[DOCKER_MACHINE_AUTO_CREATE_PROP] operator[SEP] , identifier[projectProps] operator[SEP] identifier[getProperty] operator[SEP] identifier[DockerMachineConfiguration] operator[SEP] identifier[DOCKER_MACHINE_REGENERATE_CERTS_AFTER_START_PROP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[DockerConnectionDetector] operator[SEP] identifier[DockerHostProvider] operator[>] identifier[ret] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[DockerMachine] operator[SEP] identifier[log] , identifier[config] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
|
public void addOrUpdateUsbDevice(UsbDevice usbDevice, boolean hasPermission) {
Preconditions.checkNotNull(usbDevice);
Preconditions.checkNotNull(usbDevice.getDeviceName());
usbDevices.put(usbDevice.getDeviceName(), usbDevice);
if (hasPermission) {
grantPermission(usbDevice);
} else {
revokePermission(usbDevice, RuntimeEnvironment.application.getPackageName());
}
}
|
class class_name[name] begin[{]
method[addOrUpdateUsbDevice, return_type[void], modifier[public], parameter[usbDevice, hasPermission]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.usbDevice]]]
call[Preconditions.checkNotNull, parameter[call[usbDevice.getDeviceName, parameter[]]]]
call[usbDevices.put, parameter[call[usbDevice.getDeviceName, parameter[]], member[.usbDevice]]]
if[member[.hasPermission]] begin[{]
call[.grantPermission, parameter[member[.usbDevice]]]
else begin[{]
call[.revokePermission, parameter[member[.usbDevice], call[RuntimeEnvironment.application.getPackageName, parameter[]]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addOrUpdateUsbDevice] operator[SEP] identifier[UsbDevice] identifier[usbDevice] , Keyword[boolean] identifier[hasPermission] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[usbDevice] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[usbDevice] operator[SEP] identifier[getDeviceName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[usbDevices] operator[SEP] identifier[put] operator[SEP] identifier[usbDevice] operator[SEP] identifier[getDeviceName] operator[SEP] operator[SEP] , identifier[usbDevice] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hasPermission] operator[SEP] {
identifier[grantPermission] operator[SEP] identifier[usbDevice] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[revokePermission] operator[SEP] identifier[usbDevice] , identifier[RuntimeEnvironment] operator[SEP] identifier[application] operator[SEP] identifier[getPackageName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void setCurrentIndex(long curr) {
try {
if (curr < 0 || curr > count) {
throw new RuntimeException(curr + " is not in the range 0 to " + count);
}
seek(getHeaderSize() + curr * getEntryLength());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
|
class class_name[name] begin[{]
method[setCurrentIndex, return_type[void], modifier[public], parameter[curr]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=curr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=curr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=curr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is not in the range 0 to "), operator=+), operandr=MemberReference(member=count, 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=RuntimeException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getHeaderSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=curr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getEntryLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=*), operator=+)], member=seek, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setCurrentIndex] operator[SEP] Keyword[long] identifier[curr] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[curr] operator[<] Other[0] operator[||] identifier[curr] operator[>] identifier[count] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[curr] operator[+] literal[String] operator[+] identifier[count] operator[SEP] operator[SEP]
}
identifier[seek] operator[SEP] identifier[getHeaderSize] operator[SEP] operator[SEP] operator[+] identifier[curr] operator[*] identifier[getEntryLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
protected void assertWorkingSolutionInitialized(AbstractPhaseScope<Solution_> phaseScope) {
if (!phaseScope.getStartingScore().isSolutionInitialized()) {
InnerScoreDirector<Solution_> scoreDirector = phaseScope.getScoreDirector();
SolutionDescriptor<Solution_> solutionDescriptor = scoreDirector.getSolutionDescriptor();
Solution_ workingSolution = scoreDirector.getWorkingSolution();
for (Iterator<Object> it = solutionDescriptor.extractAllEntitiesIterator(workingSolution); it.hasNext();) {
Object entity = it.next();
EntityDescriptor<Solution_> entityDescriptor = solutionDescriptor.findEntityDescriptorOrFail(
entity.getClass());
if (!entityDescriptor.isEntityInitializedOrImmovable(scoreDirector, entity)) {
String variableRef = null;
for (GenuineVariableDescriptor<Solution_> variableDescriptor : entityDescriptor.getGenuineVariableDescriptors()) {
if (!variableDescriptor.isInitialized(entity)) {
variableRef = variableDescriptor.getSimpleEntityAndVariableName();
break;
}
}
throw new IllegalStateException(getPhaseTypeString() + " phase (" + phaseIndex
+ ") needs to start from an initialized solution, but the planning variable (" + variableRef
+ ") is uninitialized for the entity (" + entity + ").\n"
+ "Maybe there is no Construction Heuristic configured before this phase to initialize the solution.\n"
+ "Or maybe the getter/setters of your planning variables in your domain classes aren't implemented correctly.");
}
}
}
}
|
class class_name[name] begin[{]
method[assertWorkingSolutionInitialized, return_type[void], modifier[protected], parameter[phaseScope]] begin[{]
if[call[phaseScope.getStartingScore, parameter[]]] begin[{]
local_variable[type[InnerScoreDirector], scoreDirector]
local_variable[type[SolutionDescriptor], solutionDescriptor]
local_variable[type[Solution_], workingSolution]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), name=entity)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=entity, selectors=[], type_arguments=None)], member=findEntityDescriptorOrFail, postfix_operators=[], prefix_operators=[], qualifier=solutionDescriptor, selectors=[], type_arguments=None), name=entityDescriptor)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Solution_, sub_type=None))], dimensions=[], name=EntityDescriptor, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=scoreDirector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isEntityInitializedOrImmovable, postfix_operators=[], prefix_operators=['!'], qualifier=entityDescriptor, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=variableRef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isInitialized, postfix_operators=[], prefix_operators=['!'], qualifier=variableDescriptor, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=variableRef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getSimpleEntityAndVariableName, postfix_operators=[], prefix_operators=[], qualifier=variableDescriptor, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getGenuineVariableDescriptors, postfix_operators=[], prefix_operators=[], qualifier=entityDescriptor, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=variableDescriptor)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Solution_, sub_type=None))], dimensions=[], name=GenuineVariableDescriptor, sub_type=None))), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPhaseTypeString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" phase ("), operator=+), operandr=MemberReference(member=phaseIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") needs to start from an initialized solution, but the planning variable ("), operator=+), operandr=MemberReference(member=variableRef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") is uninitialized for the entity ("), operator=+), operandr=MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=").\n"), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Maybe there is no Construction Heuristic configured before this phase to initialize the solution.\n"), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Or maybe the getter/setters of your planning variables in your domain classes aren't implemented correctly."), 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)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[MemberReference(member=workingSolution, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=extractAllEntitiesIterator, postfix_operators=[], prefix_operators=[], qualifier=solutionDescriptor, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[assertWorkingSolutionInitialized] operator[SEP] identifier[AbstractPhaseScope] operator[<] identifier[Solution_] operator[>] identifier[phaseScope] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[phaseScope] operator[SEP] identifier[getStartingScore] operator[SEP] operator[SEP] operator[SEP] identifier[isSolutionInitialized] operator[SEP] operator[SEP] operator[SEP] {
identifier[InnerScoreDirector] operator[<] identifier[Solution_] operator[>] identifier[scoreDirector] operator[=] identifier[phaseScope] operator[SEP] identifier[getScoreDirector] operator[SEP] operator[SEP] operator[SEP] identifier[SolutionDescriptor] operator[<] identifier[Solution_] operator[>] identifier[solutionDescriptor] operator[=] identifier[scoreDirector] operator[SEP] identifier[getSolutionDescriptor] operator[SEP] operator[SEP] operator[SEP] identifier[Solution_] identifier[workingSolution] operator[=] identifier[scoreDirector] operator[SEP] identifier[getWorkingSolution] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[Object] operator[>] identifier[it] operator[=] identifier[solutionDescriptor] operator[SEP] identifier[extractAllEntitiesIterator] operator[SEP] identifier[workingSolution] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[entity] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[EntityDescriptor] operator[<] identifier[Solution_] operator[>] identifier[entityDescriptor] operator[=] identifier[solutionDescriptor] operator[SEP] identifier[findEntityDescriptorOrFail] operator[SEP] identifier[entity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[entityDescriptor] operator[SEP] identifier[isEntityInitializedOrImmovable] operator[SEP] identifier[scoreDirector] , identifier[entity] operator[SEP] operator[SEP] {
identifier[String] identifier[variableRef] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[GenuineVariableDescriptor] operator[<] identifier[Solution_] operator[>] identifier[variableDescriptor] operator[:] identifier[entityDescriptor] operator[SEP] identifier[getGenuineVariableDescriptors] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[variableDescriptor] operator[SEP] identifier[isInitialized] operator[SEP] identifier[entity] operator[SEP] operator[SEP] {
identifier[variableRef] operator[=] identifier[variableDescriptor] operator[SEP] identifier[getSimpleEntityAndVariableName] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[getPhaseTypeString] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[phaseIndex] operator[+] literal[String] operator[+] identifier[variableRef] operator[+] literal[String] operator[+] identifier[entity] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
}
|
public TypeDefinitionList getTypeChildren(
String typeId,
boolean includePropertyDefinitions,
BigInteger maxItems,
BigInteger skipCount) {
refresh();
TypeDefinitionListImpl result = new TypeDefinitionListImpl(new ArrayList<TypeDefinition>());
int skip = (skipCount == null ? 0 : skipCount.intValue());
if (skip < 0) {
skip = 0;
}
int max = (maxItems == null ? Integer.MAX_VALUE : maxItems.intValue());
if (max < 1) {
return result;
}
if (typeId == null) {
if (skip < 1) {
result.getList().add(copyTypeDefintion(m_types.get(FOLDER_TYPE_ID).getTypeDefinition()));
max--;
}
if ((skip < 2) && (max > 0)) {
result.getList().add(copyTypeDefintion(m_types.get(DOCUMENT_TYPE_ID).getTypeDefinition()));
max--;
}
result.setHasMoreItems(Boolean.valueOf((result.getList().size() + skip) < 2));
result.setNumItems(BigInteger.valueOf(2));
} else {
TypeDefinitionContainer tc = m_types.get(typeId);
if ((tc == null) || (tc.getChildren() == null)) {
return result;
}
for (TypeDefinitionContainer child : tc.getChildren()) {
if (skip > 0) {
skip--;
continue;
}
result.getList().add(copyTypeDefintion(child.getTypeDefinition()));
max--;
if (max == 0) {
break;
}
}
result.setHasMoreItems(Boolean.valueOf((result.getList().size() + skip) < tc.getChildren().size()));
result.setNumItems(BigInteger.valueOf(tc.getChildren().size()));
}
if (!includePropertyDefinitions) {
for (TypeDefinition type : result.getList()) {
type.getPropertyDefinitions().clear();
}
}
return result;
}
|
class class_name[name] begin[{]
method[getTypeChildren, return_type[type[TypeDefinitionList]], modifier[public], parameter[typeId, includePropertyDefinitions, maxItems, skipCount]] begin[{]
call[.refresh, parameter[]]
local_variable[type[TypeDefinitionListImpl], result]
local_variable[type[int], skip]
if[binary_operation[member[.skip], <, literal[0]]] begin[{]
assign[member[.skip], literal[0]]
else begin[{]
None
end[}]
local_variable[type[int], max]
if[binary_operation[member[.max], <, literal[1]]] begin[{]
return[member[.result]]
else begin[{]
None
end[}]
if[binary_operation[member[.typeId], ==, literal[null]]] begin[{]
if[binary_operation[member[.skip], <, literal[1]]] begin[{]
call[result.getList, parameter[]]
member[.max]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.skip], <, literal[2]], &&, binary_operation[member[.max], >, literal[0]]]] begin[{]
call[result.getList, parameter[]]
member[.max]
else begin[{]
None
end[}]
call[result.setHasMoreItems, parameter[call[Boolean.valueOf, parameter[binary_operation[binary_operation[call[result.getList, parameter[]], +, member[.skip]], <, literal[2]]]]]]
call[result.setNumItems, parameter[call[BigInteger.valueOf, parameter[literal[2]]]]]
else begin[{]
local_variable[type[TypeDefinitionContainer], tc]
if[binary_operation[binary_operation[member[.tc], ==, literal[null]], ||, binary_operation[call[tc.getChildren, parameter[]], ==, literal[null]]]] begin[{]
return[member[.result]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=skip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=skip, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None), ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=getList, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTypeDefinition, postfix_operators=[], prefix_operators=[], qualifier=child, selectors=[], type_arguments=None)], member=copyTypeDefintion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=max, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getChildren, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=child)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeDefinitionContainer, sub_type=None))), label=None)
call[result.setHasMoreItems, parameter[call[Boolean.valueOf, parameter[binary_operation[binary_operation[call[result.getList, parameter[]], +, member[.skip]], <, call[tc.getChildren, parameter[]]]]]]]
call[result.setNumItems, parameter[call[BigInteger.valueOf, parameter[call[tc.getChildren, parameter[]]]]]]
end[}]
if[member[.includePropertyDefinitions]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getPropertyDefinitions, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[MethodInvocation(arguments=[], member=clear, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getList, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeDefinition, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[TypeDefinitionList] identifier[getTypeChildren] operator[SEP] identifier[String] identifier[typeId] , Keyword[boolean] identifier[includePropertyDefinitions] , identifier[BigInteger] identifier[maxItems] , identifier[BigInteger] identifier[skipCount] operator[SEP] {
identifier[refresh] operator[SEP] operator[SEP] operator[SEP] identifier[TypeDefinitionListImpl] identifier[result] operator[=] Keyword[new] identifier[TypeDefinitionListImpl] operator[SEP] Keyword[new] identifier[ArrayList] operator[<] identifier[TypeDefinition] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[skip] operator[=] operator[SEP] identifier[skipCount] operator[==] Other[null] operator[?] Other[0] operator[:] identifier[skipCount] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[skip] operator[<] Other[0] operator[SEP] {
identifier[skip] operator[=] Other[0] operator[SEP]
}
Keyword[int] identifier[max] operator[=] operator[SEP] identifier[maxItems] operator[==] Other[null] operator[?] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[:] identifier[maxItems] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[max] operator[<] Other[1] operator[SEP] {
Keyword[return] identifier[result] operator[SEP]
}
Keyword[if] operator[SEP] identifier[typeId] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[skip] operator[<] Other[1] operator[SEP] {
identifier[result] operator[SEP] identifier[getList] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[copyTypeDefintion] operator[SEP] identifier[m_types] operator[SEP] identifier[get] operator[SEP] identifier[FOLDER_TYPE_ID] operator[SEP] operator[SEP] identifier[getTypeDefinition] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[max] operator[--] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[skip] operator[<] Other[2] operator[SEP] operator[&&] operator[SEP] identifier[max] operator[>] Other[0] operator[SEP] operator[SEP] {
identifier[result] operator[SEP] identifier[getList] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[copyTypeDefintion] operator[SEP] identifier[m_types] operator[SEP] identifier[get] operator[SEP] identifier[DOCUMENT_TYPE_ID] operator[SEP] operator[SEP] identifier[getTypeDefinition] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[max] operator[--] operator[SEP]
}
identifier[result] operator[SEP] identifier[setHasMoreItems] operator[SEP] identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[getList] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] identifier[skip] operator[SEP] operator[<] Other[2] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[setNumItems] operator[SEP] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[TypeDefinitionContainer] identifier[tc] operator[=] identifier[m_types] operator[SEP] identifier[get] operator[SEP] identifier[typeId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[tc] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[tc] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] operator[SEP] {
Keyword[return] identifier[result] operator[SEP]
}
Keyword[for] operator[SEP] identifier[TypeDefinitionContainer] identifier[child] operator[:] identifier[tc] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[skip] operator[>] Other[0] operator[SEP] {
identifier[skip] operator[--] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[result] operator[SEP] identifier[getList] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[copyTypeDefintion] operator[SEP] identifier[child] operator[SEP] identifier[getTypeDefinition] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[max] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[max] operator[==] Other[0] operator[SEP] {
Keyword[break] operator[SEP]
}
}
identifier[result] operator[SEP] identifier[setHasMoreItems] operator[SEP] identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[getList] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] identifier[skip] operator[SEP] operator[<] identifier[tc] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[setNumItems] operator[SEP] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] identifier[tc] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[includePropertyDefinitions] operator[SEP] {
Keyword[for] operator[SEP] identifier[TypeDefinition] identifier[type] operator[:] identifier[result] operator[SEP] identifier[getList] operator[SEP] operator[SEP] operator[SEP] {
identifier[type] operator[SEP] identifier[getPropertyDefinitions] operator[SEP] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public void raVerifyConfiguration(ConfigProperties properties) throws InvalidConfigurationException {
String httpClientFactoryClassName = (String) properties.getProperty(CFG_PROPERTY_HTTP_CLIENT_FACTORY)
.getValue();
if (httpClientFactoryClassName.isEmpty()) {
try {
Integer i = (Integer) properties.getProperty(CFG_PROPERTY_MAX_CONNECTIONS_TOTAL).getValue();
if (i < 1) {
throw new InvalidConfigurationException(CFG_PROPERTY_MAX_CONNECTIONS_TOTAL + " must be > 0");
}
} catch (InvalidConfigurationException e) {
throw e;
} catch (Exception e) {
tracer.severe("failure in config validation", e);
throw new InvalidConfigurationException(e.getMessage());
}
try {
Integer i = (Integer) properties.getProperty(CFG_PROPERTY_DEFAULT_MAX_FOR_ROUTE).getValue();
if (i < 1) {
throw new InvalidConfigurationException(CFG_PROPERTY_DEFAULT_MAX_FOR_ROUTE + " must be > 0");
}
} catch (InvalidConfigurationException e) {
throw e;
} catch (Exception e) {
tracer.severe("failure in config validation", e);
throw new InvalidConfigurationException(e.getMessage());
}
try {
String maxForRoutesString = (String) properties.getProperty(CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES)
.getValue();
String[] maxForRoutesStrings = maxForRoutesString.split(",");
for (String maxForRoute : maxForRoutesStrings) {
if (maxForRoute.isEmpty()) {
continue;
}
String[] maxForRouteParts = maxForRoute.split(":");
if (maxForRouteParts.length != MAX_CONNECTIONS_FOR_ROUTES_TOKEN_LENGTH) {
throw new InvalidConfigurationException(CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES
+ " format is scheme:host:port:maxForRoute separated by comma");
}
String scheme = maxForRouteParts[HTTP_SCHEME_INDEX];
if (scheme == null || scheme.equals("")) {
scheme = HttpHost.DEFAULT_SCHEME_NAME;
}
String host = maxForRouteParts[HTTP_HOST_INDEX];
if (host == null || host.equals("")) {
throw new InvalidConfigurationException(
CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES
+ " format is scheme:host:port:maxForRoute separated by comma. Passing host is mandatory");
}
String portStr = maxForRouteParts[HTTP_PORT_INDEX];
if (portStr == null || portStr.equals("")) {
portStr = "80";
}
int port = Integer.parseInt(portStr);
String maxForRoutePartsStr = maxForRouteParts[HTTP_MAXFORROUTE_INDEX];
Integer max = Integer.valueOf(maxForRoutePartsStr);
if (max < 1) {
throw new InvalidConfigurationException(
CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES
+ " format is scheme:host:port:maxForRoute separated by comma. Passing maxForRoute is mandatory and must be greater than 0");
}
new HttpRoute(new HttpHost(host, port, scheme));
}
} catch (InvalidConfigurationException e) {
throw e;
} catch (Exception e) {
tracer.severe("failure in config validation", e);
throw new InvalidConfigurationException(e.getMessage());
}
} else {
try {
Class<? extends HttpClientFactory> c = (Class<? extends HttpClientFactory>) Class
.forName(httpClientFactoryClassName);
c.newInstance();
} catch (Exception e) {
tracer.severe("failed to load http client factory class", e);
throw new InvalidConfigurationException("failed to load http client factory class", e);
}
}
}
|
class class_name[name] begin[{]
method[raVerifyConfiguration, return_type[void], modifier[public], parameter[properties]] begin[{]
local_variable[type[String], httpClientFactoryClassName]
if[call[httpClientFactoryClassName.isEmpty, parameter[]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=CFG_PROPERTY_MAX_CONNECTIONS_TOTAL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), name=i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=CFG_PROPERTY_MAX_CONNECTIONS_TOTAL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" must be > 0"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidConfigurationException, sub_type=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvalidConfigurationException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failure in config validation"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=severe, postfix_operators=[], prefix_operators=[], qualifier=tracer, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidConfigurationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=CFG_PROPERTY_DEFAULT_MAX_FOR_ROUTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), name=i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=CFG_PROPERTY_DEFAULT_MAX_FOR_ROUTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" must be > 0"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidConfigurationException, sub_type=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvalidConfigurationException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failure in config validation"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=severe, postfix_operators=[], prefix_operators=[], qualifier=tracer, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidConfigurationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=maxForRoutesString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=",")], member=split, postfix_operators=[], prefix_operators=[], qualifier=maxForRoutesString, selectors=[], type_arguments=None), name=maxForRoutesStrings)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=maxForRoute, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":")], member=split, postfix_operators=[], prefix_operators=[], qualifier=maxForRoute, selectors=[], type_arguments=None), name=maxForRouteParts)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=maxForRouteParts, selectors=[]), operandr=MemberReference(member=MAX_CONNECTIONS_FOR_ROUTES_TOKEN_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" format is scheme:host:port:maxForRoute separated by comma"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidConfigurationException, sub_type=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=maxForRouteParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=HTTP_SCHEME_INDEX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=scheme)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=scheme, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=DEFAULT_SCHEME_NAME, postfix_operators=[], prefix_operators=[], qualifier=HttpHost, selectors=[])), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=maxForRouteParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=HTTP_HOST_INDEX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=host)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=host, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" format is scheme:host:port:maxForRoute separated by comma. Passing host is mandatory"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidConfigurationException, sub_type=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=maxForRouteParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=HTTP_PORT_INDEX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=portStr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=portStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=portStr, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=portStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="80")), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=portStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=port)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=maxForRouteParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=HTTP_MAXFORROUTE_INDEX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=maxForRoutePartsStr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=maxForRoutePartsStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=max)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" format is scheme:host:port:maxForRoute separated by comma. Passing maxForRoute is mandatory and must be greater than 0"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidConfigurationException, sub_type=None)), label=None)])), StatementExpression(expression=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scheme, 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=HttpHost, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HttpRoute, sub_type=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=maxForRoutesStrings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=maxForRoute)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvalidConfigurationException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failure in config validation"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=severe, postfix_operators=[], prefix_operators=[], qualifier=tracer, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidConfigurationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=httpClientFactoryClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=HttpClientFactory, sub_type=None))], dimensions=[], name=Class, sub_type=None)), name=c)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=HttpClientFactory, sub_type=None))], dimensions=[], name=Class, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed to load http client factory class"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=severe, postfix_operators=[], prefix_operators=[], qualifier=tracer, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed to load http client factory class"), 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=InvalidConfigurationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[raVerifyConfiguration] operator[SEP] identifier[ConfigProperties] identifier[properties] operator[SEP] Keyword[throws] identifier[InvalidConfigurationException] {
identifier[String] identifier[httpClientFactoryClassName] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[CFG_PROPERTY_HTTP_CLIENT_FACTORY] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[httpClientFactoryClassName] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[Integer] identifier[i] operator[=] operator[SEP] identifier[Integer] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[CFG_PROPERTY_MAX_CONNECTIONS_TOTAL] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[<] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidConfigurationException] operator[SEP] identifier[CFG_PROPERTY_MAX_CONNECTIONS_TOTAL] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InvalidConfigurationException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[tracer] operator[SEP] identifier[severe] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InvalidConfigurationException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[Integer] identifier[i] operator[=] operator[SEP] identifier[Integer] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[CFG_PROPERTY_DEFAULT_MAX_FOR_ROUTE] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[<] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidConfigurationException] operator[SEP] identifier[CFG_PROPERTY_DEFAULT_MAX_FOR_ROUTE] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InvalidConfigurationException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[tracer] operator[SEP] identifier[severe] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InvalidConfigurationException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[String] identifier[maxForRoutesString] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[maxForRoutesStrings] operator[=] identifier[maxForRoutesString] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[maxForRoute] operator[:] identifier[maxForRoutesStrings] operator[SEP] {
Keyword[if] operator[SEP] identifier[maxForRoute] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[maxForRouteParts] operator[=] identifier[maxForRoute] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[maxForRouteParts] operator[SEP] identifier[length] operator[!=] identifier[MAX_CONNECTIONS_FOR_ROUTES_TOKEN_LENGTH] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidConfigurationException] operator[SEP] identifier[CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[scheme] operator[=] identifier[maxForRouteParts] operator[SEP] identifier[HTTP_SCHEME_INDEX] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scheme] operator[==] Other[null] operator[||] identifier[scheme] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[scheme] operator[=] identifier[HttpHost] operator[SEP] identifier[DEFAULT_SCHEME_NAME] operator[SEP]
}
identifier[String] identifier[host] operator[=] identifier[maxForRouteParts] operator[SEP] identifier[HTTP_HOST_INDEX] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[host] operator[==] Other[null] operator[||] identifier[host] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidConfigurationException] operator[SEP] identifier[CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[portStr] operator[=] identifier[maxForRouteParts] operator[SEP] identifier[HTTP_PORT_INDEX] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[portStr] operator[==] Other[null] operator[||] identifier[portStr] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[portStr] operator[=] literal[String] operator[SEP]
}
Keyword[int] identifier[port] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[portStr] operator[SEP] operator[SEP] identifier[String] identifier[maxForRoutePartsStr] operator[=] identifier[maxForRouteParts] operator[SEP] identifier[HTTP_MAXFORROUTE_INDEX] operator[SEP] operator[SEP] identifier[Integer] identifier[max] operator[=] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[maxForRoutePartsStr] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[max] operator[<] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidConfigurationException] operator[SEP] identifier[CFG_PROPERTY_MAX_CONNECTIONS_FOR_ROUTES] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[new] identifier[HttpRoute] operator[SEP] Keyword[new] identifier[HttpHost] operator[SEP] identifier[host] , identifier[port] , identifier[scheme] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InvalidConfigurationException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[tracer] operator[SEP] identifier[severe] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InvalidConfigurationException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[try] {
identifier[Class] operator[<] operator[?] Keyword[extends] identifier[HttpClientFactory] operator[>] identifier[c] operator[=] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[HttpClientFactory] operator[>] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[httpClientFactoryClassName] operator[SEP] operator[SEP] identifier[c] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[tracer] operator[SEP] identifier[severe] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InvalidConfigurationException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public int setUserID(int iChangeType, boolean bDisplayOption)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
int iUserID = -1;
if (this.getOwner().getRecordOwner() != null)
if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()) != null)
if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID() != null)
if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID().length() > 0)
iUserID = Integer.parseInt(((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID());
boolean bOldModified = this.getOwner().getField(userIdFieldName).isModified();
boolean[] rgbEnabled = null;
if (iChangeType == DBConstants.INIT_MOVE)
rgbEnabled = this.getOwner().getField(userIdFieldName).setEnableListeners(false);
iErrorCode = this.getOwner().getField(userIdFieldName).setValue(iUserID, bDisplayOption, iChangeType);
if (iChangeType == DBConstants.INIT_MOVE)
{ // Don't change the record on an init
this.getOwner().getField(userIdFieldName).setEnableListeners(rgbEnabled);
this.getOwner().getField(userIdFieldName).setModified(bOldModified);
}
return iErrorCode;
}
|
class class_name[name] begin[{]
method[setUserID, return_type[type[int]], modifier[public], parameter[iChangeType, bDisplayOption]] begin[{]
local_variable[type[int], iErrorCode]
local_variable[type[int], iUserID]
if[binary_operation[THIS[call[None.getOwner, parameter[]]call[None.getRecordOwner, parameter[]]], !=, literal[null]]] begin[{]
if[binary_operation[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getOwner, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getRecordOwner, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTask, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getApplication, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=BaseApplication, sub_type=None)), !=, literal[null]]] begin[{]
if[binary_operation[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getOwner, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getRecordOwner, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTask, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getApplication, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=BaseApplication, sub_type=None)), !=, literal[null]]] begin[{]
if[binary_operation[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getOwner, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getRecordOwner, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTask, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getApplication, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=BaseApplication, sub_type=None)), >, literal[0]]] begin[{]
assign[member[.iUserID], call[Integer.parseInt, parameter[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getOwner, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getRecordOwner, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTask, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getApplication, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=BaseApplication, sub_type=None))]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[boolean], bOldModified]
local_variable[type[boolean], rgbEnabled]
if[binary_operation[member[.iChangeType], ==, member[DBConstants.INIT_MOVE]]] begin[{]
assign[member[.rgbEnabled], THIS[call[None.getOwner, parameter[]]call[None.getField, parameter[member[.userIdFieldName]]]call[None.setEnableListeners, parameter[literal[false]]]]]
else begin[{]
None
end[}]
assign[member[.iErrorCode], THIS[call[None.getOwner, parameter[]]call[None.getField, parameter[member[.userIdFieldName]]]call[None.setValue, parameter[member[.iUserID], member[.bDisplayOption], member[.iChangeType]]]]]
if[binary_operation[member[.iChangeType], ==, member[DBConstants.INIT_MOVE]]] begin[{]
THIS[call[None.getOwner, parameter[]]call[None.getField, parameter[member[.userIdFieldName]]]call[None.setEnableListeners, parameter[member[.rgbEnabled]]]]
THIS[call[None.getOwner, parameter[]]call[None.getField, parameter[member[.userIdFieldName]]]call[None.setModified, parameter[member[.bOldModified]]]]
else begin[{]
None
end[}]
return[member[.iErrorCode]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[setUserID] operator[SEP] Keyword[int] identifier[iChangeType] , Keyword[boolean] identifier[bDisplayOption] operator[SEP] {
Keyword[int] identifier[iErrorCode] operator[=] identifier[DBConstants] operator[SEP] identifier[NORMAL_RETURN] operator[SEP] Keyword[int] identifier[iUserID] operator[=] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getRecordOwner] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[BaseApplication] operator[SEP] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getRecordOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[BaseApplication] operator[SEP] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getRecordOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getUserID] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[BaseApplication] operator[SEP] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getRecordOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getUserID] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[iUserID] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] operator[SEP] operator[SEP] identifier[BaseApplication] operator[SEP] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getRecordOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getUserID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[bOldModified] operator[=] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[userIdFieldName] operator[SEP] operator[SEP] identifier[isModified] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] operator[SEP] operator[SEP] identifier[rgbEnabled] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[iChangeType] operator[==] identifier[DBConstants] operator[SEP] identifier[INIT_MOVE] operator[SEP] identifier[rgbEnabled] operator[=] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[userIdFieldName] operator[SEP] operator[SEP] identifier[setEnableListeners] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[iErrorCode] operator[=] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[userIdFieldName] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] identifier[iUserID] , identifier[bDisplayOption] , identifier[iChangeType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iChangeType] operator[==] identifier[DBConstants] operator[SEP] identifier[INIT_MOVE] operator[SEP] {
Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[userIdFieldName] operator[SEP] operator[SEP] identifier[setEnableListeners] operator[SEP] identifier[rgbEnabled] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[userIdFieldName] operator[SEP] operator[SEP] identifier[setModified] operator[SEP] identifier[bOldModified] operator[SEP] operator[SEP]
}
Keyword[return] identifier[iErrorCode] operator[SEP]
}
|
public boolean addConnectedDownstreamElementWithCheck( IHillSlope element ) {
if (PfafstetterNumber.areConnectedDownstream(this.getPfafstetterNumber(), element.getPfafstetterNumber())) {
downstreamElement = element;
element.addConnectedUpstreamElementWithCheck(this);
return true;
}
return false;
}
|
class class_name[name] begin[{]
method[addConnectedDownstreamElementWithCheck, return_type[type[boolean]], modifier[public], parameter[element]] begin[{]
if[call[PfafstetterNumber.areConnectedDownstream, parameter[THIS[call[None.getPfafstetterNumber, parameter[]]], call[element.getPfafstetterNumber, parameter[]]]]] begin[{]
assign[member[.downstreamElement], member[.element]]
call[element.addConnectedUpstreamElementWithCheck, parameter[THIS[]]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[addConnectedDownstreamElementWithCheck] operator[SEP] identifier[IHillSlope] identifier[element] operator[SEP] {
Keyword[if] operator[SEP] identifier[PfafstetterNumber] operator[SEP] identifier[areConnectedDownstream] operator[SEP] Keyword[this] operator[SEP] identifier[getPfafstetterNumber] operator[SEP] operator[SEP] , identifier[element] operator[SEP] identifier[getPfafstetterNumber] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[downstreamElement] operator[=] identifier[element] operator[SEP] identifier[element] operator[SEP] identifier[addConnectedUpstreamElementWithCheck] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@NonNull
@Experimental
public static Scheduler from(@NonNull Executor executor, boolean interruptibleWorker) {
return new ExecutorScheduler(executor, interruptibleWorker);
}
|
class class_name[name] begin[{]
method[from, return_type[type[Scheduler]], modifier[public static], parameter[executor, interruptibleWorker]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=executor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=interruptibleWorker, 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=ExecutorScheduler, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[NonNull] annotation[@] identifier[Experimental] Keyword[public] Keyword[static] identifier[Scheduler] identifier[from] operator[SEP] annotation[@] identifier[NonNull] identifier[Executor] identifier[executor] , Keyword[boolean] identifier[interruptibleWorker] operator[SEP] {
Keyword[return] Keyword[new] identifier[ExecutorScheduler] operator[SEP] identifier[executor] , identifier[interruptibleWorker] operator[SEP] operator[SEP]
}
|
public Batch<D> getNextAvailableBatch () {
final ReentrantLock lock = SequentialBasedBatchAccumulator.this.dqLock;
try {
lock.lock();
if (SequentialBasedBatchAccumulator.this.isClosed()) {
return dq.poll();
} else {
while (dq.size() == 0) {
LOG.debug ("ready to sleep because of queue is empty");
SequentialBasedBatchAccumulator.this.notEmpty.await();
if (SequentialBasedBatchAccumulator.this.isClosed()) {
return dq.poll();
}
}
if (dq.size() > 1) {
BytesBoundedBatch candidate = dq.poll();
SequentialBasedBatchAccumulator.this.notFull.signal();
LOG.debug ("retrieve batch " + candidate.getId());
return candidate;
}
if (dq.size() == 1) {
if (dq.peekFirst().isTTLExpire()) {
LOG.debug ("Batch " + dq.peekFirst().getId() + " is expired");
BytesBoundedBatch candidate = dq.poll();
SequentialBasedBatchAccumulator.this.notFull.signal();
return candidate;
} else {
return null;
}
} else {
throw new RuntimeException("Should never get to here");
}
}
} catch (InterruptedException e) {
LOG.error("Wait for next batch is interrupted. " + e.toString());
} finally {
lock.unlock();
}
return null;
}
|
class class_name[name] begin[{]
method[getNextAvailableBatch, return_type[type[Batch]], modifier[public], parameter[]] begin[{]
local_variable[type[ReentrantLock], lock]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=lock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None), IfStatement(condition=This(postfix_operators=[], prefix_operators=[], qualifier=SequentialBasedBatchAccumulator, selectors=[MethodInvocation(arguments=[], member=isClosed, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=BlockStatement(label=None, statements=[WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ready to sleep because of queue is empty")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=SequentialBasedBatchAccumulator, selectors=[MemberReference(member=notEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=await, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), IfStatement(condition=This(postfix_operators=[], prefix_operators=[], qualifier=SequentialBasedBatchAccumulator, selectors=[MethodInvocation(arguments=[], member=isClosed, 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=MethodInvocation(arguments=[], member=poll, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[], type_arguments=None), label=None)]))]), condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=poll, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[], type_arguments=None), name=candidate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BytesBoundedBatch, sub_type=None)), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=SequentialBasedBatchAccumulator, selectors=[MemberReference(member=notFull, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=signal, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="retrieve batch "), operandr=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=candidate, selectors=[], type_arguments=None), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=candidate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Should never get to here")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=peekFirst, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[MethodInvocation(arguments=[], member=isTTLExpire, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Batch "), operandr=MethodInvocation(arguments=[], member=peekFirst, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[MethodInvocation(arguments=[], member=getId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is expired"), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=poll, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[], type_arguments=None), name=candidate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BytesBoundedBatch, sub_type=None)), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=SequentialBasedBatchAccumulator, selectors=[MemberReference(member=notFull, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=signal, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), ReturnStatement(expression=MemberReference(member=candidate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]))]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=poll, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Wait for next batch is interrupted. "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[public] identifier[Batch] operator[<] identifier[D] operator[>] identifier[getNextAvailableBatch] operator[SEP] operator[SEP] {
Keyword[final] identifier[ReentrantLock] identifier[lock] operator[=] identifier[SequentialBasedBatchAccumulator] operator[SEP] Keyword[this] operator[SEP] identifier[dqLock] operator[SEP] Keyword[try] {
identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[SequentialBasedBatchAccumulator] operator[SEP] Keyword[this] operator[SEP] identifier[isClosed] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[dq] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[while] operator[SEP] identifier[dq] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[SequentialBasedBatchAccumulator] operator[SEP] Keyword[this] operator[SEP] identifier[notEmpty] operator[SEP] identifier[await] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[SequentialBasedBatchAccumulator] operator[SEP] Keyword[this] operator[SEP] identifier[isClosed] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[dq] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[dq] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[BytesBoundedBatch] identifier[candidate] operator[=] identifier[dq] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] identifier[SequentialBasedBatchAccumulator] operator[SEP] Keyword[this] operator[SEP] identifier[notFull] operator[SEP] identifier[signal] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[candidate] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[candidate] operator[SEP]
}
Keyword[if] operator[SEP] identifier[dq] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[dq] operator[SEP] identifier[peekFirst] operator[SEP] operator[SEP] operator[SEP] identifier[isTTLExpire] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[dq] operator[SEP] identifier[peekFirst] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[BytesBoundedBatch] identifier[candidate] operator[=] identifier[dq] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] identifier[SequentialBasedBatchAccumulator] operator[SEP] Keyword[this] operator[SEP] identifier[notFull] operator[SEP] identifier[signal] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[candidate] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public ServiceFuture<Void> deleteManagementPoliciesAsync(String resourceGroupName, String accountName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(deleteManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback);
}
|
class class_name[name] begin[{]
method[deleteManagementPoliciesAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, accountName, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.deleteManagementPoliciesWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.accountName]]], member[.serviceCallback]]]]
end[}]
END[}]
|
Keyword[public] identifier[ServiceFuture] operator[<] identifier[Void] operator[>] identifier[deleteManagementPoliciesAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[accountName] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[Void] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[deleteManagementPoliciesWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[accountName] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
static Set<JPAPuId> scanForTxSynchronizationCollisions(List<Object> bindingList) {
if (bindingList == null) {
return new HashSet<JPAPuId>();
}
HashMap<JPAPuId, Boolean> knownPuIdMap = new HashMap<JPAPuId, Boolean>();
HashSet<JPAPuId> returnSet = new HashSet<JPAPuId>();
for (Object o : bindingList) {
JPAPCtxtInjectionBinding injBinding = (JPAPCtxtInjectionBinding) o;
JPAPuId puid = injBinding.ivPuId;
Boolean isUnsynchronized = injBinding.isUnsynchronized() ? Boolean.TRUE : Boolean.FALSE;
if (Boolean.TRUE.equals(isUnsynchronized)) {
returnSet.add(puid);
}
Boolean pVal = knownPuIdMap.put(puid, isUnsynchronized);
if (pVal != null) {
// JPAPuId has been seen before, verify that the sync type remains the same.
if (!pVal.equals(isUnsynchronized)) {
// Mismatching SynchronizationType
Tr.error(tc, "JPATXSYNC_INCOMPATIBLE_CWWJP0044E", puid);
String msgTxt = "CWWJP0044E: Multiple extended persistence context definitions of the persistence unit " +
puid +
" have been declared with unequal synchronization configuration.";
throw new IllegalStateException(msgTxt);
}
}
}
return returnSet;
}
|
class class_name[name] begin[{]
method[scanForTxSynchronizationCollisions, return_type[type[Set]], modifier[static], parameter[bindingList]] begin[{]
if[binary_operation[member[.bindingList], ==, literal[null]]] begin[{]
return[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=JPAPuId, sub_type=None))], dimensions=None, name=HashSet, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[HashMap], knownPuIdMap]
local_variable[type[HashSet], returnSet]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JPAPCtxtInjectionBinding, sub_type=None)), name=injBinding)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JPAPCtxtInjectionBinding, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=ivPuId, postfix_operators=[], prefix_operators=[], qualifier=injBinding, selectors=[]), name=puid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JPAPuId, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MethodInvocation(arguments=[], member=isUnsynchronized, postfix_operators=[], prefix_operators=[], qualifier=injBinding, selectors=[], type_arguments=None), if_false=MemberReference(member=FALSE, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[]), if_true=MemberReference(member=TRUE, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[])), name=isUnsynchronized)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=isUnsynchronized, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=Boolean.TRUE, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=puid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=returnSet, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=puid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=isUnsynchronized, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=knownPuIdMap, selectors=[], type_arguments=None), name=pVal)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pVal, 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=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=isUnsynchronized, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=pVal, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="JPATXSYNC_INCOMPATIBLE_CWWJP0044E"), MemberReference(member=puid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CWWJP0044E: Multiple extended persistence context definitions of the persistence unit "), operandr=MemberReference(member=puid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" have been declared with unequal synchronization configuration."), operator=+), name=msgTxt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msgTxt, 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=IllegalStateException, sub_type=None)), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=bindingList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[member[.returnSet]]
end[}]
END[}]
|
Keyword[static] identifier[Set] operator[<] identifier[JPAPuId] operator[>] identifier[scanForTxSynchronizationCollisions] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] identifier[bindingList] operator[SEP] {
Keyword[if] operator[SEP] identifier[bindingList] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[HashSet] operator[<] identifier[JPAPuId] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
identifier[HashMap] operator[<] identifier[JPAPuId] , identifier[Boolean] operator[>] identifier[knownPuIdMap] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[JPAPuId] , identifier[Boolean] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[HashSet] operator[<] identifier[JPAPuId] operator[>] identifier[returnSet] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[JPAPuId] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[bindingList] operator[SEP] {
identifier[JPAPCtxtInjectionBinding] identifier[injBinding] operator[=] operator[SEP] identifier[JPAPCtxtInjectionBinding] operator[SEP] identifier[o] operator[SEP] identifier[JPAPuId] identifier[puid] operator[=] identifier[injBinding] operator[SEP] identifier[ivPuId] operator[SEP] identifier[Boolean] identifier[isUnsynchronized] operator[=] identifier[injBinding] operator[SEP] identifier[isUnsynchronized] operator[SEP] operator[SEP] operator[?] identifier[Boolean] operator[SEP] identifier[TRUE] operator[:] identifier[Boolean] operator[SEP] identifier[FALSE] operator[SEP] Keyword[if] operator[SEP] identifier[Boolean] operator[SEP] identifier[TRUE] operator[SEP] identifier[equals] operator[SEP] identifier[isUnsynchronized] operator[SEP] operator[SEP] {
identifier[returnSet] operator[SEP] identifier[add] operator[SEP] identifier[puid] operator[SEP] operator[SEP]
}
identifier[Boolean] identifier[pVal] operator[=] identifier[knownPuIdMap] operator[SEP] identifier[put] operator[SEP] identifier[puid] , identifier[isUnsynchronized] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pVal] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[pVal] operator[SEP] identifier[equals] operator[SEP] identifier[isUnsynchronized] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , identifier[puid] operator[SEP] operator[SEP] identifier[String] identifier[msgTxt] operator[=] literal[String] operator[+] identifier[puid] operator[+] literal[String] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[msgTxt] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[returnSet] operator[SEP]
}
|
public boolean next() {
final int currentIndex = current.getCurrentIndex();
int nextIndex = currentIndex + 1;
TestScript testScript = current.getTestScript();
LOG.debug("debug.test", current);
if (currentIndex < testScript.getTestStepCount()) {
if (pm.isDebug()) {
LOG.debug("debug.index", currentIndex, testScript.getTestStepCount());
TestStep nextStep = testScript.getTestStep(nextIndex);
if (nextStep != null && nextStep.isBreakPointEnabled()) {
LOG.info("debug.break.point");
pause();
}
nextIndex = getNextIndex(currentIndex);
}
if (nextIndex >= testScript.getTestStepCount()) {
sendCaseEnd();
return current.isContinued();
}
current.setCurrentIndex(nextIndex);
current.setTestStep(current.getTestScript().getTestStep(nextIndex));
sendStepStart();
return true;
} else {
sendCaseEnd();
return current.isContinued();
}
}
|
class class_name[name] begin[{]
method[next, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[int], currentIndex]
local_variable[type[int], nextIndex]
local_variable[type[TestScript], testScript]
call[LOG.debug, parameter[literal["debug.test"], member[.current]]]
if[binary_operation[member[.currentIndex], <, call[testScript.getTestStepCount, parameter[]]]] begin[{]
if[call[pm.isDebug, parameter[]]] begin[{]
call[LOG.debug, parameter[literal["debug.index"], member[.currentIndex], call[testScript.getTestStepCount, parameter[]]]]
local_variable[type[TestStep], nextStep]
if[binary_operation[binary_operation[member[.nextStep], !=, literal[null]], &&, call[nextStep.isBreakPointEnabled, parameter[]]]] begin[{]
call[LOG.info, parameter[literal["debug.break.point"]]]
call[.pause, parameter[]]
else begin[{]
None
end[}]
assign[member[.nextIndex], call[.getNextIndex, parameter[member[.currentIndex]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.nextIndex], >=, call[testScript.getTestStepCount, parameter[]]]] begin[{]
call[.sendCaseEnd, parameter[]]
return[call[current.isContinued, parameter[]]]
else begin[{]
None
end[}]
call[current.setCurrentIndex, parameter[member[.nextIndex]]]
call[current.setTestStep, parameter[call[current.getTestScript, parameter[]]]]
call[.sendStepStart, parameter[]]
return[literal[true]]
else begin[{]
call[.sendCaseEnd, parameter[]]
return[call[current.isContinued, parameter[]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[next] operator[SEP] operator[SEP] {
Keyword[final] Keyword[int] identifier[currentIndex] operator[=] identifier[current] operator[SEP] identifier[getCurrentIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[nextIndex] operator[=] identifier[currentIndex] operator[+] Other[1] operator[SEP] identifier[TestScript] identifier[testScript] operator[=] identifier[current] operator[SEP] identifier[getTestScript] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[current] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentIndex] operator[<] identifier[testScript] operator[SEP] identifier[getTestStepCount] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[pm] operator[SEP] identifier[isDebug] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[currentIndex] , identifier[testScript] operator[SEP] identifier[getTestStepCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[TestStep] identifier[nextStep] operator[=] identifier[testScript] operator[SEP] identifier[getTestStep] operator[SEP] identifier[nextIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nextStep] operator[!=] Other[null] operator[&&] identifier[nextStep] operator[SEP] identifier[isBreakPointEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[pause] operator[SEP] operator[SEP] operator[SEP]
}
identifier[nextIndex] operator[=] identifier[getNextIndex] operator[SEP] identifier[currentIndex] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[nextIndex] operator[>=] identifier[testScript] operator[SEP] identifier[getTestStepCount] operator[SEP] operator[SEP] operator[SEP] {
identifier[sendCaseEnd] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[current] operator[SEP] identifier[isContinued] operator[SEP] operator[SEP] operator[SEP]
}
identifier[current] operator[SEP] identifier[setCurrentIndex] operator[SEP] identifier[nextIndex] operator[SEP] operator[SEP] identifier[current] operator[SEP] identifier[setTestStep] operator[SEP] identifier[current] operator[SEP] identifier[getTestScript] operator[SEP] operator[SEP] operator[SEP] identifier[getTestStep] operator[SEP] identifier[nextIndex] operator[SEP] operator[SEP] operator[SEP] identifier[sendStepStart] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[sendCaseEnd] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[current] operator[SEP] identifier[isContinued] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void onUpdateNotification(NotificationView view, View contentView, NotificationEntry entry, int layoutId) {
if (DBG) Log.v(TAG, "onUpdateNotification - " + entry.ID);
final Drawable icon = entry.iconDrawable;
final CharSequence title = entry.title;
final CharSequence text = entry.text;
final CharSequence when = entry.showWhen ? entry.whenFormatted : null;
ChildViewManager mgr = view.getChildViewManager();
mgr.setImageDrawable(ICON, icon, false);
mgr.setText(TITLE, title, false);
mgr.setText(TEXT, text, false);
mgr.setText(WHEN, when, false);
}
|
class class_name[name] begin[{]
method[onUpdateNotification, return_type[void], modifier[public], parameter[view, contentView, entry, layoutId]] begin[{]
if[member[.DBG]] begin[{]
call[Log.v, parameter[member[.TAG], binary_operation[literal["onUpdateNotification - "], +, member[entry.ID]]]]
else begin[{]
None
end[}]
local_variable[type[Drawable], icon]
local_variable[type[CharSequence], title]
local_variable[type[CharSequence], text]
local_variable[type[CharSequence], when]
local_variable[type[ChildViewManager], mgr]
call[mgr.setImageDrawable, parameter[member[.ICON], member[.icon], literal[false]]]
call[mgr.setText, parameter[member[.TITLE], member[.title], literal[false]]]
call[mgr.setText, parameter[member[.TEXT], member[.text], literal[false]]]
call[mgr.setText, parameter[member[.WHEN], member[.when], literal[false]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[onUpdateNotification] operator[SEP] identifier[NotificationView] identifier[view] , identifier[View] identifier[contentView] , identifier[NotificationEntry] identifier[entry] , Keyword[int] identifier[layoutId] operator[SEP] {
Keyword[if] operator[SEP] identifier[DBG] operator[SEP] identifier[Log] operator[SEP] identifier[v] operator[SEP] identifier[TAG] , literal[String] operator[+] identifier[entry] operator[SEP] identifier[ID] operator[SEP] operator[SEP] Keyword[final] identifier[Drawable] identifier[icon] operator[=] identifier[entry] operator[SEP] identifier[iconDrawable] operator[SEP] Keyword[final] identifier[CharSequence] identifier[title] operator[=] identifier[entry] operator[SEP] identifier[title] operator[SEP] Keyword[final] identifier[CharSequence] identifier[text] operator[=] identifier[entry] operator[SEP] identifier[text] operator[SEP] Keyword[final] identifier[CharSequence] identifier[when] operator[=] identifier[entry] operator[SEP] identifier[showWhen] operator[?] identifier[entry] operator[SEP] identifier[whenFormatted] operator[:] Other[null] operator[SEP] identifier[ChildViewManager] identifier[mgr] operator[=] identifier[view] operator[SEP] identifier[getChildViewManager] operator[SEP] operator[SEP] operator[SEP] identifier[mgr] operator[SEP] identifier[setImageDrawable] operator[SEP] identifier[ICON] , identifier[icon] , literal[boolean] operator[SEP] operator[SEP] identifier[mgr] operator[SEP] identifier[setText] operator[SEP] identifier[TITLE] , identifier[title] , literal[boolean] operator[SEP] operator[SEP] identifier[mgr] operator[SEP] identifier[setText] operator[SEP] identifier[TEXT] , identifier[text] , literal[boolean] operator[SEP] operator[SEP] identifier[mgr] operator[SEP] identifier[setText] operator[SEP] identifier[WHEN] , identifier[when] , literal[boolean] operator[SEP] operator[SEP]
}
|
private void onDelete(Object entity, Object pKey, Object connection)
{
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
AttributeWrapper wrapper = wrap(entityMetadata, entity);
Set<byte[]> columnNames = wrapper.columns.keySet();
String rowKey = null;
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
entityMetadata.getPersistenceUnit());
if (metaModel.isEmbeddable(entityMetadata.getIdAttribute().getBindableJavaType()))
{
rowKey = KunderaCoreUtils.prepareCompositeKey(entityMetadata, pKey);
}
else
{
rowKey = PropertyAccessorHelper.getString(entity, (Field) entityMetadata.getIdAttribute().getJavaMember());
}
for (byte[] name : columnNames)
{
if (resource != null && resource.isActive())
{
((Transaction) connection).hdel(getHashKey(entityMetadata.getTableName(), rowKey),
PropertyAccessorFactory.STRING.fromBytes(String.class, name));
}
else
{
((Pipeline) connection).hdel(getHashKey(entityMetadata.getTableName(), rowKey),
PropertyAccessorFactory.STRING.fromBytes(String.class, name));
}
}
// Delete relation values.
deleteRelation(connection, entityMetadata, rowKey);
// Delete inverted indexes.
unIndex(connection, wrapper, rowKey);
if (resource != null && resource.isActive())
{
((Transaction) connection).zrem(
getHashKey(entityMetadata.getTableName(),
((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName()), rowKey);
}
else
{
((Pipeline) connection).zrem(
getHashKey(entityMetadata.getTableName(),
((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName()), rowKey);
}
KunderaCoreUtils.printQuery("Delete data from:" + entityMetadata.getTableName() + "for primary key: " + rowKey,
showQuery);
}
|
class class_name[name] begin[{]
method[onDelete, return_type[void], modifier[private], parameter[entity, pKey, connection]] begin[{]
local_variable[type[EntityMetadata], entityMetadata]
local_variable[type[AttributeWrapper], wrapper]
local_variable[type[Set], columnNames]
local_variable[type[String], rowKey]
local_variable[type[MetamodelImpl], metaModel]
if[call[metaModel.isEmbeddable, parameter[call[entityMetadata.getIdAttribute, parameter[]]]]] begin[{]
assign[member[.rowKey], call[KunderaCoreUtils.prepareCompositeKey, parameter[member[.entityMetadata], member[.pKey]]]]
else begin[{]
assign[member[.rowKey], call[PropertyAccessorHelper.getString, parameter[member[.entity], Cast(expression=MethodInvocation(arguments=[], member=getIdAttribute, postfix_operators=[], prefix_operators=[], qualifier=entityMetadata, selectors=[MethodInvocation(arguments=[], member=getJavaMember, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))]]]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isActive, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Pipeline, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Transaction, sub_type=None)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=columnNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=name)], modifiers=set(), type=BasicType(dimensions=[None], name=byte))), label=None)
call[.deleteRelation, parameter[member[.connection], member[.entityMetadata], member[.rowKey]]]
call[.unIndex, parameter[member[.connection], member[.wrapper], member[.rowKey]]]
if[binary_operation[binary_operation[member[.resource], !=, literal[null]], &&, call[resource.isActive, parameter[]]]] begin[{]
Cast(expression=MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Transaction, sub_type=None))
else begin[{]
Cast(expression=MemberReference(member=connection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Pipeline, sub_type=None))
end[}]
call[KunderaCoreUtils.printQuery, parameter[binary_operation[binary_operation[binary_operation[literal["Delete data from:"], +, call[entityMetadata.getTableName, parameter[]]], +, literal["for primary key: "]], +, member[.rowKey]], member[.showQuery]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[onDelete] operator[SEP] identifier[Object] identifier[entity] , identifier[Object] identifier[pKey] , identifier[Object] identifier[connection] operator[SEP] {
identifier[EntityMetadata] identifier[entityMetadata] operator[=] identifier[KunderaMetadataManager] operator[SEP] identifier[getEntityMetadata] operator[SEP] identifier[kunderaMetadata] , identifier[entity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[AttributeWrapper] identifier[wrapper] operator[=] identifier[wrap] operator[SEP] identifier[entityMetadata] , identifier[entity] operator[SEP] operator[SEP] identifier[Set] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[columnNames] operator[=] identifier[wrapper] operator[SEP] identifier[columns] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[rowKey] operator[=] Other[null] operator[SEP] identifier[MetamodelImpl] identifier[metaModel] operator[=] operator[SEP] identifier[MetamodelImpl] operator[SEP] identifier[kunderaMetadata] operator[SEP] identifier[getApplicationMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[getMetamodel] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getPersistenceUnit] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[metaModel] operator[SEP] identifier[isEmbeddable] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getIdAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[getBindableJavaType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[rowKey] operator[=] identifier[KunderaCoreUtils] operator[SEP] identifier[prepareCompositeKey] operator[SEP] identifier[entityMetadata] , identifier[pKey] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[rowKey] operator[=] identifier[PropertyAccessorHelper] operator[SEP] identifier[getString] operator[SEP] identifier[entity] , operator[SEP] identifier[Field] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getIdAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[getJavaMember] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[name] operator[:] identifier[columnNames] operator[SEP] {
Keyword[if] operator[SEP] identifier[resource] operator[!=] Other[null] operator[&&] identifier[resource] operator[SEP] identifier[isActive] operator[SEP] operator[SEP] operator[SEP] {
operator[SEP] operator[SEP] identifier[Transaction] operator[SEP] identifier[connection] operator[SEP] operator[SEP] identifier[hdel] operator[SEP] identifier[getHashKey] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , identifier[rowKey] operator[SEP] , identifier[PropertyAccessorFactory] operator[SEP] identifier[STRING] operator[SEP] identifier[fromBytes] operator[SEP] identifier[String] operator[SEP] Keyword[class] , identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
operator[SEP] operator[SEP] identifier[Pipeline] operator[SEP] identifier[connection] operator[SEP] operator[SEP] identifier[hdel] operator[SEP] identifier[getHashKey] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , identifier[rowKey] operator[SEP] , identifier[PropertyAccessorFactory] operator[SEP] identifier[STRING] operator[SEP] identifier[fromBytes] operator[SEP] identifier[String] operator[SEP] Keyword[class] , identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[deleteRelation] operator[SEP] identifier[connection] , identifier[entityMetadata] , identifier[rowKey] operator[SEP] operator[SEP] identifier[unIndex] operator[SEP] identifier[connection] , identifier[wrapper] , identifier[rowKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resource] operator[!=] Other[null] operator[&&] identifier[resource] operator[SEP] identifier[isActive] operator[SEP] operator[SEP] operator[SEP] {
operator[SEP] operator[SEP] identifier[Transaction] operator[SEP] identifier[connection] operator[SEP] operator[SEP] identifier[zrem] operator[SEP] identifier[getHashKey] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , operator[SEP] operator[SEP] identifier[AbstractAttribute] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getIdAttribute] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getJPAColumnName] operator[SEP] operator[SEP] operator[SEP] , identifier[rowKey] operator[SEP] operator[SEP]
}
Keyword[else] {
operator[SEP] operator[SEP] identifier[Pipeline] operator[SEP] identifier[connection] operator[SEP] operator[SEP] identifier[zrem] operator[SEP] identifier[getHashKey] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , operator[SEP] operator[SEP] identifier[AbstractAttribute] operator[SEP] identifier[entityMetadata] operator[SEP] identifier[getIdAttribute] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getJPAColumnName] operator[SEP] operator[SEP] operator[SEP] , identifier[rowKey] operator[SEP] operator[SEP]
}
identifier[KunderaCoreUtils] operator[SEP] identifier[printQuery] operator[SEP] literal[String] operator[+] identifier[entityMetadata] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[rowKey] , identifier[showQuery] operator[SEP] operator[SEP]
}
|
public static <E extends Enum<E>> EnumSet<E> copyOf(Collection<E> c) {
if (c instanceof EnumSet) {
return ((EnumSet<E>)c).clone();
} else {
if (c.isEmpty())
throw new IllegalArgumentException("Collection is empty");
Iterator<E> i = c.iterator();
E first = i.next();
// J2ObjC modification - This check is implicit in the JVM but not with J2ObjC.
if (!(first instanceof Enum)) {
// Violates method's generic signature.
throw new ClassCastException();
}
EnumSet<E> result = EnumSet.of(first);
while (i.hasNext())
result.add(i.next());
return result;
}
}
|
class class_name[name] begin[{]
method[copyOf, return_type[type[EnumSet]], modifier[public static], parameter[c]] begin[{]
if[binary_operation[member[.c], instanceof, type[EnumSet]]] begin[{]
return[Cast(expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=[], name=EnumSet, sub_type=None))]
else begin[{]
if[call[c.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Collection is empty")], 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[Iterator], i]
local_variable[type[E], first]
if[binary_operation[member[.first], instanceof, type[Enum]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassCastException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[EnumSet], result]
while[call[i.hasNext, parameter[]]] begin[{]
call[result.add, parameter[call[i.next, parameter[]]]]
end[}]
return[member[.result]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[E] Keyword[extends] identifier[Enum] operator[<] identifier[E] operator[>] operator[>] identifier[EnumSet] operator[<] identifier[E] operator[>] identifier[copyOf] operator[SEP] identifier[Collection] operator[<] identifier[E] operator[>] identifier[c] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] Keyword[instanceof] identifier[EnumSet] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[EnumSet] operator[<] identifier[E] operator[>] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[E] operator[>] identifier[i] operator[=] identifier[c] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[E] identifier[first] operator[=] identifier[i] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[first] Keyword[instanceof] identifier[Enum] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ClassCastException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[EnumSet] operator[<] identifier[E] operator[>] identifier[result] operator[=] identifier[EnumSet] operator[SEP] identifier[of] operator[SEP] identifier[first] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[i] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
}
|
public static RecurrenceIterator join(
RecurrenceIterator a, RecurrenceIterator... b) {
List<RecurrenceIterator> incl = new ArrayList<RecurrenceIterator>();
incl.add(a);
incl.addAll(Arrays.asList(b));
return new CompoundIteratorImpl(
incl, Collections.<RecurrenceIterator>emptyList());
}
|
class class_name[name] begin[{]
method[join, return_type[type[RecurrenceIterator]], modifier[public static], parameter[a, b]] begin[{]
local_variable[type[List], incl]
call[incl.add, parameter[member[.a]]]
call[incl.addAll, parameter[call[Arrays.asList, parameter[member[.b]]]]]
return[ClassCreator(arguments=[MemberReference(member=incl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=Collections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RecurrenceIterator, sub_type=None))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CompoundIteratorImpl, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[RecurrenceIterator] identifier[join] operator[SEP] identifier[RecurrenceIterator] identifier[a] , identifier[RecurrenceIterator] operator[...] identifier[b] operator[SEP] {
identifier[List] operator[<] identifier[RecurrenceIterator] operator[>] identifier[incl] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[RecurrenceIterator] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[incl] operator[SEP] identifier[add] operator[SEP] identifier[a] operator[SEP] operator[SEP] identifier[incl] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[b] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[CompoundIteratorImpl] operator[SEP] identifier[incl] , identifier[Collections] operator[SEP] operator[<] identifier[RecurrenceIterator] operator[>] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean process( List<AssociatedTriple> observations , TrifocalTensor solution ) {
if( observations.size() < 7 )
throw new IllegalArgumentException(
"At least 7 correspondences must be provided. Found "+observations.size());
// compute normalization to reduce numerical errors
LowLevelMultiViewOps.computeNormalization(observations, N1, N2, N3);
// compute solution in normalized pixel coordinates
createLinearSystem(observations);
// solve for the trifocal tensor
solveLinearSystem();
// enforce geometric constraints to improve solution
extractEpipoles.setTensor(solutionN);
extractEpipoles.extractEpipoles(e2,e3);
enforce.process(e2,e3,A);
enforce.extractSolution(solutionN);
// undo normalization
removeNormalization(solution);
return true;
}
|
class class_name[name] begin[{]
method[process, return_type[type[boolean]], modifier[public], parameter[observations, solution]] begin[{]
if[binary_operation[call[observations.size, parameter[]], <, literal[7]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="At least 7 correspondences must be provided. Found "), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=observations, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[LowLevelMultiViewOps.computeNormalization, parameter[member[.observations], member[.N1], member[.N2], member[.N3]]]
call[.createLinearSystem, parameter[member[.observations]]]
call[.solveLinearSystem, parameter[]]
call[extractEpipoles.setTensor, parameter[member[.solutionN]]]
call[extractEpipoles.extractEpipoles, parameter[member[.e2], member[.e3]]]
call[enforce.process, parameter[member[.e2], member[.e3], member[.A]]]
call[enforce.extractSolution, parameter[member[.solutionN]]]
call[.removeNormalization, parameter[member[.solution]]]
return[literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[process] operator[SEP] identifier[List] operator[<] identifier[AssociatedTriple] operator[>] identifier[observations] , identifier[TrifocalTensor] identifier[solution] operator[SEP] {
Keyword[if] operator[SEP] identifier[observations] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] Other[7] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[observations] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LowLevelMultiViewOps] operator[SEP] identifier[computeNormalization] operator[SEP] identifier[observations] , identifier[N1] , identifier[N2] , identifier[N3] operator[SEP] operator[SEP] identifier[createLinearSystem] operator[SEP] identifier[observations] operator[SEP] operator[SEP] identifier[solveLinearSystem] operator[SEP] operator[SEP] operator[SEP] identifier[extractEpipoles] operator[SEP] identifier[setTensor] operator[SEP] identifier[solutionN] operator[SEP] operator[SEP] identifier[extractEpipoles] operator[SEP] identifier[extractEpipoles] operator[SEP] identifier[e2] , identifier[e3] operator[SEP] operator[SEP] identifier[enforce] operator[SEP] identifier[process] operator[SEP] identifier[e2] , identifier[e3] , identifier[A] operator[SEP] operator[SEP] identifier[enforce] operator[SEP] identifier[extractSolution] operator[SEP] identifier[solutionN] operator[SEP] operator[SEP] identifier[removeNormalization] operator[SEP] identifier[solution] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
void saveLastSavedPreferences() {
String templateName = ""; //$NON-NLS-1$
Template template = getSelectedTemplate();
if (template != null) {
templateName = template.getName();
}
GlassmakerUIPlugin.getDefault().getPreferenceStore().setValue("newFileTemplateName", templateName);
GlassmakerUIPlugin.getDefault().savePluginPreferences();
}
|
class class_name[name] begin[{]
method[saveLastSavedPreferences, return_type[void], modifier[default], parameter[]] begin[{]
local_variable[type[String], templateName]
local_variable[type[Template], template]
if[binary_operation[member[.template], !=, literal[null]]] begin[{]
assign[member[.templateName], call[template.getName, parameter[]]]
else begin[{]
None
end[}]
call[GlassmakerUIPlugin.getDefault, parameter[]]
call[GlassmakerUIPlugin.getDefault, parameter[]]
end[}]
END[}]
|
Keyword[void] identifier[saveLastSavedPreferences] operator[SEP] operator[SEP] {
identifier[String] identifier[templateName] operator[=] literal[String] operator[SEP] identifier[Template] identifier[template] operator[=] identifier[getSelectedTemplate] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[template] operator[!=] Other[null] operator[SEP] {
identifier[templateName] operator[=] identifier[template] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP]
}
identifier[GlassmakerUIPlugin] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] identifier[getPreferenceStore] operator[SEP] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] literal[String] , identifier[templateName] operator[SEP] operator[SEP] identifier[GlassmakerUIPlugin] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] identifier[savePluginPreferences] operator[SEP] operator[SEP] operator[SEP]
}
|
protected Runtime createRuntime(ResourceLoader resourceLoader, ClassLoader classLoader,
RuntimeOptions runtimeOptions) throws InitializationError, IOException {
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
return new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
}
|
class class_name[name] begin[{]
method[createRuntime, return_type[type[Runtime]], modifier[protected], parameter[resourceLoader, classLoader, runtimeOptions]] begin[{]
local_variable[type[ClassFinder], classFinder]
return[ClassCreator(arguments=[MemberReference(member=resourceLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=classFinder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=classLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=runtimeOptions, 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=Runtime, sub_type=None))]
end[}]
END[}]
|
Keyword[protected] identifier[Runtime] identifier[createRuntime] operator[SEP] identifier[ResourceLoader] identifier[resourceLoader] , identifier[ClassLoader] identifier[classLoader] , identifier[RuntimeOptions] identifier[runtimeOptions] operator[SEP] Keyword[throws] identifier[InitializationError] , identifier[IOException] {
identifier[ClassFinder] identifier[classFinder] operator[=] Keyword[new] identifier[ResourceLoaderClassFinder] operator[SEP] identifier[resourceLoader] , identifier[classLoader] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Runtime] operator[SEP] identifier[resourceLoader] , identifier[classFinder] , identifier[classLoader] , identifier[runtimeOptions] operator[SEP] operator[SEP]
}
|
protected final void putInt32(long i32) {
ensureCapacity(position + 4);
byte[] buf = buffer;
buf[position++] = (byte) (i32 & 0xff);
buf[position++] = (byte) (i32 >>> 8);
buf[position++] = (byte) (i32 >>> 16);
buf[position++] = (byte) (i32 >>> 24);
}
|
class class_name[name] begin[{]
method[putInt32, return_type[void], modifier[final protected], parameter[i32]] begin[{]
call[.ensureCapacity, parameter[binary_operation[member[.position], +, literal[4]]]]
local_variable[type[byte], buf]
assign[member[.buf], Cast(expression=BinaryOperation(operandl=MemberReference(member=i32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), type=BasicType(dimensions=[], name=byte))]
assign[member[.buf], Cast(expression=BinaryOperation(operandl=MemberReference(member=i32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>>), type=BasicType(dimensions=[], name=byte))]
assign[member[.buf], Cast(expression=BinaryOperation(operandl=MemberReference(member=i32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=>>>), type=BasicType(dimensions=[], name=byte))]
assign[member[.buf], Cast(expression=BinaryOperation(operandl=MemberReference(member=i32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=24), operator=>>>), type=BasicType(dimensions=[], name=byte))]
end[}]
END[}]
|
Keyword[protected] Keyword[final] Keyword[void] identifier[putInt32] operator[SEP] Keyword[long] identifier[i32] operator[SEP] {
identifier[ensureCapacity] operator[SEP] identifier[position] operator[+] Other[4] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[buf] operator[=] identifier[buffer] operator[SEP] identifier[buf] operator[SEP] identifier[position] operator[++] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[i32] operator[&] literal[Integer] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[position] operator[++] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[i32] operator[>] operator[>] operator[>] Other[8] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[position] operator[++] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[i32] operator[>] operator[>] operator[>] Other[16] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[position] operator[++] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[i32] operator[>] operator[>] operator[>] Other[24] operator[SEP] operator[SEP]
}
|
public <T> T deserialize(String body, TypeRef returnType) throws ApiException {
JavaType javaType = mapper.constructType(returnType.getType());
try {
return mapper.readValue(body, javaType);
} catch (IOException e) {
if (returnType.getType().equals(String.class))
return (T) body;
else
throw new ApiException(500, e.getMessage(), null, body);
}
}
|
class class_name[name] begin[{]
method[deserialize, return_type[type[T]], modifier[public], parameter[body, returnType]] begin[{]
local_variable[type[JavaType], javaType]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=javaType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readValue, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=returnType, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=500), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=body, 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=ApiException, sub_type=None)), label=None), label=None, then_statement=ReturnStatement(expression=Cast(expression=MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), label=None))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[deserialize] operator[SEP] identifier[String] identifier[body] , identifier[TypeRef] identifier[returnType] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[JavaType] identifier[javaType] operator[=] identifier[mapper] operator[SEP] identifier[constructType] operator[SEP] identifier[returnType] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[mapper] operator[SEP] identifier[readValue] operator[SEP] identifier[body] , identifier[javaType] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[returnType] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[T] operator[SEP] identifier[body] operator[SEP] Keyword[else] Keyword[throw] Keyword[new] identifier[ApiException] operator[SEP] Other[500] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , Other[null] , identifier[body] operator[SEP] operator[SEP]
}
}
|
public static Date nextSecond(Date date, int second) {
Calendar cal = Calendar.getInstance();
if (date != null) {
cal.setTime(date);
}
cal.add(Calendar.SECOND, second);
return cal.getTime();
}
|
class class_name[name] begin[{]
method[nextSecond, return_type[type[Date]], modifier[public static], parameter[date, second]] begin[{]
local_variable[type[Calendar], cal]
if[binary_operation[member[.date], !=, literal[null]]] begin[{]
call[cal.setTime, parameter[member[.date]]]
else begin[{]
None
end[}]
call[cal.add, parameter[member[Calendar.SECOND], member[.second]]]
return[call[cal.getTime, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Date] identifier[nextSecond] operator[SEP] identifier[Date] identifier[date] , Keyword[int] identifier[second] operator[SEP] {
identifier[Calendar] identifier[cal] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[date] operator[!=] Other[null] operator[SEP] {
identifier[cal] operator[SEP] identifier[setTime] operator[SEP] identifier[date] operator[SEP] operator[SEP]
}
identifier[cal] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , identifier[second] operator[SEP] operator[SEP] Keyword[return] identifier[cal] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP]
}
|
public void start() {
for (Thread schedulerForType : schedulersForTypes.values()) {
LOG.info("Starting " + schedulerForType.getName());
schedulerForType.start();
}
configManager.start();
}
|
class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Starting "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=schedulerForType, selectors=[], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=start, postfix_operators=[], prefix_operators=[], qualifier=schedulerForType, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=schedulersForTypes, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=schedulerForType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Thread, sub_type=None))), label=None)
call[configManager.start, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[start] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Thread] identifier[schedulerForType] operator[:] identifier[schedulersForTypes] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[schedulerForType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[schedulerForType] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
identifier[configManager] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP]
}
|
private String formatTimeUnit(TimeUnit timeUnit)
{
int units = timeUnit.getValue();
String result;
String[][] unitNames = LocaleData.getStringArrays(m_locale, LocaleData.TIME_UNITS_ARRAY);
if (units < 0 || units >= unitNames.length)
{
result = "";
}
else
{
result = unitNames[units][0];
}
return (result);
}
|
class class_name[name] begin[{]
method[formatTimeUnit, return_type[type[String]], modifier[private], parameter[timeUnit]] begin[{]
local_variable[type[int], units]
local_variable[type[String], result]
local_variable[type[String], unitNames]
if[binary_operation[binary_operation[member[.units], <, literal[0]], ||, binary_operation[member[.units], >=, member[unitNames.length]]]] begin[{]
assign[member[.result], literal[""]]
else begin[{]
assign[member[.result], member[.unitNames]]
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[formatTimeUnit] operator[SEP] identifier[TimeUnit] identifier[timeUnit] operator[SEP] {
Keyword[int] identifier[units] operator[=] identifier[timeUnit] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[result] operator[SEP] identifier[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[unitNames] operator[=] identifier[LocaleData] operator[SEP] identifier[getStringArrays] operator[SEP] identifier[m_locale] , identifier[LocaleData] operator[SEP] identifier[TIME_UNITS_ARRAY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[units] operator[<] Other[0] operator[||] identifier[units] operator[>=] identifier[unitNames] operator[SEP] identifier[length] operator[SEP] {
identifier[result] operator[=] literal[String] operator[SEP]
}
Keyword[else] {
identifier[result] operator[=] identifier[unitNames] operator[SEP] identifier[units] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[result] operator[SEP] operator[SEP]
}
|
public static String getFileExtension(String _fileName) {
if (_fileName == null) {
return null;
}
int lastDot = _fileName.lastIndexOf('.');
if (lastDot == -1) {
return "";
}
return _fileName.substring(lastDot + 1);
}
|
class class_name[name] begin[{]
method[getFileExtension, return_type[type[String]], modifier[public static], parameter[_fileName]] begin[{]
if[binary_operation[member[._fileName], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], lastDot]
if[binary_operation[member[.lastDot], ==, literal[1]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
return[call[_fileName.substring, parameter[binary_operation[member[.lastDot], +, literal[1]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getFileExtension] operator[SEP] identifier[String] identifier[_fileName] operator[SEP] {
Keyword[if] operator[SEP] identifier[_fileName] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[int] identifier[lastDot] operator[=] identifier[_fileName] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastDot] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[return] identifier[_fileName] operator[SEP] identifier[substring] operator[SEP] identifier[lastDot] operator[+] Other[1] operator[SEP] operator[SEP]
}
|
public final void addAllConstraints(
@NonNull final Collection<Constraint<CharSequence>> constraints) {
Condition.INSTANCE.ensureNotNull(constraints, "The collection may not be null");
for (Constraint<CharSequence> constraint : constraints) {
addConstraint(constraint);
}
}
|
class class_name[name] begin[{]
method[addAllConstraints, return_type[void], modifier[final public], parameter[constraints]] begin[{]
call[Condition.INSTANCE.ensureNotNull, parameter[member[.constraints], literal["The collection may not be null"]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=constraint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addConstraint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=constraints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=constraint)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CharSequence, sub_type=None))], dimensions=[], name=Constraint, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[addAllConstraints] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[Collection] operator[<] identifier[Constraint] operator[<] identifier[CharSequence] operator[>] operator[>] identifier[constraints] operator[SEP] {
identifier[Condition] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[ensureNotNull] operator[SEP] identifier[constraints] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Constraint] operator[<] identifier[CharSequence] operator[>] identifier[constraint] operator[:] identifier[constraints] operator[SEP] {
identifier[addConstraint] operator[SEP] identifier[constraint] operator[SEP] operator[SEP]
}
}
|
private void trackServletContextHelper(final BundleContext bundleContext, ExtendedHttpServiceRuntime httpServiceRuntime) {
final ServiceTracker<ServletContextHelper, ServletContextHelperElement> servletContextHelperTracker =
ServletContextHelperTracker.createTracker(extenderContext, bundleContext, httpServiceRuntime);
servletContextHelperTracker.open();
trackers.add(0, servletContextHelperTracker);
}
|
class class_name[name] begin[{]
method[trackServletContextHelper, return_type[void], modifier[private], parameter[bundleContext, httpServiceRuntime]] begin[{]
local_variable[type[ServiceTracker], servletContextHelperTracker]
call[servletContextHelperTracker.open, parameter[]]
call[trackers.add, parameter[literal[0], member[.servletContextHelperTracker]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[trackServletContextHelper] operator[SEP] Keyword[final] identifier[BundleContext] identifier[bundleContext] , identifier[ExtendedHttpServiceRuntime] identifier[httpServiceRuntime] operator[SEP] {
Keyword[final] identifier[ServiceTracker] operator[<] identifier[ServletContextHelper] , identifier[ServletContextHelperElement] operator[>] identifier[servletContextHelperTracker] operator[=] identifier[ServletContextHelperTracker] operator[SEP] identifier[createTracker] operator[SEP] identifier[extenderContext] , identifier[bundleContext] , identifier[httpServiceRuntime] operator[SEP] operator[SEP] identifier[servletContextHelperTracker] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP] identifier[trackers] operator[SEP] identifier[add] operator[SEP] Other[0] , identifier[servletContextHelperTracker] operator[SEP] operator[SEP]
}
|
public static String getMethodName(ServiceMethod serviceMethod) {
String name = serviceMethod.getName();
String formattedName = Formatter.toCamelCase(name);
if (isReservedKeyword(formattedName)) {
return formattedName + '_';
}
return formattedName;
}
|
class class_name[name] begin[{]
method[getMethodName, return_type[type[String]], modifier[public static], parameter[serviceMethod]] begin[{]
local_variable[type[String], name]
local_variable[type[String], formattedName]
if[call[.isReservedKeyword, parameter[member[.formattedName]]]] begin[{]
return[binary_operation[member[.formattedName], +, literal['_']]]
else begin[{]
None
end[}]
return[member[.formattedName]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getMethodName] operator[SEP] identifier[ServiceMethod] identifier[serviceMethod] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[serviceMethod] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[formattedName] operator[=] identifier[Formatter] operator[SEP] identifier[toCamelCase] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isReservedKeyword] operator[SEP] identifier[formattedName] operator[SEP] operator[SEP] {
Keyword[return] identifier[formattedName] operator[+] literal[String] operator[SEP]
}
Keyword[return] identifier[formattedName] operator[SEP]
}
|
@Override
public void serialize(final DataOutput pOutput) throws TTIOException {
try {
pOutput.writeInt(IConstants.INDIRCTBUCKET);
pOutput.writeLong(mBucketKey);
for (long key : mReferenceKeys) {
pOutput.writeLong(key);
}
for (byte[] hash : mReferenceHashs) {
pOutput.writeInt(hash.length);
pOutput.write(hash);
}
} catch (final IOException exc) {
throw new TTIOException(exc);
}
}
|
class class_name[name] begin[{]
method[serialize, return_type[void], modifier[public], parameter[pOutput]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=INDIRCTBUCKET, postfix_operators=[], prefix_operators=[], qualifier=IConstants, selectors=[])], member=writeInt, postfix_operators=[], prefix_operators=[], qualifier=pOutput, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mBucketKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeLong, postfix_operators=[], prefix_operators=[], qualifier=pOutput, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeLong, postfix_operators=[], prefix_operators=[], qualifier=pOutput, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=mReferenceKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=BasicType(dimensions=[], name=long))), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=hash, selectors=[])], member=writeInt, postfix_operators=[], prefix_operators=[], qualifier=pOutput, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=pOutput, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=mReferenceHashs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=hash)], modifiers=set(), type=BasicType(dimensions=[None], name=byte))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=exc, 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=TTIOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exc, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[serialize] operator[SEP] Keyword[final] identifier[DataOutput] identifier[pOutput] operator[SEP] Keyword[throws] identifier[TTIOException] {
Keyword[try] {
identifier[pOutput] operator[SEP] identifier[writeInt] operator[SEP] identifier[IConstants] operator[SEP] identifier[INDIRCTBUCKET] operator[SEP] operator[SEP] identifier[pOutput] operator[SEP] identifier[writeLong] operator[SEP] identifier[mBucketKey] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[long] identifier[key] operator[:] identifier[mReferenceKeys] operator[SEP] {
identifier[pOutput] operator[SEP] identifier[writeLong] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[hash] operator[:] identifier[mReferenceHashs] operator[SEP] {
identifier[pOutput] operator[SEP] identifier[writeInt] operator[SEP] identifier[hash] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[pOutput] operator[SEP] identifier[write] operator[SEP] identifier[hash] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[exc] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TTIOException] operator[SEP] identifier[exc] operator[SEP] operator[SEP]
}
}
|
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
// Needs to be set per user as the model holds the current page index and total row per user.
ExampleScrollableModel model = new ExampleScrollableModel(table,
new String[]{"firstName", "lastName",
"dateOfBirth"}, "more");
model.setIterateFirstLevel(true);
table.setTableModel(model);
setInitialised(true);
}
}
|
class class_name[name] begin[{]
method[preparePaintComponent, return_type[void], modifier[protected], parameter[request]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=preparePaintComponent, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
if[call[.isInitialised, parameter[]]] begin[{]
local_variable[type[ExampleScrollableModel], model]
call[model.setIterateFirstLevel, parameter[literal[true]]]
call[table.setTableModel, parameter[member[.model]]]
call[.setInitialised, parameter[literal[true]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[preparePaintComponent] operator[SEP] Keyword[final] identifier[Request] identifier[request] operator[SEP] {
Keyword[super] operator[SEP] identifier[preparePaintComponent] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isInitialised] operator[SEP] operator[SEP] operator[SEP] {
identifier[ExampleScrollableModel] identifier[model] operator[=] Keyword[new] identifier[ExampleScrollableModel] operator[SEP] identifier[table] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
literal[String] , literal[String] , literal[String]
} , literal[String] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setIterateFirstLevel] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[setTableModel] operator[SEP] identifier[model] operator[SEP] operator[SEP] identifier[setInitialised] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
|
@Override
public String toBinaryString() {
String result;
if(hasNoStringCache() || (result = getStringCache().binaryString) == null) {
IPStringCache stringCache = getStringCache();
stringCache.binaryString = result = toBinaryString(null);
}
return result;
}
|
class class_name[name] begin[{]
method[toBinaryString, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[String], result]
if[binary_operation[call[.hasNoStringCache, parameter[]], ||, binary_operation[assign[member[.result], call[.getStringCache, parameter[]]], ==, literal[null]]]] begin[{]
local_variable[type[IPStringCache], stringCache]
assign[member[stringCache.binaryString], assign[member[.result], call[.toBinaryString, parameter[literal[null]]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[toBinaryString] operator[SEP] operator[SEP] {
identifier[String] identifier[result] operator[SEP] Keyword[if] operator[SEP] identifier[hasNoStringCache] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[result] operator[=] identifier[getStringCache] operator[SEP] operator[SEP] operator[SEP] identifier[binaryString] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[IPStringCache] identifier[stringCache] operator[=] identifier[getStringCache] operator[SEP] operator[SEP] operator[SEP] identifier[stringCache] operator[SEP] identifier[binaryString] operator[=] identifier[result] operator[=] identifier[toBinaryString] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static int[] getOrder(int[] values, int[] indices, boolean descending) {
// Create an index series:
Integer[] opIndices = ArrayUtils.toObject(indices);
// Sort indices:
Arrays.sort(opIndices, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
if (descending) {
return Double.compare(values[o2], values[o1]);
} else {
return Double.compare(values[o1], values[o2]);
}
}
});
return ArrayUtils.toPrimitive(opIndices);
}
|
class class_name[name] begin[{]
method[getOrder, return_type[type[int]], modifier[public static], parameter[values, indices, descending]] begin[{]
local_variable[type[Integer], opIndices]
call[Arrays.sort, parameter[member[.opIndices], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MemberReference(member=descending, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=compare, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=compare, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers=set(), name=o1, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=o2, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=None, name=Comparator, sub_type=None))]]
return[call[ArrayUtils.toPrimitive, parameter[member[.opIndices]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] operator[SEP] operator[SEP] identifier[getOrder] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[values] , Keyword[int] operator[SEP] operator[SEP] identifier[indices] , Keyword[boolean] identifier[descending] operator[SEP] {
identifier[Integer] operator[SEP] operator[SEP] identifier[opIndices] operator[=] identifier[ArrayUtils] operator[SEP] identifier[toObject] operator[SEP] identifier[indices] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[opIndices] , Keyword[new] identifier[Comparator] operator[<] identifier[Integer] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[Integer] identifier[o1] , identifier[Integer] identifier[o2] operator[SEP] {
Keyword[if] operator[SEP] identifier[descending] operator[SEP] {
Keyword[return] identifier[Double] operator[SEP] identifier[compare] operator[SEP] identifier[values] operator[SEP] identifier[o2] operator[SEP] , identifier[values] operator[SEP] identifier[o1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Double] operator[SEP] identifier[compare] operator[SEP] identifier[values] operator[SEP] identifier[o1] operator[SEP] , identifier[values] operator[SEP] identifier[o2] operator[SEP] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP] Keyword[return] identifier[ArrayUtils] operator[SEP] identifier[toPrimitive] operator[SEP] identifier[opIndices] operator[SEP] operator[SEP]
}
|
@Override
public void doReportStat(SofaTracerSpan sofaTracerSpan) {
//tags
Map<String, String> tagsWithStr = sofaTracerSpan.getTagsWithStr();
StatMapKey statKey = new StatMapKey();
String fromApp = getFromApp(tagsWithStr);
String toApp = getToApp(tagsWithStr);
String zone = getZone(tagsWithStr);
//service name
String serviceName = tagsWithStr.get(RpcSpanTags.SERVICE);
//method name
String methodName = tagsWithStr.get(RpcSpanTags.METHOD);
statKey.setKey(buildString(new String[] { fromApp, toApp, serviceName, methodName }));
String resultCode = tagsWithStr.get(RpcSpanTags.RESULT_CODE);
statKey.setResult(isSuccess(resultCode) ? "Y" : "N");
statKey.setEnd(buildString(new String[] { getLoadTestMark(sofaTracerSpan), zone }));
statKey.setLoadTest(TracerUtils.isLoadTest(sofaTracerSpan));
statKey.addKey(RpcSpanTags.LOCAL_APP, tagsWithStr.get(RpcSpanTags.LOCAL_APP));
statKey.addKey(RpcSpanTags.REMOTE_APP, tagsWithStr.get(RpcSpanTags.REMOTE_APP));
statKey.addKey(RpcSpanTags.SERVICE, serviceName);
statKey.addKey(RpcSpanTags.METHOD, methodName);
//次数和耗时,最后一个耗时是单独打印的字段
long duration = sofaTracerSpan.getEndTime() - sofaTracerSpan.getStartTime();
long[] values = new long[] { 1, duration };
this.addStat(statKey, values);
}
|
class class_name[name] begin[{]
method[doReportStat, return_type[void], modifier[public], parameter[sofaTracerSpan]] begin[{]
local_variable[type[Map], tagsWithStr]
local_variable[type[StatMapKey], statKey]
local_variable[type[String], fromApp]
local_variable[type[String], toApp]
local_variable[type[String], zone]
local_variable[type[String], serviceName]
local_variable[type[String], methodName]
call[statKey.setKey, parameter[call[.buildString, parameter[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=fromApp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=toApp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=serviceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]]]
local_variable[type[String], resultCode]
call[statKey.setResult, parameter[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=resultCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isSuccess, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="N"), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Y"))]]
call[statKey.setEnd, parameter[call[.buildString, parameter[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=sofaTracerSpan, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLoadTestMark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=zone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]]]
call[statKey.setLoadTest, parameter[call[TracerUtils.isLoadTest, parameter[member[.sofaTracerSpan]]]]]
call[statKey.addKey, parameter[member[RpcSpanTags.LOCAL_APP], call[tagsWithStr.get, parameter[member[RpcSpanTags.LOCAL_APP]]]]]
call[statKey.addKey, parameter[member[RpcSpanTags.REMOTE_APP], call[tagsWithStr.get, parameter[member[RpcSpanTags.REMOTE_APP]]]]]
call[statKey.addKey, parameter[member[RpcSpanTags.SERVICE], member[.serviceName]]]
call[statKey.addKey, parameter[member[RpcSpanTags.METHOD], member[.methodName]]]
local_variable[type[long], duration]
local_variable[type[long], values]
THIS[call[None.addStat, parameter[member[.statKey], member[.values]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[doReportStat] operator[SEP] identifier[SofaTracerSpan] identifier[sofaTracerSpan] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[tagsWithStr] operator[=] identifier[sofaTracerSpan] operator[SEP] identifier[getTagsWithStr] operator[SEP] operator[SEP] operator[SEP] identifier[StatMapKey] identifier[statKey] operator[=] Keyword[new] identifier[StatMapKey] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[fromApp] operator[=] identifier[getFromApp] operator[SEP] identifier[tagsWithStr] operator[SEP] operator[SEP] identifier[String] identifier[toApp] operator[=] identifier[getToApp] operator[SEP] identifier[tagsWithStr] operator[SEP] operator[SEP] identifier[String] identifier[zone] operator[=] identifier[getZone] operator[SEP] identifier[tagsWithStr] operator[SEP] operator[SEP] identifier[String] identifier[serviceName] operator[=] identifier[tagsWithStr] operator[SEP] identifier[get] operator[SEP] identifier[RpcSpanTags] operator[SEP] identifier[SERVICE] operator[SEP] operator[SEP] identifier[String] identifier[methodName] operator[=] identifier[tagsWithStr] operator[SEP] identifier[get] operator[SEP] identifier[RpcSpanTags] operator[SEP] identifier[METHOD] operator[SEP] operator[SEP] identifier[statKey] operator[SEP] identifier[setKey] operator[SEP] identifier[buildString] operator[SEP] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[fromApp] , identifier[toApp] , identifier[serviceName] , identifier[methodName]
} operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[resultCode] operator[=] identifier[tagsWithStr] operator[SEP] identifier[get] operator[SEP] identifier[RpcSpanTags] operator[SEP] identifier[RESULT_CODE] operator[SEP] operator[SEP] identifier[statKey] operator[SEP] identifier[setResult] operator[SEP] identifier[isSuccess] operator[SEP] identifier[resultCode] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[SEP] identifier[statKey] operator[SEP] identifier[setEnd] operator[SEP] identifier[buildString] operator[SEP] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[getLoadTestMark] operator[SEP] identifier[sofaTracerSpan] operator[SEP] , identifier[zone]
} operator[SEP] operator[SEP] operator[SEP] identifier[statKey] operator[SEP] identifier[setLoadTest] operator[SEP] identifier[TracerUtils] operator[SEP] identifier[isLoadTest] operator[SEP] identifier[sofaTracerSpan] operator[SEP] operator[SEP] operator[SEP] identifier[statKey] operator[SEP] identifier[addKey] operator[SEP] identifier[RpcSpanTags] operator[SEP] identifier[LOCAL_APP] , identifier[tagsWithStr] operator[SEP] identifier[get] operator[SEP] identifier[RpcSpanTags] operator[SEP] identifier[LOCAL_APP] operator[SEP] operator[SEP] operator[SEP] identifier[statKey] operator[SEP] identifier[addKey] operator[SEP] identifier[RpcSpanTags] operator[SEP] identifier[REMOTE_APP] , identifier[tagsWithStr] operator[SEP] identifier[get] operator[SEP] identifier[RpcSpanTags] operator[SEP] identifier[REMOTE_APP] operator[SEP] operator[SEP] operator[SEP] identifier[statKey] operator[SEP] identifier[addKey] operator[SEP] identifier[RpcSpanTags] operator[SEP] identifier[SERVICE] , identifier[serviceName] operator[SEP] operator[SEP] identifier[statKey] operator[SEP] identifier[addKey] operator[SEP] identifier[RpcSpanTags] operator[SEP] identifier[METHOD] , identifier[methodName] operator[SEP] operator[SEP] Keyword[long] identifier[duration] operator[=] identifier[sofaTracerSpan] operator[SEP] identifier[getEndTime] operator[SEP] operator[SEP] operator[-] identifier[sofaTracerSpan] operator[SEP] identifier[getStartTime] operator[SEP] operator[SEP] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[values] operator[=] Keyword[new] Keyword[long] operator[SEP] operator[SEP] {
Other[1] , identifier[duration]
} operator[SEP] Keyword[this] operator[SEP] identifier[addStat] operator[SEP] identifier[statKey] , identifier[values] operator[SEP] operator[SEP]
}
|
public static AuthInfo plain(String username, String password) {
return new AuthInfo(new PlainCallbackHandler(username, password), new String[] {"PLAIN"});
}
|
class class_name[name] begin[{]
method[plain, return_type[type[AuthInfo]], modifier[public static], parameter[username, password]] begin[{]
return[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=username, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PlainCallbackHandler, sub_type=None)), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PLAIN")]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AuthInfo, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[AuthInfo] identifier[plain] operator[SEP] identifier[String] identifier[username] , identifier[String] identifier[password] operator[SEP] {
Keyword[return] Keyword[new] identifier[AuthInfo] operator[SEP] Keyword[new] identifier[PlainCallbackHandler] operator[SEP] identifier[username] , identifier[password] operator[SEP] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
literal[String]
} operator[SEP] operator[SEP]
}
|
public static MozuUrl getConfigurationUrl(String carrierId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/carriers/{carrierId}?responseFields={responseFields}");
formatter.formatUrl("carrierId", carrierId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
}
|
class class_name[name] begin[{]
method[getConfigurationUrl, return_type[type[MozuUrl]], modifier[public static], parameter[carrierId, responseFields]] begin[{]
local_variable[type[UrlFormatter], formatter]
call[formatter.formatUrl, parameter[literal["carrierId"], member[.carrierId]]]
call[formatter.formatUrl, parameter[literal["responseFields"], member[.responseFields]]]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getResourceUrl, postfix_operators=[], prefix_operators=[], qualifier=formatter, selectors=[], type_arguments=None), MemberReference(member=TENANT_POD, postfix_operators=[], prefix_operators=[], qualifier=MozuUrl.UrlLocation, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MozuUrl, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[MozuUrl] identifier[getConfigurationUrl] operator[SEP] identifier[String] identifier[carrierId] , identifier[String] identifier[responseFields] operator[SEP] {
identifier[UrlFormatter] identifier[formatter] operator[=] Keyword[new] identifier[UrlFormatter] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[formatUrl] operator[SEP] literal[String] , identifier[carrierId] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[formatUrl] operator[SEP] literal[String] , identifier[responseFields] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[MozuUrl] operator[SEP] identifier[formatter] operator[SEP] identifier[getResourceUrl] operator[SEP] operator[SEP] , identifier[MozuUrl] operator[SEP] identifier[UrlLocation] operator[SEP] identifier[TENANT_POD] operator[SEP] operator[SEP]
}
|
public void addDirtyRegion (Rectangle rect)
{
// make sure we're on an AWT thread
if (!EventQueue.isDispatchThread()) {
log.warning("Oi! Region dirtied on non-AWT thread", "rect", rect, new Exception());
}
// sanity check
if (rect == null) {
log.warning("Attempt to dirty a null rect!?", new Exception());
return;
}
// more sanity checking
long x = rect.x, y = rect.y;
if ((Math.abs(x) > Integer.MAX_VALUE/2) || (Math.abs(y) > Integer.MAX_VALUE/2)) {
log.warning("Requested to dirty questionable region", "rect", rect, new Exception());
return; // Let's not do it!
}
if (isValidSize(rect.width, rect.height)) {
// Log.info("Invalidating " + StringUtil.toString(rect));
_dirty.add(rect);
}
}
|
class class_name[name] begin[{]
method[addDirtyRegion, return_type[void], modifier[public], parameter[rect]] begin[{]
if[call[EventQueue.isDispatchThread, parameter[]]] begin[{]
call[log.warning, parameter[literal["Oi! Region dirtied on non-AWT thread"], literal["rect"], member[.rect], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[member[.rect], ==, literal[null]]] begin[{]
call[log.warning, parameter[literal["Attempt to dirty a null rect!?"], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None))]]
return[None]
else begin[{]
None
end[}]
local_variable[type[long], x]
if[binary_operation[binary_operation[call[Math.abs, parameter[member[.x]]], >, binary_operation[member[Integer.MAX_VALUE], /, literal[2]]], ||, binary_operation[call[Math.abs, parameter[member[.y]]], >, binary_operation[member[Integer.MAX_VALUE], /, literal[2]]]]] begin[{]
call[log.warning, parameter[literal["Requested to dirty questionable region"], literal["rect"], member[.rect], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None))]]
return[None]
else begin[{]
None
end[}]
if[call[.isValidSize, parameter[member[rect.width], member[rect.height]]]] begin[{]
call[_dirty.add, parameter[member[.rect]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addDirtyRegion] operator[SEP] identifier[Rectangle] identifier[rect] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[EventQueue] operator[SEP] identifier[isDispatchThread] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[warning] operator[SEP] literal[String] , literal[String] , identifier[rect] , Keyword[new] identifier[Exception] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[rect] operator[==] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[warning] operator[SEP] literal[String] , Keyword[new] identifier[Exception] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[long] identifier[x] operator[=] identifier[rect] operator[SEP] identifier[x] , identifier[y] operator[=] identifier[rect] operator[SEP] identifier[y] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[x] operator[SEP] operator[>] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[/] Other[2] operator[SEP] operator[||] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[y] operator[SEP] operator[>] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[/] Other[2] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[warning] operator[SEP] literal[String] , literal[String] , identifier[rect] , Keyword[new] identifier[Exception] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isValidSize] operator[SEP] identifier[rect] operator[SEP] identifier[width] , identifier[rect] operator[SEP] identifier[height] operator[SEP] operator[SEP] {
identifier[_dirty] operator[SEP] identifier[add] operator[SEP] identifier[rect] operator[SEP] operator[SEP]
}
}
|
public static File addFileExtension(File file, String extension) {
return new File(file.getAbsolutePath() + "." + extension);
}
|
class class_name[name] begin[{]
method[addFileExtension, return_type[type[File]], modifier[public static], parameter[file, extension]] begin[{]
return[ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=extension, 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=File, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[File] identifier[addFileExtension] operator[SEP] identifier[File] identifier[file] , identifier[String] identifier[extension] operator[SEP] {
Keyword[return] Keyword[new] identifier[File] operator[SEP] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[extension] operator[SEP] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.w3.org/2001/XMLSchema", name = "group")
public JAXBElement<NamedGroup> createGroup(NamedGroup value) {
return new JAXBElement<NamedGroup>(_Group_QNAME, NamedGroup.class, null, value);
}
|
class class_name[name] begin[{]
method[createGroup, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_Group_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NamedGroup, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NamedGroup, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[NamedGroup] operator[>] identifier[createGroup] operator[SEP] identifier[NamedGroup] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[NamedGroup] operator[>] operator[SEP] identifier[_Group_QNAME] , identifier[NamedGroup] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
private void insertImage() {
String initialDir = System.getProperty("user.dir");
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Insert image");
fileChooser.setInitialDirectory(new File(initialDir));
File selectedFile = fileChooser.showOpenDialog(mainStage);
if (selectedFile != null) {
String imagePath = selectedFile.getAbsolutePath();
imagePath = imagePath.replace('\\', '/');
ReadOnlyStyledDocument<ParStyle, Either<String, LinkedImage>, TextStyle> ros =
ReadOnlyStyledDocument.fromSegment(Either.right(new RealLinkedImage(imagePath)),
ParStyle.EMPTY, TextStyle.EMPTY, area.getSegOps());
area.replaceSelection(ros);
}
}
|
class class_name[name] begin[{]
method[insertImage, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[String], initialDir]
local_variable[type[FileChooser], fileChooser]
call[fileChooser.setTitle, parameter[literal["Insert image"]]]
call[fileChooser.setInitialDirectory, parameter[ClassCreator(arguments=[MemberReference(member=initialDir, 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))]]
local_variable[type[File], selectedFile]
if[binary_operation[member[.selectedFile], !=, literal[null]]] begin[{]
local_variable[type[String], imagePath]
assign[member[.imagePath], call[imagePath.replace, parameter[literal['\\'], literal['/']]]]
local_variable[type[ReadOnlyStyledDocument], ros]
call[area.replaceSelection, parameter[member[.ros]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[insertImage] operator[SEP] operator[SEP] {
identifier[String] identifier[initialDir] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[FileChooser] identifier[fileChooser] operator[=] Keyword[new] identifier[FileChooser] operator[SEP] operator[SEP] operator[SEP] identifier[fileChooser] operator[SEP] identifier[setTitle] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[fileChooser] operator[SEP] identifier[setInitialDirectory] operator[SEP] Keyword[new] identifier[File] operator[SEP] identifier[initialDir] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[selectedFile] operator[=] identifier[fileChooser] operator[SEP] identifier[showOpenDialog] operator[SEP] identifier[mainStage] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[selectedFile] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[imagePath] operator[=] identifier[selectedFile] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] identifier[imagePath] operator[=] identifier[imagePath] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[ReadOnlyStyledDocument] operator[<] identifier[ParStyle] , identifier[Either] operator[<] identifier[String] , identifier[LinkedImage] operator[>] , identifier[TextStyle] operator[>] identifier[ros] operator[=] identifier[ReadOnlyStyledDocument] operator[SEP] identifier[fromSegment] operator[SEP] identifier[Either] operator[SEP] identifier[right] operator[SEP] Keyword[new] identifier[RealLinkedImage] operator[SEP] identifier[imagePath] operator[SEP] operator[SEP] , identifier[ParStyle] operator[SEP] identifier[EMPTY] , identifier[TextStyle] operator[SEP] identifier[EMPTY] , identifier[area] operator[SEP] identifier[getSegOps] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[area] operator[SEP] identifier[replaceSelection] operator[SEP] identifier[ros] operator[SEP] operator[SEP]
}
}
|
@CheckReturnValue
@BackpressureSupport(BackpressureKind.ERROR)
@SchedulerSupport(SchedulerSupport.COMPUTATION)
public static Flowable<Long> interval(long period, TimeUnit unit) {
return interval(period, period, unit, Schedulers.computation());
}
|
class class_name[name] begin[{]
method[interval, return_type[type[Flowable]], modifier[public static], parameter[period, unit]] begin[{]
return[call[.interval, parameter[member[.period], member[.period], member[.unit], call[Schedulers.computation, parameter[]]]]]
end[}]
END[}]
|
annotation[@] identifier[CheckReturnValue] annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[ERROR] operator[SEP] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[COMPUTATION] operator[SEP] Keyword[public] Keyword[static] identifier[Flowable] operator[<] identifier[Long] operator[>] identifier[interval] operator[SEP] Keyword[long] identifier[period] , identifier[TimeUnit] identifier[unit] operator[SEP] {
Keyword[return] identifier[interval] operator[SEP] identifier[period] , identifier[period] , identifier[unit] , identifier[Schedulers] operator[SEP] identifier[computation] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private static boolean isRunnable(FilterTargetData targetData, List<FilterDefinition> filters) {
if (filters == null || filters.isEmpty()) {
return true;
}
for (FilterDefinition filterDefinition : filters) {
String type = filterDefinition.getType();
String text = filterDefinition.getText();
if (type == null || type.isEmpty()) {
type = "*";
}
// We must evaluate all the filters and return only when there is a valid match
if (
(type.equalsIgnoreCase("*") && targetData.anyMatch(text)) || // Any filter
("key".equalsIgnoreCase(type) && targetData.keyMatch(text)) || // Key filter
("fp".equalsIgnoreCase(type) && targetData.fingerpringMatch(text)) || // Fingerprint filter
("name".equalsIgnoreCase(type) && targetData.nameMatch(text)) || // Name filter
("tag".equalsIgnoreCase(type) && targetData.tagMatch(text)) || // Tag filter
("ticket".equalsIgnoreCase(type) && targetData.ticketMatch(text)) // Ticket filter
) {
return true;
}
}
return false;
}
|
class class_name[name] begin[{]
method[isRunnable, return_type[type[boolean]], modifier[private static], parameter[targetData, filters]] begin[{]
if[binary_operation[binary_operation[member[.filters], ==, literal[null]], ||, call[filters.isEmpty, parameter[]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=filterDefinition, selectors=[], type_arguments=None), name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getText, postfix_operators=[], prefix_operators=[], qualifier=filterDefinition, selectors=[], type_arguments=None), name=text)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="*")), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="*")], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=anyMatch, postfix_operators=[], prefix_operators=[], qualifier=targetData, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="key"), operandr=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=keyMatch, postfix_operators=[], prefix_operators=[], qualifier=targetData, selectors=[], type_arguments=None), operator=&&), operator=||), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="fp"), operandr=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fingerpringMatch, postfix_operators=[], prefix_operators=[], qualifier=targetData, selectors=[], type_arguments=None), operator=&&), operator=||), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="name"), operandr=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nameMatch, postfix_operators=[], prefix_operators=[], qualifier=targetData, selectors=[], type_arguments=None), operator=&&), operator=||), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="tag"), operandr=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=tagMatch, postfix_operators=[], prefix_operators=[], qualifier=targetData, selectors=[], type_arguments=None), operator=&&), operator=||), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="ticket"), operandr=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ticketMatch, postfix_operators=[], prefix_operators=[], qualifier=targetData, selectors=[], type_arguments=None), operator=&&), 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)]))]), control=EnhancedForControl(iterable=MemberReference(member=filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=filterDefinition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FilterDefinition, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[isRunnable] operator[SEP] identifier[FilterTargetData] identifier[targetData] , identifier[List] operator[<] identifier[FilterDefinition] operator[>] identifier[filters] operator[SEP] {
Keyword[if] operator[SEP] identifier[filters] operator[==] Other[null] operator[||] identifier[filters] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] identifier[FilterDefinition] identifier[filterDefinition] operator[:] identifier[filters] operator[SEP] {
identifier[String] identifier[type] operator[=] identifier[filterDefinition] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[text] operator[=] identifier[filterDefinition] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[||] identifier[type] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[type] operator[=] literal[String] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[type] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[targetData] operator[SEP] identifier[anyMatch] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[||] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[type] operator[SEP] operator[&&] identifier[targetData] operator[SEP] identifier[keyMatch] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[||] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[type] operator[SEP] operator[&&] identifier[targetData] operator[SEP] identifier[fingerpringMatch] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[||] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[type] operator[SEP] operator[&&] identifier[targetData] operator[SEP] identifier[nameMatch] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[||] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[type] operator[SEP] operator[&&] identifier[targetData] operator[SEP] identifier[tagMatch] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[||] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[type] operator[SEP] operator[&&] identifier[targetData] operator[SEP] identifier[ticketMatch] operator[SEP] identifier[text] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public EClass getECP() {
if (ecpEClass == null) {
ecpEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(237);
}
return ecpEClass;
}
|
class class_name[name] begin[{]
method[getECP, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ecpEClass], ==, literal[null]]] begin[{]
assign[member[.ecpEClass], 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=237)], 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[.ecpEClass]]
end[}]
END[}]
|
Keyword[public] identifier[EClass] identifier[getECP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ecpEClass] operator[==] Other[null] operator[SEP] {
identifier[ecpEClass] 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[237] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ecpEClass] operator[SEP]
}
|
public synchronized Collection<TaskTrackerStatus> taskTrackers() {
Collection<TaskTrackerStatus> ttStatuses;
synchronized (taskTrackers) {
ttStatuses =
new ArrayList<TaskTrackerStatus>(taskTrackers.values().size());
for (TaskTracker tt : taskTrackers.values()) {
ttStatuses.add(tt.getStatus());
}
}
return ttStatuses;
}
|
class class_name[name] begin[{]
method[taskTrackers, return_type[type[Collection]], modifier[synchronized public], parameter[]] begin[{]
local_variable[type[Collection], ttStatuses]
SYNCHRONIZED[member[.taskTrackers]] BEGIN[{]
assign[member[.ttStatuses], ClassCreator(arguments=[MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=taskTrackers, selectors=[MethodInvocation(arguments=[], member=size, 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=TaskTrackerStatus, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStatus, postfix_operators=[], prefix_operators=[], qualifier=tt, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=ttStatuses, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=taskTrackers, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TaskTracker, sub_type=None))), label=None)
END[}]
return[member[.ttStatuses]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] identifier[Collection] operator[<] identifier[TaskTrackerStatus] operator[>] identifier[taskTrackers] operator[SEP] operator[SEP] {
identifier[Collection] operator[<] identifier[TaskTrackerStatus] operator[>] identifier[ttStatuses] operator[SEP] Keyword[synchronized] operator[SEP] identifier[taskTrackers] operator[SEP] {
identifier[ttStatuses] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[TaskTrackerStatus] operator[>] operator[SEP] identifier[taskTrackers] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TaskTracker] identifier[tt] operator[:] identifier[taskTrackers] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[ttStatuses] operator[SEP] identifier[add] operator[SEP] identifier[tt] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[ttStatuses] operator[SEP]
}
|
public static <T> boolean any(Optional<? extends T>... optionals) {
return Iterables.any(Arrays.asList(optionals), isPresent());
}
|
class class_name[name] begin[{]
method[any, return_type[type[boolean]], modifier[public static], parameter[optionals]] begin[{]
return[call[Iterables.any, parameter[call[Arrays.asList, parameter[member[.optionals]]], call[.isPresent, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[boolean] identifier[any] operator[SEP] identifier[Optional] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] operator[...] identifier[optionals] operator[SEP] {
Keyword[return] identifier[Iterables] operator[SEP] identifier[any] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[optionals] operator[SEP] , identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void flush()
{
try {
// Flush index writer
indexWriter.flush();
// Write out metrics mutations
BatchWriter metricsWriter = connector.createBatchWriter(table.getMetricsTableName(), writerConfig);
metricsWriter.addMutations(getMetricsMutations());
metricsWriter.close();
// Re-initialize the metrics
metrics.clear();
metrics.put(METRICS_TABLE_ROW_COUNT, new AtomicLong(0));
}
catch (MutationsRejectedException e) {
throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Index mutation was rejected by server on flush", e);
}
catch (TableNotFoundException e) {
throw new PrestoException(ACCUMULO_TABLE_DNE, "Accumulo table does not exist", e);
}
}
|
class class_name[name] begin[{]
method[flush, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=indexWriter, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMetricsTableName, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), MemberReference(member=writerConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createBatchWriter, postfix_operators=[], prefix_operators=[], qualifier=connector, selectors=[], type_arguments=None), name=metricsWriter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BatchWriter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMetricsMutations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addMutations, postfix_operators=[], prefix_operators=[], qualifier=metricsWriter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=metricsWriter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=metrics, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=METRICS_TABLE_ROW_COUNT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AtomicLong, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=metrics, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=UNEXPECTED_ACCUMULO_ERROR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Index mutation was rejected by server on flush"), 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=PrestoException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MutationsRejectedException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ACCUMULO_TABLE_DNE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Accumulo table does not exist"), 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=PrestoException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TableNotFoundException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[flush] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[indexWriter] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[BatchWriter] identifier[metricsWriter] operator[=] identifier[connector] operator[SEP] identifier[createBatchWriter] operator[SEP] identifier[table] operator[SEP] identifier[getMetricsTableName] operator[SEP] operator[SEP] , identifier[writerConfig] operator[SEP] operator[SEP] identifier[metricsWriter] operator[SEP] identifier[addMutations] operator[SEP] identifier[getMetricsMutations] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[metricsWriter] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[metrics] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[metrics] operator[SEP] identifier[put] operator[SEP] identifier[METRICS_TABLE_ROW_COUNT] , Keyword[new] identifier[AtomicLong] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MutationsRejectedException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PrestoException] operator[SEP] identifier[UNEXPECTED_ACCUMULO_ERROR] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TableNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PrestoException] operator[SEP] identifier[ACCUMULO_TABLE_DNE] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static InvalidStateException invalidState(String msg, Object... args) {
throw new InvalidStateException(S.fmt(msg, args));
}
|
class class_name[name] begin[{]
method[invalidState, return_type[type[InvalidStateException]], modifier[public static], parameter[msg, args]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fmt, postfix_operators=[], prefix_operators=[], qualifier=S, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidStateException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[InvalidStateException] identifier[invalidState] operator[SEP] identifier[String] identifier[msg] , identifier[Object] operator[...] identifier[args] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidStateException] operator[SEP] identifier[S] operator[SEP] identifier[fmt] operator[SEP] identifier[msg] , identifier[args] operator[SEP] operator[SEP] operator[SEP]
}
|
public String encrypt(String toEncrypt) {
byte[] encryptedBytes = encryptInternal(dataEncryptionSecretKeySpec, toEncrypt);
return new String(base64Encoder.encode(encryptedBytes));
}
|
class class_name[name] begin[{]
method[encrypt, return_type[type[String]], modifier[public], parameter[toEncrypt]] begin[{]
local_variable[type[byte], encryptedBytes]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=encryptedBytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode, postfix_operators=[], prefix_operators=[], qualifier=base64Encoder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[encrypt] operator[SEP] identifier[String] identifier[toEncrypt] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[encryptedBytes] operator[=] identifier[encryptInternal] operator[SEP] identifier[dataEncryptionSecretKeySpec] , identifier[toEncrypt] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[base64Encoder] operator[SEP] identifier[encode] operator[SEP] identifier[encryptedBytes] operator[SEP] operator[SEP] operator[SEP]
}
|
public static CodepageDetectorProxy getInstance() {
if (CodepageDetectorProxy.instance == null) {
CodepageDetectorProxy.instance = new CodepageDetectorProxy();
}
return CodepageDetectorProxy.instance;
}
|
class class_name[name] begin[{]
method[getInstance, return_type[type[CodepageDetectorProxy]], modifier[public static], parameter[]] begin[{]
if[binary_operation[member[CodepageDetectorProxy.instance], ==, literal[null]]] begin[{]
assign[member[CodepageDetectorProxy.instance], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CodepageDetectorProxy, sub_type=None))]
else begin[{]
None
end[}]
return[member[CodepageDetectorProxy.instance]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CodepageDetectorProxy] identifier[getInstance] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[CodepageDetectorProxy] operator[SEP] identifier[instance] operator[==] Other[null] operator[SEP] {
identifier[CodepageDetectorProxy] operator[SEP] identifier[instance] operator[=] Keyword[new] identifier[CodepageDetectorProxy] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[CodepageDetectorProxy] operator[SEP] identifier[instance] operator[SEP]
}
|
public boolean isValidLocalTld(String lTld) {
lTld = unicodeToASCII(lTld);
return Arrays.binarySearch(LOCAL_TLDS, chompLeadingDot(lTld.toLowerCase(Locale.ENGLISH))) >= 0;
}
|
class class_name[name] begin[{]
method[isValidLocalTld, return_type[type[boolean]], modifier[public], parameter[lTld]] begin[{]
assign[member[.lTld], call[.unicodeToASCII, parameter[member[.lTld]]]]
return[binary_operation[call[Arrays.binarySearch, parameter[member[.LOCAL_TLDS], call[.chompLeadingDot, parameter[call[lTld.toLowerCase, parameter[member[Locale.ENGLISH]]]]]]], >=, literal[0]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isValidLocalTld] operator[SEP] identifier[String] identifier[lTld] operator[SEP] {
identifier[lTld] operator[=] identifier[unicodeToASCII] operator[SEP] identifier[lTld] operator[SEP] operator[SEP] Keyword[return] identifier[Arrays] operator[SEP] identifier[binarySearch] operator[SEP] identifier[LOCAL_TLDS] , identifier[chompLeadingDot] operator[SEP] identifier[lTld] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[Locale] operator[SEP] identifier[ENGLISH] operator[SEP] operator[SEP] operator[SEP] operator[>=] Other[0] operator[SEP]
}
|
@Override
public Object invoke(Exchange exchange, Object o)
{
BindingOperationInfo bop = exchange.getBindingOperationInfo();
MethodDispatcher md = (MethodDispatcher) exchange.getService().get(MethodDispatcher.class.getName());
List<Object> params = null;
if (o instanceof List) {
params = CastUtils.cast((List<?>) o);
} else if (o != null) {
params = new MessageContentsList(o);
}
final Object tb = (factory == null) ? targetBean : this.getServiceObject(exchange);
final Method method = (bop == null) ? null : md.getMethod(bop);
if (method == null)
{
throw Messages.MESSAGES.missingBindingOpeartionAndDispatchedMethod();
}
//performance optimization, adjustMethodAndParams currently looks for @UseAsyncMethod (which is expensive) and only performs actions if it's found
final Method fm = checkForUseAsyncMethod ? adjustMethodAndParams(md.getMethod(bop), exchange, params, tb.getClass()) : method;
return invoke(exchange, tb, fm, params);
}
|
class class_name[name] begin[{]
method[invoke, return_type[type[Object]], modifier[public], parameter[exchange, o]] begin[{]
local_variable[type[BindingOperationInfo], bop]
local_variable[type[MethodDispatcher], md]
local_variable[type[List], params]
if[binary_operation[member[.o], instanceof, type[List]]] begin[{]
assign[member[.params], call[CastUtils.cast, parameter[Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=List, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.o], !=, literal[null]]] begin[{]
assign[member[.params], ClassCreator(arguments=[MemberReference(member=o, 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=MessageContentsList, sub_type=None))]
else begin[{]
None
end[}]
end[}]
local_variable[type[Object], tb]
local_variable[type[Method], method]
if[binary_operation[member[.method], ==, literal[null]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[], member=missingBindingOpeartionAndDispatchedMethod, postfix_operators=[], prefix_operators=[], qualifier=Messages.MESSAGES, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
local_variable[type[Method], fm]
return[call[.invoke, parameter[member[.exchange], member[.tb], member[.fm], member[.params]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[invoke] operator[SEP] identifier[Exchange] identifier[exchange] , identifier[Object] identifier[o] operator[SEP] {
identifier[BindingOperationInfo] identifier[bop] operator[=] identifier[exchange] operator[SEP] identifier[getBindingOperationInfo] operator[SEP] operator[SEP] operator[SEP] identifier[MethodDispatcher] identifier[md] operator[=] operator[SEP] identifier[MethodDispatcher] operator[SEP] identifier[exchange] operator[SEP] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[MethodDispatcher] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] identifier[params] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[List] operator[SEP] {
identifier[params] operator[=] identifier[CastUtils] operator[SEP] identifier[cast] operator[SEP] operator[SEP] identifier[List] operator[<] operator[?] operator[>] operator[SEP] identifier[o] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[o] operator[!=] Other[null] operator[SEP] {
identifier[params] operator[=] Keyword[new] identifier[MessageContentsList] operator[SEP] identifier[o] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Object] identifier[tb] operator[=] operator[SEP] identifier[factory] operator[==] Other[null] operator[SEP] operator[?] identifier[targetBean] operator[:] Keyword[this] operator[SEP] identifier[getServiceObject] operator[SEP] identifier[exchange] operator[SEP] operator[SEP] Keyword[final] identifier[Method] identifier[method] operator[=] operator[SEP] identifier[bop] operator[==] Other[null] operator[SEP] operator[?] Other[null] operator[:] identifier[md] operator[SEP] identifier[getMethod] operator[SEP] identifier[bop] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[method] operator[==] Other[null] operator[SEP] {
Keyword[throw] identifier[Messages] operator[SEP] identifier[MESSAGES] operator[SEP] identifier[missingBindingOpeartionAndDispatchedMethod] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Method] identifier[fm] operator[=] identifier[checkForUseAsyncMethod] operator[?] identifier[adjustMethodAndParams] operator[SEP] identifier[md] operator[SEP] identifier[getMethod] operator[SEP] identifier[bop] operator[SEP] , identifier[exchange] , identifier[params] , identifier[tb] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[method] operator[SEP] Keyword[return] identifier[invoke] operator[SEP] identifier[exchange] , identifier[tb] , identifier[fm] , identifier[params] operator[SEP] operator[SEP]
}
|
public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) {
int updatedStartIndex = input.loadIndeces(rowIndexEntries, startIndex);
int numIndeces = rowIndexEntries.size();
indeces = new int[numIndeces + 1];
int i = 0;
for (RowIndexEntry rowIndexEntry : rowIndexEntries) {
indeces[i] = (int) rowIndexEntry.getPositions(updatedStartIndex);
i++;
}
return updatedStartIndex + 1;
}
|
class class_name[name] begin[{]
method[loadIndeces, return_type[type[int]], modifier[public], parameter[rowIndexEntries, startIndex]] begin[{]
local_variable[type[int], updatedStartIndex]
local_variable[type[int], numIndeces]
assign[member[.indeces], ArrayCreator(dimensions=[BinaryOperation(operandl=MemberReference(member=numIndeces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=indeces, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=updatedStartIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPositions, postfix_operators=[], prefix_operators=[], qualifier=rowIndexEntry, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))), label=None), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rowIndexEntries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=rowIndexEntry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RowIndexEntry, sub_type=None))), label=None)
return[binary_operation[member[.updatedStartIndex], +, literal[1]]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[loadIndeces] operator[SEP] identifier[List] operator[<] identifier[RowIndexEntry] operator[>] identifier[rowIndexEntries] , Keyword[int] identifier[startIndex] operator[SEP] {
Keyword[int] identifier[updatedStartIndex] operator[=] identifier[input] operator[SEP] identifier[loadIndeces] operator[SEP] identifier[rowIndexEntries] , identifier[startIndex] operator[SEP] operator[SEP] Keyword[int] identifier[numIndeces] operator[=] identifier[rowIndexEntries] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[indeces] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[numIndeces] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[RowIndexEntry] identifier[rowIndexEntry] operator[:] identifier[rowIndexEntries] operator[SEP] {
identifier[indeces] operator[SEP] identifier[i] operator[SEP] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[rowIndexEntry] operator[SEP] identifier[getPositions] operator[SEP] identifier[updatedStartIndex] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP]
}
Keyword[return] identifier[updatedStartIndex] operator[+] Other[1] operator[SEP]
}
|
public String get(final String aMessage, final Object... aDetailsArray) {
final String[] details = new String[aDetailsArray.length];
for (int index = 0; index < details.length; index++) {
details[index] = aDetailsArray[index].toString();
}
LOGGER.debug(MessageCodes.UTIL_026, aMessage, details);
return StringUtils.format(super.getString(aMessage), details);
}
|
class class_name[name] begin[{]
method[get, return_type[type[String]], modifier[public], parameter[aMessage, aDetailsArray]] begin[{]
local_variable[type[String], details]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=details, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=aDetailsArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=details, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=index, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[LOGGER.debug, parameter[member[MessageCodes.UTIL_026], member[.aMessage], member[.details]]]
return[call[StringUtils.format, parameter[SuperMethodInvocation(arguments=[MemberReference(member=aMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), member[.details]]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[get] operator[SEP] Keyword[final] identifier[String] identifier[aMessage] , Keyword[final] identifier[Object] operator[...] identifier[aDetailsArray] operator[SEP] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[details] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[aDetailsArray] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] identifier[index] operator[<] identifier[details] operator[SEP] identifier[length] operator[SEP] identifier[index] operator[++] operator[SEP] {
identifier[details] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[aDetailsArray] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] identifier[MessageCodes] operator[SEP] identifier[UTIL_026] , identifier[aMessage] , identifier[details] operator[SEP] operator[SEP] Keyword[return] identifier[StringUtils] operator[SEP] identifier[format] operator[SEP] Keyword[super] operator[SEP] identifier[getString] operator[SEP] identifier[aMessage] operator[SEP] , identifier[details] operator[SEP] operator[SEP]
}
|
public static PipelineObjects queryFullPipeline(String rootJobHandle) {
Key rootJobKey = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, rootJobHandle);
return backEnd.queryFullPipeline(rootJobKey);
}
|
class class_name[name] begin[{]
method[queryFullPipeline, return_type[type[PipelineObjects]], modifier[public static], parameter[rootJobHandle]] begin[{]
local_variable[type[Key], rootJobKey]
return[call[backEnd.queryFullPipeline, parameter[member[.rootJobKey]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[PipelineObjects] identifier[queryFullPipeline] operator[SEP] identifier[String] identifier[rootJobHandle] operator[SEP] {
identifier[Key] identifier[rootJobKey] operator[=] identifier[KeyFactory] operator[SEP] identifier[createKey] operator[SEP] identifier[JobRecord] operator[SEP] identifier[DATA_STORE_KIND] , identifier[rootJobHandle] operator[SEP] operator[SEP] Keyword[return] identifier[backEnd] operator[SEP] identifier[queryFullPipeline] operator[SEP] identifier[rootJobKey] operator[SEP] operator[SEP]
}
|
protected void gatherComponentInfo (ComponentRepository crepo)
{
// get the list of all component classes
Iterators.addAll(_classes, crepo.enumerateComponentClasses());
for (int ii = 0; ii < _classes.size(); ii++) {
// get the list of components available for this class
ComponentClass cclass = _classes.get(ii);
Iterator<Integer> iter = crepo.enumerateComponentIds(cclass);
while (iter.hasNext()) {
Integer cid = iter.next();
ArrayList<Integer> clist = _components.get(cclass);
if (clist == null) {
_components.put(cclass, clist = Lists.newArrayList());
}
clist.add(cid);
}
}
}
|
class class_name[name] begin[{]
method[gatherComponentInfo, return_type[void], modifier[protected], parameter[crepo]] begin[{]
call[Iterators.addAll, parameter[member[._classes], call[crepo.enumerateComponentClasses, parameter[]]]]
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=_classes, selectors=[], type_arguments=None), name=cclass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ComponentClass, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=cclass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=enumerateComponentIds, postfix_operators=[], prefix_operators=[], qualifier=crepo, selectors=[], type_arguments=None), name=iter)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), name=cid)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=cclass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=_components, selectors=[], type_arguments=None), name=clist)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=[], name=ArrayList, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=clist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cclass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Assignment(expressionl=MemberReference(member=clist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=newArrayList, postfix_operators=[], prefix_operators=[], qualifier=Lists, selectors=[], type_arguments=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=_components, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=clist, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iter, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=_classes, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=ii)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ii, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[gatherComponentInfo] operator[SEP] identifier[ComponentRepository] identifier[crepo] operator[SEP] {
identifier[Iterators] operator[SEP] identifier[addAll] operator[SEP] identifier[_classes] , identifier[crepo] operator[SEP] identifier[enumerateComponentClasses] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ii] operator[=] Other[0] operator[SEP] identifier[ii] operator[<] identifier[_classes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[ii] operator[++] operator[SEP] {
identifier[ComponentClass] identifier[cclass] operator[=] identifier[_classes] operator[SEP] identifier[get] operator[SEP] identifier[ii] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[Integer] operator[>] identifier[iter] operator[=] identifier[crepo] operator[SEP] identifier[enumerateComponentIds] operator[SEP] identifier[cclass] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Integer] identifier[cid] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[ArrayList] operator[<] identifier[Integer] operator[>] identifier[clist] operator[=] identifier[_components] operator[SEP] identifier[get] operator[SEP] identifier[cclass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[clist] operator[==] Other[null] operator[SEP] {
identifier[_components] operator[SEP] identifier[put] operator[SEP] identifier[cclass] , identifier[clist] operator[=] identifier[Lists] operator[SEP] identifier[newArrayList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[clist] operator[SEP] identifier[add] operator[SEP] identifier[cid] operator[SEP] operator[SEP]
}
}
}
|
public Period withYears(int years) {
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.YEAR_INDEX, values, years);
return new Period(values, getPeriodType());
}
|
class class_name[name] begin[{]
method[withYears, return_type[type[Period]], modifier[public], parameter[years]] begin[{]
local_variable[type[int], values]
call[.getPeriodType, parameter[]]
return[ClassCreator(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getPeriodType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Period, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[Period] identifier[withYears] operator[SEP] Keyword[int] identifier[years] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[values] operator[=] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] identifier[getPeriodType] operator[SEP] operator[SEP] operator[SEP] identifier[setIndexedField] operator[SEP] Keyword[this] , identifier[PeriodType] operator[SEP] identifier[YEAR_INDEX] , identifier[values] , identifier[years] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Period] operator[SEP] identifier[values] , identifier[getPeriodType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
static void rollback(final String patchId, final Collection<ContentModification> originalPatch, final Collection<ContentModification> rollbackPatch,
final ContentTaskDefinitions modifications, final ContentItemFilter filter,
final PatchingTaskContext.Mode mode) {
// Process the original patch information
final Map<Location, ContentModification> originalModifications = new HashMap<Location, ContentModification>(originalPatch.size());
for (final ContentModification modification : originalPatch) {
originalModifications.put(new Location(modification.getItem()), modification);
}
// Process the rollback information
for (final ContentModification modification : rollbackPatch) {
final ContentItem item = modification.getItem();
// Skip module items when rolling back
if (!filter.accepts(item)) {
continue;
}
final Location location = new Location(item);
final ContentModification original = originalModifications.remove(location);
final ContentEntry contentEntry = new ContentEntry(patchId, modification);
ContentTaskDefinition definition = modifications.get(location);
if (definition == null) {
definition = new ContentTaskDefinition(location, contentEntry, true);
modifications.put(location, definition);
} else {
// TODO perhaps we don't need check that
boolean strict = true; // Strict history checks
if (strict) {
// Check if the consistency of the history
final ContentEntry previous = definition.getTarget();
final byte[] hash = previous.getItem().getContentHash();
if (!Arrays.equals(hash, contentEntry.getTargetHash())) {
throw new IllegalStateException();
}
}
//
definition.setTarget(contentEntry);
}
if (original == null
|| mode == PatchingTaskContext.Mode.ROLLBACK) {
continue;
}
// Check if the current content was the original item (preserve)
final byte[] currentContent = modification.getTargetHash();
final byte[] originalContent = original.getItem().getContentHash();
// TODO relax requirements for conflict resolution on rollback!
if (!Arrays.equals(currentContent, originalContent)) {
definition.addConflict(contentEntry);
} else {
// Check if backup item was the targeted one (override)
final byte[] backupItem = item.getContentHash();
final byte[] originalTarget = original.getTargetHash();
//
if (!Arrays.equals(backupItem, originalTarget)) {
definition.addConflict(contentEntry);
}
}
}
}
|
class class_name[name] begin[{]
method[rollback, return_type[void], modifier[static], parameter[patchId, originalPatch, rollbackPatch, modifications, filter, mode]] begin[{]
local_variable[type[Map], originalModifications]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getItem, postfix_operators=[], prefix_operators=[], qualifier=modification, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Location, sub_type=None)), MemberReference(member=modification, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=originalModifications, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=originalPatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=modification)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ContentModification, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getItem, postfix_operators=[], prefix_operators=[], qualifier=modification, selectors=[], type_arguments=None), name=item)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ContentItem, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=item, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accepts, postfix_operators=[], prefix_operators=['!'], qualifier=filter, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=item, 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=Location, sub_type=None)), name=location)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Location, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=originalModifications, selectors=[], type_arguments=None), name=original)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ContentModification, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=patchId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=modification, 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=ContentEntry, sub_type=None)), name=contentEntry)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ContentEntry, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=modifications, selectors=[], type_arguments=None), name=definition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ContentTaskDefinition, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=definition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=strict)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MemberReference(member=strict, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTarget, postfix_operators=[], prefix_operators=[], qualifier=definition, selectors=[], type_arguments=None), name=previous)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ContentEntry, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getItem, postfix_operators=[], prefix_operators=[], qualifier=previous, selectors=[MethodInvocation(arguments=[], member=getContentHash, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=hash)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getTargetHash, postfix_operators=[], prefix_operators=[], qualifier=contentEntry, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=Arrays, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[], 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)]))])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contentEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTarget, postfix_operators=[], prefix_operators=[], qualifier=definition, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=definition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=contentEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ContentTaskDefinition, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=definition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=modifications, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=original, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MemberReference(member=mode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ROLLBACK, postfix_operators=[], prefix_operators=[], qualifier=PatchingTaskContext.Mode, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTargetHash, postfix_operators=[], prefix_operators=[], qualifier=modification, selectors=[], type_arguments=None), name=currentContent)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getItem, postfix_operators=[], prefix_operators=[], qualifier=original, selectors=[MethodInvocation(arguments=[], member=getContentHash, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=originalContent)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=currentContent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=originalContent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=Arrays, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getContentHash, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=backupItem)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTargetHash, postfix_operators=[], prefix_operators=[], qualifier=original, selectors=[], type_arguments=None), name=originalTarget)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=backupItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=originalTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=Arrays, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contentEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addConflict, postfix_operators=[], prefix_operators=[], qualifier=definition, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contentEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addConflict, postfix_operators=[], prefix_operators=[], qualifier=definition, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=rollbackPatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=modification)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ContentModification, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[static] Keyword[void] identifier[rollback] operator[SEP] Keyword[final] identifier[String] identifier[patchId] , Keyword[final] identifier[Collection] operator[<] identifier[ContentModification] operator[>] identifier[originalPatch] , Keyword[final] identifier[Collection] operator[<] identifier[ContentModification] operator[>] identifier[rollbackPatch] , Keyword[final] identifier[ContentTaskDefinitions] identifier[modifications] , Keyword[final] identifier[ContentItemFilter] identifier[filter] , Keyword[final] identifier[PatchingTaskContext] operator[SEP] identifier[Mode] identifier[mode] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[Location] , identifier[ContentModification] operator[>] identifier[originalModifications] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[Location] , identifier[ContentModification] operator[>] operator[SEP] identifier[originalPatch] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[ContentModification] identifier[modification] operator[:] identifier[originalPatch] operator[SEP] {
identifier[originalModifications] operator[SEP] identifier[put] operator[SEP] Keyword[new] identifier[Location] operator[SEP] identifier[modification] operator[SEP] identifier[getItem] operator[SEP] operator[SEP] operator[SEP] , identifier[modification] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[final] identifier[ContentModification] identifier[modification] operator[:] identifier[rollbackPatch] operator[SEP] {
Keyword[final] identifier[ContentItem] identifier[item] operator[=] identifier[modification] operator[SEP] identifier[getItem] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[filter] operator[SEP] identifier[accepts] operator[SEP] identifier[item] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[final] identifier[Location] identifier[location] operator[=] Keyword[new] identifier[Location] operator[SEP] identifier[item] operator[SEP] operator[SEP] Keyword[final] identifier[ContentModification] identifier[original] operator[=] identifier[originalModifications] operator[SEP] identifier[remove] operator[SEP] identifier[location] operator[SEP] operator[SEP] Keyword[final] identifier[ContentEntry] identifier[contentEntry] operator[=] Keyword[new] identifier[ContentEntry] operator[SEP] identifier[patchId] , identifier[modification] operator[SEP] operator[SEP] identifier[ContentTaskDefinition] identifier[definition] operator[=] identifier[modifications] operator[SEP] identifier[get] operator[SEP] identifier[location] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[definition] operator[==] Other[null] operator[SEP] {
identifier[definition] operator[=] Keyword[new] identifier[ContentTaskDefinition] operator[SEP] identifier[location] , identifier[contentEntry] , literal[boolean] operator[SEP] operator[SEP] identifier[modifications] operator[SEP] identifier[put] operator[SEP] identifier[location] , identifier[definition] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[boolean] identifier[strict] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[strict] operator[SEP] {
Keyword[final] identifier[ContentEntry] identifier[previous] operator[=] identifier[definition] operator[SEP] identifier[getTarget] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[hash] operator[=] identifier[previous] operator[SEP] identifier[getItem] operator[SEP] operator[SEP] operator[SEP] identifier[getContentHash] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Arrays] operator[SEP] identifier[equals] operator[SEP] identifier[hash] , identifier[contentEntry] operator[SEP] identifier[getTargetHash] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[definition] operator[SEP] identifier[setTarget] operator[SEP] identifier[contentEntry] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[original] operator[==] Other[null] operator[||] identifier[mode] operator[==] identifier[PatchingTaskContext] operator[SEP] identifier[Mode] operator[SEP] identifier[ROLLBACK] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[currentContent] operator[=] identifier[modification] operator[SEP] identifier[getTargetHash] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[originalContent] operator[=] identifier[original] operator[SEP] identifier[getItem] operator[SEP] operator[SEP] operator[SEP] identifier[getContentHash] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Arrays] operator[SEP] identifier[equals] operator[SEP] identifier[currentContent] , identifier[originalContent] operator[SEP] operator[SEP] {
identifier[definition] operator[SEP] identifier[addConflict] operator[SEP] identifier[contentEntry] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[backupItem] operator[=] identifier[item] operator[SEP] identifier[getContentHash] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[originalTarget] operator[=] identifier[original] operator[SEP] identifier[getTargetHash] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Arrays] operator[SEP] identifier[equals] operator[SEP] identifier[backupItem] , identifier[originalTarget] operator[SEP] operator[SEP] {
identifier[definition] operator[SEP] identifier[addConflict] operator[SEP] identifier[contentEntry] operator[SEP] operator[SEP]
}
}
}
}
|
private UpdateResult insert(V item, Node node) {
UpdateResult result;
if (node == null) {
// This is the right location for the item, but there's no node. Create one.
result = new UpdateResult();
result.node = new Node(item);
this.size++;
this.modCount++;
} else {
long itemKey = item.key();
long nodeKey = node.item.key();
if (itemKey < nodeKey) {
// New item is smaller than the current node's item; move to the left child.
result = insert(item, node.left);
node.left = result.node;
} else if (itemKey > nodeKey) {
// New item is larger than the current node's item; move to the right child.
result = insert(item, node.right);
node.right = result.node;
} else {
// Node already exists. Save the existing node's item and return it.
result = new UpdateResult();
result.updatedItem = node.item;
node.item = item;
}
// Rebalance the sub-tree, if necessary.
result.node = balance(node);
}
return result;
}
|
class class_name[name] begin[{]
method[insert, return_type[type[UpdateResult]], modifier[private], parameter[item, node]] begin[{]
local_variable[type[UpdateResult], result]
if[binary_operation[member[.node], ==, literal[null]]] begin[{]
assign[member[.result], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UpdateResult, sub_type=None))]
assign[member[result.node], ClassCreator(arguments=[MemberReference(member=item, 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=Node, sub_type=None))]
THIS[member[None.size]]
THIS[member[None.modCount]]
else begin[{]
local_variable[type[long], itemKey]
local_variable[type[long], nodeKey]
if[binary_operation[member[.itemKey], <, member[.nodeKey]]] begin[{]
assign[member[.result], call[.insert, parameter[member[.item], member[node.left]]]]
assign[member[node.left], member[result.node]]
else begin[{]
if[binary_operation[member[.itemKey], >, member[.nodeKey]]] begin[{]
assign[member[.result], call[.insert, parameter[member[.item], member[node.right]]]]
assign[member[node.right], member[result.node]]
else begin[{]
assign[member[.result], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UpdateResult, sub_type=None))]
assign[member[result.updatedItem], member[node.item]]
assign[member[node.item], member[.item]]
end[}]
end[}]
assign[member[result.node], call[.balance, parameter[member[.node]]]]
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[private] identifier[UpdateResult] identifier[insert] operator[SEP] identifier[V] identifier[item] , identifier[Node] identifier[node] operator[SEP] {
identifier[UpdateResult] identifier[result] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[==] Other[null] operator[SEP] {
identifier[result] operator[=] Keyword[new] identifier[UpdateResult] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[node] operator[=] Keyword[new] identifier[Node] operator[SEP] identifier[item] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[size] operator[++] operator[SEP] Keyword[this] operator[SEP] identifier[modCount] operator[++] operator[SEP]
}
Keyword[else] {
Keyword[long] identifier[itemKey] operator[=] identifier[item] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[nodeKey] operator[=] identifier[node] operator[SEP] identifier[item] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[itemKey] operator[<] identifier[nodeKey] operator[SEP] {
identifier[result] operator[=] identifier[insert] operator[SEP] identifier[item] , identifier[node] operator[SEP] identifier[left] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[left] operator[=] identifier[result] operator[SEP] identifier[node] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[itemKey] operator[>] identifier[nodeKey] operator[SEP] {
identifier[result] operator[=] identifier[insert] operator[SEP] identifier[item] , identifier[node] operator[SEP] identifier[right] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[right] operator[=] identifier[result] operator[SEP] identifier[node] operator[SEP]
}
Keyword[else] {
identifier[result] operator[=] Keyword[new] identifier[UpdateResult] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[updatedItem] operator[=] identifier[node] operator[SEP] identifier[item] operator[SEP] identifier[node] operator[SEP] identifier[item] operator[=] identifier[item] operator[SEP]
}
identifier[result] operator[SEP] identifier[node] operator[=] identifier[balance] operator[SEP] identifier[node] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public final void setGuaranteedRemoteGetStartTick(long value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setGuaranteedRemoteGetStartTick", Long.valueOf(value));
getHdr2().setLongField(JsHdr2Access.GUARANTEEDREMOTEGET_SET_STARTTICK, value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setGuaranteedRemoteGetStartTick");
}
|
class class_name[name] begin[{]
method[setGuaranteedRemoteGetStartTick, return_type[void], modifier[final public], parameter[value]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["setGuaranteedRemoteGetStartTick"], call[Long.valueOf, parameter[member[.value]]]]]
else begin[{]
None
end[}]
call[.getHdr2, parameter[]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["setGuaranteedRemoteGetStartTick"]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[setGuaranteedRemoteGetStartTick] operator[SEP] Keyword[long] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[Long] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[getHdr2] operator[SEP] operator[SEP] operator[SEP] identifier[setLongField] operator[SEP] identifier[JsHdr2Access] operator[SEP] identifier[GUARANTEEDREMOTEGET_SET_STARTTICK] , identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public static int compare(byte[] b1, byte[] b2, int offset, int to) {
int j = offset;
int b2Length = to - offset;
if(to > b2.length)
throw new IllegalArgumentException("To offset (" + to + ") should be <= than length ("
+ b2.length + ")");
for(int i = 0; i < b1.length && j < to; i++, j++) {
int a = (b1[i] & 0xff);
int b = (b2[j] & 0xff);
if(a != b) {
return (a - b) / (Math.abs(a - b));
}
}
return (b1.length - b2Length) / (Math.max(1, Math.abs(b1.length - b2Length)));
}
|
class class_name[name] begin[{]
method[compare, return_type[type[int]], modifier[public static], parameter[b1, b2, offset, to]] begin[{]
local_variable[type[int], j]
local_variable[type[int], b2Length]
if[binary_operation[member[.to], >, member[b2.length]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="To offset ("), operandr=MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") should be <= than length ("), operator=+), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=b2, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=b1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), name=a)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=b2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), name=b)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=abs, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), operator=/), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=b1, selectors=[]), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), 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=[]), MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[binary_operation[binary_operation[member[b1.length], -, member[.b2Length]], /, call[Math.max, parameter[literal[1], call[Math.abs, parameter[binary_operation[member[b1.length], -, member[.b2Length]]]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[compare] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[b1] , Keyword[byte] operator[SEP] operator[SEP] identifier[b2] , Keyword[int] identifier[offset] , Keyword[int] identifier[to] operator[SEP] {
Keyword[int] identifier[j] operator[=] identifier[offset] operator[SEP] Keyword[int] identifier[b2Length] operator[=] identifier[to] operator[-] identifier[offset] operator[SEP] Keyword[if] operator[SEP] identifier[to] operator[>] identifier[b2] operator[SEP] identifier[length] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[to] operator[+] literal[String] operator[+] identifier[b2] operator[SEP] identifier[length] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[b1] operator[SEP] identifier[length] operator[&&] identifier[j] operator[<] identifier[to] operator[SEP] identifier[i] operator[++] , identifier[j] operator[++] operator[SEP] {
Keyword[int] identifier[a] operator[=] operator[SEP] identifier[b1] operator[SEP] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] Keyword[int] identifier[b] operator[=] operator[SEP] identifier[b2] operator[SEP] identifier[j] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[a] operator[!=] identifier[b] operator[SEP] {
Keyword[return] operator[SEP] identifier[a] operator[-] identifier[b] operator[SEP] operator[/] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[a] operator[-] identifier[b] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] operator[SEP] identifier[b1] operator[SEP] identifier[length] operator[-] identifier[b2Length] operator[SEP] operator[/] operator[SEP] identifier[Math] operator[SEP] identifier[max] operator[SEP] Other[1] , identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[b1] operator[SEP] identifier[length] operator[-] identifier[b2Length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private void setParentForChildCommand(final List<ConfigCommand> commandList, final int i,
final ConfigCommand child) {
int matchIndex = -1;
ConfigRange matchRange = null;
for (int j = 0; j < commandList.size(); j++) {
if (j != i) {
Command commandParent = commandList.get(j);
if (!commandParent.getCommandTypeName().equalsIgnoreCase(TieConstants.COMMAND_FORM)
&& WebSheetUtility.insideRange(child.getConfigRange(), commandParent.getConfigRange())
&& ((matchRange == null)
|| (WebSheetUtility.insideRange(commandParent.getConfigRange(), matchRange)))) {
matchRange = commandParent.getConfigRange();
matchIndex = j;
}
}
}
if (matchIndex >= 0) {
commandList.get(matchIndex).getConfigRange().addCommand(child);
child.setParentFound(true);
}
}
|
class class_name[name] begin[{]
method[setParentForChildCommand, return_type[void], modifier[private], parameter[commandList, i, child]] begin[{]
local_variable[type[int], matchIndex]
local_variable[type[ConfigRange], matchRange]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=commandList, selectors=[], type_arguments=None), name=commandParent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Command, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCommandTypeName, postfix_operators=[], prefix_operators=['!'], qualifier=commandParent, selectors=[MethodInvocation(arguments=[MemberReference(member=COMMAND_FORM, postfix_operators=[], prefix_operators=[], qualifier=TieConstants, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getConfigRange, postfix_operators=[], prefix_operators=[], qualifier=child, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getConfigRange, postfix_operators=[], prefix_operators=[], qualifier=commandParent, selectors=[], type_arguments=None)], member=insideRange, postfix_operators=[], prefix_operators=[], qualifier=WebSheetUtility, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=matchRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getConfigRange, postfix_operators=[], prefix_operators=[], qualifier=commandParent, selectors=[], type_arguments=None), MemberReference(member=matchRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=insideRange, postfix_operators=[], prefix_operators=[], qualifier=WebSheetUtility, selectors=[], type_arguments=None), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=matchRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getConfigRange, postfix_operators=[], prefix_operators=[], qualifier=commandParent, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=matchIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=commandList, selectors=[], type_arguments=None), 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)
if[binary_operation[member[.matchIndex], >=, literal[0]]] begin[{]
call[commandList.get, parameter[member[.matchIndex]]]
call[child.setParentFound, parameter[literal[true]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[setParentForChildCommand] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[ConfigCommand] operator[>] identifier[commandList] , Keyword[final] Keyword[int] identifier[i] , Keyword[final] identifier[ConfigCommand] identifier[child] operator[SEP] {
Keyword[int] identifier[matchIndex] operator[=] operator[-] Other[1] operator[SEP] identifier[ConfigRange] identifier[matchRange] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[commandList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[j] operator[!=] identifier[i] operator[SEP] {
identifier[Command] identifier[commandParent] operator[=] identifier[commandList] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[commandParent] operator[SEP] identifier[getCommandTypeName] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[TieConstants] operator[SEP] identifier[COMMAND_FORM] operator[SEP] operator[&&] identifier[WebSheetUtility] operator[SEP] identifier[insideRange] operator[SEP] identifier[child] operator[SEP] identifier[getConfigRange] operator[SEP] operator[SEP] , identifier[commandParent] operator[SEP] identifier[getConfigRange] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[SEP] operator[SEP] identifier[matchRange] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[WebSheetUtility] operator[SEP] identifier[insideRange] operator[SEP] identifier[commandParent] operator[SEP] identifier[getConfigRange] operator[SEP] operator[SEP] , identifier[matchRange] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[matchRange] operator[=] identifier[commandParent] operator[SEP] identifier[getConfigRange] operator[SEP] operator[SEP] operator[SEP] identifier[matchIndex] operator[=] identifier[j] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[matchIndex] operator[>=] Other[0] operator[SEP] {
identifier[commandList] operator[SEP] identifier[get] operator[SEP] identifier[matchIndex] operator[SEP] operator[SEP] identifier[getConfigRange] operator[SEP] operator[SEP] operator[SEP] identifier[addCommand] operator[SEP] identifier[child] operator[SEP] operator[SEP] identifier[child] operator[SEP] identifier[setParentFound] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
|
protected void addSubNavEntry(final NavEntry navEntry) {
Button button = m_rootLayout.addSubNavEntry(navEntry);
button.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
openSubView(navEntry.getTargetState(), true);
}
});
}
|
class class_name[name] begin[{]
method[addSubNavEntry, return_type[void], modifier[protected], parameter[navEntry]] begin[{]
local_variable[type[Button], button]
call[button.addClickListener, parameter[ClassCreator(arguments=[], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1L), name=serialVersionUID)], documentation=None, modifiers={'final', 'private', 'static'}, type=BasicType(dimensions=[], name=long)), MethodDeclaration(annotations=[], body=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTargetState, postfix_operators=[], prefix_operators=[], qualifier=navEntry, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=openSubView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=buttonClick, parameters=[FormalParameter(annotations=[], modifiers=set(), name=event, type=ReferenceType(arguments=None, dimensions=[], name=ClickEvent, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClickListener, sub_type=None))]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[addSubNavEntry] operator[SEP] Keyword[final] identifier[NavEntry] identifier[navEntry] operator[SEP] {
identifier[Button] identifier[button] operator[=] identifier[m_rootLayout] operator[SEP] identifier[addSubNavEntry] operator[SEP] identifier[navEntry] operator[SEP] operator[SEP] identifier[button] operator[SEP] identifier[addClickListener] operator[SEP] Keyword[new] identifier[ClickListener] operator[SEP] operator[SEP] {
Keyword[private] Keyword[static] Keyword[final] Keyword[long] identifier[serialVersionUID] operator[=] Other[1L] operator[SEP] Keyword[public] Keyword[void] identifier[buttonClick] operator[SEP] identifier[ClickEvent] identifier[event] operator[SEP] {
identifier[openSubView] operator[SEP] identifier[navEntry] operator[SEP] identifier[getTargetState] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@ObjectiveCName("sendContactWithPeer:withName:withPhones:withEmails:withPhoto:")
public void sendContact(@NotNull Peer peer, @NotNull String name, @NotNull ArrayList<String> phones,
@NotNull ArrayList<String> emails, @Nullable String base64photo) {
modules.getMessagesModule().sendContact(peer, name, phones, emails, base64photo);
}
|
class class_name[name] begin[{]
method[sendContact, return_type[void], modifier[public], parameter[peer, name, phones, emails, base64photo]] begin[{]
call[modules.getMessagesModule, parameter[]]
end[}]
END[}]
|
annotation[@] identifier[ObjectiveCName] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[sendContact] operator[SEP] annotation[@] identifier[NotNull] identifier[Peer] identifier[peer] , annotation[@] identifier[NotNull] identifier[String] identifier[name] , annotation[@] identifier[NotNull] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[phones] , annotation[@] identifier[NotNull] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[emails] , annotation[@] identifier[Nullable] identifier[String] identifier[base64photo] operator[SEP] {
identifier[modules] operator[SEP] identifier[getMessagesModule] operator[SEP] operator[SEP] operator[SEP] identifier[sendContact] operator[SEP] identifier[peer] , identifier[name] , identifier[phones] , identifier[emails] , identifier[base64photo] operator[SEP] operator[SEP]
}
|
public String convertFromValuesAsObjectMap(Map<String, Object> properties, String... includeDomainKeys) throws ParsePropertiesException {
Map<String, Object> filteredProperties = new HashMap<>();
for (String key : properties.keySet()) {
for (String requiredKey : includeDomainKeys) {
checkKey(properties, filteredProperties, key, requiredKey);
}
}
return convertFromValuesAsObjectMap(filteredProperties);
}
|
class class_name[name] begin[{]
method[convertFromValuesAsObjectMap, return_type[type[String]], modifier[public], parameter[properties, includeDomainKeys]] begin[{]
local_variable[type[Map], filteredProperties]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=filteredProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requiredKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=includeDomainKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=requiredKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[call[.convertFromValuesAsObjectMap, parameter[member[.filteredProperties]]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[convertFromValuesAsObjectMap] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] , identifier[String] operator[...] identifier[includeDomainKeys] operator[SEP] Keyword[throws] identifier[ParsePropertiesException] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[filteredProperties] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[properties] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[requiredKey] operator[:] identifier[includeDomainKeys] operator[SEP] {
identifier[checkKey] operator[SEP] identifier[properties] , identifier[filteredProperties] , identifier[key] , identifier[requiredKey] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[convertFromValuesAsObjectMap] operator[SEP] identifier[filteredProperties] operator[SEP] operator[SEP]
}
|
public static <T> Iterator<T> next(final Iterator<? extends T> iterator, final int count) {
return new ImmutableIterator<T>() {
private int position = 0;
@Override
public boolean hasNext() {
return iterator.hasNext() && position < count;
}
@Override
public T next() {
T next = iterator.next();
position++;
return next;
}
};
}
|
class class_name[name] begin[{]
method[next, return_type[type[Iterator]], modifier[public static], parameter[iterator, count]] begin[{]
return[ClassCreator(arguments=[], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=position)], documentation=None, modifiers={'private'}, type=BasicType(dimensions=[], name=int)), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operator=&&), label=None)], documentation=None, modifiers={'public'}, name=hasNext, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), name=next)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), StatementExpression(expression=MemberReference(member=position, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), ReturnStatement(expression=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=next, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=ImmutableIterator, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Iterator] operator[<] identifier[T] operator[>] identifier[next] operator[SEP] Keyword[final] identifier[Iterator] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] identifier[iterator] , Keyword[final] Keyword[int] identifier[count] operator[SEP] {
Keyword[return] Keyword[new] identifier[ImmutableIterator] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] {
Keyword[private] Keyword[int] identifier[position] operator[=] Other[0] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[return] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[&&] identifier[position] operator[<] identifier[count] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[T] identifier[next] operator[SEP] operator[SEP] {
identifier[T] identifier[next] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[position] operator[++] operator[SEP] Keyword[return] identifier[next] operator[SEP]
}
} operator[SEP]
}
|
public static int countsForBigram(String text, String pattern) {
int count = 0;
int index = -1;
while (true) {
index = text.indexOf(pattern, index + 1);
if (index > -1) {
LOG.debug("模式: " + pattern + " 出现在文本中的位置:" + index);
count++;
} else {
break;
}
}
return count;
}
|
class class_name[name] begin[{]
method[countsForBigram, return_type[type[int]], modifier[public static], parameter[text, pattern]] begin[{]
local_variable[type[int], count]
local_variable[type[int], index]
while[literal[true]] begin[{]
assign[member[.index], call[text.indexOf, parameter[member[.pattern], binary_operation[member[.index], +, literal[1]]]]]
if[binary_operation[member[.index], >, literal[1]]] begin[{]
call[LOG.debug, parameter[binary_operation[binary_operation[binary_operation[literal["模式: "], +, member[.pattern]], +, literal[" 出现在文本中的位置:"]], +, member[.index]]]]
member[.count]
else begin[{]
BreakStatement(goto=None, label=None)
end[}]
end[}]
return[member[.count]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[countsForBigram] operator[SEP] identifier[String] identifier[text] , identifier[String] identifier[pattern] operator[SEP] {
Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[int] identifier[index] operator[=] operator[-] Other[1] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[index] operator[=] identifier[text] operator[SEP] identifier[indexOf] operator[SEP] identifier[pattern] , identifier[index] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[>] operator[-] Other[1] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[pattern] operator[+] literal[String] operator[+] identifier[index] operator[SEP] operator[SEP] identifier[count] operator[++] operator[SEP]
}
Keyword[else] {
Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[count] operator[SEP]
}
|
public static double[] CalculateAcadExtrusion(double[] coord_in, double[] xtru) {
double[] coord_out;
double dxt0 = 0D, dyt0 = 0D, dzt0 = 0D;
double dvx1, dvx2, dvx3;
double dvy1, dvy2, dvy3;
double dmod, dxt, dyt, dzt;
double aux = 1D/64D;
double aux1 = Math.abs(xtru[0]);
double aux2 = Math.abs(xtru[1]);
dxt0 = coord_in[0];
dyt0 = coord_in[1];
dzt0 = coord_in[2];
double xtruX, xtruY, xtruZ;
xtruX = xtru[0];
xtruY = xtru[1];
xtruZ = xtru[2];
if ((aux1 < aux) && (aux2 < aux)) {
dmod = Math.sqrt(xtruZ*xtruZ + xtruX*xtruX);
dvx1 = xtruZ / dmod;
dvx2 = 0;
dvx3 = -xtruX / dmod;
} else {
dmod = Math.sqrt(xtruY*xtruY + xtruX*xtruX);
dvx1 = -xtruY / dmod;
dvx2 = xtruX / dmod;
dvx3 = 0;
}
dvy1 = xtruY*dvx3 - xtruZ*dvx2;
dvy2 = xtruZ*dvx1 - xtruX*dvx3;
dvy3 = xtruX*dvx2 - xtruY*dvx1;
dmod = Math.sqrt(dvy1*dvy1 + dvy2*dvy2 + dvy3*dvy3);
dvy1 = dvy1 / dmod;
dvy2 = dvy2 / dmod;
dvy3 = dvy3 / dmod;
dxt = dvx1*dxt0 + dvy1*dyt0 + xtruX*dzt0;
dyt = dvx2*dxt0 + dvy2*dyt0 + xtruY*dzt0;
dzt = dvx3*dxt0 + dvy3*dyt0 + xtruZ*dzt0;
coord_out = new double[]{dxt, dyt, dzt};
dxt0 = 0;
dyt0 = 0;
dzt0 = 0;
return coord_out;
}
|
class class_name[name] begin[{]
method[CalculateAcadExtrusion, return_type[type[double]], modifier[public static], parameter[coord_in, xtru]] begin[{]
local_variable[type[double], coord_out]
local_variable[type[double], dxt0]
local_variable[type[double], dvx1]
local_variable[type[double], dvy1]
local_variable[type[double], dmod]
local_variable[type[double], aux]
local_variable[type[double], aux1]
local_variable[type[double], aux2]
assign[member[.dxt0], member[.coord_in]]
assign[member[.dyt0], member[.coord_in]]
assign[member[.dzt0], member[.coord_in]]
local_variable[type[double], xtruX]
assign[member[.xtruX], member[.xtru]]
assign[member[.xtruY], member[.xtru]]
assign[member[.xtruZ], member[.xtru]]
if[binary_operation[binary_operation[member[.aux1], <, member[.aux]], &&, binary_operation[member[.aux2], <, member[.aux]]]] begin[{]
assign[member[.dmod], call[Math.sqrt, parameter[binary_operation[binary_operation[member[.xtruZ], *, member[.xtruZ]], +, binary_operation[member[.xtruX], *, member[.xtruX]]]]]]
assign[member[.dvx1], binary_operation[member[.xtruZ], /, member[.dmod]]]
assign[member[.dvx2], literal[0]]
assign[member[.dvx3], binary_operation[member[.xtruX], /, member[.dmod]]]
else begin[{]
assign[member[.dmod], call[Math.sqrt, parameter[binary_operation[binary_operation[member[.xtruY], *, member[.xtruY]], +, binary_operation[member[.xtruX], *, member[.xtruX]]]]]]
assign[member[.dvx1], binary_operation[member[.xtruY], /, member[.dmod]]]
assign[member[.dvx2], binary_operation[member[.xtruX], /, member[.dmod]]]
assign[member[.dvx3], literal[0]]
end[}]
assign[member[.dvy1], binary_operation[binary_operation[member[.xtruY], *, member[.dvx3]], -, binary_operation[member[.xtruZ], *, member[.dvx2]]]]
assign[member[.dvy2], binary_operation[binary_operation[member[.xtruZ], *, member[.dvx1]], -, binary_operation[member[.xtruX], *, member[.dvx3]]]]
assign[member[.dvy3], binary_operation[binary_operation[member[.xtruX], *, member[.dvx2]], -, binary_operation[member[.xtruY], *, member[.dvx1]]]]
assign[member[.dmod], call[Math.sqrt, parameter[binary_operation[binary_operation[binary_operation[member[.dvy1], *, member[.dvy1]], +, binary_operation[member[.dvy2], *, member[.dvy2]]], +, binary_operation[member[.dvy3], *, member[.dvy3]]]]]]
assign[member[.dvy1], binary_operation[member[.dvy1], /, member[.dmod]]]
assign[member[.dvy2], binary_operation[member[.dvy2], /, member[.dmod]]]
assign[member[.dvy3], binary_operation[member[.dvy3], /, member[.dmod]]]
assign[member[.dxt], binary_operation[binary_operation[binary_operation[member[.dvx1], *, member[.dxt0]], +, binary_operation[member[.dvy1], *, member[.dyt0]]], +, binary_operation[member[.xtruX], *, member[.dzt0]]]]
assign[member[.dyt], binary_operation[binary_operation[binary_operation[member[.dvx2], *, member[.dxt0]], +, binary_operation[member[.dvy2], *, member[.dyt0]]], +, binary_operation[member[.xtruY], *, member[.dzt0]]]]
assign[member[.dzt], binary_operation[binary_operation[binary_operation[member[.dvx3], *, member[.dxt0]], +, binary_operation[member[.dvy3], *, member[.dyt0]]], +, binary_operation[member[.xtruZ], *, member[.dzt0]]]]
assign[member[.coord_out], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=dxt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dyt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dzt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=double))]
assign[member[.dxt0], literal[0]]
assign[member[.dyt0], literal[0]]
assign[member[.dzt0], literal[0]]
return[member[.coord_out]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[double] operator[SEP] operator[SEP] identifier[CalculateAcadExtrusion] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[coord_in] , Keyword[double] operator[SEP] operator[SEP] identifier[xtru] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] identifier[coord_out] operator[SEP] Keyword[double] identifier[dxt0] operator[=] literal[Float] , identifier[dyt0] operator[=] literal[Float] , identifier[dzt0] operator[=] literal[Float] operator[SEP] Keyword[double] identifier[dvx1] , identifier[dvx2] , identifier[dvx3] operator[SEP] Keyword[double] identifier[dvy1] , identifier[dvy2] , identifier[dvy3] operator[SEP] Keyword[double] identifier[dmod] , identifier[dxt] , identifier[dyt] , identifier[dzt] operator[SEP] Keyword[double] identifier[aux] operator[=] literal[Float] operator[/] literal[Float] operator[SEP] Keyword[double] identifier[aux1] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[xtru] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[aux2] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[xtru] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[dxt0] operator[=] identifier[coord_in] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[dyt0] operator[=] identifier[coord_in] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[dzt0] operator[=] identifier[coord_in] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[double] identifier[xtruX] , identifier[xtruY] , identifier[xtruZ] operator[SEP] identifier[xtruX] operator[=] identifier[xtru] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[xtruY] operator[=] identifier[xtru] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[xtruZ] operator[=] identifier[xtru] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[aux1] operator[<] identifier[aux] operator[SEP] operator[&&] operator[SEP] identifier[aux2] operator[<] identifier[aux] operator[SEP] operator[SEP] {
identifier[dmod] operator[=] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[xtruZ] operator[*] identifier[xtruZ] operator[+] identifier[xtruX] operator[*] identifier[xtruX] operator[SEP] operator[SEP] identifier[dvx1] operator[=] identifier[xtruZ] operator[/] identifier[dmod] operator[SEP] identifier[dvx2] operator[=] Other[0] operator[SEP] identifier[dvx3] operator[=] operator[-] identifier[xtruX] operator[/] identifier[dmod] operator[SEP]
}
Keyword[else] {
identifier[dmod] operator[=] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[xtruY] operator[*] identifier[xtruY] operator[+] identifier[xtruX] operator[*] identifier[xtruX] operator[SEP] operator[SEP] identifier[dvx1] operator[=] operator[-] identifier[xtruY] operator[/] identifier[dmod] operator[SEP] identifier[dvx2] operator[=] identifier[xtruX] operator[/] identifier[dmod] operator[SEP] identifier[dvx3] operator[=] Other[0] operator[SEP]
}
identifier[dvy1] operator[=] identifier[xtruY] operator[*] identifier[dvx3] operator[-] identifier[xtruZ] operator[*] identifier[dvx2] operator[SEP] identifier[dvy2] operator[=] identifier[xtruZ] operator[*] identifier[dvx1] operator[-] identifier[xtruX] operator[*] identifier[dvx3] operator[SEP] identifier[dvy3] operator[=] identifier[xtruX] operator[*] identifier[dvx2] operator[-] identifier[xtruY] operator[*] identifier[dvx1] operator[SEP] identifier[dmod] operator[=] identifier[Math] operator[SEP] identifier[sqrt] operator[SEP] identifier[dvy1] operator[*] identifier[dvy1] operator[+] identifier[dvy2] operator[*] identifier[dvy2] operator[+] identifier[dvy3] operator[*] identifier[dvy3] operator[SEP] operator[SEP] identifier[dvy1] operator[=] identifier[dvy1] operator[/] identifier[dmod] operator[SEP] identifier[dvy2] operator[=] identifier[dvy2] operator[/] identifier[dmod] operator[SEP] identifier[dvy3] operator[=] identifier[dvy3] operator[/] identifier[dmod] operator[SEP] identifier[dxt] operator[=] identifier[dvx1] operator[*] identifier[dxt0] operator[+] identifier[dvy1] operator[*] identifier[dyt0] operator[+] identifier[xtruX] operator[*] identifier[dzt0] operator[SEP] identifier[dyt] operator[=] identifier[dvx2] operator[*] identifier[dxt0] operator[+] identifier[dvy2] operator[*] identifier[dyt0] operator[+] identifier[xtruY] operator[*] identifier[dzt0] operator[SEP] identifier[dzt] operator[=] identifier[dvx3] operator[*] identifier[dxt0] operator[+] identifier[dvy3] operator[*] identifier[dyt0] operator[+] identifier[xtruZ] operator[*] identifier[dzt0] operator[SEP] identifier[coord_out] operator[=] Keyword[new] Keyword[double] operator[SEP] operator[SEP] {
identifier[dxt] , identifier[dyt] , identifier[dzt]
} operator[SEP] identifier[dxt0] operator[=] Other[0] operator[SEP] identifier[dyt0] operator[=] Other[0] operator[SEP] identifier[dzt0] operator[=] Other[0] operator[SEP] Keyword[return] identifier[coord_out] operator[SEP]
}
|
public void error( String format, Object arg )
{
if( m_delegate.isErrorEnabled() )
{
FormattingTuple tuple = MessageFormatter.format( format, arg );
m_delegate.error( tuple.getMessage(), tuple.getThrowable() );
}
}
|
class class_name[name] begin[{]
method[error, return_type[void], modifier[public], parameter[format, arg]] begin[{]
if[call[m_delegate.isErrorEnabled, parameter[]]] begin[{]
local_variable[type[FormattingTuple], tuple]
call[m_delegate.error, parameter[call[tuple.getMessage, parameter[]], call[tuple.getThrowable, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[error] operator[SEP] identifier[String] identifier[format] , identifier[Object] identifier[arg] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_delegate] operator[SEP] identifier[isErrorEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[FormattingTuple] identifier[tuple] operator[=] identifier[MessageFormatter] operator[SEP] identifier[format] operator[SEP] identifier[format] , identifier[arg] operator[SEP] operator[SEP] identifier[m_delegate] operator[SEP] identifier[error] operator[SEP] identifier[tuple] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[tuple] operator[SEP] identifier[getThrowable] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
protected Set<ConstraintViolation<Object>> hibernateValidate(Object form, Class<?>[] groups) {
try {
return hibernateValidator.validate(form, groups);
} catch (RuntimeException e) {
handleHibernateValidatorException(form, groups, e);
return null; // unreachable
}
}
|
class class_name[name] begin[{]
method[hibernateValidate, return_type[type[Set]], modifier[protected], parameter[form, groups]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=form, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=groups, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=validate, postfix_operators=[], prefix_operators=[], qualifier=hibernateValidator, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=form, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=groups, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleHibernateValidatorException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RuntimeException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] identifier[Set] operator[<] identifier[ConstraintViolation] operator[<] identifier[Object] operator[>] operator[>] identifier[hibernateValidate] operator[SEP] identifier[Object] identifier[form] , identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[groups] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[hibernateValidator] operator[SEP] identifier[validate] operator[SEP] identifier[form] , identifier[groups] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[e] operator[SEP] {
identifier[handleHibernateValidatorException] operator[SEP] identifier[form] , identifier[groups] , identifier[e] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
public NetworkInterfaceIPConfigurationInner getVirtualMachineScaleSetIpConfiguration(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex, String networkInterfaceName, String ipConfigurationName) {
return getVirtualMachineScaleSetIpConfigurationWithServiceResponseAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName).toBlocking().single().body();
}
|
class class_name[name] begin[{]
method[getVirtualMachineScaleSetIpConfiguration, return_type[type[NetworkInterfaceIPConfigurationInner]], modifier[public], parameter[resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName]] begin[{]
return[call[.getVirtualMachineScaleSetIpConfigurationWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.virtualMachineScaleSetName], member[.virtualmachineIndex], member[.networkInterfaceName], member[.ipConfigurationName]]]]
end[}]
END[}]
|
Keyword[public] identifier[NetworkInterfaceIPConfigurationInner] identifier[getVirtualMachineScaleSetIpConfiguration] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[virtualMachineScaleSetName] , identifier[String] identifier[virtualmachineIndex] , identifier[String] identifier[networkInterfaceName] , identifier[String] identifier[ipConfigurationName] operator[SEP] {
Keyword[return] identifier[getVirtualMachineScaleSetIpConfigurationWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[virtualMachineScaleSetName] , identifier[virtualmachineIndex] , identifier[networkInterfaceName] , identifier[ipConfigurationName] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> T pickRandom (List<T> values)
{
int size = values.size();
if (size == 0) {
throw new IllegalArgumentException(
"Must have at least one element [size=" + size + "]");
}
return values.get(getInt(size));
}
|
class class_name[name] begin[{]
method[pickRandom, return_type[type[T]], modifier[public static], parameter[values]] begin[{]
local_variable[type[int], size]
if[binary_operation[member[.size], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Must have at least one element [size="), operandr=MemberReference(member=size, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[values.get, parameter[call[.getInt, parameter[member[.size]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[pickRandom] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[values] operator[SEP] {
Keyword[int] identifier[size] operator[=] identifier[values] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[size] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[values] operator[SEP] identifier[get] operator[SEP] identifier[getInt] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP]
}
|
protected synchronized void unsetRepertoire(RepertoireConfigService config) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Removing repertoire: " + config.getAlias());
}
repertoireMap.remove(config.getAlias());
repertoirePIDMap.remove(config.getPID());
repertoirePropertiesMap.remove(config.getAlias());
processConfig(repertoirePropertiesMap.remove(config.getAlias()) != null);
}
|
class class_name[name] begin[{]
method[unsetRepertoire, return_type[void], modifier[synchronized protected], parameter[config]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEventEnabled, parameter[]]]] begin[{]
call[Tr.event, parameter[member[.tc], binary_operation[literal["Removing repertoire: "], +, call[config.getAlias, parameter[]]]]]
else begin[{]
None
end[}]
call[repertoireMap.remove, parameter[call[config.getAlias, parameter[]]]]
call[repertoirePIDMap.remove, parameter[call[config.getPID, parameter[]]]]
call[repertoirePropertiesMap.remove, parameter[call[config.getAlias, parameter[]]]]
call[.processConfig, parameter[binary_operation[call[repertoirePropertiesMap.remove, parameter[call[config.getAlias, parameter[]]]], !=, literal[null]]]]
end[}]
END[}]
|
Keyword[protected] Keyword[synchronized] Keyword[void] identifier[unsetRepertoire] operator[SEP] identifier[RepertoireConfigService] identifier[config] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEventEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[event] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[config] operator[SEP] identifier[getAlias] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[repertoireMap] operator[SEP] identifier[remove] operator[SEP] identifier[config] operator[SEP] identifier[getAlias] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[repertoirePIDMap] operator[SEP] identifier[remove] operator[SEP] identifier[config] operator[SEP] identifier[getPID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[repertoirePropertiesMap] operator[SEP] identifier[remove] operator[SEP] identifier[config] operator[SEP] identifier[getAlias] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[processConfig] operator[SEP] identifier[repertoirePropertiesMap] operator[SEP] identifier[remove] operator[SEP] identifier[config] operator[SEP] identifier[getAlias] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP]
}
|
@Override
public FileBuilder addSymbolicLink(Path target, Path linkTarget) throws IOException
{
checkTarget(target);
checkTarget(linkTarget);
FileBuilder fb = new FileBuilder();
fb.target = target;
fb.linkTo = linkTarget;
fb.content = ByteBuffer.wrap(PathHelper.posixString(linkTarget).getBytes(US_ASCII));
fb.size = fb.content.limit();
fb.mode = (short) 0120000;
fb.compressFilename();
fileBuilders.add(fb);
return fb;
}
|
class class_name[name] begin[{]
method[addSymbolicLink, return_type[type[FileBuilder]], modifier[public], parameter[target, linkTarget]] begin[{]
call[.checkTarget, parameter[member[.target]]]
call[.checkTarget, parameter[member[.linkTarget]]]
local_variable[type[FileBuilder], fb]
assign[member[fb.target], member[.target]]
assign[member[fb.linkTo], member[.linkTarget]]
assign[member[fb.content], call[ByteBuffer.wrap, parameter[call[PathHelper.posixString, parameter[member[.linkTarget]]]]]]
assign[member[fb.size], call[fb.content.limit, parameter[]]]
assign[member[fb.mode], Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0120000), type=BasicType(dimensions=[], name=short))]
call[fb.compressFilename, parameter[]]
call[fileBuilders.add, parameter[member[.fb]]]
return[member[.fb]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[FileBuilder] identifier[addSymbolicLink] operator[SEP] identifier[Path] identifier[target] , identifier[Path] identifier[linkTarget] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[checkTarget] operator[SEP] identifier[target] operator[SEP] operator[SEP] identifier[checkTarget] operator[SEP] identifier[linkTarget] operator[SEP] operator[SEP] identifier[FileBuilder] identifier[fb] operator[=] Keyword[new] identifier[FileBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[fb] operator[SEP] identifier[target] operator[=] identifier[target] operator[SEP] identifier[fb] operator[SEP] identifier[linkTo] operator[=] identifier[linkTarget] operator[SEP] identifier[fb] operator[SEP] identifier[content] operator[=] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[PathHelper] operator[SEP] identifier[posixString] operator[SEP] identifier[linkTarget] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] identifier[US_ASCII] operator[SEP] operator[SEP] operator[SEP] identifier[fb] operator[SEP] identifier[size] operator[=] identifier[fb] operator[SEP] identifier[content] operator[SEP] identifier[limit] operator[SEP] operator[SEP] operator[SEP] identifier[fb] operator[SEP] identifier[mode] operator[=] operator[SEP] Keyword[short] operator[SEP] literal[Integer] operator[SEP] identifier[fb] operator[SEP] identifier[compressFilename] operator[SEP] operator[SEP] operator[SEP] identifier[fileBuilders] operator[SEP] identifier[add] operator[SEP] identifier[fb] operator[SEP] operator[SEP] Keyword[return] identifier[fb] operator[SEP]
}
|
public LocalTime withNano(int nanoOfSecond) {
if (this.nano == nanoOfSecond) {
return this;
}
NANO_OF_SECOND.checkValidValue(nanoOfSecond);
return create(hour, minute, second, nanoOfSecond);
}
|
class class_name[name] begin[{]
method[withNano, return_type[type[LocalTime]], modifier[public], parameter[nanoOfSecond]] begin[{]
if[binary_operation[THIS[member[None.nano]], ==, member[.nanoOfSecond]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
call[NANO_OF_SECOND.checkValidValue, parameter[member[.nanoOfSecond]]]
return[call[.create, parameter[member[.hour], member[.minute], member[.second], member[.nanoOfSecond]]]]
end[}]
END[}]
|
Keyword[public] identifier[LocalTime] identifier[withNano] operator[SEP] Keyword[int] identifier[nanoOfSecond] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[nano] operator[==] identifier[nanoOfSecond] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
identifier[NANO_OF_SECOND] operator[SEP] identifier[checkValidValue] operator[SEP] identifier[nanoOfSecond] operator[SEP] operator[SEP] Keyword[return] identifier[create] operator[SEP] identifier[hour] , identifier[minute] , identifier[second] , identifier[nanoOfSecond] operator[SEP] operator[SEP]
}
|
public void setSourceRpm( final String rpm) {
if ( rpm != null) format.getHeader().createEntry( SOURCERPM, rpm);
}
|
class class_name[name] begin[{]
method[setSourceRpm, return_type[void], modifier[public], parameter[rpm]] begin[{]
if[binary_operation[member[.rpm], !=, literal[null]]] begin[{]
call[format.getHeader, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setSourceRpm] operator[SEP] Keyword[final] identifier[String] identifier[rpm] operator[SEP] {
Keyword[if] operator[SEP] identifier[rpm] operator[!=] Other[null] operator[SEP] identifier[format] operator[SEP] identifier[getHeader] operator[SEP] operator[SEP] operator[SEP] identifier[createEntry] operator[SEP] identifier[SOURCERPM] , identifier[rpm] operator[SEP] operator[SEP]
}
|
public void init(final FilterConfig pConfig) throws ServletException {
if (pConfig == null) {
throw new ServletConfigException("filter config == null");
}
// Store filter config
filterConfig = pConfig;
// Configure this
try {
BeanUtil.configure(this, ServletUtil.asMap(pConfig), true);
}
catch (InvocationTargetException e) {
throw new ServletConfigException("Could not configure " + getFilterName(), e.getCause());
}
// Create run-once attribute name
attribRunOnce = pConfig.getFilterName() + ATTRIB_RUN_ONCE_EXT;
log("init (oncePerRequest=" + oncePerRequest + ", attribRunOnce=" + attribRunOnce + ")");
init();
}
|
class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[pConfig]] begin[{]
if[binary_operation[member[.pConfig], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="filter config == null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServletConfigException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.filterConfig], member[.pConfig]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[MemberReference(member=pConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asMap, postfix_operators=[], prefix_operators=[], qualifier=ServletUtil, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=configure, postfix_operators=[], prefix_operators=[], qualifier=BeanUtil, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not configure "), operandr=MethodInvocation(arguments=[], member=getFilterName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServletConfigException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvocationTargetException']))], finally_block=None, label=None, resources=None)
assign[member[.attribRunOnce], binary_operation[call[pConfig.getFilterName, parameter[]], +, member[.ATTRIB_RUN_ONCE_EXT]]]
call[.log, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["init (oncePerRequest="], +, member[.oncePerRequest]], +, literal[", attribRunOnce="]], +, member[.attribRunOnce]], +, literal[")"]]]]
call[.init, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[init] operator[SEP] Keyword[final] identifier[FilterConfig] identifier[pConfig] operator[SEP] Keyword[throws] identifier[ServletException] {
Keyword[if] operator[SEP] identifier[pConfig] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ServletConfigException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[filterConfig] operator[=] identifier[pConfig] operator[SEP] Keyword[try] {
identifier[BeanUtil] operator[SEP] identifier[configure] operator[SEP] Keyword[this] , identifier[ServletUtil] operator[SEP] identifier[asMap] operator[SEP] identifier[pConfig] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InvocationTargetException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ServletConfigException] operator[SEP] literal[String] operator[+] identifier[getFilterName] operator[SEP] operator[SEP] , identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[attribRunOnce] operator[=] identifier[pConfig] operator[SEP] identifier[getFilterName] operator[SEP] operator[SEP] operator[+] identifier[ATTRIB_RUN_ONCE_EXT] operator[SEP] identifier[log] operator[SEP] literal[String] operator[+] identifier[oncePerRequest] operator[+] literal[String] operator[+] identifier[attribRunOnce] operator[+] literal[String] operator[SEP] operator[SEP] identifier[init] operator[SEP] operator[SEP] operator[SEP]
}
|
private void matchIds(@NonNull ArrayMap<View, TransitionValues> unmatchedStart,
@NonNull ArrayMap<View, TransitionValues> unmatchedEnd,
@NonNull SparseArray<View> startIds,
@NonNull SparseArray<View> endIds) {
int numStartIds = startIds.size();
for (int i = 0; i < numStartIds; i++) {
View startView = startIds.valueAt(i);
if (startView != null && isValidTarget(startView)) {
View endView = endIds.get(startIds.keyAt(i));
if (endView != null && isValidTarget(endView)) {
TransitionValues startValues = unmatchedStart.get(startView);
TransitionValues endValues = unmatchedEnd.get(endView);
if (startValues != null && endValues != null) {
mStartValuesList.add(startValues);
mEndValuesList.add(endValues);
unmatchedStart.remove(startView);
unmatchedEnd.remove(endView);
}
}
}
}
}
|
class class_name[name] begin[{]
method[matchIds, return_type[void], modifier[private], parameter[unmatchedStart, unmatchedEnd, startIds, endIds]] begin[{]
local_variable[type[int], numStartIds]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueAt, postfix_operators=[], prefix_operators=[], qualifier=startIds, selectors=[], type_arguments=None), name=startView)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=startView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=startView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isValidTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=keyAt, postfix_operators=[], prefix_operators=[], qualifier=startIds, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=endIds, selectors=[], type_arguments=None), name=endView)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=endView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=endView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isValidTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=startView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=unmatchedStart, selectors=[], type_arguments=None), name=startValues)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TransitionValues, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=endView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=unmatchedEnd, selectors=[], type_arguments=None), name=endValues)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TransitionValues, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=startValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=endValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=startValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=mStartValuesList, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=endValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=mEndValuesList, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=startView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=unmatchedStart, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=endView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=unmatchedEnd, selectors=[], type_arguments=None), label=None)]))]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numStartIds, 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[matchIds] operator[SEP] annotation[@] identifier[NonNull] identifier[ArrayMap] operator[<] identifier[View] , identifier[TransitionValues] operator[>] identifier[unmatchedStart] , annotation[@] identifier[NonNull] identifier[ArrayMap] operator[<] identifier[View] , identifier[TransitionValues] operator[>] identifier[unmatchedEnd] , annotation[@] identifier[NonNull] identifier[SparseArray] operator[<] identifier[View] operator[>] identifier[startIds] , annotation[@] identifier[NonNull] identifier[SparseArray] operator[<] identifier[View] operator[>] identifier[endIds] operator[SEP] {
Keyword[int] identifier[numStartIds] operator[=] identifier[startIds] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[numStartIds] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[View] identifier[startView] operator[=] identifier[startIds] operator[SEP] identifier[valueAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[startView] operator[!=] Other[null] operator[&&] identifier[isValidTarget] operator[SEP] identifier[startView] operator[SEP] operator[SEP] {
identifier[View] identifier[endView] operator[=] identifier[endIds] operator[SEP] identifier[get] operator[SEP] identifier[startIds] operator[SEP] identifier[keyAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[endView] operator[!=] Other[null] operator[&&] identifier[isValidTarget] operator[SEP] identifier[endView] operator[SEP] operator[SEP] {
identifier[TransitionValues] identifier[startValues] operator[=] identifier[unmatchedStart] operator[SEP] identifier[get] operator[SEP] identifier[startView] operator[SEP] operator[SEP] identifier[TransitionValues] identifier[endValues] operator[=] identifier[unmatchedEnd] operator[SEP] identifier[get] operator[SEP] identifier[endView] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[startValues] operator[!=] Other[null] operator[&&] identifier[endValues] operator[!=] Other[null] operator[SEP] {
identifier[mStartValuesList] operator[SEP] identifier[add] operator[SEP] identifier[startValues] operator[SEP] operator[SEP] identifier[mEndValuesList] operator[SEP] identifier[add] operator[SEP] identifier[endValues] operator[SEP] operator[SEP] identifier[unmatchedStart] operator[SEP] identifier[remove] operator[SEP] identifier[startView] operator[SEP] operator[SEP] identifier[unmatchedEnd] operator[SEP] identifier[remove] operator[SEP] identifier[endView] operator[SEP] operator[SEP]
}
}
}
}
}
|
public static void removePages4Session(final String _sessionId)
{
final AdvancedCache<String, StoredPage> cache = InfinispanCache.get().<String, StoredPage>getIgnReCache(
InfinispanPageStore.PAGECACHE);
final QueryFactory queryFactory = Search.getQueryFactory(cache);
final Query query = queryFactory.from(StoredPage.class).having("sessionId").eq(_sessionId).build();
query.<StoredPage>list().forEach(storedPage -> cache.remove(storedPage.getSessionId() + "::" + storedPage
.getPage().getPageId()));
}
|
class class_name[name] begin[{]
method[removePages4Session, return_type[void], modifier[public static], parameter[_sessionId]] begin[{]
local_variable[type[AdvancedCache], cache]
local_variable[type[QueryFactory], queryFactory]
local_variable[type[Query], query]
call[.query, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[removePages4Session] operator[SEP] Keyword[final] identifier[String] identifier[_sessionId] operator[SEP] {
Keyword[final] identifier[AdvancedCache] operator[<] identifier[String] , identifier[StoredPage] operator[>] identifier[cache] operator[=] identifier[InfinispanCache] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[<] identifier[String] , identifier[StoredPage] operator[>] identifier[getIgnReCache] operator[SEP] identifier[InfinispanPageStore] operator[SEP] identifier[PAGECACHE] operator[SEP] operator[SEP] Keyword[final] identifier[QueryFactory] identifier[queryFactory] operator[=] identifier[Search] operator[SEP] identifier[getQueryFactory] operator[SEP] identifier[cache] operator[SEP] operator[SEP] Keyword[final] identifier[Query] identifier[query] operator[=] identifier[queryFactory] operator[SEP] identifier[from] operator[SEP] identifier[StoredPage] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[having] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[eq] operator[SEP] identifier[_sessionId] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[query] operator[SEP] operator[<] identifier[StoredPage] operator[>] identifier[list] operator[SEP] operator[SEP] operator[SEP] identifier[forEach] operator[SEP] identifier[storedPage] operator[->] identifier[cache] operator[SEP] identifier[remove] operator[SEP] identifier[storedPage] operator[SEP] identifier[getSessionId] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[storedPage] operator[SEP] identifier[getPage] operator[SEP] operator[SEP] operator[SEP] identifier[getPageId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.