code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static boolean renderHTMLStringAttribute(ResponseWriter writer,
UIComponent component, String componentProperty, String htmlAttrName)
throws IOException
{
String value = (String) component.getAttributes().get(componentProperty);
if (!isDefaultStringAttributeValue(value))
{
writer.writeAttribute(htmlAttrName, value, componentProperty);
return true;
}
return false;
} | class class_name[name] begin[{]
method[renderHTMLStringAttribute, return_type[type[boolean]], modifier[public static], parameter[writer, component, componentProperty, htmlAttrName]] begin[{]
local_variable[type[String], value]
if[call[.isDefaultStringAttributeValue, parameter[member[.value]]]] begin[{]
call[writer.writeAttribute, parameter[member[.htmlAttrName], member[.value], member[.componentProperty]]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[renderHTMLStringAttribute] operator[SEP] identifier[ResponseWriter] identifier[writer] , identifier[UIComponent] identifier[component] , identifier[String] identifier[componentProperty] , identifier[String] identifier[htmlAttrName] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[value] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[component] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[componentProperty] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isDefaultStringAttributeValue] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
identifier[writer] operator[SEP] identifier[writeAttribute] operator[SEP] identifier[htmlAttrName] , identifier[value] , identifier[componentProperty] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public Blade scanPackages(@NonNull String... packages) {
this.packages.addAll(Arrays.asList(packages));
return this;
} | class class_name[name] begin[{]
method[scanPackages, return_type[type[Blade]], modifier[public], parameter[packages]] begin[{]
THIS[member[None.packages]call[None.addAll, parameter[call[Arrays.asList, parameter[member[.packages]]]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Blade] identifier[scanPackages] operator[SEP] annotation[@] identifier[NonNull] identifier[String] operator[...] identifier[packages] operator[SEP] {
Keyword[this] operator[SEP] identifier[packages] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[packages] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static void main(String[] args) throws IOException,
InterruptedException {
start = System.currentTimeMillis();
long insertTimeStart = start;
long insertTimeEnd;
final JDBCLoaderConfig cfg = new JDBCLoaderConfig();
cfg.parse(JDBCLoader.class.getName(), args);
FileReader fr = null;
BufferedReader br = null;
m_config = cfg;
configuration();
// Split server list
final String[] serverlist = m_config.servers.split(",");
// read username and password from txt file
if (m_config.credentials != null && !m_config.credentials.trim().isEmpty()) {
Properties props = MiscUtils.readPropertiesFromCredentials(m_config.credentials);
m_config.user = props.getProperty("username");
m_config.password = props.getProperty("password");
}
// If we need to prompt the user for a VoltDB password, do so.
m_config.password = CLIConfig.readPasswordIfNeeded(m_config.user, m_config.password, "Enter VoltDB password: ");
// Create connection
final ClientConfig c_config;
AutoReconnectListener listener = new AutoReconnectListener();
if (m_config.stopondisconnect) {
c_config = new ClientConfig(m_config.user, m_config.password, null);
c_config.setReconnectOnConnectionLoss(false);
} else {
c_config = new ClientConfig(m_config.user, m_config.password, listener);
c_config.setReconnectOnConnectionLoss(true);
}
if (m_config.ssl != null && !m_config.ssl.trim().isEmpty()) {
c_config.setTrustStoreConfigFromPropertyFile(m_config.ssl);
c_config.enableSSL();
}
c_config.setProcedureCallTimeout(0); // Set procedure all to infinite
Client csvClient = null;
try {
csvClient = JDBCLoader.getClient(c_config, serverlist, m_config.port);
} catch (Exception e) {
System.err.println("Error connecting to the servers: "
+ m_config.servers + ": " + e);
System.exit(-1);
}
assert (csvClient != null);
try {
long readerTime;
long insertCount;
long ackCount;
final JDBCLoader errHandler = new JDBCLoader();
final CSVDataLoader dataLoader;
errHandler.launchErrorFlushProcessor();
if (m_config.useSuppliedProcedure) {
dataLoader = new CSVTupleDataLoader((ClientImpl) csvClient, m_config.procedure, errHandler);
} else {
dataLoader = new CSVBulkDataLoader((ClientImpl) csvClient, m_config.table, m_config.batch, m_config.update, errHandler);
}
if (!m_config.stopondisconnect) {
listener.setLoader(dataLoader);
}
// If we need to prompt the user for a JDBC datasource password, do so.
m_config.jdbcpassword = CLIConfig.readPasswordIfNeeded(m_config.jdbcuser, m_config.jdbcpassword, "Enter JDBC source database password: ");
//Created Source reader
JDBCStatementReader.initializeReader(cfg, csvClient);
JDBCStatementReader jdbcReader = new JDBCStatementReader(dataLoader, errHandler);
Thread readerThread = new Thread(jdbcReader);
readerThread.setName("JDBCSourceReader");
readerThread.setDaemon(true);
//Wait for reader to finish.
readerThread.start();
readerThread.join();
insertTimeEnd = System.currentTimeMillis();
csvClient.close();
errHandler.waitForErrorFlushComplete();
readerTime = (jdbcReader.m_parsingTime) / 1000000;
insertCount = dataLoader.getProcessedRows();
ackCount = insertCount - dataLoader.getFailedRows();
if (errHandler.hasReachedErrorLimit()) {
System.out.println("The number of failed rows exceeds the configured maximum failed rows: "
+ m_config.maxerrors);
}
System.out.println("Read " + insertCount + " rows from file and successfully inserted "
+ ackCount + " rows (final)");
errHandler.produceFiles(ackCount, insertCount);
close_cleanup();
//In test junit mode we let it continue for reuse
if (!JDBCLoader.testMode) {
System.exit(errHandler.m_errorInfo.isEmpty() ? 0 : -1);
}
} catch (Exception ex) {
System.err.println("Exception Happened while loading CSV data : " + ex);
System.exit(1);
}
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
assign[member[.start], call[System.currentTimeMillis, parameter[]]]
local_variable[type[long], insertTimeStart]
local_variable[type[long], insertTimeEnd]
local_variable[type[JDBCLoaderConfig], cfg]
call[cfg.parse, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=JDBCLoader, sub_type=None)), member[.args]]]
local_variable[type[FileReader], fr]
local_variable[type[BufferedReader], br]
assign[member[.m_config], member[.cfg]]
call[.configuration, parameter[]]
local_variable[type[String], serverlist]
if[binary_operation[binary_operation[member[m_config.credentials], !=, literal[null]], &&, call[m_config.credentials.trim, parameter[]]]] begin[{]
local_variable[type[Properties], props]
assign[member[m_config.user], call[props.getProperty, parameter[literal["username"]]]]
assign[member[m_config.password], call[props.getProperty, parameter[literal["password"]]]]
else begin[{]
None
end[}]
assign[member[m_config.password], call[CLIConfig.readPasswordIfNeeded, parameter[member[m_config.user], member[m_config.password], literal["Enter VoltDB password: "]]]]
local_variable[type[ClientConfig], c_config]
local_variable[type[AutoReconnectListener], listener]
if[member[m_config.stopondisconnect]] begin[{]
assign[member[.c_config], ClassCreator(arguments=[MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClientConfig, sub_type=None))]
call[c_config.setReconnectOnConnectionLoss, parameter[literal[false]]]
else begin[{]
assign[member[.c_config], ClassCreator(arguments=[MemberReference(member=user, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), MemberReference(member=listener, 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=ClientConfig, sub_type=None))]
call[c_config.setReconnectOnConnectionLoss, parameter[literal[true]]]
end[}]
if[binary_operation[binary_operation[member[m_config.ssl], !=, literal[null]], &&, call[m_config.ssl.trim, parameter[]]]] begin[{]
call[c_config.setTrustStoreConfigFromPropertyFile, parameter[member[m_config.ssl]]]
call[c_config.enableSSL, parameter[]]
else begin[{]
None
end[}]
call[c_config.setProcedureCallTimeout, parameter[literal[0]]]
local_variable[type[Client], csvClient]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=csvClient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=c_config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=serverlist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[])], member=getClient, postfix_operators=[], prefix_operators=[], qualifier=JDBCLoader, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error connecting to the servers: "), operandr=MemberReference(member=servers, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), operandr=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=csvClient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=readerTime)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=insertCount)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=ackCount)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JDBCLoader, sub_type=None)), name=errHandler)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=JDBCLoader, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=dataLoader)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=CSVDataLoader, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=launchErrorFlushProcessor, postfix_operators=[], prefix_operators=[], qualifier=errHandler, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=useSuppliedProcedure, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=dataLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Cast(expression=MemberReference(member=csvClient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ClientImpl, sub_type=None)), MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), MemberReference(member=batch, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), MemberReference(member=update, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), MemberReference(member=errHandler, 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=CSVBulkDataLoader, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=dataLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Cast(expression=MemberReference(member=csvClient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ClientImpl, sub_type=None)), MemberReference(member=procedure, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), MemberReference(member=errHandler, 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=CSVTupleDataLoader, sub_type=None))), label=None)])), IfStatement(condition=MemberReference(member=stopondisconnect, postfix_operators=[], prefix_operators=['!'], qualifier=m_config, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dataLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLoader, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=jdbcpassword, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=jdbcuser, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), MemberReference(member=jdbcpassword, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Enter JDBC source database password: ")], member=readPasswordIfNeeded, postfix_operators=[], prefix_operators=[], qualifier=CLIConfig, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cfg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=csvClient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initializeReader, postfix_operators=[], prefix_operators=[], qualifier=JDBCStatementReader, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=dataLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=errHandler, 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=JDBCStatementReader, sub_type=None)), name=jdbcReader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JDBCStatementReader, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=jdbcReader, 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=Thread, sub_type=None)), name=readerThread)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Thread, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="JDBCSourceReader")], member=setName, postfix_operators=[], prefix_operators=[], qualifier=readerThread, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setDaemon, postfix_operators=[], prefix_operators=[], qualifier=readerThread, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=start, postfix_operators=[], prefix_operators=[], qualifier=readerThread, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=join, postfix_operators=[], prefix_operators=[], qualifier=readerThread, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=insertTimeEnd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=csvClient, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=waitForErrorFlushComplete, postfix_operators=[], prefix_operators=[], qualifier=errHandler, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=readerTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=m_parsingTime, postfix_operators=[], prefix_operators=[], qualifier=jdbcReader, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000000), operator=/)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=insertCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getProcessedRows, postfix_operators=[], prefix_operators=[], qualifier=dataLoader, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ackCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=insertCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getFailedRows, postfix_operators=[], prefix_operators=[], qualifier=dataLoader, selectors=[], type_arguments=None), operator=-)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=hasReachedErrorLimit, postfix_operators=[], prefix_operators=[], qualifier=errHandler, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The number of failed rows exceeds the configured maximum failed rows: "), operandr=MemberReference(member=maxerrors, postfix_operators=[], prefix_operators=[], qualifier=m_config, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Read "), operandr=MemberReference(member=insertCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" rows from file and successfully inserted "), operator=+), operandr=MemberReference(member=ackCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" rows (final)"), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ackCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=insertCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=produceFiles, postfix_operators=[], prefix_operators=[], qualifier=errHandler, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close_cleanup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=testMode, postfix_operators=[], prefix_operators=['!'], qualifier=JDBCLoader, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[TernaryExpression(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=errHandler.m_errorInfo, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception Happened while loading CSV data : "), operandr=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.err, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=exit, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
identifier[start] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[insertTimeStart] operator[=] identifier[start] operator[SEP] Keyword[long] identifier[insertTimeEnd] operator[SEP] Keyword[final] identifier[JDBCLoaderConfig] identifier[cfg] operator[=] Keyword[new] identifier[JDBCLoaderConfig] operator[SEP] operator[SEP] operator[SEP] identifier[cfg] operator[SEP] identifier[parse] operator[SEP] identifier[JDBCLoader] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[args] operator[SEP] operator[SEP] identifier[FileReader] identifier[fr] operator[=] Other[null] operator[SEP] identifier[BufferedReader] identifier[br] operator[=] Other[null] operator[SEP] identifier[m_config] operator[=] identifier[cfg] operator[SEP] identifier[configuration] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[serverlist] operator[=] identifier[m_config] operator[SEP] identifier[servers] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_config] operator[SEP] identifier[credentials] operator[!=] Other[null] operator[&&] operator[!] identifier[m_config] operator[SEP] identifier[credentials] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Properties] identifier[props] operator[=] identifier[MiscUtils] operator[SEP] identifier[readPropertiesFromCredentials] operator[SEP] identifier[m_config] operator[SEP] identifier[credentials] operator[SEP] operator[SEP] identifier[m_config] operator[SEP] identifier[user] operator[=] identifier[props] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[m_config] operator[SEP] identifier[password] operator[=] identifier[props] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[m_config] operator[SEP] identifier[password] operator[=] identifier[CLIConfig] operator[SEP] identifier[readPasswordIfNeeded] operator[SEP] identifier[m_config] operator[SEP] identifier[user] , identifier[m_config] operator[SEP] identifier[password] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[ClientConfig] identifier[c_config] operator[SEP] identifier[AutoReconnectListener] identifier[listener] operator[=] Keyword[new] identifier[AutoReconnectListener] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_config] operator[SEP] identifier[stopondisconnect] operator[SEP] {
identifier[c_config] operator[=] Keyword[new] identifier[ClientConfig] operator[SEP] identifier[m_config] operator[SEP] identifier[user] , identifier[m_config] operator[SEP] identifier[password] , Other[null] operator[SEP] operator[SEP] identifier[c_config] operator[SEP] identifier[setReconnectOnConnectionLoss] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[c_config] operator[=] Keyword[new] identifier[ClientConfig] operator[SEP] identifier[m_config] operator[SEP] identifier[user] , identifier[m_config] operator[SEP] identifier[password] , identifier[listener] operator[SEP] operator[SEP] identifier[c_config] operator[SEP] identifier[setReconnectOnConnectionLoss] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_config] operator[SEP] identifier[ssl] operator[!=] Other[null] operator[&&] operator[!] identifier[m_config] operator[SEP] identifier[ssl] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[c_config] operator[SEP] identifier[setTrustStoreConfigFromPropertyFile] operator[SEP] identifier[m_config] operator[SEP] identifier[ssl] operator[SEP] operator[SEP] identifier[c_config] operator[SEP] identifier[enableSSL] operator[SEP] operator[SEP] operator[SEP]
}
identifier[c_config] operator[SEP] identifier[setProcedureCallTimeout] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[Client] identifier[csvClient] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[csvClient] operator[=] identifier[JDBCLoader] operator[SEP] identifier[getClient] operator[SEP] identifier[c_config] , identifier[serverlist] , identifier[m_config] operator[SEP] identifier[port] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[m_config] operator[SEP] identifier[servers] operator[+] literal[String] operator[+] identifier[e] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[assert] operator[SEP] identifier[csvClient] operator[!=] Other[null] operator[SEP] operator[SEP] Keyword[try] {
Keyword[long] identifier[readerTime] operator[SEP] Keyword[long] identifier[insertCount] operator[SEP] Keyword[long] identifier[ackCount] operator[SEP] Keyword[final] identifier[JDBCLoader] identifier[errHandler] operator[=] Keyword[new] identifier[JDBCLoader] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[CSVDataLoader] identifier[dataLoader] operator[SEP] identifier[errHandler] operator[SEP] identifier[launchErrorFlushProcessor] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_config] operator[SEP] identifier[useSuppliedProcedure] operator[SEP] {
identifier[dataLoader] operator[=] Keyword[new] identifier[CSVTupleDataLoader] operator[SEP] operator[SEP] identifier[ClientImpl] operator[SEP] identifier[csvClient] , identifier[m_config] operator[SEP] identifier[procedure] , identifier[errHandler] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[dataLoader] operator[=] Keyword[new] identifier[CSVBulkDataLoader] operator[SEP] operator[SEP] identifier[ClientImpl] operator[SEP] identifier[csvClient] , identifier[m_config] operator[SEP] identifier[table] , identifier[m_config] operator[SEP] identifier[batch] , identifier[m_config] operator[SEP] identifier[update] , identifier[errHandler] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[m_config] operator[SEP] identifier[stopondisconnect] operator[SEP] {
identifier[listener] operator[SEP] identifier[setLoader] operator[SEP] identifier[dataLoader] operator[SEP] operator[SEP]
}
identifier[m_config] operator[SEP] identifier[jdbcpassword] operator[=] identifier[CLIConfig] operator[SEP] identifier[readPasswordIfNeeded] operator[SEP] identifier[m_config] operator[SEP] identifier[jdbcuser] , identifier[m_config] operator[SEP] identifier[jdbcpassword] , literal[String] operator[SEP] operator[SEP] identifier[JDBCStatementReader] operator[SEP] identifier[initializeReader] operator[SEP] identifier[cfg] , identifier[csvClient] operator[SEP] operator[SEP] identifier[JDBCStatementReader] identifier[jdbcReader] operator[=] Keyword[new] identifier[JDBCStatementReader] operator[SEP] identifier[dataLoader] , identifier[errHandler] operator[SEP] operator[SEP] identifier[Thread] identifier[readerThread] operator[=] Keyword[new] identifier[Thread] operator[SEP] identifier[jdbcReader] operator[SEP] operator[SEP] identifier[readerThread] operator[SEP] identifier[setName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[readerThread] operator[SEP] identifier[setDaemon] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[readerThread] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[readerThread] operator[SEP] identifier[join] operator[SEP] operator[SEP] operator[SEP] identifier[insertTimeEnd] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[csvClient] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[errHandler] operator[SEP] identifier[waitForErrorFlushComplete] operator[SEP] operator[SEP] operator[SEP] identifier[readerTime] operator[=] operator[SEP] identifier[jdbcReader] operator[SEP] identifier[m_parsingTime] operator[SEP] operator[/] Other[1000000] operator[SEP] identifier[insertCount] operator[=] identifier[dataLoader] operator[SEP] identifier[getProcessedRows] operator[SEP] operator[SEP] operator[SEP] identifier[ackCount] operator[=] identifier[insertCount] operator[-] identifier[dataLoader] operator[SEP] identifier[getFailedRows] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[errHandler] operator[SEP] identifier[hasReachedErrorLimit] operator[SEP] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[m_config] operator[SEP] identifier[maxerrors] operator[SEP] operator[SEP]
}
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[insertCount] operator[+] literal[String] operator[+] identifier[ackCount] operator[+] literal[String] operator[SEP] operator[SEP] identifier[errHandler] operator[SEP] identifier[produceFiles] operator[SEP] identifier[ackCount] , identifier[insertCount] operator[SEP] operator[SEP] identifier[close_cleanup] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[JDBCLoader] operator[SEP] identifier[testMode] operator[SEP] {
identifier[System] operator[SEP] identifier[exit] operator[SEP] identifier[errHandler] operator[SEP] identifier[m_errorInfo] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[?] Other[0] operator[:] operator[-] Other[1] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[ex] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
}
|
private StreamTokenizer makeArffTokenizer(BufferedReader br) {
// Setup tokenizer
StreamTokenizer tokenizer = new StreamTokenizer(br);
{
tokenizer.resetSyntax();
tokenizer.whitespaceChars(0, ' ');
tokenizer.ordinaryChars('0', '9'); // Do not parse numbers
tokenizer.ordinaryChar('-');
tokenizer.ordinaryChar('.');
tokenizer.wordChars(' ' + 1, '\u00FF');
tokenizer.whitespaceChars(',', ',');
tokenizer.commentChar('%');
tokenizer.quoteChar('"');
tokenizer.quoteChar('\'');
tokenizer.ordinaryChar('{');
tokenizer.ordinaryChar('}');
tokenizer.eolIsSignificant(true);
}
return tokenizer;
} | class class_name[name] begin[{]
method[makeArffTokenizer, return_type[type[StreamTokenizer]], modifier[private], parameter[br]] begin[{]
local_variable[type[StreamTokenizer], tokenizer]
call[tokenizer.resetSyntax, parameter[]]
call[tokenizer.whitespaceChars, parameter[literal[0], literal[' ']]]
call[tokenizer.ordinaryChars, parameter[literal['0'], literal['9']]]
call[tokenizer.ordinaryChar, parameter[literal['-']]]
call[tokenizer.ordinaryChar, parameter[literal['.']]]
call[tokenizer.wordChars, parameter[binary_operation[literal[' '], +, literal[1]], literal['ÿ']]]
call[tokenizer.whitespaceChars, parameter[literal[','], literal[',']]]
call[tokenizer.commentChar, parameter[literal['%']]]
call[tokenizer.quoteChar, parameter[literal['"']]]
call[tokenizer.quoteChar, parameter[literal['\'']]]
call[tokenizer.ordinaryChar, parameter[literal['{']]]
call[tokenizer.ordinaryChar, parameter[literal['}']]]
call[tokenizer.eolIsSignificant, parameter[literal[true]]]
return[member[.tokenizer]]
end[}]
END[}] | Keyword[private] identifier[StreamTokenizer] identifier[makeArffTokenizer] operator[SEP] identifier[BufferedReader] identifier[br] operator[SEP] {
identifier[StreamTokenizer] identifier[tokenizer] operator[=] Keyword[new] identifier[StreamTokenizer] operator[SEP] identifier[br] operator[SEP] operator[SEP] {
identifier[tokenizer] operator[SEP] identifier[resetSyntax] operator[SEP] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[whitespaceChars] operator[SEP] Other[0] , literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[ordinaryChars] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[ordinaryChar] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[ordinaryChar] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[wordChars] operator[SEP] literal[String] operator[+] Other[1] , literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[whitespaceChars] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[commentChar] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[quoteChar] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[quoteChar] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[ordinaryChar] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[ordinaryChar] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[eolIsSignificant] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] identifier[tokenizer] operator[SEP]
}
|
public File findFile( String path ) throws IOException {
File base = new File(getBasePath());
File pathFile = new File(base, "."+path);
if( !pathFile.exists()) throw new FileNotFoundException("No file or directory at "+pathFile.getCanonicalPath());
if( pathFile.isFile()) return pathFile;
pathFile = new File(pathFile, "index.html");
if( !pathFile.exists() ) throw new FileNotFoundException("No welcome file at "+pathFile.getCanonicalPath());
return pathFile;
} | class class_name[name] begin[{]
method[findFile, return_type[type[File]], modifier[public], parameter[path]] begin[{]
local_variable[type[File], base]
local_variable[type[File], pathFile]
if[call[pathFile.exists, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No file or directory at "), operandr=MethodInvocation(arguments=[], member=getCanonicalPath, postfix_operators=[], prefix_operators=[], qualifier=pathFile, 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=FileNotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[pathFile.isFile, parameter[]]] begin[{]
return[member[.pathFile]]
else begin[{]
None
end[}]
assign[member[.pathFile], ClassCreator(arguments=[MemberReference(member=pathFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="index.html")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))]
if[call[pathFile.exists, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No welcome file at "), operandr=MethodInvocation(arguments=[], member=getCanonicalPath, postfix_operators=[], prefix_operators=[], qualifier=pathFile, 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=FileNotFoundException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.pathFile]]
end[}]
END[}] | Keyword[public] identifier[File] identifier[findFile] operator[SEP] identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[File] identifier[base] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[getBasePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[pathFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[base] , literal[String] operator[+] identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[pathFile] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[FileNotFoundException] operator[SEP] literal[String] operator[+] identifier[pathFile] operator[SEP] identifier[getCanonicalPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pathFile] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[pathFile] operator[SEP] identifier[pathFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[pathFile] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[pathFile] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[FileNotFoundException] operator[SEP] literal[String] operator[+] identifier[pathFile] operator[SEP] identifier[getCanonicalPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[pathFile] operator[SEP]
}
|
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AfplibPackage.STO__IORNTION:
setIORNTION((Integer)newValue);
return;
case AfplibPackage.STO__BORNTION:
setBORNTION((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
} | class class_name[name] begin[{]
method[eSet, return_type[void], modifier[public], parameter[featureID, newValue]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=STO__IORNTION, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setIORNTION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=STO__BORNTION, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], member=setBORNTION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eSet] operator[SEP] Keyword[int] identifier[featureID] , identifier[Object] identifier[newValue] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[STO__IORNTION] operator[:] identifier[setIORNTION] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[STO__BORNTION] operator[:] identifier[setBORNTION] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eSet] operator[SEP] identifier[featureID] , identifier[newValue] operator[SEP] operator[SEP]
}
|
public Collection<SyntheticsAlertCondition> list(long policyId, String name)
{
List<SyntheticsAlertCondition> ret = new ArrayList<SyntheticsAlertCondition>();
Collection<SyntheticsAlertCondition> conditions = list(policyId);
for(SyntheticsAlertCondition condition : conditions)
{
if(condition.getName().equals(name))
ret.add(condition);
}
return ret;
} | class class_name[name] begin[{]
method[list, return_type[type[Collection]], modifier[public], parameter[policyId, name]] begin[{]
local_variable[type[List], ret]
local_variable[type[Collection], conditions]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=condition, selectors=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=condition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=conditions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=condition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SyntheticsAlertCondition, sub_type=None))), label=None)
return[member[.ret]]
end[}]
END[}] | Keyword[public] identifier[Collection] operator[<] identifier[SyntheticsAlertCondition] operator[>] identifier[list] operator[SEP] Keyword[long] identifier[policyId] , identifier[String] identifier[name] operator[SEP] {
identifier[List] operator[<] identifier[SyntheticsAlertCondition] operator[>] identifier[ret] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[SyntheticsAlertCondition] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[SyntheticsAlertCondition] operator[>] identifier[conditions] operator[=] identifier[list] operator[SEP] identifier[policyId] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[SyntheticsAlertCondition] identifier[condition] operator[:] identifier[conditions] operator[SEP] {
Keyword[if] operator[SEP] identifier[condition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[condition] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public Date getFrom() {
final TimeInterval first = intervals.first();
if (first != null) {
return new Date(first.getFrom());
}
return null;
} | class class_name[name] begin[{]
method[getFrom, return_type[type[Date]], modifier[public], parameter[]] begin[{]
local_variable[type[TimeInterval], first]
if[binary_operation[member[.first], !=, literal[null]]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getFrom, postfix_operators=[], prefix_operators=[], qualifier=first, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None))]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[Date] identifier[getFrom] operator[SEP] operator[SEP] {
Keyword[final] identifier[TimeInterval] identifier[first] operator[=] identifier[intervals] operator[SEP] identifier[first] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[first] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[Date] operator[SEP] identifier[first] operator[SEP] identifier[getFrom] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
protected <T> T _executeTx(
final String operation,
final Class<? extends Persistable<?>> type,
final TransactionCallback<T> action
)
{
return _executeTx( operation, type, null, action );
} | class class_name[name] begin[{]
method[_executeTx, return_type[type[T]], modifier[protected], parameter[operation, type, action]] begin[{]
return[call[._executeTx, parameter[member[.operation], member[.type], literal[null], member[.action]]]]
end[}]
END[}] | Keyword[protected] operator[<] identifier[T] operator[>] identifier[T] identifier[_executeTx] operator[SEP] Keyword[final] identifier[String] identifier[operation] , Keyword[final] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Persistable] operator[<] operator[?] operator[>] operator[>] identifier[type] , Keyword[final] identifier[TransactionCallback] operator[<] identifier[T] operator[>] identifier[action] operator[SEP] {
Keyword[return] identifier[_executeTx] operator[SEP] identifier[operation] , identifier[type] , Other[null] , identifier[action] operator[SEP] operator[SEP]
}
|
@Override
public BackchannelAuthenticationFailResponse backchannelAuthenticationFail(BackchannelAuthenticationFailRequest request) throws AuthleteApiException
{
return executeApiCall(
new ServicePostApiCaller<BackchannelAuthenticationFailResponse>(
BackchannelAuthenticationFailResponse.class, request, BACKCHANNEL_AUTHENTICATION_FAIL_API_PATH));
} | class class_name[name] begin[{]
method[backchannelAuthenticationFail, return_type[type[BackchannelAuthenticationFailResponse]], modifier[public], parameter[request]] begin[{]
return[call[.executeApiCall, parameter[ClassCreator(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BackchannelAuthenticationFailResponse, sub_type=None)), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=BACKCHANNEL_AUTHENTICATION_FAIL_API_PATH, 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=BackchannelAuthenticationFailResponse, sub_type=None))], dimensions=None, name=ServicePostApiCaller, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[BackchannelAuthenticationFailResponse] identifier[backchannelAuthenticationFail] operator[SEP] identifier[BackchannelAuthenticationFailRequest] identifier[request] operator[SEP] Keyword[throws] identifier[AuthleteApiException] {
Keyword[return] identifier[executeApiCall] operator[SEP] Keyword[new] identifier[ServicePostApiCaller] operator[<] identifier[BackchannelAuthenticationFailResponse] operator[>] operator[SEP] identifier[BackchannelAuthenticationFailResponse] operator[SEP] Keyword[class] , identifier[request] , identifier[BACKCHANNEL_AUTHENTICATION_FAIL_API_PATH] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setTypes(com.google.api.ads.admanager.axis.v201902.LabelType[] types) {
this.types = types;
} | class class_name[name] begin[{]
method[setTypes, return_type[void], modifier[public], parameter[types]] begin[{]
assign[THIS[member[None.types]], member[.types]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setTypes] operator[SEP] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201902] operator[SEP] identifier[LabelType] operator[SEP] operator[SEP] identifier[types] operator[SEP] {
Keyword[this] operator[SEP] identifier[types] operator[=] identifier[types] operator[SEP]
}
|
@Override
public void onNext(final T event) {
LOG.log(Level.FINEST, "Invoked for event: {0}", event);
lock.readLock().lock();
final List<EventHandler<? extends T>> list;
try {
list = clazzToListOfHandlersMap.get(event.getClass());
if (list == null) {
throw new WakeRuntimeException("No event " + event.getClass() + " handler");
}
for (final EventHandler<? extends T> handler : list) {
LOG.log(Level.FINEST, "Invoking {0}", handler);
((EventHandler<T>) handler).onNext(event);
}
} finally {
lock.readLock().unlock();
}
} | class class_name[name] begin[{]
method[onNext, return_type[void], modifier[public], parameter[event]] begin[{]
call[LOG.log, parameter[member[Level.FINEST], literal["Invoked for event: {0}"], member[.event]]]
call[lock.readLock, parameter[]]
local_variable[type[List], list]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=clazzToListOfHandlersMap, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No event "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" handler"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WakeRuntimeException, sub_type=None)), label=None)])), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINEST, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invoking {0}"), MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Cast(expression=MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=EventHandler, sub_type=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=handler)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=EventHandler, sub_type=None))), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=readLock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onNext] operator[SEP] Keyword[final] identifier[T] identifier[event] operator[SEP] {
identifier[LOG] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[FINEST] , literal[String] , identifier[event] operator[SEP] operator[SEP] identifier[lock] operator[SEP] identifier[readLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[EventHandler] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] operator[>] identifier[list] operator[SEP] Keyword[try] {
identifier[list] operator[=] identifier[clazzToListOfHandlersMap] operator[SEP] identifier[get] operator[SEP] identifier[event] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[list] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WakeRuntimeException] operator[SEP] literal[String] operator[+] identifier[event] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[final] identifier[EventHandler] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] identifier[handler] operator[:] identifier[list] operator[SEP] {
identifier[LOG] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[FINEST] , literal[String] , identifier[handler] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[EventHandler] operator[<] identifier[T] operator[>] operator[SEP] identifier[handler] operator[SEP] operator[SEP] identifier[onNext] operator[SEP] identifier[event] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[readLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Deprecated
public static List<Footer> readFooters(Configuration configuration, FileStatus pathStatus) throws IOException {
return readFooters(configuration, pathStatus, false);
} | class class_name[name] begin[{]
method[readFooters, return_type[type[List]], modifier[public static], parameter[configuration, pathStatus]] begin[{]
return[call[.readFooters, parameter[member[.configuration], member[.pathStatus], literal[false]]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Footer] operator[>] identifier[readFooters] operator[SEP] identifier[Configuration] identifier[configuration] , identifier[FileStatus] identifier[pathStatus] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[readFooters] operator[SEP] identifier[configuration] , identifier[pathStatus] , literal[boolean] operator[SEP] operator[SEP]
}
|
public void copyDirectoryStructure( File sourceDirectory, File targetDirectory )
throws MojoExecutionException
{
makeDirectoryIfNecessary( targetDirectory );
// hopefully available from FileUtils 1.0.5-SNAPSHOT
try
{
FileUtils.copyDirectoryStructure( sourceDirectory, targetDirectory );
}
catch ( IOException e )
{
throw new MojoExecutionException(
"Could not copy directory structure from " + sourceDirectory + " to " + targetDirectory, e );
}
} | class class_name[name] begin[{]
method[copyDirectoryStructure, return_type[void], modifier[public], parameter[sourceDirectory, targetDirectory]] begin[{]
call[.makeDirectoryIfNecessary, parameter[member[.targetDirectory]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sourceDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=targetDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copyDirectoryStructure, postfix_operators=[], prefix_operators=[], qualifier=FileUtils, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not copy directory structure from "), operandr=MemberReference(member=sourceDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" to "), operator=+), operandr=MemberReference(member=targetDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MojoExecutionException, 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[copyDirectoryStructure] operator[SEP] identifier[File] identifier[sourceDirectory] , identifier[File] identifier[targetDirectory] operator[SEP] Keyword[throws] identifier[MojoExecutionException] {
identifier[makeDirectoryIfNecessary] operator[SEP] identifier[targetDirectory] operator[SEP] operator[SEP] Keyword[try] {
identifier[FileUtils] operator[SEP] identifier[copyDirectoryStructure] operator[SEP] identifier[sourceDirectory] , identifier[targetDirectory] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MojoExecutionException] operator[SEP] literal[String] operator[+] identifier[sourceDirectory] operator[+] literal[String] operator[+] identifier[targetDirectory] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@NotNull
public DoubleStream filterNot(@NotNull final DoublePredicate predicate) {
return filter(DoublePredicate.Util.negate(predicate));
} | class class_name[name] begin[{]
method[filterNot, return_type[type[DoubleStream]], modifier[public], parameter[predicate]] begin[{]
return[call[.filter, parameter[call[DoublePredicate.Util.negate, parameter[member[.predicate]]]]]]
end[}]
END[}] | annotation[@] identifier[NotNull] Keyword[public] identifier[DoubleStream] identifier[filterNot] operator[SEP] annotation[@] identifier[NotNull] Keyword[final] identifier[DoublePredicate] identifier[predicate] operator[SEP] {
Keyword[return] identifier[filter] operator[SEP] identifier[DoublePredicate] operator[SEP] identifier[Util] operator[SEP] identifier[negate] operator[SEP] identifier[predicate] operator[SEP] operator[SEP] operator[SEP]
}
|
public FormFieldListing getFieldsByFormNameAndLoggedInUser(
String formNameParam,
boolean editOnlyFieldsParam)
{
Form form = new Form();
form.setFormType(formNameParam);
if(this.serviceTicket != null)
{
form.setServiceTicket(this.serviceTicket);
}
return new FormFieldListing(this.postJson(
form, WS.Path.FormField.Version1.getByFormDefinitionAndLoggedInUser(
editOnlyFieldsParam)));
} | class class_name[name] begin[{]
method[getFieldsByFormNameAndLoggedInUser, return_type[type[FormFieldListing]], modifier[public], parameter[formNameParam, editOnlyFieldsParam]] begin[{]
local_variable[type[Form], form]
call[form.setFormType, parameter[member[.formNameParam]]]
if[binary_operation[THIS[member[None.serviceTicket]], !=, literal[null]]] begin[{]
call[form.setServiceTicket, parameter[THIS[member[None.serviceTicket]]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=form, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=editOnlyFieldsParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getByFormDefinitionAndLoggedInUser, postfix_operators=[], prefix_operators=[], qualifier=WS.Path.FormField.Version1, selectors=[], type_arguments=None)], member=postJson, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FormFieldListing, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[FormFieldListing] identifier[getFieldsByFormNameAndLoggedInUser] operator[SEP] identifier[String] identifier[formNameParam] , Keyword[boolean] identifier[editOnlyFieldsParam] operator[SEP] {
identifier[Form] identifier[form] operator[=] Keyword[new] identifier[Form] operator[SEP] operator[SEP] operator[SEP] identifier[form] operator[SEP] identifier[setFormType] operator[SEP] identifier[formNameParam] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[serviceTicket] operator[!=] Other[null] operator[SEP] {
identifier[form] operator[SEP] identifier[setServiceTicket] operator[SEP] Keyword[this] operator[SEP] identifier[serviceTicket] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[FormFieldListing] operator[SEP] Keyword[this] operator[SEP] identifier[postJson] operator[SEP] identifier[form] , identifier[WS] operator[SEP] identifier[Path] operator[SEP] identifier[FormField] operator[SEP] identifier[Version1] operator[SEP] identifier[getByFormDefinitionAndLoggedInUser] operator[SEP] identifier[editOnlyFieldsParam] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public int deleteAll() throws SQLException {
int count = 0;
if (isTableExists()) {
DeleteBuilder<FeatureTileLink, FeatureTileLinkKey> db = deleteBuilder();
PreparedDelete<FeatureTileLink> deleteQuery = db.prepare();
count = delete(deleteQuery);
}
return count;
} | class class_name[name] begin[{]
method[deleteAll, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[int], count]
if[call[.isTableExists, parameter[]]] begin[{]
local_variable[type[DeleteBuilder], db]
local_variable[type[PreparedDelete], deleteQuery]
assign[member[.count], call[.delete, parameter[member[.deleteQuery]]]]
else begin[{]
None
end[}]
return[member[.count]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[deleteAll] operator[SEP] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[isTableExists] operator[SEP] operator[SEP] operator[SEP] {
identifier[DeleteBuilder] operator[<] identifier[FeatureTileLink] , identifier[FeatureTileLinkKey] operator[>] identifier[db] operator[=] identifier[deleteBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[PreparedDelete] operator[<] identifier[FeatureTileLink] operator[>] identifier[deleteQuery] operator[=] identifier[db] operator[SEP] identifier[prepare] operator[SEP] operator[SEP] operator[SEP] identifier[count] operator[=] identifier[delete] operator[SEP] identifier[deleteQuery] operator[SEP] operator[SEP]
}
Keyword[return] identifier[count] operator[SEP]
}
|
public UnprotectedStringBuffer readInnerText() throws XMLException, IOException {
if (!Type.START_ELEMENT.equals(event.type))
throw new IOException("Invalid call of readInnerText: it must be called on a start element, current event type is: " + event.type);
if (event.isClosed) return new UnprotectedStringBuffer();
UnprotectedStringBuffer elementName = event.text;
UnprotectedStringBuffer innerText = new UnprotectedStringBuffer();
do {
try { next(); }
catch (EOFException e) {
throw new XMLException(getPosition(), "Unexpected end", "readInnerText(" + elementName.toString() + ")");
}
if (Type.COMMENT.equals(event.type)) continue;
if (Type.TEXT.equals(event.type)) {
innerText.append(event.text);
continue;
}
if (Type.START_ELEMENT.equals(event.type)) {
closeElement();
continue;
}
if (Type.END_ELEMENT.equals(event.type)) {
if (!event.text.equals(elementName))
throw new XMLException(getPosition(), "Unexpected end element", event.text.asString());
return innerText;
}
} while (true);
} | class class_name[name] begin[{]
method[readInnerText, return_type[type[UnprotectedStringBuffer]], modifier[public], parameter[]] begin[{]
if[call[Type.START_ELEMENT.equals, parameter[member[event.type]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid call of readInnerText: it must be called on a start element, current event type is: "), operandr=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=event, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[member[event.isClosed]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnprotectedStringBuffer, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[UnprotectedStringBuffer], elementName]
local_variable[type[UnprotectedStringBuffer], innerText]
do[literal[true]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected end"), BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="readInnerText("), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=elementName, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XMLException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['EOFException']))], finally_block=None, label=None, resources=None)
if[call[Type.COMMENT.equals, parameter[member[event.type]]]] begin[{]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[call[Type.TEXT.equals, parameter[member[event.type]]]] begin[{]
call[innerText.append, parameter[member[event.text]]]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[call[Type.START_ELEMENT.equals, parameter[member[event.type]]]] begin[{]
call[.closeElement, parameter[]]
ContinueStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[call[Type.END_ELEMENT.equals, parameter[member[event.type]]]] begin[{]
if[call[event.text.equals, parameter[member[.elementName]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected end element"), MethodInvocation(arguments=[], member=asString, postfix_operators=[], prefix_operators=[], qualifier=event.text, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XMLException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.innerText]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] identifier[UnprotectedStringBuffer] identifier[readInnerText] operator[SEP] operator[SEP] Keyword[throws] identifier[XMLException] , identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[Type] operator[SEP] identifier[START_ELEMENT] operator[SEP] identifier[equals] operator[SEP] identifier[event] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[event] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[event] operator[SEP] identifier[isClosed] operator[SEP] Keyword[return] Keyword[new] identifier[UnprotectedStringBuffer] operator[SEP] operator[SEP] operator[SEP] identifier[UnprotectedStringBuffer] identifier[elementName] operator[=] identifier[event] operator[SEP] identifier[text] operator[SEP] identifier[UnprotectedStringBuffer] identifier[innerText] operator[=] Keyword[new] identifier[UnprotectedStringBuffer] operator[SEP] operator[SEP] operator[SEP] Keyword[do] {
Keyword[try] {
identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[EOFException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[XMLException] operator[SEP] identifier[getPosition] operator[SEP] operator[SEP] , literal[String] , literal[String] operator[+] identifier[elementName] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Type] operator[SEP] identifier[COMMENT] operator[SEP] identifier[equals] operator[SEP] identifier[event] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] Keyword[if] operator[SEP] identifier[Type] operator[SEP] identifier[TEXT] operator[SEP] identifier[equals] operator[SEP] identifier[event] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
identifier[innerText] operator[SEP] identifier[append] operator[SEP] identifier[event] operator[SEP] identifier[text] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Type] operator[SEP] identifier[START_ELEMENT] operator[SEP] identifier[equals] operator[SEP] identifier[event] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
identifier[closeElement] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Type] operator[SEP] identifier[END_ELEMENT] operator[SEP] identifier[equals] operator[SEP] identifier[event] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[event] operator[SEP] identifier[text] operator[SEP] identifier[equals] operator[SEP] identifier[elementName] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[XMLException] operator[SEP] identifier[getPosition] operator[SEP] operator[SEP] , literal[String] , identifier[event] operator[SEP] identifier[text] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[innerText] operator[SEP]
}
}
Keyword[while] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
public Graph<KT, VVT, Tuple2<EV, EV>> projectionTopSimple() {
DataSet<Edge<KT, Tuple2<EV, EV>>> newEdges = edges.join(edges)
.where(1)
.equalTo(1)
.with(new ProjectionTopSimple<>())
.name("Simple top projection");
return Graph.fromDataSet(topVertices, newEdges, context);
} | class class_name[name] begin[{]
method[projectionTopSimple, return_type[type[Graph]], modifier[public], parameter[]] begin[{]
local_variable[type[DataSet], newEdges]
return[call[Graph.fromDataSet, parameter[member[.topVertices], member[.newEdges], member[.context]]]]
end[}]
END[}] | Keyword[public] identifier[Graph] operator[<] identifier[KT] , identifier[VVT] , identifier[Tuple2] operator[<] identifier[EV] , identifier[EV] operator[>] operator[>] identifier[projectionTopSimple] operator[SEP] operator[SEP] {
identifier[DataSet] operator[<] identifier[Edge] operator[<] identifier[KT] , identifier[Tuple2] operator[<] identifier[EV] , identifier[EV] operator[>] operator[>] operator[>] identifier[newEdges] operator[=] identifier[edges] operator[SEP] identifier[join] operator[SEP] identifier[edges] operator[SEP] operator[SEP] identifier[where] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[equalTo] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[with] operator[SEP] Keyword[new] identifier[ProjectionTopSimple] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[Graph] operator[SEP] identifier[fromDataSet] operator[SEP] identifier[topVertices] , identifier[newEdges] , identifier[context] operator[SEP] operator[SEP]
}
|
@Override
public void actionCommit() {
List<Throwable> errors = new ArrayList<Throwable>();
try {
if (isForAll()) {
OpenCms.getSessionManager().sendBroadcast(getCms(), m_msgInfo.getMsg());
} else {
List<String> ids = CmsStringUtil.splitAsList(getParamSessionids(), CmsHtmlList.ITEM_SEPARATOR);
Iterator<String> itIds = ids.iterator();
while (itIds.hasNext()) {
String id = itIds.next();
OpenCms.getSessionManager().sendBroadcast(getCms(), m_msgInfo.getMsg(), id);
}
}
} catch (Throwable t) {
errors.add(t);
}
// set the list of errors to display when saving failed
setCommitErrors(errors);
} | class class_name[name] begin[{]
method[actionCommit, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[List], errors]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isForAll, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParamSessionids, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=ITEM_SEPARATOR, postfix_operators=[], prefix_operators=[], qualifier=CmsHtmlList, selectors=[])], member=splitAsList, postfix_operators=[], prefix_operators=[], qualifier=CmsStringUtil, selectors=[], type_arguments=None), name=ids)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=ids, selectors=[], type_arguments=None), name=itIds)], 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)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=itIds, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getSessionManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMsg, postfix_operators=[], prefix_operators=[], qualifier=m_msgInfo, selectors=[], type_arguments=None), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sendBroadcast, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=itIds, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getSessionManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMsg, postfix_operators=[], prefix_operators=[], qualifier=m_msgInfo, selectors=[], type_arguments=None)], member=sendBroadcast, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
call[.setCommitErrors, parameter[member[.errors]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[actionCommit] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Throwable] operator[>] identifier[errors] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Throwable] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[isForAll] operator[SEP] operator[SEP] operator[SEP] {
identifier[OpenCms] operator[SEP] identifier[getSessionManager] operator[SEP] operator[SEP] operator[SEP] identifier[sendBroadcast] operator[SEP] identifier[getCms] operator[SEP] operator[SEP] , identifier[m_msgInfo] operator[SEP] identifier[getMsg] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[List] operator[<] identifier[String] operator[>] identifier[ids] operator[=] identifier[CmsStringUtil] operator[SEP] identifier[splitAsList] operator[SEP] identifier[getParamSessionids] operator[SEP] operator[SEP] , identifier[CmsHtmlList] operator[SEP] identifier[ITEM_SEPARATOR] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[itIds] operator[=] identifier[ids] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itIds] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[id] operator[=] identifier[itIds] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getSessionManager] operator[SEP] operator[SEP] operator[SEP] identifier[sendBroadcast] operator[SEP] identifier[getCms] operator[SEP] operator[SEP] , identifier[m_msgInfo] operator[SEP] identifier[getMsg] operator[SEP] operator[SEP] , identifier[id] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[errors] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
identifier[setCommitErrors] operator[SEP] identifier[errors] operator[SEP] operator[SEP]
}
|
public Response editPhotos(String photosetId, String primaryPhotoId, List<String> photoIds) throws JinxException {
JinxUtils.validateParams(photosetId, primaryPhotoId, photoIds);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photosets.editPhotos");
params.put("photoset_id", photosetId);
params.put("primary_photo_id", primaryPhotoId);
StringBuilder builder = new StringBuilder();
for (String id : photoIds) {
builder.append(id).append(',');
}
builder.deleteCharAt(builder.length() - 1);
params.put("photo_ids", builder.toString());
return jinx.flickrPost(params, Response.class);
} | class class_name[name] begin[{]
method[editPhotos, return_type[type[Response]], modifier[public], parameter[photosetId, primaryPhotoId, photoIds]] begin[{]
call[JinxUtils.validateParams, parameter[member[.photosetId], member[.primaryPhotoId], member[.photoIds]]]
local_variable[type[Map], params]
call[params.put, parameter[literal["method"], literal["flickr.photosets.editPhotos"]]]
call[params.put, parameter[literal["photoset_id"], member[.photosetId]]]
call[params.put, parameter[literal["primary_photo_id"], member[.primaryPhotoId]]]
local_variable[type[StringBuilder], builder]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, 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)]), control=EnhancedForControl(iterable=MemberReference(member=photoIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[builder.deleteCharAt, parameter[binary_operation[call[builder.length, parameter[]], -, literal[1]]]]
call[params.put, parameter[literal["photo_ids"], call[builder.toString, parameter[]]]]
return[call[jinx.flickrPost, parameter[member[.params], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Response, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[Response] identifier[editPhotos] operator[SEP] identifier[String] identifier[photosetId] , identifier[String] identifier[primaryPhotoId] , identifier[List] operator[<] identifier[String] operator[>] identifier[photoIds] operator[SEP] Keyword[throws] identifier[JinxException] {
identifier[JinxUtils] operator[SEP] identifier[validateParams] operator[SEP] identifier[photosetId] , identifier[primaryPhotoId] , identifier[photoIds] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] operator[=] Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[photosetId] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[primaryPhotoId] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[id] operator[:] identifier[photoIds] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[deleteCharAt] operator[SEP] identifier[builder] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[jinx] operator[SEP] identifier[flickrPost] operator[SEP] identifier[params] , identifier[Response] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public long position()
{
if (isClosed)
{
return CLOSED;
}
final long rawTail = rawTailVolatile(logMetaDataBuffer);
final int termOffset = termOffset(rawTail, termBufferLength);
return computePosition(termId(rawTail), termOffset, positionBitsToShift, initialTermId);
} | class class_name[name] begin[{]
method[position, return_type[type[long]], modifier[public], parameter[]] begin[{]
if[member[.isClosed]] begin[{]
return[member[.CLOSED]]
else begin[{]
None
end[}]
local_variable[type[long], rawTail]
local_variable[type[int], termOffset]
return[call[.computePosition, parameter[call[.termId, parameter[member[.rawTail]]], member[.termOffset], member[.positionBitsToShift], member[.initialTermId]]]]
end[}]
END[}] | Keyword[public] Keyword[long] identifier[position] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isClosed] operator[SEP] {
Keyword[return] identifier[CLOSED] operator[SEP]
}
Keyword[final] Keyword[long] identifier[rawTail] operator[=] identifier[rawTailVolatile] operator[SEP] identifier[logMetaDataBuffer] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[termOffset] operator[=] identifier[termOffset] operator[SEP] identifier[rawTail] , identifier[termBufferLength] operator[SEP] operator[SEP] Keyword[return] identifier[computePosition] operator[SEP] identifier[termId] operator[SEP] identifier[rawTail] operator[SEP] , identifier[termOffset] , identifier[positionBitsToShift] , identifier[initialTermId] operator[SEP] operator[SEP]
}
|
public GraphQLDirective buildDirective(Directive directive, Set<GraphQLDirective> directiveDefinitions, DirectiveLocation directiveLocation) {
Optional<GraphQLDirective> directiveDefinition = directiveDefinitions.stream().filter(dd -> dd.getName().equals(directive.getName())).findFirst();
GraphQLDirective.Builder builder = GraphQLDirective.newDirective()
.name(directive.getName())
.description(buildDescription(directive, null))
.validLocations(directiveLocation);
List<GraphQLArgument> arguments = directive.getArguments().stream()
.map(arg -> buildDirectiveArgument(arg, directiveDefinition))
.collect(Collectors.toList());
if (directiveDefinition.isPresent()) {
arguments = transferMissingArguments(arguments, directiveDefinition.get());
}
arguments.forEach(builder::argument);
return builder.build();
} | class class_name[name] begin[{]
method[buildDirective, return_type[type[GraphQLDirective]], modifier[public], parameter[directive, directiveDefinitions, directiveLocation]] begin[{]
local_variable[type[Optional], directiveDefinition]
local_variable[type[GraphQLDirective], builder]
local_variable[type[List], arguments]
if[call[directiveDefinition.isPresent, parameter[]]] begin[{]
assign[member[.arguments], call[.transferMissingArguments, parameter[member[.arguments], call[directiveDefinition.get, parameter[]]]]]
else begin[{]
None
end[}]
call[arguments.forEach, parameter[MethodReference(expression=MemberReference(member=builder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=argument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])]]
return[call[builder.build, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[GraphQLDirective] identifier[buildDirective] operator[SEP] identifier[Directive] identifier[directive] , identifier[Set] operator[<] identifier[GraphQLDirective] operator[>] identifier[directiveDefinitions] , identifier[DirectiveLocation] identifier[directiveLocation] operator[SEP] {
identifier[Optional] operator[<] identifier[GraphQLDirective] operator[>] identifier[directiveDefinition] operator[=] identifier[directiveDefinitions] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[dd] operator[->] identifier[dd] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[directive] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[findFirst] operator[SEP] operator[SEP] operator[SEP] identifier[GraphQLDirective] operator[SEP] identifier[Builder] identifier[builder] operator[=] identifier[GraphQLDirective] operator[SEP] identifier[newDirective] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] identifier[directive] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[description] operator[SEP] identifier[buildDescription] operator[SEP] identifier[directive] , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[validLocations] operator[SEP] identifier[directiveLocation] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[GraphQLArgument] operator[>] identifier[arguments] operator[=] identifier[directive] operator[SEP] identifier[getArguments] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[arg] operator[->] identifier[buildDirectiveArgument] operator[SEP] identifier[arg] , identifier[directiveDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[directiveDefinition] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
identifier[arguments] operator[=] identifier[transferMissingArguments] operator[SEP] identifier[arguments] , identifier[directiveDefinition] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[arguments] operator[SEP] identifier[forEach] operator[SEP] identifier[builder] operator[::] identifier[argument] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
protected String getMessage(Message message) {
switch(message) {
case CHECK:
return "This conversion doesn't seem right. Do you want to correct it automatically?";
case SUGGESTION:
return "Writing for an international audience? Consider adding the metric equivalent.";
case CHECK_UNKNOWN_UNIT:
return "This conversion doesn't seem right, unable to recognize the used unit.";
case UNIT_MISMATCH:
return "These units don't seem to be compatible.";
default:
throw new RuntimeException("Unknown message type: " + message);
}
} | class class_name[name] begin[{]
method[getMessage, return_type[type[String]], modifier[protected], parameter[message]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['CHECK'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This conversion doesn't seem right. Do you want to correct it automatically?"), label=None)]), SwitchStatementCase(case=['SUGGESTION'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Writing for an international audience? Consider adding the metric equivalent."), label=None)]), SwitchStatementCase(case=['CHECK_UNKNOWN_UNIT'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="This conversion doesn't seem right, unable to recognize the used unit."), label=None)]), SwitchStatementCase(case=['UNIT_MISMATCH'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="These units don't seem to be compatible."), label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown message type: "), operandr=MemberReference(member=message, 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)])], expression=MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[protected] identifier[String] identifier[getMessage] operator[SEP] identifier[Message] identifier[message] operator[SEP] {
Keyword[switch] operator[SEP] identifier[message] operator[SEP] {
Keyword[case] identifier[CHECK] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[SUGGESTION] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[CHECK_UNKNOWN_UNIT] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[case] identifier[UNIT_MISMATCH] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[message] operator[SEP] operator[SEP]
}
}
|
public static List<String> cleanupFuzzyContentTypes(List<String> contentTypes) {
if (contentTypes == null || contentTypes.isEmpty()) {
return contentTypes;
}
List<String> types = new ArrayList<>();
for (String contentType : contentTypes) {
if (contentType.equals("*") || contentType.equals("*/*")) {
types.add(contentType);
continue;
}
int i = contentType.indexOf('*');
if (i > -1) {
types.add(contentType.substring(0, i));
} else {
types.add(contentType);
}
}
return types;
} | class class_name[name] begin[{]
method[cleanupFuzzyContentTypes, return_type[type[List]], modifier[public static], parameter[contentTypes]] begin[{]
if[binary_operation[binary_operation[member[.contentTypes], ==, literal[null]], ||, call[contentTypes.isEmpty, parameter[]]]] begin[{]
return[member[.contentTypes]]
else begin[{]
None
end[}]
local_variable[type[List], types]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="*")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=contentType, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="*/*")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=contentType, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contentType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=types, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*')], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=contentType, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), 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=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contentType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=types, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=contentType, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=types, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=contentTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=contentType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.types]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[cleanupFuzzyContentTypes] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[contentTypes] operator[SEP] {
Keyword[if] operator[SEP] identifier[contentTypes] operator[==] Other[null] operator[||] identifier[contentTypes] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[contentTypes] operator[SEP]
}
identifier[List] operator[<] identifier[String] operator[>] identifier[types] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[contentType] operator[:] identifier[contentTypes] operator[SEP] {
Keyword[if] operator[SEP] identifier[contentType] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[contentType] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[types] operator[SEP] identifier[add] operator[SEP] identifier[contentType] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[int] identifier[i] operator[=] identifier[contentType] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[>] operator[-] Other[1] operator[SEP] {
identifier[types] operator[SEP] identifier[add] operator[SEP] identifier[contentType] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[types] operator[SEP] identifier[add] operator[SEP] identifier[contentType] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[types] operator[SEP]
}
|
public ServiceFuture<List<HostingEnvironmentDiagnosticsInner>> listDiagnosticsAsync(String resourceGroupName, String name, final ServiceCallback<List<HostingEnvironmentDiagnosticsInner>> serviceCallback) {
return ServiceFuture.fromResponse(listDiagnosticsWithServiceResponseAsync(resourceGroupName, name), serviceCallback);
} | class class_name[name] begin[{]
method[listDiagnosticsAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, name, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.listDiagnosticsWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.name]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[List] operator[<] identifier[HostingEnvironmentDiagnosticsInner] operator[>] operator[>] identifier[listDiagnosticsAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[name] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[List] operator[<] identifier[HostingEnvironmentDiagnosticsInner] operator[>] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[listDiagnosticsWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[name] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public static String validName(String name) {
if (name == null || name.trim().isEmpty()) {
return "unnamed";
}
StringBuilder result = new StringBuilder();
for (char c : name.toCharArray()) {
if (c == '_' || c == '.' || Character.isLetterOrDigit(c)) {
result.append(c);
}
}
return result.toString();
} | class class_name[name] begin[{]
method[validName, return_type[type[String]], modifier[public static], parameter[name]] begin[{]
if[binary_operation[binary_operation[member[.name], ==, literal[null]], ||, call[name.trim, parameter[]]]] begin[{]
return[literal["unnamed"]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], result]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='_'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='.'), operator===), operator=||), operandr=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isLetterOrDigit, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char))), label=None)
return[call[result.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[validName] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[||] identifier[name] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[char] identifier[c] operator[:] identifier[name] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[||] identifier[c] operator[==] literal[String] operator[||] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[c] operator[SEP] operator[SEP] {
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private void processEndIfCmd(String parms, int cmdTPosBegin, int cmdTPosEnd)
throws MiniTemplator.TemplateSyntaxException {
excludeTemplateRange(cmdTPosBegin, cmdTPosEnd);
if (parms.trim().length() != 0) {
throw new MiniTemplator.TemplateSyntaxException("Invalid parameters for $endIf command.");
}
if (condLevel < 0) {
throw new MiniTemplator.TemplateSyntaxException("$endif without matching $if.");
}
condLevel--;
} | class class_name[name] begin[{]
method[processEndIfCmd, return_type[void], modifier[private], parameter[parms, cmdTPosBegin, cmdTPosEnd]] begin[{]
call[.excludeTemplateRange, parameter[member[.cmdTPosBegin], member[.cmdTPosEnd]]]
if[binary_operation[call[parms.trim, parameter[]], !=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid parameters for $endIf command.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MiniTemplator, sub_type=ReferenceType(arguments=None, dimensions=None, name=TemplateSyntaxException, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.condLevel], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="$endif without matching $if.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MiniTemplator, sub_type=ReferenceType(arguments=None, dimensions=None, name=TemplateSyntaxException, sub_type=None))), label=None)
else begin[{]
None
end[}]
member[.condLevel]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[processEndIfCmd] operator[SEP] identifier[String] identifier[parms] , Keyword[int] identifier[cmdTPosBegin] , Keyword[int] identifier[cmdTPosEnd] operator[SEP] Keyword[throws] identifier[MiniTemplator] operator[SEP] identifier[TemplateSyntaxException] {
identifier[excludeTemplateRange] operator[SEP] identifier[cmdTPosBegin] , identifier[cmdTPosEnd] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parms] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MiniTemplator] operator[SEP] identifier[TemplateSyntaxException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[condLevel] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MiniTemplator] operator[SEP] identifier[TemplateSyntaxException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[condLevel] operator[--] operator[SEP]
}
|
public PostBuilder withTags(Term... tags) {
return withTags(Arrays.stream(tags).map(Term::getId).collect(toList()));
} | class class_name[name] begin[{]
method[withTags, return_type[type[PostBuilder]], modifier[public], parameter[tags]] begin[{]
return[call[.withTags, parameter[call[Arrays.stream, parameter[member[.tags]]]]]]
end[}]
END[}] | Keyword[public] identifier[PostBuilder] identifier[withTags] operator[SEP] identifier[Term] operator[...] identifier[tags] operator[SEP] {
Keyword[return] identifier[withTags] operator[SEP] identifier[Arrays] operator[SEP] identifier[stream] operator[SEP] identifier[tags] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[Term] operator[::] identifier[getId] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
@InService(PageServiceSync.class)
public void afterDataFlush(PageServiceImpl tableService,
int sequenceFlush)
{
super.afterDataFlush(tableService, sequenceFlush);
sweepStub(tableService);
} | class class_name[name] begin[{]
method[afterDataFlush, return_type[void], modifier[public], parameter[tableService, sequenceFlush]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=tableService, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sequenceFlush, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=afterDataFlush, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[.sweepStub, parameter[member[.tableService]]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[InService] operator[SEP] identifier[PageServiceSync] operator[SEP] Keyword[class] operator[SEP] Keyword[public] Keyword[void] identifier[afterDataFlush] operator[SEP] identifier[PageServiceImpl] identifier[tableService] , Keyword[int] identifier[sequenceFlush] operator[SEP] {
Keyword[super] operator[SEP] identifier[afterDataFlush] operator[SEP] identifier[tableService] , identifier[sequenceFlush] operator[SEP] operator[SEP] identifier[sweepStub] operator[SEP] identifier[tableService] operator[SEP] operator[SEP]
}
|
public void marshall(DeleteActivationRequest deleteActivationRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteActivationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteActivationRequest.getActivationId(), ACTIVATIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[deleteActivationRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deleteActivationRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getActivationId, postfix_operators=[], prefix_operators=[], qualifier=deleteActivationRequest, selectors=[], type_arguments=None), MemberReference(member=ACTIVATIONID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[DeleteActivationRequest] identifier[deleteActivationRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deleteActivationRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[deleteActivationRequest] operator[SEP] identifier[getActivationId] operator[SEP] operator[SEP] , identifier[ACTIVATIONID_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static Request newStatusUpdateRequest(Session session, String message, GraphPlace place,
List<GraphUser> tags, Callback callback) {
List<String> tagIds = null;
if (tags != null) {
tagIds = new ArrayList<String>(tags.size());
for (GraphUser tag: tags) {
tagIds.add(tag.getId());
}
}
String placeId = place == null ? null : place.getId();
return newStatusUpdateRequest(session, message, placeId, tagIds, callback);
} | class class_name[name] begin[{]
method[newStatusUpdateRequest, return_type[type[Request]], modifier[public static], parameter[session, message, place, tags, callback]] begin[{]
local_variable[type[List], tagIds]
if[binary_operation[member[.tags], !=, literal[null]]] begin[{]
assign[member[.tagIds], ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=tags, selectors=[], 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=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=tag, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=tagIds, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tag)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=GraphUser, sub_type=None))), label=None)
else begin[{]
None
end[}]
local_variable[type[String], placeId]
return[call[.newStatusUpdateRequest, parameter[member[.session], member[.message], member[.placeId], member[.tagIds], member[.callback]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Request] identifier[newStatusUpdateRequest] operator[SEP] identifier[Session] identifier[session] , identifier[String] identifier[message] , identifier[GraphPlace] identifier[place] , identifier[List] operator[<] identifier[GraphUser] operator[>] identifier[tags] , identifier[Callback] identifier[callback] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[tagIds] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[tags] operator[!=] Other[null] operator[SEP] {
identifier[tagIds] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[tags] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[GraphUser] identifier[tag] operator[:] identifier[tags] operator[SEP] {
identifier[tagIds] operator[SEP] identifier[add] operator[SEP] identifier[tag] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[String] identifier[placeId] operator[=] identifier[place] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[place] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[newStatusUpdateRequest] operator[SEP] identifier[session] , identifier[message] , identifier[placeId] , identifier[tagIds] , identifier[callback] operator[SEP] operator[SEP]
}
|
private static void updateNetwork(WifiManager wifiManager, WifiConfiguration config) {
Integer foundNetworkID = findNetworkInExistingConfig(wifiManager, config.SSID);
if (foundNetworkID != null) {
Log.i(TAG, "Removing old configuration for network " + config.SSID);
wifiManager.removeNetwork(foundNetworkID);
wifiManager.saveConfiguration();
}
int networkId = wifiManager.addNetwork(config);
if (networkId >= 0) {
// Try to disable the current network and start a new one.
if (wifiManager.enableNetwork(networkId, true)) {
Log.i(TAG, "Associating to network " + config.SSID);
wifiManager.saveConfiguration();
} else {
Log.w(TAG, "Failed to enable network " + config.SSID);
}
} else {
Log.w(TAG, "Unable to add network " + config.SSID);
}
} | class class_name[name] begin[{]
method[updateNetwork, return_type[void], modifier[private static], parameter[wifiManager, config]] begin[{]
local_variable[type[Integer], foundNetworkID]
if[binary_operation[member[.foundNetworkID], !=, literal[null]]] begin[{]
call[Log.i, parameter[member[.TAG], binary_operation[literal["Removing old configuration for network "], +, member[config.SSID]]]]
call[wifiManager.removeNetwork, parameter[member[.foundNetworkID]]]
call[wifiManager.saveConfiguration, parameter[]]
else begin[{]
None
end[}]
local_variable[type[int], networkId]
if[binary_operation[member[.networkId], >=, literal[0]]] begin[{]
if[call[wifiManager.enableNetwork, parameter[member[.networkId], literal[true]]]] begin[{]
call[Log.i, parameter[member[.TAG], binary_operation[literal["Associating to network "], +, member[config.SSID]]]]
call[wifiManager.saveConfiguration, parameter[]]
else begin[{]
call[Log.w, parameter[member[.TAG], binary_operation[literal["Failed to enable network "], +, member[config.SSID]]]]
end[}]
else begin[{]
call[Log.w, parameter[member[.TAG], binary_operation[literal["Unable to add network "], +, member[config.SSID]]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[updateNetwork] operator[SEP] identifier[WifiManager] identifier[wifiManager] , identifier[WifiConfiguration] identifier[config] operator[SEP] {
identifier[Integer] identifier[foundNetworkID] operator[=] identifier[findNetworkInExistingConfig] operator[SEP] identifier[wifiManager] , identifier[config] operator[SEP] identifier[SSID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[foundNetworkID] operator[!=] Other[null] operator[SEP] {
identifier[Log] operator[SEP] identifier[i] operator[SEP] identifier[TAG] , literal[String] operator[+] identifier[config] operator[SEP] identifier[SSID] operator[SEP] operator[SEP] identifier[wifiManager] operator[SEP] identifier[removeNetwork] operator[SEP] identifier[foundNetworkID] operator[SEP] operator[SEP] identifier[wifiManager] operator[SEP] identifier[saveConfiguration] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[networkId] operator[=] identifier[wifiManager] operator[SEP] identifier[addNetwork] operator[SEP] identifier[config] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[networkId] operator[>=] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[wifiManager] operator[SEP] identifier[enableNetwork] operator[SEP] identifier[networkId] , literal[boolean] operator[SEP] operator[SEP] {
identifier[Log] operator[SEP] identifier[i] operator[SEP] identifier[TAG] , literal[String] operator[+] identifier[config] operator[SEP] identifier[SSID] operator[SEP] operator[SEP] identifier[wifiManager] operator[SEP] identifier[saveConfiguration] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Log] operator[SEP] identifier[w] operator[SEP] identifier[TAG] , literal[String] operator[+] identifier[config] operator[SEP] identifier[SSID] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[Log] operator[SEP] identifier[w] operator[SEP] identifier[TAG] , literal[String] operator[+] identifier[config] operator[SEP] identifier[SSID] operator[SEP] operator[SEP]
}
}
|
void waitForTransparentConnect() throws InterruptedException,
NotConnectedToServerException {
if (state == DISCONNECTED_VISIBLE) {
LOG.warn(listeningPort + ": waitForTransparentConnect: got visible" +
" disconnected state");
throw new NotConnectedToServerException();
}
// Wait until we are not hidden disconnected
while (state != CONNECTED) {
connectionLock.wait();
switch (state) {
case CONNECTED:
break;
case DISCONNECTED_HIDDEN:
continue;
case DISCONNECTED_VISIBLE:
LOG.warn(listeningPort + ": waitForTransparentConnect: got visible" +
" disconnected state");
throw new NotConnectedToServerException();
}
}
} | class class_name[name] begin[{]
method[waitForTransparentConnect, return_type[void], modifier[default], parameter[]] begin[{]
if[binary_operation[member[.state], ==, member[.DISCONNECTED_VISIBLE]]] begin[{]
call[LOG.warn, parameter[binary_operation[binary_operation[member[.listeningPort], +, literal[": waitForTransparentConnect: got visible"]], +, literal[" disconnected state"]]]]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotConnectedToServerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
while[binary_operation[member[.state], !=, member[.CONNECTED]]] begin[{]
call[connectionLock.wait, parameter[]]
SwitchStatement(cases=[SwitchStatementCase(case=['CONNECTED'], statements=[BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DISCONNECTED_HIDDEN'], statements=[ContinueStatement(goto=None, label=None)]), SwitchStatementCase(case=['DISCONNECTED_VISIBLE'], statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=listeningPort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": waitForTransparentConnect: got visible"), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" disconnected state"), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotConnectedToServerException, sub_type=None)), label=None)])], expression=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
end[}]
END[}] | Keyword[void] identifier[waitForTransparentConnect] operator[SEP] operator[SEP] Keyword[throws] identifier[InterruptedException] , identifier[NotConnectedToServerException] {
Keyword[if] operator[SEP] identifier[state] operator[==] identifier[DISCONNECTED_VISIBLE] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] identifier[listeningPort] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NotConnectedToServerException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[state] operator[!=] identifier[CONNECTED] operator[SEP] {
identifier[connectionLock] operator[SEP] identifier[wait] operator[SEP] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[state] operator[SEP] {
Keyword[case] identifier[CONNECTED] operator[:] Keyword[break] operator[SEP] Keyword[case] identifier[DISCONNECTED_HIDDEN] operator[:] Keyword[continue] operator[SEP] Keyword[case] identifier[DISCONNECTED_VISIBLE] operator[:] identifier[LOG] operator[SEP] identifier[warn] operator[SEP] identifier[listeningPort] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NotConnectedToServerException] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@javax.annotation.Nullable
synchronized ViewData getView(View.Name viewName, Clock clock, State state) {
MutableViewData view = getMutableViewData(viewName);
return view == null ? null : view.toViewData(clock.now(), state);
} | class class_name[name] begin[{]
method[getView, return_type[type[ViewData]], modifier[synchronized], parameter[viewName, clock, state]] begin[{]
local_variable[type[MutableViewData], view]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=view, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=now, postfix_operators=[], prefix_operators=[], qualifier=clock, selectors=[], type_arguments=None), MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toViewData, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | annotation[@] identifier[javax] operator[SEP] identifier[annotation] operator[SEP] identifier[Nullable] Keyword[synchronized] identifier[ViewData] identifier[getView] operator[SEP] identifier[View] operator[SEP] identifier[Name] identifier[viewName] , identifier[Clock] identifier[clock] , identifier[State] identifier[state] operator[SEP] {
identifier[MutableViewData] identifier[view] operator[=] identifier[getMutableViewData] operator[SEP] identifier[viewName] operator[SEP] operator[SEP] Keyword[return] identifier[view] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[view] operator[SEP] identifier[toViewData] operator[SEP] identifier[clock] operator[SEP] identifier[now] operator[SEP] operator[SEP] , identifier[state] operator[SEP] operator[SEP]
}
|
public static void compare(final IFileContentResultBean fileContentResultBean,
final boolean ignoreAbsolutePathEquality, final boolean ignoreExtensionEquality,
final boolean ignoreLengthEquality, final boolean ignoreLastModified,
final boolean ignoreNameEquality, final boolean ignoreContentEquality)
{
compare(fileContentResultBean, ignoreAbsolutePathEquality, ignoreExtensionEquality,
ignoreLengthEquality, ignoreLastModified, ignoreNameEquality);
final File source = fileContentResultBean.getSourceFile();
final File compare = fileContentResultBean.getFileToCompare();
if (!ignoreContentEquality)
{
boolean contentEquality;
try
{
final String sourceChecksum = ChecksumExtensions.getChecksum(source,
HashAlgorithm.SHA_512.getAlgorithm());
final String compareChecksum = ChecksumExtensions.getChecksum(compare,
HashAlgorithm.SHA_512.getAlgorithm());
contentEquality = sourceChecksum.equals(compareChecksum);
fileContentResultBean.setContentEquality(contentEquality);
}
catch (final NoSuchAlgorithmException e)
{
// if the algorithm is not supported check it with CRC32.
try
{
contentEquality = ChecksumExtensions
.getCheckSumCRC32(source) == ChecksumExtensions.getCheckSumCRC32(compare);
fileContentResultBean.setContentEquality(contentEquality);
}
catch (IOException e1)
{
fileContentResultBean.setContentEquality(false);
}
}
catch (IOException e)
{
fileContentResultBean.setContentEquality(false);
}
}
else
{
fileContentResultBean.setContentEquality(true);
}
} | class class_name[name] begin[{]
method[compare, return_type[void], modifier[public static], parameter[fileContentResultBean, ignoreAbsolutePathEquality, ignoreExtensionEquality, ignoreLengthEquality, ignoreLastModified, ignoreNameEquality, ignoreContentEquality]] begin[{]
call[.compare, parameter[member[.fileContentResultBean], member[.ignoreAbsolutePathEquality], member[.ignoreExtensionEquality], member[.ignoreLengthEquality], member[.ignoreLastModified], member[.ignoreNameEquality]]]
local_variable[type[File], source]
local_variable[type[File], compare]
if[member[.ignoreContentEquality]] begin[{]
local_variable[type[boolean], contentEquality]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getAlgorithm, postfix_operators=[], prefix_operators=[], qualifier=HashAlgorithm.SHA_512, selectors=[], type_arguments=None)], member=getChecksum, postfix_operators=[], prefix_operators=[], qualifier=ChecksumExtensions, selectors=[], type_arguments=None), name=sourceChecksum)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=compare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getAlgorithm, postfix_operators=[], prefix_operators=[], qualifier=HashAlgorithm.SHA_512, selectors=[], type_arguments=None)], member=getChecksum, postfix_operators=[], prefix_operators=[], qualifier=ChecksumExtensions, selectors=[], type_arguments=None), name=compareChecksum)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=contentEquality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=compareChecksum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=sourceChecksum, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contentEquality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContentEquality, postfix_operators=[], prefix_operators=[], qualifier=fileContentResultBean, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=contentEquality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCheckSumCRC32, postfix_operators=[], prefix_operators=[], qualifier=ChecksumExtensions, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=compare, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCheckSumCRC32, postfix_operators=[], prefix_operators=[], qualifier=ChecksumExtensions, selectors=[], type_arguments=None), operator===)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contentEquality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContentEquality, postfix_operators=[], prefix_operators=[], qualifier=fileContentResultBean, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=setContentEquality, postfix_operators=[], prefix_operators=[], qualifier=fileContentResultBean, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['IOException']))], finally_block=None, label=None, resources=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchAlgorithmException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=setContentEquality, postfix_operators=[], prefix_operators=[], qualifier=fileContentResultBean, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
call[fileContentResultBean.setContentEquality, parameter[literal[true]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[compare] operator[SEP] Keyword[final] identifier[IFileContentResultBean] identifier[fileContentResultBean] , Keyword[final] Keyword[boolean] identifier[ignoreAbsolutePathEquality] , Keyword[final] Keyword[boolean] identifier[ignoreExtensionEquality] , Keyword[final] Keyword[boolean] identifier[ignoreLengthEquality] , Keyword[final] Keyword[boolean] identifier[ignoreLastModified] , Keyword[final] Keyword[boolean] identifier[ignoreNameEquality] , Keyword[final] Keyword[boolean] identifier[ignoreContentEquality] operator[SEP] {
identifier[compare] operator[SEP] identifier[fileContentResultBean] , identifier[ignoreAbsolutePathEquality] , identifier[ignoreExtensionEquality] , identifier[ignoreLengthEquality] , identifier[ignoreLastModified] , identifier[ignoreNameEquality] operator[SEP] operator[SEP] Keyword[final] identifier[File] identifier[source] operator[=] identifier[fileContentResultBean] operator[SEP] identifier[getSourceFile] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[File] identifier[compare] operator[=] identifier[fileContentResultBean] operator[SEP] identifier[getFileToCompare] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[ignoreContentEquality] operator[SEP] {
Keyword[boolean] identifier[contentEquality] operator[SEP] Keyword[try] {
Keyword[final] identifier[String] identifier[sourceChecksum] operator[=] identifier[ChecksumExtensions] operator[SEP] identifier[getChecksum] operator[SEP] identifier[source] , identifier[HashAlgorithm] operator[SEP] identifier[SHA_512] operator[SEP] identifier[getAlgorithm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[compareChecksum] operator[=] identifier[ChecksumExtensions] operator[SEP] identifier[getChecksum] operator[SEP] identifier[compare] , identifier[HashAlgorithm] operator[SEP] identifier[SHA_512] operator[SEP] identifier[getAlgorithm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[contentEquality] operator[=] identifier[sourceChecksum] operator[SEP] identifier[equals] operator[SEP] identifier[compareChecksum] operator[SEP] operator[SEP] identifier[fileContentResultBean] operator[SEP] identifier[setContentEquality] operator[SEP] identifier[contentEquality] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[NoSuchAlgorithmException] identifier[e] operator[SEP] {
Keyword[try] {
identifier[contentEquality] operator[=] identifier[ChecksumExtensions] operator[SEP] identifier[getCheckSumCRC32] operator[SEP] identifier[source] operator[SEP] operator[==] identifier[ChecksumExtensions] operator[SEP] identifier[getCheckSumCRC32] operator[SEP] identifier[compare] operator[SEP] operator[SEP] identifier[fileContentResultBean] operator[SEP] identifier[setContentEquality] operator[SEP] identifier[contentEquality] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e1] operator[SEP] {
identifier[fileContentResultBean] operator[SEP] identifier[setContentEquality] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[fileContentResultBean] operator[SEP] identifier[setContentEquality] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[fileContentResultBean] operator[SEP] identifier[setContentEquality] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
|
public Texture createTexture (float width, float height, Texture.Config config) {
int texWidth = config.toTexWidth(scale.scaledCeil(width));
int texHeight = config.toTexHeight(scale.scaledCeil(height));
if (texWidth <= 0 || texHeight <= 0) throw new IllegalArgumentException(
"Invalid texture size: " + texWidth + "x" + texHeight);
int id = createTexture(config);
gl.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texWidth, texHeight,
0, GL_RGBA, GL_UNSIGNED_BYTE, null);
return new Texture(this, id, config, texWidth, texHeight, scale, width, height);
} | class class_name[name] begin[{]
method[createTexture, return_type[type[Texture]], modifier[public], parameter[width, height, config]] begin[{]
local_variable[type[int], texWidth]
local_variable[type[int], texHeight]
if[binary_operation[binary_operation[member[.texWidth], <=, literal[0]], ||, binary_operation[member[.texHeight], <=, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid texture size: "), operandr=MemberReference(member=texWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="x"), operator=+), operandr=MemberReference(member=texHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], id]
call[gl.glTexImage2D, parameter[member[.GL_TEXTURE_2D], literal[0], member[.GL_RGBA], member[.texWidth], member[.texHeight], literal[0], member[.GL_RGBA], member[.GL_UNSIGNED_BYTE], literal[null]]]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=texWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=texHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, 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=Texture, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Texture] identifier[createTexture] operator[SEP] Keyword[float] identifier[width] , Keyword[float] identifier[height] , identifier[Texture] operator[SEP] identifier[Config] identifier[config] operator[SEP] {
Keyword[int] identifier[texWidth] operator[=] identifier[config] operator[SEP] identifier[toTexWidth] operator[SEP] identifier[scale] operator[SEP] identifier[scaledCeil] operator[SEP] identifier[width] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[texHeight] operator[=] identifier[config] operator[SEP] identifier[toTexHeight] operator[SEP] identifier[scale] operator[SEP] identifier[scaledCeil] operator[SEP] identifier[height] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[texWidth] operator[<=] Other[0] operator[||] identifier[texHeight] operator[<=] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[texWidth] operator[+] literal[String] operator[+] identifier[texHeight] operator[SEP] operator[SEP] Keyword[int] identifier[id] operator[=] identifier[createTexture] operator[SEP] identifier[config] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glTexImage2D] operator[SEP] identifier[GL_TEXTURE_2D] , Other[0] , identifier[GL_RGBA] , identifier[texWidth] , identifier[texHeight] , Other[0] , identifier[GL_RGBA] , identifier[GL_UNSIGNED_BYTE] , Other[null] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Texture] operator[SEP] Keyword[this] , identifier[id] , identifier[config] , identifier[texWidth] , identifier[texHeight] , identifier[scale] , identifier[width] , identifier[height] operator[SEP] operator[SEP]
}
|
public JsDestinationAddress getReplyDestination()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getReplyDestination");
SibTr.exit(tc, "getReplyDestination", null);
}
// No op for foreign destinations
return null;
} | class class_name[name] begin[{]
method[getReplyDestination, return_type[type[JsDestinationAddress]], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["getReplyDestination"]]]
call[SibTr.exit, parameter[member[.tc], literal["getReplyDestination"], literal[null]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[JsDestinationAddress] identifier[getReplyDestination] 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[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , Other[null] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public DescribeParametersRequest withFilters(ParametersFilter... filters) {
if (this.filters == null) {
setFilters(new com.amazonaws.internal.SdkInternalList<ParametersFilter>(filters.length));
}
for (ParametersFilter ele : filters) {
this.filters.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withFilters, return_type[type[DescribeParametersRequest]], modifier[public], parameter[filters]] begin[{]
if[binary_operation[THIS[member[None.filters]], ==, literal[null]]] begin[{]
call[.setFilters, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=filters, 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=ParametersFilter, 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=filters, 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=filters, 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=ParametersFilter, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[DescribeParametersRequest] identifier[withFilters] operator[SEP] identifier[ParametersFilter] operator[...] identifier[filters] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[filters] operator[==] Other[null] operator[SEP] {
identifier[setFilters] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[ParametersFilter] operator[>] operator[SEP] identifier[filters] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ParametersFilter] identifier[ele] operator[:] identifier[filters] operator[SEP] {
Keyword[this] operator[SEP] identifier[filters] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
static void computePPpX( DMatrixRMaj P , DMatrixRMaj P_plus, DMatrixRMaj X , int offsetX, DMatrixRMaj output ) {
final int N = P.numRows;
output.reshape(N,1);
// A=P_plus * X <-- 2x1
double a00=0,a10=0;
for (int i = 0,indexX=offsetX; i < N; i++, indexX += 2) {
double x = -X.data[indexX];
a00 += x*P_plus.data[i];
a10 += x*P_plus.data[i+N];
}
// P*A
for (int i = 0,indexP=0; i < N; i++) {
output.data[i] = a00*P.data[indexP++] + a10*P.data[indexP++];
}
} | class class_name[name] begin[{]
method[computePPpX, return_type[void], modifier[static], parameter[P, P_plus, X, offsetX, output]] begin[{]
local_variable[type[int], N]
call[output.reshape, parameter[member[.N], literal[1]]]
local_variable[type[double], a00]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=data, postfix_operators=[], prefix_operators=['-'], qualifier=X, selectors=[ArraySelector(index=MemberReference(member=indexX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=x)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=a00, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=P_plus, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=a10, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=P_plus, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=N, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=N, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i), VariableDeclarator(dimensions=[], initializer=MemberReference(member=offsetX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=indexX)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), Assignment(expressionl=MemberReference(member=indexX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=a00, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=P, selectors=[ArraySelector(index=MemberReference(member=indexP, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=a10, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=P, selectors=[ArraySelector(index=MemberReference(member=indexP, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), operator=*), operator=+)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=N, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i), VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=indexP)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[static] Keyword[void] identifier[computePPpX] operator[SEP] identifier[DMatrixRMaj] identifier[P] , identifier[DMatrixRMaj] identifier[P_plus] , identifier[DMatrixRMaj] identifier[X] , Keyword[int] identifier[offsetX] , identifier[DMatrixRMaj] identifier[output] operator[SEP] {
Keyword[final] Keyword[int] identifier[N] operator[=] identifier[P] operator[SEP] identifier[numRows] operator[SEP] identifier[output] operator[SEP] identifier[reshape] operator[SEP] identifier[N] , Other[1] operator[SEP] operator[SEP] Keyword[double] identifier[a00] operator[=] Other[0] , identifier[a10] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[indexX] operator[=] identifier[offsetX] operator[SEP] identifier[i] operator[<] identifier[N] operator[SEP] identifier[i] operator[++] , identifier[indexX] operator[+=] Other[2] operator[SEP] {
Keyword[double] identifier[x] operator[=] operator[-] identifier[X] operator[SEP] identifier[data] operator[SEP] identifier[indexX] operator[SEP] operator[SEP] identifier[a00] operator[+=] identifier[x] operator[*] identifier[P_plus] operator[SEP] identifier[data] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[a10] operator[+=] identifier[x] operator[*] identifier[P_plus] operator[SEP] identifier[data] operator[SEP] identifier[i] operator[+] identifier[N] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[indexP] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[N] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[output] operator[SEP] identifier[data] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[a00] operator[*] identifier[P] operator[SEP] identifier[data] operator[SEP] identifier[indexP] operator[++] operator[SEP] operator[+] identifier[a10] operator[*] identifier[P] operator[SEP] identifier[data] operator[SEP] identifier[indexP] operator[++] operator[SEP] operator[SEP]
}
}
|
public void modify(Channel channel) {
Assert.assertNotNull(channel);
try {
ChannelDO channelDo = modelToDo(channel);
if (channelDao.checkUnique(channelDo)) {
channelDao.update(channelDo);
} else {
String exceptionCause = "exist the same name channel in the database.";
logger.warn("WARN ## " + exceptionCause);
throw new RepeatConfigureException(exceptionCause);
}
} catch (RepeatConfigureException rce) {
throw rce;
} catch (Exception e) {
logger.error("ERROR ## modify channel has an exception ", e);
throw new ManagerException(e);
}
} | class class_name[name] begin[{]
method[modify, return_type[void], modifier[public], parameter[channel]] begin[{]
call[Assert.assertNotNull, parameter[member[.channel]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=modelToDo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=channelDo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelDO, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=channelDo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkUnique, postfix_operators=[], prefix_operators=[], qualifier=channelDao, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="exist the same name channel in the database."), name=exceptionCause)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="WARN ## "), operandr=MemberReference(member=exceptionCause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=exceptionCause, 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=RepeatConfigureException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=channelDo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=update, postfix_operators=[], prefix_operators=[], qualifier=channelDao, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=rce, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=rce, types=['RepeatConfigureException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ERROR ## modify channel has an exception "), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), 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=ManagerException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[modify] operator[SEP] identifier[Channel] identifier[channel] operator[SEP] {
identifier[Assert] operator[SEP] identifier[assertNotNull] operator[SEP] identifier[channel] operator[SEP] operator[SEP] Keyword[try] {
identifier[ChannelDO] identifier[channelDo] operator[=] identifier[modelToDo] operator[SEP] identifier[channel] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[channelDao] operator[SEP] identifier[checkUnique] operator[SEP] identifier[channelDo] operator[SEP] operator[SEP] {
identifier[channelDao] operator[SEP] identifier[update] operator[SEP] identifier[channelDo] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[exceptionCause] operator[=] literal[String] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[exceptionCause] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RepeatConfigureException] operator[SEP] identifier[exceptionCause] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RepeatConfigureException] identifier[rce] operator[SEP] {
Keyword[throw] identifier[rce] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ManagerException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public Matrix4d orthoCrop(Matrix4dc view, Matrix4d dest) {
// determine min/max world z and min/max orthographically view-projected x/y
double minX = Double.POSITIVE_INFINITY, maxX = Double.NEGATIVE_INFINITY;
double minY = Double.POSITIVE_INFINITY, maxY = Double.NEGATIVE_INFINITY;
double minZ = Double.POSITIVE_INFINITY, maxZ = Double.NEGATIVE_INFINITY;
for (int t = 0; t < 8; t++) {
double x = ((t & 1) << 1) - 1.0;
double y = (((t >>> 1) & 1) << 1) - 1.0;
double z = (((t >>> 2) & 1) << 1) - 1.0;
double invW = 1.0 / (m03 * x + m13 * y + m23 * z + m33);
double wx = (m00 * x + m10 * y + m20 * z + m30) * invW;
double wy = (m01 * x + m11 * y + m21 * z + m31) * invW;
double wz = (m02 * x + m12 * y + m22 * z + m32) * invW;
invW = 1.0 / (view.m03() * wx + view.m13() * wy + view.m23() * wz + view.m33());
double vx = view.m00() * wx + view.m10() * wy + view.m20() * wz + view.m30();
double vy = view.m01() * wx + view.m11() * wy + view.m21() * wz + view.m31();
double vz = (view.m02() * wx + view.m12() * wy + view.m22() * wz + view.m32()) * invW;
minX = minX < vx ? minX : vx;
maxX = maxX > vx ? maxX : vx;
minY = minY < vy ? minY : vy;
maxY = maxY > vy ? maxY : vy;
minZ = minZ < vz ? minZ : vz;
maxZ = maxZ > vz ? maxZ : vz;
}
// build crop projection matrix to fit 'this' frustum into view
return dest.setOrtho(minX, maxX, minY, maxY, -maxZ, -minZ);
} | class class_name[name] begin[{]
method[orthoCrop, return_type[type[Matrix4d]], modifier[public], parameter[view, dest]] begin[{]
local_variable[type[double], minX]
local_variable[type[double], minY]
local_variable[type[double], minZ]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<<), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operator=-), name=x)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<<), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operator=-), name=y)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<<), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operator=-), name=z)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=m03, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=m13, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MemberReference(member=m23, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=z, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MemberReference(member=m33, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operator=/), name=invW)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=m00, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=m10, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MemberReference(member=m20, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=z, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MemberReference(member=m30, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=invW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), name=wx)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=m01, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=m11, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MemberReference(member=m21, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=z, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MemberReference(member=m31, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=invW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), name=wy)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=m02, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MemberReference(member=m12, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MemberReference(member=m22, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=z, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MemberReference(member=m32, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=invW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), name=wz)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=invW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m03, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m13, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m23, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MethodInvocation(arguments=[], member=m33, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operator=+), operator=/)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m00, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m10, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m20, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MethodInvocation(arguments=[], member=m30, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operator=+), name=vx)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m01, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m11, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m21, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MethodInvocation(arguments=[], member=m31, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operator=+), name=vy)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m02, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m12, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=m22, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operandr=MemberReference(member=wz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=MethodInvocation(arguments=[], member=m32, postfix_operators=[], prefix_operators=[], qualifier=view, selectors=[], type_arguments=None), operator=+), operandr=MemberReference(member=invW, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), name=vz)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=minX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=minX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=vx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=MemberReference(member=vx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=minX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=maxX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=vx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), if_false=MemberReference(member=vx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=maxX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=minY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=minY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=vy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=MemberReference(member=vy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=minY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=maxY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=vy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), if_false=MemberReference(member=vy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=maxY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=minZ, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=minZ, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=vz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=MemberReference(member=vz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=minZ, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxZ, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=maxZ, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=vz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), if_false=MemberReference(member=vz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=maxZ, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=t)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=t, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[dest.setOrtho, parameter[member[.minX], member[.maxX], member[.minY], member[.maxY], member[.maxZ], member[.minZ]]]]
end[}]
END[}] | Keyword[public] identifier[Matrix4d] identifier[orthoCrop] operator[SEP] identifier[Matrix4dc] identifier[view] , identifier[Matrix4d] identifier[dest] operator[SEP] {
Keyword[double] identifier[minX] operator[=] identifier[Double] operator[SEP] identifier[POSITIVE_INFINITY] , identifier[maxX] operator[=] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP] Keyword[double] identifier[minY] operator[=] identifier[Double] operator[SEP] identifier[POSITIVE_INFINITY] , identifier[maxY] operator[=] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP] Keyword[double] identifier[minZ] operator[=] identifier[Double] operator[SEP] identifier[POSITIVE_INFINITY] , identifier[maxZ] operator[=] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[t] operator[=] Other[0] operator[SEP] identifier[t] operator[<] Other[8] operator[SEP] identifier[t] operator[++] operator[SEP] {
Keyword[double] identifier[x] operator[=] operator[SEP] operator[SEP] identifier[t] operator[&] Other[1] operator[SEP] operator[<<] Other[1] operator[SEP] operator[-] literal[Float] operator[SEP] Keyword[double] identifier[y] operator[=] operator[SEP] operator[SEP] operator[SEP] identifier[t] operator[>] operator[>] operator[>] Other[1] operator[SEP] operator[&] Other[1] operator[SEP] operator[<<] Other[1] operator[SEP] operator[-] literal[Float] operator[SEP] Keyword[double] identifier[z] operator[=] operator[SEP] operator[SEP] operator[SEP] identifier[t] operator[>] operator[>] operator[>] Other[2] operator[SEP] operator[&] Other[1] operator[SEP] operator[<<] Other[1] operator[SEP] operator[-] literal[Float] operator[SEP] Keyword[double] identifier[invW] operator[=] literal[Float] operator[/] operator[SEP] identifier[m03] operator[*] identifier[x] operator[+] identifier[m13] operator[*] identifier[y] operator[+] identifier[m23] operator[*] identifier[z] operator[+] identifier[m33] operator[SEP] operator[SEP] Keyword[double] identifier[wx] operator[=] operator[SEP] identifier[m00] operator[*] identifier[x] operator[+] identifier[m10] operator[*] identifier[y] operator[+] identifier[m20] operator[*] identifier[z] operator[+] identifier[m30] operator[SEP] operator[*] identifier[invW] operator[SEP] Keyword[double] identifier[wy] operator[=] operator[SEP] identifier[m01] operator[*] identifier[x] operator[+] identifier[m11] operator[*] identifier[y] operator[+] identifier[m21] operator[*] identifier[z] operator[+] identifier[m31] operator[SEP] operator[*] identifier[invW] operator[SEP] Keyword[double] identifier[wz] operator[=] operator[SEP] identifier[m02] operator[*] identifier[x] operator[+] identifier[m12] operator[*] identifier[y] operator[+] identifier[m22] operator[*] identifier[z] operator[+] identifier[m32] operator[SEP] operator[*] identifier[invW] operator[SEP] identifier[invW] operator[=] literal[Float] operator[/] operator[SEP] identifier[view] operator[SEP] identifier[m03] operator[SEP] operator[SEP] operator[*] identifier[wx] operator[+] identifier[view] operator[SEP] identifier[m13] operator[SEP] operator[SEP] operator[*] identifier[wy] operator[+] identifier[view] operator[SEP] identifier[m23] operator[SEP] operator[SEP] operator[*] identifier[wz] operator[+] identifier[view] operator[SEP] identifier[m33] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[vx] operator[=] identifier[view] operator[SEP] identifier[m00] operator[SEP] operator[SEP] operator[*] identifier[wx] operator[+] identifier[view] operator[SEP] identifier[m10] operator[SEP] operator[SEP] operator[*] identifier[wy] operator[+] identifier[view] operator[SEP] identifier[m20] operator[SEP] operator[SEP] operator[*] identifier[wz] operator[+] identifier[view] operator[SEP] identifier[m30] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[vy] operator[=] identifier[view] operator[SEP] identifier[m01] operator[SEP] operator[SEP] operator[*] identifier[wx] operator[+] identifier[view] operator[SEP] identifier[m11] operator[SEP] operator[SEP] operator[*] identifier[wy] operator[+] identifier[view] operator[SEP] identifier[m21] operator[SEP] operator[SEP] operator[*] identifier[wz] operator[+] identifier[view] operator[SEP] identifier[m31] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[vz] operator[=] operator[SEP] identifier[view] operator[SEP] identifier[m02] operator[SEP] operator[SEP] operator[*] identifier[wx] operator[+] identifier[view] operator[SEP] identifier[m12] operator[SEP] operator[SEP] operator[*] identifier[wy] operator[+] identifier[view] operator[SEP] identifier[m22] operator[SEP] operator[SEP] operator[*] identifier[wz] operator[+] identifier[view] operator[SEP] identifier[m32] operator[SEP] operator[SEP] operator[SEP] operator[*] identifier[invW] operator[SEP] identifier[minX] operator[=] identifier[minX] operator[<] identifier[vx] operator[?] identifier[minX] operator[:] identifier[vx] operator[SEP] identifier[maxX] operator[=] identifier[maxX] operator[>] identifier[vx] operator[?] identifier[maxX] operator[:] identifier[vx] operator[SEP] identifier[minY] operator[=] identifier[minY] operator[<] identifier[vy] operator[?] identifier[minY] operator[:] identifier[vy] operator[SEP] identifier[maxY] operator[=] identifier[maxY] operator[>] identifier[vy] operator[?] identifier[maxY] operator[:] identifier[vy] operator[SEP] identifier[minZ] operator[=] identifier[minZ] operator[<] identifier[vz] operator[?] identifier[minZ] operator[:] identifier[vz] operator[SEP] identifier[maxZ] operator[=] identifier[maxZ] operator[>] identifier[vz] operator[?] identifier[maxZ] operator[:] identifier[vz] operator[SEP]
}
Keyword[return] identifier[dest] operator[SEP] identifier[setOrtho] operator[SEP] identifier[minX] , identifier[maxX] , identifier[minY] , identifier[maxY] , operator[-] identifier[maxZ] , operator[-] identifier[minZ] operator[SEP] operator[SEP]
}
|
final int getIndexValue() {
if (anteContextLength == pattern.length()) {
// A pattern with just ante context {such as foo)>bar} can
// match any key.
return -1;
}
int c = UTF16.charAt(pattern, anteContextLength);
return data.lookupMatcher(c) == null ? (c & 0xFF) : -1;
} | class class_name[name] begin[{]
method[getIndexValue, return_type[type[int]], modifier[final], parameter[]] begin[{]
if[binary_operation[member[.anteContextLength], ==, call[pattern.length, parameter[]]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
local_variable[type[int], c]
return[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=lookupMatcher, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), if_true=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&))]
end[}]
END[}] | Keyword[final] Keyword[int] identifier[getIndexValue] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[anteContextLength] operator[==] identifier[pattern] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[int] identifier[c] operator[=] identifier[UTF16] operator[SEP] identifier[charAt] operator[SEP] identifier[pattern] , identifier[anteContextLength] operator[SEP] operator[SEP] Keyword[return] identifier[data] operator[SEP] identifier[lookupMatcher] operator[SEP] identifier[c] operator[SEP] operator[==] Other[null] operator[?] operator[SEP] identifier[c] operator[&] literal[Integer] operator[SEP] operator[:] operator[-] Other[1] operator[SEP]
}
|
protected final FluentModelTImpl prepareIndependentDefine(String name) {
FluentModelTImpl childResource = newChildResource(name);
childResource.setPendingOperation(ExternalChildResourceImpl.PendingOperation.ToBeCreated);
return childResource;
} | class class_name[name] begin[{]
method[prepareIndependentDefine, return_type[type[FluentModelTImpl]], modifier[final protected], parameter[name]] begin[{]
local_variable[type[FluentModelTImpl], childResource]
call[childResource.setPendingOperation, parameter[member[ExternalChildResourceImpl.PendingOperation.ToBeCreated]]]
return[member[.childResource]]
end[}]
END[}] | Keyword[protected] Keyword[final] identifier[FluentModelTImpl] identifier[prepareIndependentDefine] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[FluentModelTImpl] identifier[childResource] operator[=] identifier[newChildResource] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[childResource] operator[SEP] identifier[setPendingOperation] operator[SEP] identifier[ExternalChildResourceImpl] operator[SEP] identifier[PendingOperation] operator[SEP] identifier[ToBeCreated] operator[SEP] operator[SEP] Keyword[return] identifier[childResource] operator[SEP]
}
|
public static String collapseWhitespace(final String value) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return value.trim().replaceAll("\\s\\s+", " ");
} | class class_name[name] begin[{]
method[collapseWhitespace, return_type[type[String]], modifier[public static], parameter[value]] begin[{]
call[.validate, parameter[member[.value], member[.NULL_STRING_PREDICATE], member[.NULL_STRING_MSG_SUPPLIER]]]
return[call[value.trim, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[collapseWhitespace] operator[SEP] Keyword[final] identifier[String] identifier[value] operator[SEP] {
identifier[validate] operator[SEP] identifier[value] , identifier[NULL_STRING_PREDICATE] , identifier[NULL_STRING_MSG_SUPPLIER] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
|
public String getString(String columnName, String defaultValue) {
int index = getColumnIndex(columnName);
if (isValidIndex(index)) {
return getString(index);
} else {
return defaultValue;
}
} | class class_name[name] begin[{]
method[getString, return_type[type[String]], modifier[public], parameter[columnName, defaultValue]] begin[{]
local_variable[type[int], index]
if[call[.isValidIndex, parameter[member[.index]]]] begin[{]
return[call[.getString, parameter[member[.index]]]]
else begin[{]
return[member[.defaultValue]]
end[}]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getString] operator[SEP] identifier[String] identifier[columnName] , identifier[String] identifier[defaultValue] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[getColumnIndex] operator[SEP] identifier[columnName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isValidIndex] operator[SEP] identifier[index] operator[SEP] operator[SEP] {
Keyword[return] identifier[getString] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[defaultValue] operator[SEP]
}
}
|
public void insertNode(Node n, int pos)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
insertElementAt(n, pos);
} | class class_name[name] begin[{]
method[insertNode, return_type[void], modifier[public], parameter[n, pos]] begin[{]
if[member[.m_mutable]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ER_NODESET_NOT_MUTABLE, postfix_operators=[], prefix_operators=[], qualifier=XPATHErrorResources, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=createXPATHMessage, postfix_operators=[], prefix_operators=[], qualifier=XSLMessages, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.insertElementAt, parameter[member[.n], member[.pos]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[insertNode] operator[SEP] identifier[Node] identifier[n] , Keyword[int] identifier[pos] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[m_mutable] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[XSLMessages] operator[SEP] identifier[createXPATHMessage] operator[SEP] identifier[XPATHErrorResources] operator[SEP] identifier[ER_NODESET_NOT_MUTABLE] , Other[null] operator[SEP] operator[SEP] operator[SEP] identifier[insertElementAt] operator[SEP] identifier[n] , identifier[pos] operator[SEP] operator[SEP]
}
|
void clearCroutonsForActivity(Activity activity) {
Iterator<Crouton> croutonIterator = croutonQueue.iterator();
while (croutonIterator.hasNext()) {
Crouton crouton = croutonIterator.next();
if ((null != crouton.getActivity()) && crouton.getActivity().equals(activity)) {
// remove the crouton from the content view
removeCroutonFromViewParent(crouton);
removeAllMessagesForCrouton(crouton);
// remove the crouton from the queue
croutonIterator.remove();
}
}
} | class class_name[name] begin[{]
method[clearCroutonsForActivity, return_type[void], modifier[default], parameter[activity]] begin[{]
local_variable[type[Iterator], croutonIterator]
while[call[croutonIterator.hasNext, parameter[]]] begin[{]
local_variable[type[Crouton], crouton]
if[binary_operation[binary_operation[literal[null], !=, call[crouton.getActivity, parameter[]]], &&, call[crouton.getActivity, parameter[]]]] begin[{]
call[.removeCroutonFromViewParent, parameter[member[.crouton]]]
call[.removeAllMessagesForCrouton, parameter[member[.crouton]]]
call[croutonIterator.remove, parameter[]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[void] identifier[clearCroutonsForActivity] operator[SEP] identifier[Activity] identifier[activity] operator[SEP] {
identifier[Iterator] operator[<] identifier[Crouton] operator[>] identifier[croutonIterator] operator[=] identifier[croutonQueue] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[croutonIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Crouton] identifier[crouton] operator[=] identifier[croutonIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] Other[null] operator[!=] identifier[crouton] operator[SEP] identifier[getActivity] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[crouton] operator[SEP] identifier[getActivity] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[activity] operator[SEP] operator[SEP] {
identifier[removeCroutonFromViewParent] operator[SEP] identifier[crouton] operator[SEP] operator[SEP] identifier[removeAllMessagesForCrouton] operator[SEP] identifier[crouton] operator[SEP] operator[SEP] identifier[croutonIterator] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static JSONObject getJSONObject(HttpGet request, Integer method) throws JSONException {
return UpworkRestClient.getJSONObject(request, method, new HashMap<String, String>());
} | class class_name[name] begin[{]
method[getJSONObject, return_type[type[JSONObject]], modifier[public static], parameter[request, method]] begin[{]
return[call[UpworkRestClient.getJSONObject, parameter[member[.request], member[.method], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JSONObject] identifier[getJSONObject] operator[SEP] identifier[HttpGet] identifier[request] , identifier[Integer] identifier[method] operator[SEP] Keyword[throws] identifier[JSONException] {
Keyword[return] identifier[UpworkRestClient] operator[SEP] identifier[getJSONObject] operator[SEP] identifier[request] , identifier[method] , Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Deprecated
public final String formatMeasureRange(Measure lowValue, Measure highValue) {
MeasureUnit unit = lowValue.getUnit();
if (!unit.equals(highValue.getUnit())) {
throw new IllegalArgumentException("Units must match: " + unit + " ≠ " + highValue.getUnit());
}
Number lowNumber = lowValue.getNumber();
Number highNumber = highValue.getNumber();
final boolean isCurrency = unit instanceof Currency;
UFieldPosition lowFpos = new UFieldPosition();
UFieldPosition highFpos = new UFieldPosition();
StringBuffer lowFormatted = null;
StringBuffer highFormatted = null;
if (isCurrency) {
Currency currency = (Currency) unit;
int fracDigits = currency.getDefaultFractionDigits();
int maxFrac = numberFormat.nf.getMaximumFractionDigits();
int minFrac = numberFormat.nf.getMinimumFractionDigits();
if (fracDigits != maxFrac || fracDigits != minFrac) {
DecimalFormat currentNumberFormat = (DecimalFormat) numberFormat.get();
currentNumberFormat.setMaximumFractionDigits(fracDigits);
currentNumberFormat.setMinimumFractionDigits(fracDigits);
lowFormatted = currentNumberFormat.format(lowNumber, new StringBuffer(), lowFpos);
highFormatted = currentNumberFormat.format(highNumber, new StringBuffer(), highFpos);
}
}
if (lowFormatted == null) {
lowFormatted = numberFormat.format(lowNumber, new StringBuffer(), lowFpos);
highFormatted = numberFormat.format(highNumber, new StringBuffer(), highFpos);
}
final double lowDouble = lowNumber.doubleValue();
String keywordLow = rules.select(new PluralRules.FixedDecimal(lowDouble,
lowFpos.getCountVisibleFractionDigits(), lowFpos.getFractionDigits()));
final double highDouble = highNumber.doubleValue();
String keywordHigh = rules.select(new PluralRules.FixedDecimal(highDouble,
highFpos.getCountVisibleFractionDigits(), highFpos.getFractionDigits()));
final PluralRanges pluralRanges = Factory.getDefaultFactory().getPluralRanges(getLocale());
StandardPlural resolvedPlural = pluralRanges.get(
StandardPlural.fromString(keywordLow),
StandardPlural.fromString(keywordHigh));
String rangeFormatter = getRangeFormat(getLocale(), formatWidth);
String formattedNumber = SimpleFormatterImpl.formatCompiledPattern(
rangeFormatter, lowFormatted, highFormatted);
if (isCurrency) {
// Nasty hack
currencyFormat.format(1d); // have to call this for the side effect
Currency currencyUnit = (Currency) unit;
StringBuilder result = new StringBuilder();
appendReplacingCurrency(currencyFormat.getPrefix(lowDouble >= 0), currencyUnit, resolvedPlural, result);
result.append(formattedNumber);
appendReplacingCurrency(currencyFormat.getSuffix(highDouble >= 0), currencyUnit, resolvedPlural, result);
return result.toString();
// StringBuffer buffer = new StringBuffer();
// CurrencyAmount currencyLow = (CurrencyAmount) lowValue;
// CurrencyAmount currencyHigh = (CurrencyAmount) highValue;
// FieldPosition pos = new FieldPosition(NumberFormat.INTEGER_FIELD);
// currencyFormat.format(currencyLow, buffer, pos);
// int startOfInteger = pos.getBeginIndex();
// StringBuffer buffer2 = new StringBuffer();
// FieldPosition pos2 = new FieldPosition(0);
// currencyFormat.format(currencyHigh, buffer2, pos2);
} else {
String formatter =
getPluralFormatter(lowValue.getUnit(), formatWidth, resolvedPlural.ordinal());
return SimpleFormatterImpl.formatCompiledPattern(formatter, formattedNumber);
}
} | class class_name[name] begin[{]
method[formatMeasureRange, return_type[type[String]], modifier[final public], parameter[lowValue, highValue]] begin[{]
local_variable[type[MeasureUnit], unit]
if[call[unit.equals, parameter[call[highValue.getUnit, parameter[]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Units must match: "), operandr=MemberReference(member=unit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ≠ "), operator=+), operandr=MethodInvocation(arguments=[], member=getUnit, postfix_operators=[], prefix_operators=[], qualifier=highValue, 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[}]
local_variable[type[Number], lowNumber]
local_variable[type[Number], highNumber]
local_variable[type[boolean], isCurrency]
local_variable[type[UFieldPosition], lowFpos]
local_variable[type[UFieldPosition], highFpos]
local_variable[type[StringBuffer], lowFormatted]
local_variable[type[StringBuffer], highFormatted]
if[member[.isCurrency]] begin[{]
local_variable[type[Currency], currency]
local_variable[type[int], fracDigits]
local_variable[type[int], maxFrac]
local_variable[type[int], minFrac]
if[binary_operation[binary_operation[member[.fracDigits], !=, member[.maxFrac]], ||, binary_operation[member[.fracDigits], !=, member[.minFrac]]]] begin[{]
local_variable[type[DecimalFormat], currentNumberFormat]
call[currentNumberFormat.setMaximumFractionDigits, parameter[member[.fracDigits]]]
call[currentNumberFormat.setMinimumFractionDigits, parameter[member[.fracDigits]]]
assign[member[.lowFormatted], call[currentNumberFormat.format, parameter[member[.lowNumber], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuffer, sub_type=None)), member[.lowFpos]]]]
assign[member[.highFormatted], call[currentNumberFormat.format, parameter[member[.highNumber], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuffer, sub_type=None)), member[.highFpos]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.lowFormatted], ==, literal[null]]] begin[{]
assign[member[.lowFormatted], call[numberFormat.format, parameter[member[.lowNumber], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuffer, sub_type=None)), member[.lowFpos]]]]
assign[member[.highFormatted], call[numberFormat.format, parameter[member[.highNumber], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuffer, sub_type=None)), member[.highFpos]]]]
else begin[{]
None
end[}]
local_variable[type[double], lowDouble]
local_variable[type[String], keywordLow]
local_variable[type[double], highDouble]
local_variable[type[String], keywordHigh]
local_variable[type[PluralRanges], pluralRanges]
local_variable[type[StandardPlural], resolvedPlural]
local_variable[type[String], rangeFormatter]
local_variable[type[String], formattedNumber]
if[member[.isCurrency]] begin[{]
call[currencyFormat.format, parameter[literal[1d]]]
local_variable[type[Currency], currencyUnit]
local_variable[type[StringBuilder], result]
call[.appendReplacingCurrency, parameter[call[currencyFormat.getPrefix, parameter[binary_operation[member[.lowDouble], >=, literal[0]]]], member[.currencyUnit], member[.resolvedPlural], member[.result]]]
call[result.append, parameter[member[.formattedNumber]]]
call[.appendReplacingCurrency, parameter[call[currencyFormat.getSuffix, parameter[binary_operation[member[.highDouble], >=, literal[0]]]], member[.currencyUnit], member[.resolvedPlural], member[.result]]]
return[call[result.toString, parameter[]]]
else begin[{]
local_variable[type[String], formatter]
return[call[SimpleFormatterImpl.formatCompiledPattern, parameter[member[.formatter], member[.formattedNumber]]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[final] identifier[String] identifier[formatMeasureRange] operator[SEP] identifier[Measure] identifier[lowValue] , identifier[Measure] identifier[highValue] operator[SEP] {
identifier[MeasureUnit] identifier[unit] operator[=] identifier[lowValue] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[unit] operator[SEP] identifier[equals] operator[SEP] identifier[highValue] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[unit] operator[+] literal[String] operator[+] identifier[highValue] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Number] identifier[lowNumber] operator[=] identifier[lowValue] operator[SEP] identifier[getNumber] operator[SEP] operator[SEP] operator[SEP] identifier[Number] identifier[highNumber] operator[=] identifier[highValue] operator[SEP] identifier[getNumber] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[isCurrency] operator[=] identifier[unit] Keyword[instanceof] identifier[Currency] operator[SEP] identifier[UFieldPosition] identifier[lowFpos] operator[=] Keyword[new] identifier[UFieldPosition] operator[SEP] operator[SEP] operator[SEP] identifier[UFieldPosition] identifier[highFpos] operator[=] Keyword[new] identifier[UFieldPosition] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[lowFormatted] operator[=] Other[null] operator[SEP] identifier[StringBuffer] identifier[highFormatted] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[isCurrency] operator[SEP] {
identifier[Currency] identifier[currency] operator[=] operator[SEP] identifier[Currency] operator[SEP] identifier[unit] operator[SEP] Keyword[int] identifier[fracDigits] operator[=] identifier[currency] operator[SEP] identifier[getDefaultFractionDigits] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[maxFrac] operator[=] identifier[numberFormat] operator[SEP] identifier[nf] operator[SEP] identifier[getMaximumFractionDigits] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[minFrac] operator[=] identifier[numberFormat] operator[SEP] identifier[nf] operator[SEP] identifier[getMinimumFractionDigits] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fracDigits] operator[!=] identifier[maxFrac] operator[||] identifier[fracDigits] operator[!=] identifier[minFrac] operator[SEP] {
identifier[DecimalFormat] identifier[currentNumberFormat] operator[=] operator[SEP] identifier[DecimalFormat] operator[SEP] identifier[numberFormat] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[currentNumberFormat] operator[SEP] identifier[setMaximumFractionDigits] operator[SEP] identifier[fracDigits] operator[SEP] operator[SEP] identifier[currentNumberFormat] operator[SEP] identifier[setMinimumFractionDigits] operator[SEP] identifier[fracDigits] operator[SEP] operator[SEP] identifier[lowFormatted] operator[=] identifier[currentNumberFormat] operator[SEP] identifier[format] operator[SEP] identifier[lowNumber] , Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] , identifier[lowFpos] operator[SEP] operator[SEP] identifier[highFormatted] operator[=] identifier[currentNumberFormat] operator[SEP] identifier[format] operator[SEP] identifier[highNumber] , Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] , identifier[highFpos] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[lowFormatted] operator[==] Other[null] operator[SEP] {
identifier[lowFormatted] operator[=] identifier[numberFormat] operator[SEP] identifier[format] operator[SEP] identifier[lowNumber] , Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] , identifier[lowFpos] operator[SEP] operator[SEP] identifier[highFormatted] operator[=] identifier[numberFormat] operator[SEP] identifier[format] operator[SEP] identifier[highNumber] , Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] , identifier[highFpos] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[double] identifier[lowDouble] operator[=] identifier[lowNumber] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[keywordLow] operator[=] identifier[rules] operator[SEP] identifier[select] operator[SEP] Keyword[new] identifier[PluralRules] operator[SEP] identifier[FixedDecimal] operator[SEP] identifier[lowDouble] , identifier[lowFpos] operator[SEP] identifier[getCountVisibleFractionDigits] operator[SEP] operator[SEP] , identifier[lowFpos] operator[SEP] identifier[getFractionDigits] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[highDouble] operator[=] identifier[highNumber] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[keywordHigh] operator[=] identifier[rules] operator[SEP] identifier[select] operator[SEP] Keyword[new] identifier[PluralRules] operator[SEP] identifier[FixedDecimal] operator[SEP] identifier[highDouble] , identifier[highFpos] operator[SEP] identifier[getCountVisibleFractionDigits] operator[SEP] operator[SEP] , identifier[highFpos] operator[SEP] identifier[getFractionDigits] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[PluralRanges] identifier[pluralRanges] operator[=] identifier[Factory] operator[SEP] identifier[getDefaultFactory] operator[SEP] operator[SEP] operator[SEP] identifier[getPluralRanges] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[StandardPlural] identifier[resolvedPlural] operator[=] identifier[pluralRanges] operator[SEP] identifier[get] operator[SEP] identifier[StandardPlural] operator[SEP] identifier[fromString] operator[SEP] identifier[keywordLow] operator[SEP] , identifier[StandardPlural] operator[SEP] identifier[fromString] operator[SEP] identifier[keywordHigh] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[rangeFormatter] operator[=] identifier[getRangeFormat] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] , identifier[formatWidth] operator[SEP] operator[SEP] identifier[String] identifier[formattedNumber] operator[=] identifier[SimpleFormatterImpl] operator[SEP] identifier[formatCompiledPattern] operator[SEP] identifier[rangeFormatter] , identifier[lowFormatted] , identifier[highFormatted] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isCurrency] operator[SEP] {
identifier[currencyFormat] operator[SEP] identifier[format] operator[SEP] literal[Float] operator[SEP] operator[SEP] identifier[Currency] identifier[currencyUnit] operator[=] operator[SEP] identifier[Currency] operator[SEP] identifier[unit] operator[SEP] identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[appendReplacingCurrency] operator[SEP] identifier[currencyFormat] operator[SEP] identifier[getPrefix] operator[SEP] identifier[lowDouble] operator[>=] Other[0] operator[SEP] , identifier[currencyUnit] , identifier[resolvedPlural] , identifier[result] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[formattedNumber] operator[SEP] operator[SEP] identifier[appendReplacingCurrency] operator[SEP] identifier[currencyFormat] operator[SEP] identifier[getSuffix] operator[SEP] identifier[highDouble] operator[>=] Other[0] operator[SEP] , identifier[currencyUnit] , identifier[resolvedPlural] , identifier[result] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[formatter] operator[=] identifier[getPluralFormatter] operator[SEP] identifier[lowValue] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] , identifier[formatWidth] , identifier[resolvedPlural] operator[SEP] identifier[ordinal] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[SimpleFormatterImpl] operator[SEP] identifier[formatCompiledPattern] operator[SEP] identifier[formatter] , identifier[formattedNumber] operator[SEP] operator[SEP]
}
}
|
@GwtIncompatible("InputStream")
static InputStream asInputStream(final ByteInput input) {
checkNotNull(input);
return new InputStream() {
@Override
public int read() throws IOException {
return input.read();
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
checkNotNull(b);
checkPositionIndexes(off, off + len, b.length);
if (len == 0) {
return 0;
}
int firstByte = read();
if (firstByte == -1) {
return -1;
}
b[off] = (byte) firstByte;
for (int dst = 1; dst < len; dst++) {
int readByte = read();
if (readByte == -1) {
return dst;
}
b[off + dst] = (byte) readByte;
}
return len;
}
@Override
public void close() throws IOException {
input.close();
}
};
} | class class_name[name] begin[{]
method[asInputStream, return_type[type[InputStream]], modifier[static], parameter[input]] begin[{]
call[.checkNotNull, parameter[member[.input]]]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=read, parameters=[], return_type=BasicType(dimensions=[], name=int), throws=['IOException'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkNotNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=off, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=off, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[])], member=checkPositionIndexes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=len, 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=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=firstByte)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=firstByte, 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=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=off, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MemberReference(member=firstByte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))), label=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=readByte)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=readByte, 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=[ReturnStatement(expression=MemberReference(member=dst, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=off, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dst, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), type==, value=Cast(expression=MemberReference(member=readByte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=dst, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=dst)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=dst, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), ReturnStatement(expression=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=read, parameters=[FormalParameter(annotations=[], modifiers=set(), name=b, type=BasicType(dimensions=[None], name=byte), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=off, type=BasicType(dimensions=[], name=int), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=len, type=BasicType(dimensions=[], name=int), varargs=False)], return_type=BasicType(dimensions=[], name=int), throws=['IOException'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=close, parameters=[], return_type=None, throws=['IOException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStream, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[GwtIncompatible] operator[SEP] literal[String] operator[SEP] Keyword[static] identifier[InputStream] identifier[asInputStream] operator[SEP] Keyword[final] identifier[ByteInput] identifier[input] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[InputStream] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[read] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[input] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[read] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[b] , Keyword[int] identifier[off] , Keyword[int] identifier[len] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[checkNotNull] operator[SEP] identifier[b] operator[SEP] operator[SEP] identifier[checkPositionIndexes] operator[SEP] identifier[off] , identifier[off] operator[+] identifier[len] , identifier[b] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[len] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[0] operator[SEP]
}
Keyword[int] identifier[firstByte] operator[=] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstByte] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
identifier[b] operator[SEP] identifier[off] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[firstByte] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[dst] operator[=] Other[1] operator[SEP] identifier[dst] operator[<] identifier[len] operator[SEP] identifier[dst] operator[++] operator[SEP] {
Keyword[int] identifier[readByte] operator[=] identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[readByte] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[dst] operator[SEP]
}
identifier[b] operator[SEP] identifier[off] operator[+] identifier[dst] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[readByte] operator[SEP]
}
Keyword[return] identifier[len] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[input] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public void marshall(GetDevEndpointRequest getDevEndpointRequest, ProtocolMarshaller protocolMarshaller) {
if (getDevEndpointRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getDevEndpointRequest.getEndpointName(), ENDPOINTNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[getDevEndpointRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.getDevEndpointRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEndpointName, postfix_operators=[], prefix_operators=[], qualifier=getDevEndpointRequest, selectors=[], type_arguments=None), MemberReference(member=ENDPOINTNAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[GetDevEndpointRequest] identifier[getDevEndpointRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[getDevEndpointRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getDevEndpointRequest] operator[SEP] identifier[getEndpointName] operator[SEP] operator[SEP] , identifier[ENDPOINTNAME_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public EClass getIfcStructuralPointReaction() {
if (ifcStructuralPointReactionEClass == null) {
ifcStructuralPointReactionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(560);
}
return ifcStructuralPointReactionEClass;
} | class class_name[name] begin[{]
method[getIfcStructuralPointReaction, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcStructuralPointReactionEClass], ==, literal[null]]] begin[{]
assign[member[.ifcStructuralPointReactionEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc2x3tc1Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=560)], 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[.ifcStructuralPointReactionEClass]]
end[}]
END[}] | Keyword[public] identifier[EClass] identifier[getIfcStructuralPointReaction] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcStructuralPointReactionEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcStructuralPointReactionEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc2x3tc1Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[560] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcStructuralPointReactionEClass] operator[SEP]
}
|
@CallMethod(pattern = "install/version/description")
public void appendDescription(@CallParam(pattern = "install/version/description") final String _desc)
{
if (_desc != null) {
this.description.append(_desc.trim()).append("\n");
}
} | class class_name[name] begin[{]
method[appendDescription, return_type[void], modifier[public], parameter[_desc]] begin[{]
if[binary_operation[member[._desc], !=, literal[null]]] begin[{]
THIS[member[None.description]call[None.append, parameter[call[_desc.trim, parameter[]]]]call[None.append, parameter[literal["\n"]]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[CallMethod] operator[SEP] identifier[pattern] operator[=] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[appendDescription] operator[SEP] annotation[@] identifier[CallParam] operator[SEP] identifier[pattern] operator[=] literal[String] operator[SEP] Keyword[final] identifier[String] identifier[_desc] operator[SEP] {
Keyword[if] operator[SEP] identifier[_desc] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[description] operator[SEP] identifier[append] operator[SEP] identifier[_desc] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public static <T> void forEach(T[] objectArray, int from, int to, Procedure<? super T> procedure)
{
if (objectArray == null)
{
throw new IllegalArgumentException("Cannot perform a forEach on null");
}
ListIterate.rangeCheck(from, to, objectArray.length);
InternalArrayIterate.forEachWithoutChecks(objectArray, from, to, procedure);
} | class class_name[name] begin[{]
method[forEach, return_type[void], modifier[public static], parameter[objectArray, from, to, procedure]] begin[{]
if[binary_operation[member[.objectArray], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot perform a forEach on null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[ListIterate.rangeCheck, parameter[member[.from], member[.to], member[objectArray.length]]]
call[InternalArrayIterate.forEachWithoutChecks, parameter[member[.objectArray], member[.from], member[.to], member[.procedure]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[void] identifier[forEach] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[objectArray] , Keyword[int] identifier[from] , Keyword[int] identifier[to] , identifier[Procedure] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[procedure] operator[SEP] {
Keyword[if] operator[SEP] identifier[objectArray] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ListIterate] operator[SEP] identifier[rangeCheck] operator[SEP] identifier[from] , identifier[to] , identifier[objectArray] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[InternalArrayIterate] operator[SEP] identifier[forEachWithoutChecks] operator[SEP] identifier[objectArray] , identifier[from] , identifier[to] , identifier[procedure] operator[SEP] operator[SEP]
}
|
private final boolean removeHandle(WSJdbcConnection handle) {
// Find the handle in the list and remove it.
for (int i = numHandlesInUse; i > 0;)
if (handle == handlesInUse[--i]) {
// Once found, the handle is removed by replacing it with the last handle in the
// list and nulling out the previous entry for the last handle.
handlesInUse[i] = handlesInUse[--numHandlesInUse];
handlesInUse[numHandlesInUse] = null;
return true;
}
// The handle wasn't found in the list.
return false;
} | class class_name[name] begin[{]
method[removeHandle, return_type[type[boolean]], modifier[final private], parameter[handle]] begin[{]
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=handle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=handlesInUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[]))]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=handlesInUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=handlesInUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=numHandlesInUse, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=handlesInUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=numHandlesInUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=numHandlesInUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=None), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[final] Keyword[boolean] identifier[removeHandle] operator[SEP] identifier[WSJdbcConnection] identifier[handle] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[numHandlesInUse] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[handle] operator[==] identifier[handlesInUse] operator[SEP] operator[--] identifier[i] operator[SEP] operator[SEP] {
identifier[handlesInUse] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[handlesInUse] operator[SEP] operator[--] identifier[numHandlesInUse] operator[SEP] operator[SEP] identifier[handlesInUse] operator[SEP] identifier[numHandlesInUse] operator[SEP] operator[=] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private _Private_IonBinaryWriterBuilder fillLegacyDefaults()
{
// amzn/ion-java/issues/59 Fix this to use the new writer or eliminate it
// Ensure that we don't modify the user's builder.
_Private_IonBinaryWriterBuilder b = copy();
if (b.getSymtabValueFactory() == null)
{
IonSystem system = IonSystemBuilder.standard().build();
b.setSymtabValueFactory(system);
}
SymbolTable initialSymtab = b.getInitialSymbolTable();
if (initialSymtab == null)
{
initialSymtab = initialSymtab(LocalSymbolTable.DEFAULT_LST_FACTORY,
_Private_Utils.systemSymtab(1),
b.getImports());
b.setInitialSymbolTable(initialSymtab);
}
else if (initialSymtab.isSystemTable())
{
initialSymtab = initialSymtab(LocalSymbolTable.DEFAULT_LST_FACTORY,
initialSymtab,
b.getImports());
b.setInitialSymbolTable(initialSymtab);
}
return b.immutable();
} | class class_name[name] begin[{]
method[fillLegacyDefaults, return_type[type[_Private_IonBinaryWriterBuilder]], modifier[private], parameter[]] begin[{]
local_variable[type[_Private_IonBinaryWriterBuilder], b]
if[binary_operation[call[b.getSymtabValueFactory, parameter[]], ==, literal[null]]] begin[{]
local_variable[type[IonSystem], system]
call[b.setSymtabValueFactory, parameter[member[.system]]]
else begin[{]
None
end[}]
local_variable[type[SymbolTable], initialSymtab]
if[binary_operation[member[.initialSymtab], ==, literal[null]]] begin[{]
assign[member[.initialSymtab], call[.initialSymtab, parameter[member[LocalSymbolTable.DEFAULT_LST_FACTORY], call[_Private_Utils.systemSymtab, parameter[literal[1]]], call[b.getImports, parameter[]]]]]
call[b.setInitialSymbolTable, parameter[member[.initialSymtab]]]
else begin[{]
if[call[initialSymtab.isSystemTable, parameter[]]] begin[{]
assign[member[.initialSymtab], call[.initialSymtab, parameter[member[LocalSymbolTable.DEFAULT_LST_FACTORY], member[.initialSymtab], call[b.getImports, parameter[]]]]]
call[b.setInitialSymbolTable, parameter[member[.initialSymtab]]]
else begin[{]
None
end[}]
end[}]
return[call[b.immutable, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[_Private_IonBinaryWriterBuilder] identifier[fillLegacyDefaults] operator[SEP] operator[SEP] {
identifier[_Private_IonBinaryWriterBuilder] identifier[b] operator[=] identifier[copy] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[b] operator[SEP] identifier[getSymtabValueFactory] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[IonSystem] identifier[system] operator[=] identifier[IonSystemBuilder] operator[SEP] identifier[standard] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[setSymtabValueFactory] operator[SEP] identifier[system] operator[SEP] operator[SEP]
}
identifier[SymbolTable] identifier[initialSymtab] operator[=] identifier[b] operator[SEP] identifier[getInitialSymbolTable] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[initialSymtab] operator[==] Other[null] operator[SEP] {
identifier[initialSymtab] operator[=] identifier[initialSymtab] operator[SEP] identifier[LocalSymbolTable] operator[SEP] identifier[DEFAULT_LST_FACTORY] , identifier[_Private_Utils] operator[SEP] identifier[systemSymtab] operator[SEP] Other[1] operator[SEP] , identifier[b] operator[SEP] identifier[getImports] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[setInitialSymbolTable] operator[SEP] identifier[initialSymtab] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[initialSymtab] operator[SEP] identifier[isSystemTable] operator[SEP] operator[SEP] operator[SEP] {
identifier[initialSymtab] operator[=] identifier[initialSymtab] operator[SEP] identifier[LocalSymbolTable] operator[SEP] identifier[DEFAULT_LST_FACTORY] , identifier[initialSymtab] , identifier[b] operator[SEP] identifier[getImports] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[setInitialSymbolTable] operator[SEP] identifier[initialSymtab] operator[SEP] operator[SEP]
}
Keyword[return] identifier[b] operator[SEP] identifier[immutable] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Map<String, String[]> splitMap(Map<String, String[]> src, double rate)
{
assert 0 <= rate && rate <= 1;
Map<String, String[]> output = new TreeMap<String, String[]>();
for (Map.Entry<String, String[]> entry : src.entrySet())
{
String[][] array = spiltArray(entry.getValue(), rate);
output.put(entry.getKey(), array[0]);
entry.setValue(array[1]);
}
return output;
} | class class_name[name] begin[{]
method[splitMap, return_type[type[Map]], modifier[public static], parameter[src, rate]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operandr=MemberReference(member=rate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operandr=BinaryOperation(operandl=MemberReference(member=rate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<=), operator=&&), label=None, value=None)
local_variable[type[Map], output]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=rate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=spiltArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=array)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None, None], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))])], member=put, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=src, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.output]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[splitMap] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[src] , Keyword[double] identifier[rate] operator[SEP] {
Keyword[assert] Other[0] operator[<=] identifier[rate] operator[&&] identifier[rate] operator[<=] Other[1] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[output] operator[=] Keyword[new] identifier[TreeMap] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[entry] operator[:] identifier[src] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[array] operator[=] identifier[spiltArray] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[rate] operator[SEP] operator[SEP] identifier[output] operator[SEP] identifier[put] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[array] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[setValue] operator[SEP] identifier[array] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[output] operator[SEP]
}
|
public static Pair<String, String> splitLong(long value)
{
return Pair.of(String.valueOf((int)(value >> 32)), String.valueOf((int)value));
} | class class_name[name] begin[{]
method[splitLong, return_type[type[Pair]], modifier[public static], parameter[value]] begin[{]
return[call[Pair.of, parameter[call[String.valueOf, parameter[Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32), operator=>>), type=BasicType(dimensions=[], name=int))]], call[String.valueOf, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Pair] operator[<] identifier[String] , identifier[String] operator[>] identifier[splitLong] operator[SEP] Keyword[long] identifier[value] operator[SEP] {
Keyword[return] identifier[Pair] operator[SEP] identifier[of] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] Other[32] operator[SEP] operator[SEP] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String padOrTrim(String str, int num) {
if (str == null) {
str = "null";
}
int leng = str.length();
if (leng < num) {
StringBuilder sb = new StringBuilder(str);
for (int i = 0; i < num - leng; i++) {
sb.append(' ');
}
return sb.toString();
} else if (leng > num) {
return str.substring(0, num);
} else {
return str;
}
} | class class_name[name] begin[{]
method[padOrTrim, return_type[type[String]], modifier[public static], parameter[str, num]] begin[{]
if[binary_operation[member[.str], ==, literal[null]]] begin[{]
assign[member[.str], literal["null"]]
else begin[{]
None
end[}]
local_variable[type[int], leng]
if[binary_operation[member[.leng], <, member[.num]]] begin[{]
local_variable[type[StringBuilder], sb]
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=sb, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=num, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=leng, 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=[])]), label=None)
return[call[sb.toString, parameter[]]]
else begin[{]
if[binary_operation[member[.leng], >, member[.num]]] begin[{]
return[call[str.substring, parameter[literal[0], member[.num]]]]
else begin[{]
return[member[.str]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[padOrTrim] operator[SEP] identifier[String] identifier[str] , Keyword[int] identifier[num] operator[SEP] {
Keyword[if] operator[SEP] identifier[str] operator[==] Other[null] operator[SEP] {
identifier[str] operator[=] literal[String] operator[SEP]
}
Keyword[int] identifier[leng] operator[=] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[leng] operator[<] identifier[num] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[str] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[num] operator[-] identifier[leng] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[leng] operator[>] identifier[num] operator[SEP] {
Keyword[return] identifier[str] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[num] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[str] operator[SEP]
}
}
|
public static TypeDeclarationNode functionType(
Node returnType, LinkedHashMap<String, TypeDeclarationNode> requiredParams,
LinkedHashMap<String, TypeDeclarationNode> optionalParams,
String restName, TypeDeclarationNode restType) {
TypeDeclarationNode node = new TypeDeclarationNode(Token.FUNCTION_TYPE, returnType);
checkNotNull(requiredParams);
checkNotNull(optionalParams);
for (Map.Entry<String, TypeDeclarationNode> param : requiredParams.entrySet()) {
Node name = IR.name(param.getKey());
node.addChildToBack(maybeAddType(name, param.getValue()));
}
for (Map.Entry<String, TypeDeclarationNode> param : optionalParams.entrySet()) {
Node name = IR.name(param.getKey());
name.putBooleanProp(Node.OPT_ES6_TYPED, true);
node.addChildToBack(maybeAddType(name, param.getValue()));
}
if (restName != null) {
Node rest = new Node(Token.REST, IR.name(restName));
node.addChildToBack(maybeAddType(rest, restType));
}
return node;
} | class class_name[name] begin[{]
method[functionType, return_type[type[TypeDeclarationNode]], modifier[public static], parameter[returnType, requiredParams, optionalParams, restName, restType]] begin[{]
local_variable[type[TypeDeclarationNode], node]
call[.checkNotNull, parameter[member[.requiredParams]]]
call[.checkNotNull, parameter[member[.optionalParams]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None)], member=name, postfix_operators=[], prefix_operators=[], qualifier=IR, selectors=[], type_arguments=None), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None)], member=maybeAddType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addChildToBack, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=requiredParams, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=param)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TypeDeclarationNode, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None)], member=name, postfix_operators=[], prefix_operators=[], qualifier=IR, selectors=[], type_arguments=None), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=OPT_ES6_TYPED, postfix_operators=[], prefix_operators=[], qualifier=Node, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=putBooleanProp, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None)], member=maybeAddType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addChildToBack, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=optionalParams, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=param)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TypeDeclarationNode, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
if[binary_operation[member[.restName], !=, literal[null]]] begin[{]
local_variable[type[Node], rest]
call[node.addChildToBack, parameter[call[.maybeAddType, parameter[member[.rest], member[.restType]]]]]
else begin[{]
None
end[}]
return[member[.node]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TypeDeclarationNode] identifier[functionType] operator[SEP] identifier[Node] identifier[returnType] , identifier[LinkedHashMap] operator[<] identifier[String] , identifier[TypeDeclarationNode] operator[>] identifier[requiredParams] , identifier[LinkedHashMap] operator[<] identifier[String] , identifier[TypeDeclarationNode] operator[>] identifier[optionalParams] , identifier[String] identifier[restName] , identifier[TypeDeclarationNode] identifier[restType] operator[SEP] {
identifier[TypeDeclarationNode] identifier[node] operator[=] Keyword[new] identifier[TypeDeclarationNode] operator[SEP] identifier[Token] operator[SEP] identifier[FUNCTION_TYPE] , identifier[returnType] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[requiredParams] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[optionalParams] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[TypeDeclarationNode] operator[>] identifier[param] operator[:] identifier[requiredParams] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Node] identifier[name] operator[=] identifier[IR] operator[SEP] identifier[name] operator[SEP] identifier[param] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[addChildToBack] operator[SEP] identifier[maybeAddType] operator[SEP] identifier[name] , identifier[param] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[TypeDeclarationNode] operator[>] identifier[param] operator[:] identifier[optionalParams] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Node] identifier[name] operator[=] identifier[IR] operator[SEP] identifier[name] operator[SEP] identifier[param] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[name] operator[SEP] identifier[putBooleanProp] operator[SEP] identifier[Node] operator[SEP] identifier[OPT_ES6_TYPED] , literal[boolean] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[addChildToBack] operator[SEP] identifier[maybeAddType] operator[SEP] identifier[name] , identifier[param] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[restName] operator[!=] Other[null] operator[SEP] {
identifier[Node] identifier[rest] operator[=] Keyword[new] identifier[Node] operator[SEP] identifier[Token] operator[SEP] identifier[REST] , identifier[IR] operator[SEP] identifier[name] operator[SEP] identifier[restName] operator[SEP] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[addChildToBack] operator[SEP] identifier[maybeAddType] operator[SEP] identifier[rest] , identifier[restType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[node] operator[SEP]
}
|
public void removeTag(String tagName) {
for (int i = 0; i < tags.size(); i++) {
if (tags.get(i).getName().equals(tagName)) {
tags.remove(i);
if (hashTagsName.containsKey(tagName))
hashTagsName.remove(tagName);
if (hashTagsId.containsKey(TiffTags.getTagId(tagName)))
hashTagsId.remove(TiffTags.getTagId(tagName));
i--;
}
}
} | class class_name[name] begin[{]
method[removeTag, return_type[void], modifier[public], parameter[tagName]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=tags, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=tags, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=hashTagsName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=hashTagsName, selectors=[], type_arguments=None), label=None)), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTagId, postfix_operators=[], prefix_operators=[], qualifier=TiffTags, selectors=[], type_arguments=None)], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=hashTagsId, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTagId, postfix_operators=[], prefix_operators=[], qualifier=TiffTags, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=hashTagsId, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=tags, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeTag] operator[SEP] identifier[String] identifier[tagName] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[tags] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[tags] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[tagName] operator[SEP] operator[SEP] {
identifier[tags] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hashTagsName] operator[SEP] identifier[containsKey] operator[SEP] identifier[tagName] operator[SEP] operator[SEP] identifier[hashTagsName] operator[SEP] identifier[remove] operator[SEP] identifier[tagName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hashTagsId] operator[SEP] identifier[containsKey] operator[SEP] identifier[TiffTags] operator[SEP] identifier[getTagId] operator[SEP] identifier[tagName] operator[SEP] operator[SEP] operator[SEP] identifier[hashTagsId] operator[SEP] identifier[remove] operator[SEP] identifier[TiffTags] operator[SEP] identifier[getTagId] operator[SEP] identifier[tagName] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[--] operator[SEP]
}
}
}
|
public void writeElement( String name,
int type ) {
StringBuilder nsdecl = new StringBuilder();
if (isRootElement) {
for (Iterator<String> iter = namespaces.keySet().iterator(); iter.hasNext();) {
String fullName = iter.next();
String abbrev = namespaces.get(fullName);
nsdecl.append(" xmlns:").append(abbrev).append("=\"").append(fullName).append("\"");
}
isRootElement = false;
}
int pos = name.lastIndexOf(':');
if (pos >= 0) {
// lookup prefix for namespace
String fullns = name.substring(0, pos);
String prefix = namespaces.get(fullns);
// check if instead of a full URI, the prefix is used
if (prefix == null && namespaces.containsValue(fullns)) {
prefix = fullns;
}
if (prefix == null) {
// there is no prefix for this namespace
name = name.substring(pos + 1);
nsdecl.append(" xmlns=\"").append(fullns).append("\"");
} else {
// there is a prefix
name = prefix + ":" + name.substring(pos + 1);
}
}
switch (type) {
case OPENING:
buffer.append("<" + name + nsdecl + ">");
break;
case CLOSING:
buffer.append("</" + name + ">\n");
break;
case NO_CONTENT:
default:
buffer.append("<" + name + nsdecl + "/>");
break;
}
} | class class_name[name] begin[{]
method[writeElement, return_type[void], modifier[public], parameter[name, type]] begin[{]
local_variable[type[StringBuilder], nsdecl]
if[member[.isRootElement]] 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=fullName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fullName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=namespaces, selectors=[], type_arguments=None), name=abbrev)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" xmlns:")], member=append, postfix_operators=[], prefix_operators=[], qualifier=nsdecl, selectors=[MethodInvocation(arguments=[MemberReference(member=abbrev, 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), MethodInvocation(arguments=[MemberReference(member=fullName, 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)]), 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=keySet, postfix_operators=[], prefix_operators=[], qualifier=namespaces, selectors=[MethodInvocation(arguments=[], member=iterator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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)
assign[member[.isRootElement], literal[false]]
else begin[{]
None
end[}]
local_variable[type[int], pos]
if[binary_operation[member[.pos], >=, literal[0]]] begin[{]
local_variable[type[String], fullns]
local_variable[type[String], prefix]
if[binary_operation[binary_operation[member[.prefix], ==, literal[null]], &&, call[namespaces.containsValue, parameter[member[.fullns]]]]] begin[{]
assign[member[.prefix], member[.fullns]]
else begin[{]
None
end[}]
if[binary_operation[member[.prefix], ==, literal[null]]] begin[{]
assign[member[.name], call[name.substring, parameter[binary_operation[member[.pos], +, literal[1]]]]]
call[nsdecl.append, parameter[literal[" xmlns=\""]]]
else begin[{]
assign[member[.name], binary_operation[binary_operation[member[.prefix], +, literal[":"]], +, call[name.substring, parameter[binary_operation[member[.pos], +, literal[1]]]]]]
end[}]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=['OPENING'], statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<"), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=nsdecl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=">"), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CLOSING'], statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="</"), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=">\n"), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['NO_CONTENT'], statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<"), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=nsdecl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/>"), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[writeElement] operator[SEP] identifier[String] identifier[name] , Keyword[int] identifier[type] operator[SEP] {
identifier[StringBuilder] identifier[nsdecl] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isRootElement] operator[SEP] {
Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[iter] operator[=] identifier[namespaces] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] 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[fullName] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[abbrev] operator[=] identifier[namespaces] operator[SEP] identifier[get] operator[SEP] identifier[fullName] operator[SEP] operator[SEP] identifier[nsdecl] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[abbrev] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fullName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[isRootElement] operator[=] literal[boolean] operator[SEP]
}
Keyword[int] identifier[pos] operator[=] identifier[name] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pos] operator[>=] Other[0] operator[SEP] {
identifier[String] identifier[fullns] operator[=] identifier[name] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[pos] operator[SEP] operator[SEP] identifier[String] identifier[prefix] operator[=] identifier[namespaces] operator[SEP] identifier[get] operator[SEP] identifier[fullns] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[prefix] operator[==] Other[null] operator[&&] identifier[namespaces] operator[SEP] identifier[containsValue] operator[SEP] identifier[fullns] operator[SEP] operator[SEP] {
identifier[prefix] operator[=] identifier[fullns] operator[SEP]
}
Keyword[if] operator[SEP] identifier[prefix] operator[==] Other[null] operator[SEP] {
identifier[name] operator[=] identifier[name] operator[SEP] identifier[substring] operator[SEP] identifier[pos] operator[+] Other[1] operator[SEP] operator[SEP] identifier[nsdecl] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fullns] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[name] operator[=] identifier[prefix] operator[+] literal[String] operator[+] identifier[name] operator[SEP] identifier[substring] operator[SEP] identifier[pos] operator[+] Other[1] operator[SEP] operator[SEP]
}
}
Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[OPENING] operator[:] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[name] operator[+] identifier[nsdecl] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CLOSING] operator[:] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[NO_CONTENT] operator[:] Keyword[default] operator[:] identifier[buffer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[name] operator[+] identifier[nsdecl] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
|
private NumberFormat createParser(Locale loc) throws JspException {
NumberFormat parser = null;
if ((type == null) || NUMBER.equalsIgnoreCase(type)) {
parser = NumberFormat.getNumberInstance(loc);
} else if (CURRENCY.equalsIgnoreCase(type)) {
parser = NumberFormat.getCurrencyInstance(loc);
} else if (PERCENT.equalsIgnoreCase(type)) {
parser = NumberFormat.getPercentInstance(loc);
} else {
throw new JspException(
Resources.getMessage("PARSE_NUMBER_INVALID_TYPE",
type));
}
return parser;
} | class class_name[name] begin[{]
method[createParser, return_type[type[NumberFormat]], modifier[private], parameter[loc]] begin[{]
local_variable[type[NumberFormat], parser]
if[binary_operation[binary_operation[member[.type], ==, literal[null]], ||, call[NUMBER.equalsIgnoreCase, parameter[member[.type]]]]] begin[{]
assign[member[.parser], call[NumberFormat.getNumberInstance, parameter[member[.loc]]]]
else begin[{]
if[call[CURRENCY.equalsIgnoreCase, parameter[member[.type]]]] begin[{]
assign[member[.parser], call[NumberFormat.getCurrencyInstance, parameter[member[.loc]]]]
else begin[{]
if[call[PERCENT.equalsIgnoreCase, parameter[member[.type]]]] begin[{]
assign[member[.parser], call[NumberFormat.getPercentInstance, parameter[member[.loc]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PARSE_NUMBER_INVALID_TYPE"), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=Resources, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JspException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
return[member[.parser]]
end[}]
END[}] | Keyword[private] identifier[NumberFormat] identifier[createParser] operator[SEP] identifier[Locale] identifier[loc] operator[SEP] Keyword[throws] identifier[JspException] {
identifier[NumberFormat] identifier[parser] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] operator[||] identifier[NUMBER] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
identifier[parser] operator[=] identifier[NumberFormat] operator[SEP] identifier[getNumberInstance] operator[SEP] identifier[loc] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[CURRENCY] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
identifier[parser] operator[=] identifier[NumberFormat] operator[SEP] identifier[getCurrencyInstance] operator[SEP] identifier[loc] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[PERCENT] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
identifier[parser] operator[=] identifier[NumberFormat] operator[SEP] identifier[getPercentInstance] operator[SEP] identifier[loc] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[JspException] operator[SEP] identifier[Resources] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[type] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[parser] operator[SEP]
}
|
protected ParserResults processNewSpec(final ParserData parserData, final boolean processProcesses) {
final String input = parserData.getLines().poll();
parserData.setLineCount(parserData.getLineCount() + 1);
try {
final Pair<String, String> keyValuePair = ProcessorUtilities.getAndValidateKeyValuePair(input);
final String key = keyValuePair.getFirst();
final String value = keyValuePair.getSecond();
if (key.equalsIgnoreCase(CommonConstants.CS_TITLE_TITLE)) {
parserData.getContentSpec().setTitle(value);
// Process the rest of the spec now that we know the start is correct
return processSpecContents(parserData, processProcesses);
} else if (key.equalsIgnoreCase(CommonConstants.CS_CHECKSUM_TITLE)) {
log.error(ProcessorConstants.ERROR_INCORRECT_NEW_MODE_MSG);
return new ParserResults(false, null);
} else {
log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG);
return new ParserResults(false, null);
}
} catch (InvalidKeyValueException e) {
log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG, e);
return new ParserResults(false, null);
}
} | class class_name[name] begin[{]
method[processNewSpec, return_type[type[ParserResults]], modifier[protected], parameter[parserData, processProcesses]] begin[{]
local_variable[type[String], input]
call[parserData.setLineCount, parameter[binary_operation[call[parserData.getLineCount, parameter[]], +, literal[1]]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAndValidateKeyValuePair, postfix_operators=[], prefix_operators=[], qualifier=ProcessorUtilities, selectors=[], type_arguments=None), name=keyValuePair)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Pair, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getFirst, postfix_operators=[], prefix_operators=[], qualifier=keyValuePair, selectors=[], type_arguments=None), name=key)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSecond, postfix_operators=[], prefix_operators=[], qualifier=keyValuePair, selectors=[], type_arguments=None), name=value)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=CS_TITLE_TITLE, postfix_operators=[], prefix_operators=[], qualifier=CommonConstants, selectors=[])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=CS_CHECKSUM_TITLE, postfix_operators=[], prefix_operators=[], qualifier=CommonConstants, selectors=[])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=key, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ERROR_INCORRECT_FILE_FORMAT_MSG, postfix_operators=[], prefix_operators=[], qualifier=ProcessorConstants, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParserResults, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ERROR_INCORRECT_NEW_MODE_MSG, postfix_operators=[], prefix_operators=[], qualifier=ProcessorConstants, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParserResults, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getContentSpec, postfix_operators=[], prefix_operators=[], qualifier=parserData, selectors=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTitle, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=parserData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=processProcesses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processSpecContents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ERROR_INCORRECT_FILE_FORMAT_MSG, postfix_operators=[], prefix_operators=[], qualifier=ProcessorConstants, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParserResults, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvalidKeyValueException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] identifier[ParserResults] identifier[processNewSpec] operator[SEP] Keyword[final] identifier[ParserData] identifier[parserData] , Keyword[final] Keyword[boolean] identifier[processProcesses] operator[SEP] {
Keyword[final] identifier[String] identifier[input] operator[=] identifier[parserData] operator[SEP] identifier[getLines] operator[SEP] operator[SEP] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] identifier[parserData] operator[SEP] identifier[setLineCount] operator[SEP] identifier[parserData] operator[SEP] identifier[getLineCount] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[try] {
Keyword[final] identifier[Pair] operator[<] identifier[String] , identifier[String] operator[>] identifier[keyValuePair] operator[=] identifier[ProcessorUtilities] operator[SEP] identifier[getAndValidateKeyValuePair] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[key] operator[=] identifier[keyValuePair] operator[SEP] identifier[getFirst] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[value] operator[=] identifier[keyValuePair] operator[SEP] identifier[getSecond] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[CommonConstants] operator[SEP] identifier[CS_TITLE_TITLE] operator[SEP] operator[SEP] {
identifier[parserData] operator[SEP] identifier[getContentSpec] operator[SEP] operator[SEP] operator[SEP] identifier[setTitle] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[processSpecContents] operator[SEP] identifier[parserData] , identifier[processProcesses] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[key] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[CommonConstants] operator[SEP] identifier[CS_CHECKSUM_TITLE] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[ERROR_INCORRECT_NEW_MODE_MSG] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ParserResults] operator[SEP] literal[boolean] , Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[ERROR_INCORRECT_FILE_FORMAT_MSG] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ParserResults] operator[SEP] literal[boolean] , Other[null] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InvalidKeyValueException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[ERROR_INCORRECT_FILE_FORMAT_MSG] , identifier[e] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ParserResults] operator[SEP] literal[boolean] , Other[null] operator[SEP] operator[SEP]
}
}
|
protected static boolean addRow (SmartTable table, List<Widget> widgets)
{
if (widgets == null) {
return false;
}
int row = table.getRowCount();
for (int col=0; col<widgets.size(); ++col) {
table.setWidget(row, col, widgets.get(col));
table.getFlexCellFormatter().setStyleName(row, col, "col"+col);
}
return true;
} | class class_name[name] begin[{]
method[addRow, return_type[type[boolean]], modifier[static protected], parameter[table, widgets]] begin[{]
if[binary_operation[member[.widgets], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[int], row]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=widgets, selectors=[], type_arguments=None)], member=setWidget, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getFlexCellFormatter, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="col"), operandr=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=setStyleName, 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=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=widgets, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=col)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=col, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[literal[true]]
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[boolean] identifier[addRow] operator[SEP] identifier[SmartTable] identifier[table] , identifier[List] operator[<] identifier[Widget] operator[>] identifier[widgets] operator[SEP] {
Keyword[if] operator[SEP] identifier[widgets] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[int] identifier[row] operator[=] identifier[table] operator[SEP] identifier[getRowCount] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[col] operator[=] Other[0] operator[SEP] identifier[col] operator[<] identifier[widgets] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[col] operator[SEP] {
identifier[table] operator[SEP] identifier[setWidget] operator[SEP] identifier[row] , identifier[col] , identifier[widgets] operator[SEP] identifier[get] operator[SEP] identifier[col] operator[SEP] operator[SEP] operator[SEP] identifier[table] operator[SEP] identifier[getFlexCellFormatter] operator[SEP] operator[SEP] operator[SEP] identifier[setStyleName] operator[SEP] identifier[row] , identifier[col] , literal[String] operator[+] identifier[col] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static long randomBefore(TemporalField field, long before) {
long min = field.range().getMinimum();
long max = field.range().getMaximum();
checkArgument(before > min, "Before must be after %s", min);
checkArgument(before <= max, "Before must be on or before %s", max);
return randomLong(min, before);
} | class class_name[name] begin[{]
method[randomBefore, return_type[type[long]], modifier[public static], parameter[field, before]] begin[{]
local_variable[type[long], min]
local_variable[type[long], max]
call[.checkArgument, parameter[binary_operation[member[.before], >, member[.min]], literal["Before must be after %s"], member[.min]]]
call[.checkArgument, parameter[binary_operation[member[.before], <=, member[.max]], literal["Before must be on or before %s"], member[.max]]]
return[call[.randomLong, parameter[member[.min], member[.before]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[randomBefore] operator[SEP] identifier[TemporalField] identifier[field] , Keyword[long] identifier[before] operator[SEP] {
Keyword[long] identifier[min] operator[=] identifier[field] operator[SEP] identifier[range] operator[SEP] operator[SEP] operator[SEP] identifier[getMinimum] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[max] operator[=] identifier[field] operator[SEP] identifier[range] operator[SEP] operator[SEP] operator[SEP] identifier[getMaximum] operator[SEP] operator[SEP] operator[SEP] identifier[checkArgument] operator[SEP] identifier[before] operator[>] identifier[min] , literal[String] , identifier[min] operator[SEP] operator[SEP] identifier[checkArgument] operator[SEP] identifier[before] operator[<=] identifier[max] , literal[String] , identifier[max] operator[SEP] operator[SEP] Keyword[return] identifier[randomLong] operator[SEP] identifier[min] , identifier[before] operator[SEP] operator[SEP]
}
|
public Matrix3d setLookAlong(Vector3dc dir, Vector3dc up) {
return setLookAlong(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z());
} | class class_name[name] begin[{]
method[setLookAlong, return_type[type[Matrix3d]], modifier[public], parameter[dir, up]] begin[{]
return[call[.setLookAlong, parameter[call[dir.x, parameter[]], call[dir.y, parameter[]], call[dir.z, parameter[]], call[up.x, parameter[]], call[up.y, parameter[]], call[up.z, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[Matrix3d] identifier[setLookAlong] operator[SEP] identifier[Vector3dc] identifier[dir] , identifier[Vector3dc] identifier[up] operator[SEP] {
Keyword[return] identifier[setLookAlong] operator[SEP] identifier[dir] operator[SEP] identifier[x] operator[SEP] operator[SEP] , identifier[dir] operator[SEP] identifier[y] operator[SEP] operator[SEP] , identifier[dir] operator[SEP] identifier[z] operator[SEP] operator[SEP] , identifier[up] operator[SEP] identifier[x] operator[SEP] operator[SEP] , identifier[up] operator[SEP] identifier[y] operator[SEP] operator[SEP] , identifier[up] operator[SEP] identifier[z] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public int determinePort() {
if (CollectionUtils.isEmpty(this.parsedAddresses)) {
return getPort();
}
Address address = this.parsedAddresses.get(0);
return address.port;
} | class class_name[name] begin[{]
method[determinePort, return_type[type[int]], modifier[public], parameter[]] begin[{]
if[call[CollectionUtils.isEmpty, parameter[THIS[member[None.parsedAddresses]]]]] begin[{]
return[call[.getPort, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[Address], address]
return[member[address.port]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[determinePort] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[CollectionUtils] operator[SEP] identifier[isEmpty] operator[SEP] Keyword[this] operator[SEP] identifier[parsedAddresses] operator[SEP] operator[SEP] {
Keyword[return] identifier[getPort] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Address] identifier[address] operator[=] Keyword[this] operator[SEP] identifier[parsedAddresses] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[address] operator[SEP] identifier[port] operator[SEP]
}
|
@Override
@LogarithmicTime(amortized = true)
public Handle<K, V> deleteMin() {
if (size == 0) {
throw new NoSuchElementException();
}
// updated last deleted key
Node result = currentMin;
lastDeletedKey = currentMin.key;
if (currentMin.bucket == 0) {
Node head = buckets[currentMin.bucket];
if (currentMin.next != null) {
currentMin.next.prev = currentMin.prev;
}
if (currentMin.prev != null) {
currentMin.prev.next = currentMin.next;
}
if (head == currentMin) {
currentMin.prev = null;
buckets[currentMin.bucket] = currentMin.next;
}
currentMin.next = null;
currentMin.prev = null;
currentMin.bucket = EMPTY;
// update minimum cache
currentMin = buckets[0];
if (--size > 0) {
findAndCacheMinimum(0);
}
} else {
// redistribute all elements based on new lastDeletedKey
Node newMin = null;
int currentMinBucket = currentMin.bucket;
Node val = buckets[currentMinBucket];
while (val != null) {
// remove first from list
buckets[currentMinBucket] = val.next;
if (buckets[currentMinBucket] != null) {
buckets[currentMinBucket].prev = null;
}
val.next = null;
val.prev = null;
val.bucket = EMPTY;
// redistribute
if (val != currentMin) {
int b = computeBucket(val.key, lastDeletedKey);
assert b < currentMinBucket;
val.next = buckets[b];
if (buckets[b] != null) {
buckets[b].prev = val;
}
buckets[b] = val;
val.bucket = b;
if (newMin == null || compare(val.key, newMin.key) < 0) {
newMin = val;
}
}
val = buckets[currentMinBucket];
}
// update minimum cache
currentMin = newMin;
if (--size > 0) {
findAndCacheMinimum(currentMinBucket + 1);
}
}
return result;
} | class class_name[name] begin[{]
method[deleteMin, return_type[type[Handle]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.size], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchElementException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Node], result]
assign[member[.lastDeletedKey], member[currentMin.key]]
if[binary_operation[member[currentMin.bucket], ==, literal[0]]] begin[{]
local_variable[type[Node], head]
if[binary_operation[member[currentMin.next], !=, literal[null]]] begin[{]
assign[member[currentMin.next.prev], member[currentMin.prev]]
else begin[{]
None
end[}]
if[binary_operation[member[currentMin.prev], !=, literal[null]]] begin[{]
assign[member[currentMin.prev.next], member[currentMin.next]]
else begin[{]
None
end[}]
if[binary_operation[member[.head], ==, member[.currentMin]]] begin[{]
assign[member[currentMin.prev], literal[null]]
assign[member[.buckets], member[currentMin.next]]
else begin[{]
None
end[}]
assign[member[currentMin.next], literal[null]]
assign[member[currentMin.prev], literal[null]]
assign[member[currentMin.bucket], member[.EMPTY]]
assign[member[.currentMin], member[.buckets]]
if[binary_operation[member[.size], >, literal[0]]] begin[{]
call[.findAndCacheMinimum, parameter[literal[0]]]
else begin[{]
None
end[}]
else begin[{]
local_variable[type[Node], newMin]
local_variable[type[int], currentMinBucket]
local_variable[type[Node], val]
while[binary_operation[member[.val], !=, literal[null]]] begin[{]
assign[member[.buckets], member[val.next]]
if[binary_operation[member[.buckets], !=, literal[null]]] begin[{]
assign[member[.buckets], literal[null]]
else begin[{]
None
end[}]
assign[member[val.next], literal[null]]
assign[member[val.prev], literal[null]]
assign[member[val.bucket], member[.EMPTY]]
if[binary_operation[member[.val], !=, member[.currentMin]]] begin[{]
local_variable[type[int], b]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=currentMinBucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), label=None, value=None)
assign[member[val.next], member[.buckets]]
if[binary_operation[member[.buckets], !=, literal[null]]] begin[{]
assign[member[.buckets], member[.val]]
else begin[{]
None
end[}]
assign[member[.buckets], member[.val]]
assign[member[val.bucket], member[.b]]
if[binary_operation[binary_operation[member[.newMin], ==, literal[null]], ||, binary_operation[call[.compare, parameter[member[val.key], member[newMin.key]]], <, literal[0]]]] begin[{]
assign[member[.newMin], member[.val]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.val], member[.buckets]]
end[}]
assign[member[.currentMin], member[.newMin]]
if[binary_operation[member[.size], >, literal[0]]] begin[{]
call[.findAndCacheMinimum, parameter[binary_operation[member[.currentMinBucket], +, literal[1]]]]
else begin[{]
None
end[}]
end[}]
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[LogarithmicTime] operator[SEP] identifier[amortized] operator[=] literal[boolean] operator[SEP] Keyword[public] identifier[Handle] operator[<] identifier[K] , identifier[V] operator[>] identifier[deleteMin] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[size] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoSuchElementException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Node] identifier[result] operator[=] identifier[currentMin] operator[SEP] identifier[lastDeletedKey] operator[=] identifier[currentMin] operator[SEP] identifier[key] operator[SEP] Keyword[if] operator[SEP] identifier[currentMin] operator[SEP] identifier[bucket] operator[==] Other[0] operator[SEP] {
identifier[Node] identifier[head] operator[=] identifier[buckets] operator[SEP] identifier[currentMin] operator[SEP] identifier[bucket] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentMin] operator[SEP] identifier[next] operator[!=] Other[null] operator[SEP] {
identifier[currentMin] operator[SEP] identifier[next] operator[SEP] identifier[prev] operator[=] identifier[currentMin] operator[SEP] identifier[prev] operator[SEP]
}
Keyword[if] operator[SEP] identifier[currentMin] operator[SEP] identifier[prev] operator[!=] Other[null] operator[SEP] {
identifier[currentMin] operator[SEP] identifier[prev] operator[SEP] identifier[next] operator[=] identifier[currentMin] operator[SEP] identifier[next] operator[SEP]
}
Keyword[if] operator[SEP] identifier[head] operator[==] identifier[currentMin] operator[SEP] {
identifier[currentMin] operator[SEP] identifier[prev] operator[=] Other[null] operator[SEP] identifier[buckets] operator[SEP] identifier[currentMin] operator[SEP] identifier[bucket] operator[SEP] operator[=] identifier[currentMin] operator[SEP] identifier[next] operator[SEP]
}
identifier[currentMin] operator[SEP] identifier[next] operator[=] Other[null] operator[SEP] identifier[currentMin] operator[SEP] identifier[prev] operator[=] Other[null] operator[SEP] identifier[currentMin] operator[SEP] identifier[bucket] operator[=] identifier[EMPTY] operator[SEP] identifier[currentMin] operator[=] identifier[buckets] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[--] identifier[size] operator[>] Other[0] operator[SEP] {
identifier[findAndCacheMinimum] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[Node] identifier[newMin] operator[=] Other[null] operator[SEP] Keyword[int] identifier[currentMinBucket] operator[=] identifier[currentMin] operator[SEP] identifier[bucket] operator[SEP] identifier[Node] identifier[val] operator[=] identifier[buckets] operator[SEP] identifier[currentMinBucket] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[val] operator[!=] Other[null] operator[SEP] {
identifier[buckets] operator[SEP] identifier[currentMinBucket] operator[SEP] operator[=] identifier[val] operator[SEP] identifier[next] operator[SEP] Keyword[if] operator[SEP] identifier[buckets] operator[SEP] identifier[currentMinBucket] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[buckets] operator[SEP] identifier[currentMinBucket] operator[SEP] operator[SEP] identifier[prev] operator[=] Other[null] operator[SEP]
}
identifier[val] operator[SEP] identifier[next] operator[=] Other[null] operator[SEP] identifier[val] operator[SEP] identifier[prev] operator[=] Other[null] operator[SEP] identifier[val] operator[SEP] identifier[bucket] operator[=] identifier[EMPTY] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[!=] identifier[currentMin] operator[SEP] {
Keyword[int] identifier[b] operator[=] identifier[computeBucket] operator[SEP] identifier[val] operator[SEP] identifier[key] , identifier[lastDeletedKey] operator[SEP] operator[SEP] Keyword[assert] identifier[b] operator[<] identifier[currentMinBucket] operator[SEP] identifier[val] operator[SEP] identifier[next] operator[=] identifier[buckets] operator[SEP] identifier[b] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[buckets] operator[SEP] identifier[b] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[buckets] operator[SEP] identifier[b] operator[SEP] operator[SEP] identifier[prev] operator[=] identifier[val] operator[SEP]
}
identifier[buckets] operator[SEP] identifier[b] operator[SEP] operator[=] identifier[val] operator[SEP] identifier[val] operator[SEP] identifier[bucket] operator[=] identifier[b] operator[SEP] Keyword[if] operator[SEP] identifier[newMin] operator[==] Other[null] operator[||] identifier[compare] operator[SEP] identifier[val] operator[SEP] identifier[key] , identifier[newMin] operator[SEP] identifier[key] operator[SEP] operator[<] Other[0] operator[SEP] {
identifier[newMin] operator[=] identifier[val] operator[SEP]
}
}
identifier[val] operator[=] identifier[buckets] operator[SEP] identifier[currentMinBucket] operator[SEP] operator[SEP]
}
identifier[currentMin] operator[=] identifier[newMin] operator[SEP] Keyword[if] operator[SEP] operator[--] identifier[size] operator[>] Other[0] operator[SEP] {
identifier[findAndCacheMinimum] operator[SEP] identifier[currentMinBucket] operator[+] Other[1] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
private static void applyTypeface(ViewGroup viewGroup, TypefaceCollection typefaceCollection) {
for (int i = 0; i < viewGroup.getChildCount(); i++) {
View childView = viewGroup.getChildAt(i);
if (childView instanceof ViewGroup) {
applyTypeface((ViewGroup) childView, typefaceCollection);
} else {
applyForView(childView, typefaceCollection);
}
}
} | class class_name[name] begin[{]
method[applyTypeface, return_type[void], modifier[private static], parameter[viewGroup, typefaceCollection]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getChildAt, postfix_operators=[], prefix_operators=[], qualifier=viewGroup, selectors=[], type_arguments=None), name=childView)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=View, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=childView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ViewGroup, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=childView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=typefaceCollection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=applyForView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=childView, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ViewGroup, sub_type=None)), MemberReference(member=typefaceCollection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=applyTypeface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getChildCount, postfix_operators=[], prefix_operators=[], qualifier=viewGroup, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[applyTypeface] operator[SEP] identifier[ViewGroup] identifier[viewGroup] , identifier[TypefaceCollection] identifier[typefaceCollection] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[viewGroup] operator[SEP] identifier[getChildCount] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[View] identifier[childView] operator[=] identifier[viewGroup] operator[SEP] identifier[getChildAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[childView] Keyword[instanceof] identifier[ViewGroup] operator[SEP] {
identifier[applyTypeface] operator[SEP] operator[SEP] identifier[ViewGroup] operator[SEP] identifier[childView] , identifier[typefaceCollection] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[applyForView] operator[SEP] identifier[childView] , identifier[typefaceCollection] operator[SEP] operator[SEP]
}
}
}
|
public static void traceException(TraceComponent callersTrace, Throwable ex)
{
if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {
// Find XA completion code if one exists, as this isn't in a normal dump
String xaErrStr = null;
if (ex instanceof XAException) {
XAException xaex = (XAException)ex;
xaErrStr = "XAExceptionErrorCode: " + xaex.errorCode;
}
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
if (xaErrStr != null) SibTr.debug(light_tc, xaErrStr);
SibTr.exception(light_tc, ex);
}
else {
if (xaErrStr != null) SibTr.debug(callersTrace, xaErrStr);
SibTr.exception(callersTrace, ex);
}
}
} | class class_name[name] begin[{]
method[traceException, return_type[void], modifier[public static], parameter[callersTrace, ex]] begin[{]
if[binary_operation[call[light_tc.isDebugEnabled, parameter[]], ||, call[callersTrace.isDebugEnabled, parameter[]]]] begin[{]
local_variable[type[String], xaErrStr]
if[binary_operation[member[.ex], instanceof, type[XAException]]] begin[{]
local_variable[type[XAException], xaex]
assign[member[.xaErrStr], binary_operation[literal["XAExceptionErrorCode: "], +, member[xaex.errorCode]]]
else begin[{]
None
end[}]
if[call[light_tc.isDebugEnabled, parameter[]]] begin[{]
if[binary_operation[member[.xaErrStr], !=, literal[null]]] begin[{]
call[SibTr.debug, parameter[member[.light_tc], member[.xaErrStr]]]
else begin[{]
None
end[}]
call[SibTr.exception, parameter[member[.light_tc], member[.ex]]]
else begin[{]
if[binary_operation[member[.xaErrStr], !=, literal[null]]] begin[{]
call[SibTr.debug, parameter[member[.callersTrace], member[.xaErrStr]]]
else begin[{]
None
end[}]
call[SibTr.exception, parameter[member[.callersTrace], member[.ex]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[traceException] operator[SEP] identifier[TraceComponent] identifier[callersTrace] , identifier[Throwable] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] identifier[light_tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[||] identifier[callersTrace] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[xaErrStr] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[ex] Keyword[instanceof] identifier[XAException] operator[SEP] {
identifier[XAException] identifier[xaex] operator[=] operator[SEP] identifier[XAException] operator[SEP] identifier[ex] operator[SEP] identifier[xaErrStr] operator[=] literal[String] operator[+] identifier[xaex] operator[SEP] identifier[errorCode] operator[SEP]
}
Keyword[if] operator[SEP] identifier[light_tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[xaErrStr] operator[!=] Other[null] operator[SEP] identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] identifier[light_tc] , identifier[xaErrStr] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[light_tc] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[xaErrStr] operator[!=] Other[null] operator[SEP] identifier[SibTr] operator[SEP] identifier[debug] operator[SEP] identifier[callersTrace] , identifier[xaErrStr] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[callersTrace] , identifier[ex] operator[SEP] operator[SEP]
}
}
}
|
@GwtIncompatible("incompatible method")
public static long getFragmentInSeconds(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, TimeUnit.SECONDS);
} | class class_name[name] begin[{]
method[getFragmentInSeconds, return_type[type[long]], modifier[public static], parameter[calendar, fragment]] begin[{]
return[call[.getFragment, parameter[member[.calendar], member[.fragment], member[TimeUnit.SECONDS]]]]
end[}]
END[}] | annotation[@] identifier[GwtIncompatible] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] Keyword[long] identifier[getFragmentInSeconds] operator[SEP] Keyword[final] identifier[Calendar] identifier[calendar] , Keyword[final] Keyword[int] identifier[fragment] operator[SEP] {
Keyword[return] identifier[getFragment] operator[SEP] identifier[calendar] , identifier[fragment] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP]
}
|
public static Color fromString(final String hexValue) {
if (ColorHelper.helper == null)
ColorHelper.helper = new ColorHelper();
return ColorHelper.helper.getFromString(hexValue);
} | class class_name[name] begin[{]
method[fromString, return_type[type[Color]], modifier[public static], parameter[hexValue]] begin[{]
if[binary_operation[member[ColorHelper.helper], ==, literal[null]]] begin[{]
assign[member[ColorHelper.helper], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ColorHelper, sub_type=None))]
else begin[{]
None
end[}]
return[call[ColorHelper.helper.getFromString, parameter[member[.hexValue]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Color] identifier[fromString] operator[SEP] Keyword[final] identifier[String] identifier[hexValue] operator[SEP] {
Keyword[if] operator[SEP] identifier[ColorHelper] operator[SEP] identifier[helper] operator[==] Other[null] operator[SEP] identifier[ColorHelper] operator[SEP] identifier[helper] operator[=] Keyword[new] identifier[ColorHelper] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ColorHelper] operator[SEP] identifier[helper] operator[SEP] identifier[getFromString] operator[SEP] identifier[hexValue] operator[SEP] operator[SEP]
}
|
@Override
public void run()
{
try
{
String serverHost = InetUtils.resolveAutoInterfaceAddress(settings.getStringProperty(FFMQJMXConsoleSettings.SERVER_HOST, "localhost"));
int serverPort = settings.getIntProperty(FFMQJMXConsoleSettings.SERVER_PORT, 10003);
String serviceUrl = "service:jmx:rmi://"+serverHost+"/jndi/rmi://"+serverHost+":"+serverPort+"/jmxconnector-FFMQ-server";
out.println("JMX Service URL : "+serviceUrl);
this.jmxServiceURL = new JMXServiceURL(serviceUrl);
printServerVersion();
boolean interactive = settings.getBooleanProperty(FFMQJMXConsoleSettings.INTERACTIVE, false);
if (interactive)
interactiveMode();
else
{
String command = settings.getStringProperty(FFMQJMXConsoleSettings.COMMAND, "help");
processCommand(command);
}
}
catch (Exception e)
{
closeJMXResources();
handleException(e);
}
} | class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=SERVER_HOST, postfix_operators=[], prefix_operators=[], qualifier=FFMQJMXConsoleSettings, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="localhost")], member=getStringProperty, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[], type_arguments=None)], member=resolveAutoInterfaceAddress, postfix_operators=[], prefix_operators=[], qualifier=InetUtils, selectors=[], type_arguments=None), name=serverHost)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=SERVER_PORT, postfix_operators=[], prefix_operators=[], qualifier=FFMQJMXConsoleSettings, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=10003)], member=getIntProperty, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[], type_arguments=None), name=serverPort)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="service:jmx:rmi://"), operandr=MemberReference(member=serverHost, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/jndi/rmi://"), operator=+), operandr=MemberReference(member=serverHost, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+), operandr=MemberReference(member=serverPort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/jmxconnector-FFMQ-server"), operator=+), name=serviceUrl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="JMX Service URL : "), operandr=MemberReference(member=serviceUrl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=jmxServiceURL, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=ClassCreator(arguments=[MemberReference(member=serviceUrl, 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=JMXServiceURL, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=printServerVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=INTERACTIVE, postfix_operators=[], prefix_operators=[], qualifier=FFMQJMXConsoleSettings, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getBooleanProperty, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[], type_arguments=None), name=interactive)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MemberReference(member=interactive, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=COMMAND, postfix_operators=[], prefix_operators=[], qualifier=FFMQJMXConsoleSettings, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="help")], member=getStringProperty, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[], type_arguments=None), name=command)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=command, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processCommand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=interactiveMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=closeJMXResources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[String] identifier[serverHost] operator[=] identifier[InetUtils] operator[SEP] identifier[resolveAutoInterfaceAddress] operator[SEP] identifier[settings] operator[SEP] identifier[getStringProperty] operator[SEP] identifier[FFMQJMXConsoleSettings] operator[SEP] identifier[SERVER_HOST] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[serverPort] operator[=] identifier[settings] operator[SEP] identifier[getIntProperty] operator[SEP] identifier[FFMQJMXConsoleSettings] operator[SEP] identifier[SERVER_PORT] , Other[10003] operator[SEP] operator[SEP] identifier[String] identifier[serviceUrl] operator[=] literal[String] operator[+] identifier[serverHost] operator[+] literal[String] operator[+] identifier[serverHost] operator[+] literal[String] operator[+] identifier[serverPort] operator[+] literal[String] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[serviceUrl] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[jmxServiceURL] operator[=] Keyword[new] identifier[JMXServiceURL] operator[SEP] identifier[serviceUrl] operator[SEP] operator[SEP] identifier[printServerVersion] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[interactive] operator[=] identifier[settings] operator[SEP] identifier[getBooleanProperty] operator[SEP] identifier[FFMQJMXConsoleSettings] operator[SEP] identifier[INTERACTIVE] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[interactive] operator[SEP] identifier[interactiveMode] operator[SEP] operator[SEP] operator[SEP] Keyword[else] {
identifier[String] identifier[command] operator[=] identifier[settings] operator[SEP] identifier[getStringProperty] operator[SEP] identifier[FFMQJMXConsoleSettings] operator[SEP] identifier[COMMAND] , literal[String] operator[SEP] operator[SEP] identifier[processCommand] operator[SEP] identifier[command] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[closeJMXResources] operator[SEP] operator[SEP] operator[SEP] identifier[handleException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("ConstantConditions")
public void swap(@Nullable final List<T> newObjects) {
if (newObjects == null) {
clear();
} else {
synchronized (mLock) {
final DiffUtil.DiffResult result = DiffUtil.calculateDiff(new DiffUtil.Callback() {
@Override
public boolean areContentsTheSame(final int oldItemPosition,
final int newItemPosition) {
final T oldItem = mObjects.get(oldItemPosition);
final T newItem = newObjects.get(newItemPosition);
return isContentTheSame(oldItem, newItem);
}
@Override
public boolean areItemsTheSame(final int oldItemPosition,
final int newItemPosition) {
final T oldItem = mObjects.get(oldItemPosition);
final T newItem = newObjects.get(newItemPosition);
return isItemTheSame(oldItem, newItem);
}
@Override
public int getNewListSize() {
return newObjects.size();
}
@Override
public int getOldListSize() {
return mObjects.size();
}
});
mObjects.clear();
mObjects.addAll(newObjects);
result.dispatchUpdatesTo(this);
}
}
} | class class_name[name] begin[{]
method[swap, return_type[void], modifier[public], parameter[newObjects]] begin[{]
if[binary_operation[member[.newObjects], ==, literal[null]]] begin[{]
call[.clear, parameter[]]
else begin[{]
SYNCHRONIZED[member[.mLock]] BEGIN[{]
local_variable[type[DiffUtil], result]
call[mObjects.clear, parameter[]]
call[mObjects.addAll, parameter[member[.newObjects]]]
call[result.dispatchUpdatesTo, parameter[THIS[]]]
END[}]
end[}]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[swap] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[List] operator[<] identifier[T] operator[>] identifier[newObjects] operator[SEP] {
Keyword[if] operator[SEP] identifier[newObjects] operator[==] Other[null] operator[SEP] {
identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[synchronized] operator[SEP] identifier[mLock] operator[SEP] {
Keyword[final] identifier[DiffUtil] operator[SEP] identifier[DiffResult] identifier[result] operator[=] identifier[DiffUtil] operator[SEP] identifier[calculateDiff] operator[SEP] Keyword[new] identifier[DiffUtil] operator[SEP] identifier[Callback] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[areContentsTheSame] operator[SEP] Keyword[final] Keyword[int] identifier[oldItemPosition] , Keyword[final] Keyword[int] identifier[newItemPosition] operator[SEP] {
Keyword[final] identifier[T] identifier[oldItem] operator[=] identifier[mObjects] operator[SEP] identifier[get] operator[SEP] identifier[oldItemPosition] operator[SEP] operator[SEP] Keyword[final] identifier[T] identifier[newItem] operator[=] identifier[newObjects] operator[SEP] identifier[get] operator[SEP] identifier[newItemPosition] operator[SEP] operator[SEP] Keyword[return] identifier[isContentTheSame] operator[SEP] identifier[oldItem] , identifier[newItem] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[areItemsTheSame] operator[SEP] Keyword[final] Keyword[int] identifier[oldItemPosition] , Keyword[final] Keyword[int] identifier[newItemPosition] operator[SEP] {
Keyword[final] identifier[T] identifier[oldItem] operator[=] identifier[mObjects] operator[SEP] identifier[get] operator[SEP] identifier[oldItemPosition] operator[SEP] operator[SEP] Keyword[final] identifier[T] identifier[newItem] operator[=] identifier[newObjects] operator[SEP] identifier[get] operator[SEP] identifier[newItemPosition] operator[SEP] operator[SEP] Keyword[return] identifier[isItemTheSame] operator[SEP] identifier[oldItem] , identifier[newItem] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[getNewListSize] operator[SEP] operator[SEP] {
Keyword[return] identifier[newObjects] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[getOldListSize] operator[SEP] operator[SEP] {
Keyword[return] identifier[mObjects] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[mObjects] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[mObjects] operator[SEP] identifier[addAll] operator[SEP] identifier[newObjects] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[dispatchUpdatesTo] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
}
}
|
public static EventLoopGroup newEventLoopGroup(int nThreads, ThreadFactory threadFactory) {
return epollEnabled ? new EpollEventLoopGroup(nThreads, threadFactory)
: new NioEventLoopGroup(nThreads, threadFactory);
} | class class_name[name] begin[{]
method[newEventLoopGroup, return_type[type[EventLoopGroup]], modifier[public static], parameter[nThreads, threadFactory]] begin[{]
return[TernaryExpression(condition=MemberReference(member=epollEnabled, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=ClassCreator(arguments=[MemberReference(member=nThreads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=threadFactory, 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=NioEventLoopGroup, sub_type=None)), if_true=ClassCreator(arguments=[MemberReference(member=nThreads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=threadFactory, 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=EpollEventLoopGroup, sub_type=None)))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[EventLoopGroup] identifier[newEventLoopGroup] operator[SEP] Keyword[int] identifier[nThreads] , identifier[ThreadFactory] identifier[threadFactory] operator[SEP] {
Keyword[return] identifier[epollEnabled] operator[?] Keyword[new] identifier[EpollEventLoopGroup] operator[SEP] identifier[nThreads] , identifier[threadFactory] operator[SEP] operator[:] Keyword[new] identifier[NioEventLoopGroup] operator[SEP] identifier[nThreads] , identifier[threadFactory] operator[SEP] operator[SEP]
}
|
public StringTransformerChain extend(StringTransformerRule... additionalRules) {
StringTransformerRule[] newRules = new StringTransformerRule[this.rules.length + additionalRules.length];
System.arraycopy(this.rules, 0, newRules, 0, this.rules.length);
System.arraycopy(additionalRules, 0, newRules, this.rules.length, additionalRules.length);
return new StringTransformerChain(newRules);
} | class class_name[name] begin[{]
method[extend, return_type[type[StringTransformerChain]], modifier[public], parameter[additionalRules]] begin[{]
local_variable[type[StringTransformerRule], newRules]
call[System.arraycopy, parameter[THIS[member[None.rules]], literal[0], member[.newRules], literal[0], THIS[member[None.rules]member[None.length]]]]
call[System.arraycopy, parameter[member[.additionalRules], literal[0], member[.newRules], THIS[member[None.rules]member[None.length]], member[additionalRules.length]]]
return[ClassCreator(arguments=[MemberReference(member=newRules, 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=StringTransformerChain, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[StringTransformerChain] identifier[extend] operator[SEP] identifier[StringTransformerRule] operator[...] identifier[additionalRules] operator[SEP] {
identifier[StringTransformerRule] operator[SEP] operator[SEP] identifier[newRules] operator[=] Keyword[new] identifier[StringTransformerRule] operator[SEP] Keyword[this] operator[SEP] identifier[rules] operator[SEP] identifier[length] operator[+] identifier[additionalRules] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] Keyword[this] operator[SEP] identifier[rules] , Other[0] , identifier[newRules] , Other[0] , Keyword[this] operator[SEP] identifier[rules] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[additionalRules] , Other[0] , identifier[newRules] , Keyword[this] operator[SEP] identifier[rules] operator[SEP] identifier[length] , identifier[additionalRules] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[StringTransformerChain] operator[SEP] identifier[newRules] operator[SEP] operator[SEP]
}
|
public void marshall(GetConferenceProviderRequest getConferenceProviderRequest, ProtocolMarshaller protocolMarshaller) {
if (getConferenceProviderRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getConferenceProviderRequest.getConferenceProviderArn(), CONFERENCEPROVIDERARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[getConferenceProviderRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.getConferenceProviderRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getConferenceProviderArn, postfix_operators=[], prefix_operators=[], qualifier=getConferenceProviderRequest, selectors=[], type_arguments=None), MemberReference(member=CONFERENCEPROVIDERARN_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[GetConferenceProviderRequest] identifier[getConferenceProviderRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[getConferenceProviderRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[getConferenceProviderRequest] operator[SEP] identifier[getConferenceProviderArn] operator[SEP] operator[SEP] , identifier[CONFERENCEPROVIDERARN_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public SortModel createSortModel(List/*<Sort>*/ sorts) {
SortModel sortModel = new SortModel(sorts);
sortModel.setSortStrategy(SORT_STRATEGY);
return sortModel;
} | class class_name[name] begin[{]
method[createSortModel, return_type[type[SortModel]], modifier[public], parameter[sorts]] begin[{]
local_variable[type[SortModel], sortModel]
call[sortModel.setSortStrategy, parameter[member[.SORT_STRATEGY]]]
return[member[.sortModel]]
end[}]
END[}] | Keyword[public] identifier[SortModel] identifier[createSortModel] operator[SEP] identifier[List] identifier[sorts] operator[SEP] {
identifier[SortModel] identifier[sortModel] operator[=] Keyword[new] identifier[SortModel] operator[SEP] identifier[sorts] operator[SEP] operator[SEP] identifier[sortModel] operator[SEP] identifier[setSortStrategy] operator[SEP] identifier[SORT_STRATEGY] operator[SEP] operator[SEP] Keyword[return] identifier[sortModel] operator[SEP]
}
|
private void readStrips() {
ImageStrips imageStrips = new ImageStrips();
List<Strip> strips = new ArrayList<Strip>();
long rps = 0;
if (ifd.containsTagId(TiffTags.getTagId("StripOffsets"))
&& ifd.containsTagId(TiffTags.getTagId("StripBYTECount"))) {
long tsbc = ifd.getTag("StripBYTECount").getFirstNumericValue();
if (!ifd.containsTagId(TiffTags.getTagId("RowsPerStrip")) || ifd.getTag("RowsPerStrip").getCardinality() == 0)
rps = 1;
else rps = ifd.getTag("RowsPerStrip").getFirstNumericValue();
long rowLength = tsbc / rps;
if (rowLength == 0)
rowLength = 1;
for (int i = 0; i < ifd.getTag("StripOffsets").getValue().size(); i++) {
try {
int so = ifd.getTag("StripOffsets").getValue().get(i).toInt();
int sbc = ifd.getTag("StripBYTECount").getValue().get(i).toInt();
Strip strip = new Strip();
strip.setOffset(so);
strip.setLength(sbc);
strip.setStripRows((int) (sbc / rowLength));
strips.add(strip);
} catch (Exception ex) {
}
}
}
imageStrips.setStrips(strips);
imageStrips.setRowsPerStrip(rps);
ifd.setImageStrips(imageStrips);
} | class class_name[name] begin[{]
method[readStrips, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[ImageStrips], imageStrips]
local_variable[type[List], strips]
local_variable[type[long], rps]
if[binary_operation[call[ifd.containsTagId, parameter[call[TiffTags.getTagId, parameter[literal["StripOffsets"]]]]], &&, call[ifd.containsTagId, parameter[call[TiffTags.getTagId, parameter[literal["StripBYTECount"]]]]]]] begin[{]
local_variable[type[long], tsbc]
if[binary_operation[call[ifd.containsTagId, parameter[call[TiffTags.getTagId, parameter[literal["RowsPerStrip"]]]]], ||, binary_operation[call[ifd.getTag, parameter[literal["RowsPerStrip"]]], ==, literal[0]]]] begin[{]
assign[member[.rps], literal[1]]
else begin[{]
assign[member[.rps], call[ifd.getTag, parameter[literal["RowsPerStrip"]]]]
end[}]
local_variable[type[long], rowLength]
if[binary_operation[member[.rowLength], ==, literal[0]]] begin[{]
assign[member[.rowLength], literal[1]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="StripOffsets")], member=getTag, postfix_operators=[], prefix_operators=[], qualifier=ifd, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toInt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=so)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="StripBYTECount")], member=getTag, postfix_operators=[], prefix_operators=[], qualifier=ifd, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toInt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=sbc)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Strip, sub_type=None)), name=strip)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Strip, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=so, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setOffset, postfix_operators=[], prefix_operators=[], qualifier=strip, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sbc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLength, postfix_operators=[], prefix_operators=[], qualifier=strip, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=BinaryOperation(operandl=MemberReference(member=sbc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=rowLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), type=BasicType(dimensions=[], name=int))], member=setStripRows, postfix_operators=[], prefix_operators=[], qualifier=strip, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=strip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=strips, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="StripOffsets")], member=getTag, postfix_operators=[], prefix_operators=[], qualifier=ifd, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
call[imageStrips.setStrips, parameter[member[.strips]]]
call[imageStrips.setRowsPerStrip, parameter[member[.rps]]]
call[ifd.setImageStrips, parameter[member[.imageStrips]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[readStrips] operator[SEP] operator[SEP] {
identifier[ImageStrips] identifier[imageStrips] operator[=] Keyword[new] identifier[ImageStrips] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Strip] operator[>] identifier[strips] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Strip] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[rps] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[ifd] operator[SEP] identifier[containsTagId] operator[SEP] identifier[TiffTags] operator[SEP] identifier[getTagId] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[&&] identifier[ifd] operator[SEP] identifier[containsTagId] operator[SEP] identifier[TiffTags] operator[SEP] identifier[getTagId] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] {
Keyword[long] identifier[tsbc] operator[=] identifier[ifd] operator[SEP] identifier[getTag] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getFirstNumericValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[ifd] operator[SEP] identifier[containsTagId] operator[SEP] identifier[TiffTags] operator[SEP] identifier[getTagId] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[||] identifier[ifd] operator[SEP] identifier[getTag] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getCardinality] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] identifier[rps] operator[=] Other[1] operator[SEP] Keyword[else] identifier[rps] operator[=] identifier[ifd] operator[SEP] identifier[getTag] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getFirstNumericValue] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[rowLength] operator[=] identifier[tsbc] operator[/] identifier[rps] operator[SEP] Keyword[if] operator[SEP] identifier[rowLength] operator[==] Other[0] operator[SEP] identifier[rowLength] operator[=] Other[1] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[ifd] operator[SEP] identifier[getTag] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[try] {
Keyword[int] identifier[so] operator[=] identifier[ifd] operator[SEP] identifier[getTag] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[toInt] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[sbc] operator[=] identifier[ifd] operator[SEP] identifier[getTag] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[toInt] operator[SEP] operator[SEP] operator[SEP] identifier[Strip] identifier[strip] operator[=] Keyword[new] identifier[Strip] operator[SEP] operator[SEP] operator[SEP] identifier[strip] operator[SEP] identifier[setOffset] operator[SEP] identifier[so] operator[SEP] operator[SEP] identifier[strip] operator[SEP] identifier[setLength] operator[SEP] identifier[sbc] operator[SEP] operator[SEP] identifier[strip] operator[SEP] identifier[setStripRows] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[sbc] operator[/] identifier[rowLength] operator[SEP] operator[SEP] operator[SEP] identifier[strips] operator[SEP] identifier[add] operator[SEP] identifier[strip] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
}
}
}
identifier[imageStrips] operator[SEP] identifier[setStrips] operator[SEP] identifier[strips] operator[SEP] operator[SEP] identifier[imageStrips] operator[SEP] identifier[setRowsPerStrip] operator[SEP] identifier[rps] operator[SEP] operator[SEP] identifier[ifd] operator[SEP] identifier[setImageStrips] operator[SEP] identifier[imageStrips] operator[SEP] operator[SEP]
}
|
public static void destroy() {
try {
logger.info("--- Para.destroy() ---");
for (DestroyListener destroyListener : DESTROY_LISTENERS) {
if (destroyListener != null) {
destroyListener.onDestroy();
logger.debug("Executed {}.onDestroy().", destroyListener.getClass().getName());
}
}
if (!EXECUTOR.isShutdown()) {
EXECUTOR.shutdown();
EXECUTOR.awaitTermination(60, TimeUnit.SECONDS);
}
if (!SCHEDULER.isShutdown()) {
SCHEDULER.shutdown();
SCHEDULER.awaitTermination(60, TimeUnit.SECONDS);
}
} catch (Exception e) {
logger.error("Failed to destroy Para.", e);
}
} | class class_name[name] begin[{]
method[destroy, return_type[void], modifier[public static], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="--- Para.destroy() ---")], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=destroyListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=onDestroy, postfix_operators=[], prefix_operators=[], qualifier=destroyListener, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Executed {}.onDestroy()."), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=destroyListener, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=DESTROY_LISTENERS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=destroyListener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DestroyListener, sub_type=None))), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isShutdown, postfix_operators=[], prefix_operators=['!'], qualifier=EXECUTOR, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=shutdown, postfix_operators=[], prefix_operators=[], qualifier=EXECUTOR, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=60), MemberReference(member=SECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=awaitTermination, postfix_operators=[], prefix_operators=[], qualifier=EXECUTOR, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=isShutdown, postfix_operators=[], prefix_operators=['!'], qualifier=SCHEDULER, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=shutdown, postfix_operators=[], prefix_operators=[], qualifier=SCHEDULER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=60), MemberReference(member=SECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=awaitTermination, postfix_operators=[], prefix_operators=[], qualifier=SCHEDULER, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to destroy Para."), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[destroy] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[DestroyListener] identifier[destroyListener] operator[:] identifier[DESTROY_LISTENERS] operator[SEP] {
Keyword[if] operator[SEP] identifier[destroyListener] operator[!=] Other[null] operator[SEP] {
identifier[destroyListener] operator[SEP] identifier[onDestroy] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[destroyListener] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[EXECUTOR] operator[SEP] identifier[isShutdown] operator[SEP] operator[SEP] operator[SEP] {
identifier[EXECUTOR] operator[SEP] identifier[shutdown] operator[SEP] operator[SEP] operator[SEP] identifier[EXECUTOR] operator[SEP] identifier[awaitTermination] operator[SEP] Other[60] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[SCHEDULER] operator[SEP] identifier[isShutdown] operator[SEP] operator[SEP] operator[SEP] {
identifier[SCHEDULER] operator[SEP] identifier[shutdown] operator[SEP] operator[SEP] operator[SEP] identifier[SCHEDULER] operator[SEP] identifier[awaitTermination] operator[SEP] Other[60] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void tick() {
final long count = uncounted.sumThenReset();
final double instantRate = count / interval;
if (initialized) {
rate += (alpha * (instantRate - rate));
} else {
rate = instantRate;
initialized = true;
}
} | class class_name[name] begin[{]
method[tick, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[long], count]
local_variable[type[double], instantRate]
if[member[.initialized]] begin[{]
assign[member[.rate], binary_operation[member[.alpha], *, binary_operation[member[.instantRate], -, member[.rate]]]]
else begin[{]
assign[member[.rate], member[.instantRate]]
assign[member[.initialized], literal[true]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[tick] operator[SEP] operator[SEP] {
Keyword[final] Keyword[long] identifier[count] operator[=] identifier[uncounted] operator[SEP] identifier[sumThenReset] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[instantRate] operator[=] identifier[count] operator[/] identifier[interval] operator[SEP] Keyword[if] operator[SEP] identifier[initialized] operator[SEP] {
identifier[rate] operator[+=] operator[SEP] identifier[alpha] operator[*] operator[SEP] identifier[instantRate] operator[-] identifier[rate] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[rate] operator[=] identifier[instantRate] operator[SEP] identifier[initialized] operator[=] literal[boolean] operator[SEP]
}
}
|
protected MetaObject getMetaObject(Object obj) {
ObjectFactory objectFactory = OBJECT_FACTORY;
ObjectWrapperFactory objectWrapperFactory = OBJECT_WRAPPER_FACTORY;
MetaObject metaStatementHandler = MetaObject.forObject(obj, objectFactory, objectWrapperFactory, REFLECTOR_FACTORY);
// 由于目标类可能被多个拦截器拦截,从而形成多次代理,通过以下循环找出原始代理
while (metaStatementHandler.hasGetter("h")) {
Object object = metaStatementHandler.getValue("h");
metaStatementHandler = MetaObject.forObject(object, objectFactory, objectWrapperFactory, REFLECTOR_FACTORY);
}
// 得到原始代理对象的目标类,即StatementHandler实现类
if (metaStatementHandler.hasGetter("target")) {
Object object = metaStatementHandler.getValue("target");
metaStatementHandler = MetaObject.forObject(object, objectFactory, objectWrapperFactory, REFLECTOR_FACTORY);
}
return metaStatementHandler;
} | class class_name[name] begin[{]
method[getMetaObject, return_type[type[MetaObject]], modifier[protected], parameter[obj]] begin[{]
local_variable[type[ObjectFactory], objectFactory]
local_variable[type[ObjectWrapperFactory], objectWrapperFactory]
local_variable[type[MetaObject], metaStatementHandler]
while[call[metaStatementHandler.hasGetter, parameter[literal["h"]]]] begin[{]
local_variable[type[Object], object]
assign[member[.metaStatementHandler], call[MetaObject.forObject, parameter[member[.object], member[.objectFactory], member[.objectWrapperFactory], member[.REFLECTOR_FACTORY]]]]
end[}]
if[call[metaStatementHandler.hasGetter, parameter[literal["target"]]]] begin[{]
local_variable[type[Object], object]
assign[member[.metaStatementHandler], call[MetaObject.forObject, parameter[member[.object], member[.objectFactory], member[.objectWrapperFactory], member[.REFLECTOR_FACTORY]]]]
else begin[{]
None
end[}]
return[member[.metaStatementHandler]]
end[}]
END[}] | Keyword[protected] identifier[MetaObject] identifier[getMetaObject] operator[SEP] identifier[Object] identifier[obj] operator[SEP] {
identifier[ObjectFactory] identifier[objectFactory] operator[=] identifier[OBJECT_FACTORY] operator[SEP] identifier[ObjectWrapperFactory] identifier[objectWrapperFactory] operator[=] identifier[OBJECT_WRAPPER_FACTORY] operator[SEP] identifier[MetaObject] identifier[metaStatementHandler] operator[=] identifier[MetaObject] operator[SEP] identifier[forObject] operator[SEP] identifier[obj] , identifier[objectFactory] , identifier[objectWrapperFactory] , identifier[REFLECTOR_FACTORY] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[metaStatementHandler] operator[SEP] identifier[hasGetter] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[Object] identifier[object] operator[=] identifier[metaStatementHandler] operator[SEP] identifier[getValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[metaStatementHandler] operator[=] identifier[MetaObject] operator[SEP] identifier[forObject] operator[SEP] identifier[object] , identifier[objectFactory] , identifier[objectWrapperFactory] , identifier[REFLECTOR_FACTORY] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[metaStatementHandler] operator[SEP] identifier[hasGetter] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[Object] identifier[object] operator[=] identifier[metaStatementHandler] operator[SEP] identifier[getValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[metaStatementHandler] operator[=] identifier[MetaObject] operator[SEP] identifier[forObject] operator[SEP] identifier[object] , identifier[objectFactory] , identifier[objectWrapperFactory] , identifier[REFLECTOR_FACTORY] operator[SEP] operator[SEP]
}
Keyword[return] identifier[metaStatementHandler] operator[SEP]
}
|
public Vector getSpinVector(double theta, double phi) {
Vector spinvector = new Vector(3);
spinvector.vector[0] = Math.sin(theta) * Math.cos(phi);
spinvector.vector[1] = Math.sin(theta) * Math.sin(phi);
spinvector.vector[2] = Math.cos(phi);
return spinvector;
} | class class_name[name] begin[{]
method[getSpinVector, return_type[type[Vector]], modifier[public], parameter[theta, phi]] begin[{]
local_variable[type[Vector], spinvector]
assign[member[spinvector.vector], binary_operation[call[Math.sin, parameter[member[.theta]]], *, call[Math.cos, parameter[member[.phi]]]]]
assign[member[spinvector.vector], binary_operation[call[Math.sin, parameter[member[.theta]]], *, call[Math.sin, parameter[member[.phi]]]]]
assign[member[spinvector.vector], call[Math.cos, parameter[member[.phi]]]]
return[member[.spinvector]]
end[}]
END[}] | Keyword[public] identifier[Vector] identifier[getSpinVector] operator[SEP] Keyword[double] identifier[theta] , Keyword[double] identifier[phi] operator[SEP] {
identifier[Vector] identifier[spinvector] operator[=] Keyword[new] identifier[Vector] operator[SEP] Other[3] operator[SEP] operator[SEP] identifier[spinvector] operator[SEP] identifier[vector] operator[SEP] Other[0] operator[SEP] operator[=] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[theta] operator[SEP] operator[*] identifier[Math] operator[SEP] identifier[cos] operator[SEP] identifier[phi] operator[SEP] operator[SEP] identifier[spinvector] operator[SEP] identifier[vector] operator[SEP] Other[1] operator[SEP] operator[=] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[theta] operator[SEP] operator[*] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[phi] operator[SEP] operator[SEP] identifier[spinvector] operator[SEP] identifier[vector] operator[SEP] Other[2] operator[SEP] operator[=] identifier[Math] operator[SEP] identifier[cos] operator[SEP] identifier[phi] operator[SEP] operator[SEP] Keyword[return] identifier[spinvector] operator[SEP]
}
|
SICoreConnection getCoreConnection() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getCoreConnection");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getCoreConnection", coreConnection);
return coreConnection;
} | class class_name[name] begin[{]
method[getCoreConnection, return_type[type[SICoreConnection]], modifier[default], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["getCoreConnection"]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["getCoreConnection"], member[.coreConnection]]]
else begin[{]
None
end[}]
return[member[.coreConnection]]
end[}]
END[}] | identifier[SICoreConnection] identifier[getCoreConnection] 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[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] 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] , identifier[coreConnection] operator[SEP] operator[SEP] Keyword[return] identifier[coreConnection] operator[SEP]
}
|
public static ThreadPoolExecutor newCachedThreadPool(int corePoolSize,
int maximumPoolSize) {
return new ThreadPoolExecutor(corePoolSize,
maximumPoolSize,
DateUtils.MILLISECONDS_PER_MINUTE,
TimeUnit.MILLISECONDS,
new SynchronousQueue<Runnable>());
} | class class_name[name] begin[{]
method[newCachedThreadPool, return_type[type[ThreadPoolExecutor]], modifier[public static], parameter[corePoolSize, maximumPoolSize]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=corePoolSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maximumPoolSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MILLISECONDS_PER_MINUTE, postfix_operators=[], prefix_operators=[], qualifier=DateUtils, selectors=[]), MemberReference(member=MILLISECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[]), 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=Runnable, sub_type=None))], dimensions=None, name=SynchronousQueue, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ThreadPoolExecutor, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ThreadPoolExecutor] identifier[newCachedThreadPool] operator[SEP] Keyword[int] identifier[corePoolSize] , Keyword[int] identifier[maximumPoolSize] operator[SEP] {
Keyword[return] Keyword[new] identifier[ThreadPoolExecutor] operator[SEP] identifier[corePoolSize] , identifier[maximumPoolSize] , identifier[DateUtils] operator[SEP] identifier[MILLISECONDS_PER_MINUTE] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] , Keyword[new] identifier[SynchronousQueue] operator[<] identifier[Runnable] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private static boolean checkForAjax(HttpServletRequest request, HttpServletResponse response)
throws IOException {
if (!"XMLHttpRequest".equals(request.getHeader("X-Requested-With"))) {
log.log(
Level.SEVERE, "Received unexpected non-XMLHttpRequest command. Possible CSRF attack.");
response.sendError(HttpServletResponse.SC_FORBIDDEN,
"Received unexpected non-XMLHttpRequest command.");
return false;
}
return true;
} | class class_name[name] begin[{]
method[checkForAjax, return_type[type[boolean]], modifier[private static], parameter[request, response]] begin[{]
if[literal["XMLHttpRequest"]] begin[{]
call[log.log, parameter[member[Level.SEVERE], literal["Received unexpected non-XMLHttpRequest command. Possible CSRF attack."]]]
call[response.sendError, parameter[member[HttpServletResponse.SC_FORBIDDEN], literal["Received unexpected non-XMLHttpRequest command."]]]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[checkForAjax] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[request] operator[SEP] identifier[getHeader] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , literal[String] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[sendError] operator[SEP] identifier[HttpServletResponse] operator[SEP] identifier[SC_FORBIDDEN] , literal[String] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static String readString(DataInputStream is, byte[] _buff) throws IOException {
int l = is.readInt();
byte[] buff = _buff;
switch(l) {
case -1: return null;
case 0: return "";
default:
// Cover case where there is a large string, without always allocating a large buffer.
if(l>buff.length) {
buff = new byte[l];
}
is.read(buff,0,l);
return new String(buff,0,l);
}
} | class class_name[name] begin[{]
method[readString, return_type[type[String]], modifier[public static], parameter[is, _buff]] begin[{]
local_variable[type[int], l]
local_variable[type[byte], buff]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), label=None)]), SwitchStatementCase(case=[], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=buff, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=buff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ArrayCreator(dimensions=[MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=buff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=l, 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=String, sub_type=None)), label=None)])], expression=MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[readString] operator[SEP] identifier[DataInputStream] identifier[is] , Keyword[byte] operator[SEP] operator[SEP] identifier[_buff] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[l] operator[=] identifier[is] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[buff] operator[=] identifier[_buff] operator[SEP] Keyword[switch] operator[SEP] identifier[l] operator[SEP] {
Keyword[case] operator[-] Other[1] operator[:] Keyword[return] Other[null] operator[SEP] Keyword[case] Other[0] operator[:] Keyword[return] literal[String] operator[SEP] Keyword[default] operator[:] Keyword[if] operator[SEP] identifier[l] operator[>] identifier[buff] operator[SEP] identifier[length] operator[SEP] {
identifier[buff] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[l] operator[SEP] operator[SEP]
}
identifier[is] operator[SEP] identifier[read] operator[SEP] identifier[buff] , Other[0] , identifier[l] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[buff] , Other[0] , identifier[l] operator[SEP] operator[SEP]
}
}
|
public String getResponseBodyAsString() throws IOException {
HttpEntity entity = response.getEntity();
if ( entity == null ) {
return null;
}
String contentEncoding = getContentEncoding(entity);
InputStream in = entity.getContent();
BufferedReader r = new BufferedReader(new InputStreamReader(in,
contentEncoding));
StringBuilder sb = new StringBuilder();
for (;;) {
String l = r.readLine();
if (l == null) {
break;
}
sb.append(l).append("\n");
}
r.close();
in.close();
return sb.toString();
} | class class_name[name] begin[{]
method[getResponseBodyAsString, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[HttpEntity], entity]
if[binary_operation[member[.entity], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], contentEncoding]
local_variable[type[InputStream], in]
local_variable[type[BufferedReader], r]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), name=l)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=l, 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=[BreakStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=ForControl(condition=None, init=None, update=None), label=None)
call[r.close, parameter[]]
call[in.close, parameter[]]
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getResponseBodyAsString] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[HttpEntity] identifier[entity] operator[=] identifier[response] operator[SEP] identifier[getEntity] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entity] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[contentEncoding] operator[=] identifier[getContentEncoding] operator[SEP] identifier[entity] operator[SEP] operator[SEP] identifier[InputStream] identifier[in] operator[=] identifier[entity] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] operator[SEP] identifier[BufferedReader] identifier[r] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[in] , identifier[contentEncoding] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[l] operator[=] identifier[r] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[l] operator[==] Other[null] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[l] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[r] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[in] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void readObject(DataInputStream dataInputStream, ObjectManagerState objectManagerState) throws ObjectManagerException, IOException
{
super.readObject(dataInputStream, objectManagerState);
// Read in the serialVersionUID
dataInputStream.readLong();
// Read in the number of slices we have
int count = dataInputStream.readInt();
_dataSlices = new ArrayList<DataSlice>(count);
for (int i = 0; i < count; i++)
{
int length = dataInputStream.readInt();
byte[] bytes = new byte[length];
dataInputStream.readFully(bytes, 0, length);
DataSlice slice = new DataSlice(bytes, 0, length);
_dataSlices.add(slice);
}
} | class class_name[name] begin[{]
method[readObject, return_type[void], modifier[public], parameter[dataInputStream, objectManagerState]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=dataInputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=objectManagerState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[dataInputStream.readLong, parameter[]]
local_variable[type[int], count]
assign[member[._dataSlices], ClassCreator(arguments=[MemberReference(member=count, 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=DataSlice, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readInt, postfix_operators=[], prefix_operators=[], qualifier=dataInputStream, selectors=[], type_arguments=None), name=length)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte)), name=bytes)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readFully, postfix_operators=[], prefix_operators=[], qualifier=dataInputStream, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=length, 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=DataSlice, sub_type=None)), name=slice)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DataSlice, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=slice, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=_dataSlices, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[readObject] operator[SEP] identifier[DataInputStream] identifier[dataInputStream] , identifier[ObjectManagerState] identifier[objectManagerState] operator[SEP] Keyword[throws] identifier[ObjectManagerException] , identifier[IOException] {
Keyword[super] operator[SEP] identifier[readObject] operator[SEP] identifier[dataInputStream] , identifier[objectManagerState] operator[SEP] operator[SEP] identifier[dataInputStream] operator[SEP] identifier[readLong] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] identifier[dataInputStream] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] identifier[_dataSlices] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[DataSlice] operator[>] operator[SEP] identifier[count] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[count] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[length] operator[=] identifier[dataInputStream] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[dataInputStream] operator[SEP] identifier[readFully] operator[SEP] identifier[bytes] , Other[0] , identifier[length] operator[SEP] operator[SEP] identifier[DataSlice] identifier[slice] operator[=] Keyword[new] identifier[DataSlice] operator[SEP] identifier[bytes] , Other[0] , identifier[length] operator[SEP] operator[SEP] identifier[_dataSlices] operator[SEP] identifier[add] operator[SEP] identifier[slice] operator[SEP] operator[SEP]
}
}
|
public DateTimeFormatterBuilder append(DateTimePrinter printer, DateTimeParser[] parsers) {
if (printer != null) {
checkPrinter(printer);
}
if (parsers == null) {
throw new IllegalArgumentException("No parsers supplied");
}
int length = parsers.length;
if (length == 1) {
if (parsers[0] == null) {
throw new IllegalArgumentException("No parser supplied");
}
return append0(DateTimePrinterInternalPrinter.of(printer), DateTimeParserInternalParser.of(parsers[0]));
}
InternalParser[] copyOfParsers = new InternalParser[length];
int i;
for (i = 0; i < length - 1; i++) {
if ((copyOfParsers[i] = DateTimeParserInternalParser.of(parsers[i])) == null) {
throw new IllegalArgumentException("Incomplete parser array");
}
}
copyOfParsers[i] = DateTimeParserInternalParser.of(parsers[i]);
return append0(DateTimePrinterInternalPrinter.of(printer), new MatchingParser(copyOfParsers));
} | class class_name[name] begin[{]
method[append, return_type[type[DateTimeFormatterBuilder]], modifier[public], parameter[printer, parsers]] begin[{]
if[binary_operation[member[.printer], !=, literal[null]]] begin[{]
call[.checkPrinter, parameter[member[.printer]]]
else begin[{]
None
end[}]
if[binary_operation[member[.parsers], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No parsers supplied")], 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[int], length]
if[binary_operation[member[.length], ==, literal[1]]] begin[{]
if[binary_operation[member[.parsers], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No parser supplied")], 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[.append0, parameter[call[DateTimePrinterInternalPrinter.of, parameter[member[.printer]]], call[DateTimeParserInternalParser.of, parameter[member[.parsers]]]]]]
else begin[{]
None
end[}]
local_variable[type[InternalParser], copyOfParsers]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=copyOfParsers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=parsers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=of, postfix_operators=[], prefix_operators=[], qualifier=DateTimeParserInternalParser, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Incomplete parser array")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.copyOfParsers], call[DateTimeParserInternalParser.of, parameter[member[.parsers]]]]
return[call[.append0, parameter[call[DateTimePrinterInternalPrinter.of, parameter[member[.printer]]], ClassCreator(arguments=[MemberReference(member=copyOfParsers, 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=MatchingParser, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[DateTimeFormatterBuilder] identifier[append] operator[SEP] identifier[DateTimePrinter] identifier[printer] , identifier[DateTimeParser] operator[SEP] operator[SEP] identifier[parsers] operator[SEP] {
Keyword[if] operator[SEP] identifier[printer] operator[!=] Other[null] operator[SEP] {
identifier[checkPrinter] operator[SEP] identifier[printer] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[parsers] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[int] identifier[length] operator[=] identifier[parsers] operator[SEP] identifier[length] operator[SEP] Keyword[if] operator[SEP] identifier[length] operator[==] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[parsers] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[append0] operator[SEP] identifier[DateTimePrinterInternalPrinter] operator[SEP] identifier[of] operator[SEP] identifier[printer] operator[SEP] , identifier[DateTimeParserInternalParser] operator[SEP] identifier[of] operator[SEP] identifier[parsers] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[InternalParser] operator[SEP] operator[SEP] identifier[copyOfParsers] operator[=] Keyword[new] identifier[InternalParser] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[-] Other[1] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[copyOfParsers] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[DateTimeParserInternalParser] operator[SEP] identifier[of] operator[SEP] identifier[parsers] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[copyOfParsers] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[DateTimeParserInternalParser] operator[SEP] identifier[of] operator[SEP] identifier[parsers] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[append0] operator[SEP] identifier[DateTimePrinterInternalPrinter] operator[SEP] identifier[of] operator[SEP] identifier[printer] operator[SEP] , Keyword[new] identifier[MatchingParser] operator[SEP] identifier[copyOfParsers] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String getStatusLabelDetailsInString(final String value, final String style, final String id) {
final StringBuilder val = new StringBuilder();
if (!StringUtils.isEmpty(value)) {
val.append("value:").append(value).append(",");
}
if (!StringUtils.isEmpty(style)) {
val.append("style:").append(style).append(",");
}
return val.append("id:").append(id).toString();
} | class class_name[name] begin[{]
method[getStatusLabelDetailsInString, return_type[type[String]], modifier[public static], parameter[value, style, id]] begin[{]
local_variable[type[StringBuilder], val]
if[call[StringUtils.isEmpty, parameter[member[.value]]]] begin[{]
call[val.append, parameter[literal["value:"]]]
else begin[{]
None
end[}]
if[call[StringUtils.isEmpty, parameter[member[.style]]]] begin[{]
call[val.append, parameter[literal["style:"]]]
else begin[{]
None
end[}]
return[call[val.append, parameter[literal["id:"]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getStatusLabelDetailsInString] operator[SEP] Keyword[final] identifier[String] identifier[value] , Keyword[final] identifier[String] identifier[style] , Keyword[final] identifier[String] identifier[id] operator[SEP] {
Keyword[final] identifier[StringBuilder] identifier[val] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
identifier[val] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[style] operator[SEP] operator[SEP] {
identifier[val] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[style] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[val] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static boolean checkSign(PurchaseInfoResult result, String pubKey) {
if (result == null || pubKey == null) {
return false;
}
StringBuilder sb = new StringBuilder();
Map<String, Object> paramsa = new HashMap<String, Object>();
paramsa.put("pageCount", result.getPageCount());
paramsa.put("rtnCode", result.getRtnCode());
sb.append(getNoSign(paramsa, false)).append('&');
List<PurchaseInfo> purchaseInfos = result.getPurchaseInfoList();
if (purchaseInfos != null) {
for (PurchaseInfo info : purchaseInfos) {
if (info != null) {
Map<String, Object> paramsaSub = new HashMap<String, Object>();
//必选参数
paramsaSub.put("requestId", info.getRequestId());
paramsaSub.put("merchantId", info.getMerchantId());
paramsaSub.put("appId", info.getAppId());
paramsaSub.put("productId", info.getProductId());
paramsaSub.put("tradeTime", info.getTradeTime());
sb.append(getNoSign(paramsaSub, false)).append('&');
}
}
}
if (sb.charAt(sb.length()-1) == '&') {
sb.deleteCharAt(sb.length()-1);
}
return doCheck(sb.toString(), result.getSign(), pubKey);
} | class class_name[name] begin[{]
method[checkSign, return_type[type[boolean]], modifier[public static], parameter[result, pubKey]] begin[{]
if[binary_operation[binary_operation[member[.result], ==, literal[null]], ||, binary_operation[member[.pubKey], ==, literal[null]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], sb]
local_variable[type[Map], paramsa]
call[paramsa.put, parameter[literal["pageCount"], call[result.getPageCount, parameter[]]]]
call[paramsa.put, parameter[literal["rtnCode"], call[result.getRtnCode, parameter[]]]]
call[sb.append, parameter[call[.getNoSign, parameter[member[.paramsa], literal[false]]]]]
local_variable[type[List], purchaseInfos]
if[binary_operation[member[.purchaseInfos], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=HashMap, sub_type=None)), name=paramsaSub)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="requestId"), MethodInvocation(arguments=[], member=getRequestId, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=paramsaSub, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="merchantId"), MethodInvocation(arguments=[], member=getMerchantId, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=paramsaSub, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="appId"), MethodInvocation(arguments=[], member=getAppId, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=paramsaSub, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="productId"), MethodInvocation(arguments=[], member=getProductId, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=paramsaSub, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="tradeTime"), MethodInvocation(arguments=[], member=getTradeTime, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=paramsaSub, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=paramsaSub, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getNoSign, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, 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)]))]), control=EnhancedForControl(iterable=MemberReference(member=purchaseInfos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=info)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PurchaseInfo, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[call[sb.charAt, parameter[binary_operation[call[sb.length, parameter[]], -, literal[1]]]], ==, literal['&']]] begin[{]
call[sb.deleteCharAt, parameter[binary_operation[call[sb.length, parameter[]], -, literal[1]]]]
else begin[{]
None
end[}]
return[call[.doCheck, parameter[call[sb.toString, parameter[]], call[result.getSign, parameter[]], member[.pubKey]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[checkSign] operator[SEP] identifier[PurchaseInfoResult] identifier[result] , identifier[String] identifier[pubKey] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[||] identifier[pubKey] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[paramsa] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[paramsa] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[result] operator[SEP] identifier[getPageCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[paramsa] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[result] operator[SEP] identifier[getRtnCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[getNoSign] operator[SEP] identifier[paramsa] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[PurchaseInfo] operator[>] identifier[purchaseInfos] operator[=] identifier[result] operator[SEP] identifier[getPurchaseInfoList] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[purchaseInfos] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[PurchaseInfo] identifier[info] operator[:] identifier[purchaseInfos] operator[SEP] {
Keyword[if] operator[SEP] identifier[info] operator[!=] Other[null] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[paramsaSub] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[paramsaSub] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[info] operator[SEP] identifier[getRequestId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[paramsaSub] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[info] operator[SEP] identifier[getMerchantId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[paramsaSub] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[info] operator[SEP] identifier[getAppId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[paramsaSub] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[info] operator[SEP] identifier[getProductId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[paramsaSub] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[info] operator[SEP] identifier[getTradeTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[getNoSign] operator[SEP] identifier[paramsaSub] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[sb] operator[SEP] identifier[charAt] operator[SEP] identifier[sb] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[sb] operator[SEP] identifier[deleteCharAt] operator[SEP] identifier[sb] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[doCheck] operator[SEP] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[result] operator[SEP] identifier[getSign] operator[SEP] operator[SEP] , identifier[pubKey] operator[SEP] operator[SEP]
}
|
public static void addModal(JDialog dialog, Component component,
ModalListener listener) {
addModal_(dialog, component, listener, defaultModalDepth);
} | class class_name[name] begin[{]
method[addModal, return_type[void], modifier[public static], parameter[dialog, component, listener]] begin[{]
call[.addModal_, parameter[member[.dialog], member[.component], member[.listener], member[.defaultModalDepth]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[addModal] operator[SEP] identifier[JDialog] identifier[dialog] , identifier[Component] identifier[component] , identifier[ModalListener] identifier[listener] operator[SEP] {
identifier[addModal_] operator[SEP] identifier[dialog] , identifier[component] , identifier[listener] , identifier[defaultModalDepth] operator[SEP] operator[SEP]
}
|
public static String getDateStr(Date date) {
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(date);
} | class class_name[name] begin[{]
method[getDateStr, return_type[type[String]], modifier[public static], parameter[date]] begin[{]
local_variable[type[java], sdf]
return[call[sdf.format, parameter[member[.date]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getDateStr] operator[SEP] identifier[Date] identifier[date] operator[SEP] {
identifier[java] operator[SEP] identifier[text] operator[SEP] identifier[SimpleDateFormat] identifier[sdf] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[text] operator[SEP] identifier[SimpleDateFormat] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[sdf] operator[SEP] identifier[format] operator[SEP] identifier[date] operator[SEP] operator[SEP]
}
|
public void set(int row, int col, double val) {
checkIndices(row, col, true);
Entry e = new Entry(row, col);
// Spin waiting for the entry to be unlocked
while (lockedEntries.putIfAbsent(e, new Object()) != null)
;
boolean present = matrixEntries.containsKey(e);
if (val != 0) {
matrixEntries.put(e, val);
// Only invalidate the cache if the number of rows or columns
// containing data has changed
if (!present)
modifications.incrementAndGet();
}
else if (present) {
matrixEntries.remove(e);
modifications.incrementAndGet();
}
lockedEntries.remove(e);
} | class class_name[name] begin[{]
method[set, return_type[void], modifier[public], parameter[row, col, val]] begin[{]
call[.checkIndices, parameter[member[.row], member[.col], literal[true]]]
local_variable[type[Entry], e]
while[binary_operation[call[lockedEntries.putIfAbsent, parameter[member[.e], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]], !=, literal[null]]] begin[{]
Statement(label=None)
end[}]
local_variable[type[boolean], present]
if[binary_operation[member[.val], !=, literal[0]]] begin[{]
call[matrixEntries.put, parameter[member[.e], member[.val]]]
if[member[.present]] begin[{]
call[modifications.incrementAndGet, parameter[]]
else begin[{]
None
end[}]
else begin[{]
if[member[.present]] begin[{]
call[matrixEntries.remove, parameter[member[.e]]]
call[modifications.incrementAndGet, parameter[]]
else begin[{]
None
end[}]
end[}]
call[lockedEntries.remove, parameter[member[.e]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[set] operator[SEP] Keyword[int] identifier[row] , Keyword[int] identifier[col] , Keyword[double] identifier[val] operator[SEP] {
identifier[checkIndices] operator[SEP] identifier[row] , identifier[col] , literal[boolean] operator[SEP] operator[SEP] identifier[Entry] identifier[e] operator[=] Keyword[new] identifier[Entry] operator[SEP] identifier[row] , identifier[col] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[lockedEntries] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[e] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP] Keyword[boolean] identifier[present] operator[=] identifier[matrixEntries] operator[SEP] identifier[containsKey] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[!=] Other[0] operator[SEP] {
identifier[matrixEntries] operator[SEP] identifier[put] operator[SEP] identifier[e] , identifier[val] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[present] operator[SEP] identifier[modifications] operator[SEP] identifier[incrementAndGet] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[present] operator[SEP] {
identifier[matrixEntries] operator[SEP] identifier[remove] operator[SEP] identifier[e] operator[SEP] operator[SEP] identifier[modifications] operator[SEP] identifier[incrementAndGet] operator[SEP] operator[SEP] operator[SEP]
}
identifier[lockedEntries] operator[SEP] identifier[remove] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
|
protected Collection<CommunicationSummaryStatistics> doGetCommunicationSummaryStatistics(String tenantId, Criteria criteria) {
String index = client.getIndex(tenantId);
Map<String, CommunicationSummaryStatistics> stats = new HashMap<>();
if (!criteria.transactionWide()) {
Criteria txnWideCriteria = criteria.deriveTransactionWide();
buildCommunicationSummaryStatistics(stats, index, txnWideCriteria, false);
}
buildCommunicationSummaryStatistics(stats, index, criteria, true);
return stats.values();
} | class class_name[name] begin[{]
method[doGetCommunicationSummaryStatistics, return_type[type[Collection]], modifier[protected], parameter[tenantId, criteria]] begin[{]
local_variable[type[String], index]
local_variable[type[Map], stats]
if[call[criteria.transactionWide, parameter[]]] begin[{]
local_variable[type[Criteria], txnWideCriteria]
call[.buildCommunicationSummaryStatistics, parameter[member[.stats], member[.index], member[.txnWideCriteria], literal[false]]]
else begin[{]
None
end[}]
call[.buildCommunicationSummaryStatistics, parameter[member[.stats], member[.index], member[.criteria], literal[true]]]
return[call[stats.values, parameter[]]]
end[}]
END[}] | Keyword[protected] identifier[Collection] operator[<] identifier[CommunicationSummaryStatistics] operator[>] identifier[doGetCommunicationSummaryStatistics] operator[SEP] identifier[String] identifier[tenantId] , identifier[Criteria] identifier[criteria] operator[SEP] {
identifier[String] identifier[index] operator[=] identifier[client] operator[SEP] identifier[getIndex] operator[SEP] identifier[tenantId] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[CommunicationSummaryStatistics] operator[>] identifier[stats] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[criteria] operator[SEP] identifier[transactionWide] operator[SEP] operator[SEP] operator[SEP] {
identifier[Criteria] identifier[txnWideCriteria] operator[=] identifier[criteria] operator[SEP] identifier[deriveTransactionWide] operator[SEP] operator[SEP] operator[SEP] identifier[buildCommunicationSummaryStatistics] operator[SEP] identifier[stats] , identifier[index] , identifier[txnWideCriteria] , literal[boolean] operator[SEP] operator[SEP]
}
identifier[buildCommunicationSummaryStatistics] operator[SEP] identifier[stats] , identifier[index] , identifier[criteria] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[stats] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
// If current ajax trigger, process menu for current selections
if (AjaxHelper.isCurrentAjaxTrigger(this)) {
WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);
menu.handleRequest(request);
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(),
this.getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
boolean openState = "true".equals(request.getParameter(getId() + ".open"));
setOpen(openState);
}
} | class class_name[name] begin[{]
method[handleRequest, return_type[void], modifier[public], parameter[request]] begin[{]
if[call[.isDisabled, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[call[.isMenuPresent, parameter[member[.request]]]] begin[{]
if[call[AjaxHelper.isCurrentAjaxTrigger, parameter[THIS[]]]] begin[{]
local_variable[type[WMenu], menu]
call[menu.handleRequest, parameter[member[.request]]]
local_variable[type[Action], action]
if[binary_operation[member[.action], !=, literal[null]]] begin[{]
local_variable[type[ActionEvent], event]
local_variable[type[Runnable], later]
call[.invokeLater, parameter[member[.later]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[boolean], openState]
call[.setOpen, parameter[member[.openState]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handleRequest] operator[SEP] Keyword[final] identifier[Request] identifier[request] operator[SEP] {
Keyword[if] operator[SEP] identifier[isDisabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isMenuPresent] operator[SEP] identifier[request] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[AjaxHelper] operator[SEP] identifier[isCurrentAjaxTrigger] operator[SEP] Keyword[this] operator[SEP] operator[SEP] {
identifier[WMenu] identifier[menu] operator[=] identifier[WebUtilities] operator[SEP] identifier[getAncestorOfClass] operator[SEP] identifier[WMenu] operator[SEP] Keyword[class] , Keyword[this] operator[SEP] operator[SEP] identifier[menu] operator[SEP] identifier[handleRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[final] identifier[Action] identifier[action] operator[=] identifier[getAction] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[action] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[ActionEvent] identifier[event] operator[=] Keyword[new] identifier[ActionEvent] operator[SEP] Keyword[this] , Keyword[this] operator[SEP] identifier[getActionCommand] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[getActionObject] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Runnable] identifier[later] operator[=] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[action] operator[SEP] identifier[execute] operator[SEP] identifier[event] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[invokeLater] operator[SEP] identifier[later] operator[SEP] operator[SEP]
}
}
Keyword[boolean] identifier[openState] operator[=] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[setOpen] operator[SEP] identifier[openState] operator[SEP] operator[SEP]
}
}
|
private static void parseServlets(final ServletType servletType, final WebApp webApp) {
final WebAppServlet servlet = new WebAppServlet();
servlet.setServletName(servletType.getServletName().getValue());
if (servletType.getServletClass() != null) {
servlet.setServletClassName(servletType.getServletClass().getValue());
webApp.addServlet(servlet);
} else {
String jspFile = servletType.getJspFile().getValue();
if (jspFile != null) {
WebAppJspServlet jspServlet = new WebAppJspServlet();
jspServlet.setServletName(servletType.getServletName().getValue());
jspServlet.setJspPath(jspFile);
webApp.addServlet(jspServlet);
}
}
servlet.setLoadOnStartup(servletType.getLoadOnStartup());
if (servletType.getAsyncSupported() != null) {
servlet.setAsyncSupported(servletType.getAsyncSupported().isValue());
}
MultipartConfigType multipartConfig = servletType.getMultipartConfig();
if (multipartConfig != null) {
String location;
if (multipartConfig.getLocation() == null) {
location = null;
} else {
location = multipartConfig.getLocation().getValue();
}
long maxFileSize;
if (multipartConfig.getMaxFileSize() == null) {
maxFileSize = -1L;
} else {
maxFileSize = multipartConfig.getMaxFileSize();
}
long maxRequestSize;
if (multipartConfig.getMaxRequestSize() == null) {
maxRequestSize = -1L;
} else {
maxRequestSize = multipartConfig.getMaxRequestSize();
}
int fileSizeThreshold;
if (multipartConfig.getFileSizeThreshold() == null) {
fileSizeThreshold = 0;
} else {
fileSizeThreshold = multipartConfig.getFileSizeThreshold().intValue();
}
MultipartConfigElement multipartConfigElement = new MultipartConfigElement(location, maxFileSize, maxRequestSize,
fileSizeThreshold);
servlet.setMultipartConfig(multipartConfigElement);
}
List<ParamValueType> servletInitParams = servletType.getInitParam();
for (ParamValueType initParamElement : servletInitParams) {
final WebAppInitParam initParam = new WebAppInitParam();
initParam.setParamName(initParamElement.getParamName().getValue());
initParam.setParamValue(initParamElement.getParamValue().getValue());
servlet.addInitParam(initParam);
}
} | class class_name[name] begin[{]
method[parseServlets, return_type[void], modifier[private static], parameter[servletType, webApp]] begin[{]
local_variable[type[WebAppServlet], servlet]
call[servlet.setServletName, parameter[call[servletType.getServletName, parameter[]]]]
if[binary_operation[call[servletType.getServletClass, parameter[]], !=, literal[null]]] begin[{]
call[servlet.setServletClassName, parameter[call[servletType.getServletClass, parameter[]]]]
call[webApp.addServlet, parameter[member[.servlet]]]
else begin[{]
local_variable[type[String], jspFile]
if[binary_operation[member[.jspFile], !=, literal[null]]] begin[{]
local_variable[type[WebAppJspServlet], jspServlet]
call[jspServlet.setServletName, parameter[call[servletType.getServletName, parameter[]]]]
call[jspServlet.setJspPath, parameter[member[.jspFile]]]
call[webApp.addServlet, parameter[member[.jspServlet]]]
else begin[{]
None
end[}]
end[}]
call[servlet.setLoadOnStartup, parameter[call[servletType.getLoadOnStartup, parameter[]]]]
if[binary_operation[call[servletType.getAsyncSupported, parameter[]], !=, literal[null]]] begin[{]
call[servlet.setAsyncSupported, parameter[call[servletType.getAsyncSupported, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[MultipartConfigType], multipartConfig]
if[binary_operation[member[.multipartConfig], !=, literal[null]]] begin[{]
local_variable[type[String], location]
if[binary_operation[call[multipartConfig.getLocation, parameter[]], ==, literal[null]]] begin[{]
assign[member[.location], literal[null]]
else begin[{]
assign[member[.location], call[multipartConfig.getLocation, parameter[]]]
end[}]
local_variable[type[long], maxFileSize]
if[binary_operation[call[multipartConfig.getMaxFileSize, parameter[]], ==, literal[null]]] begin[{]
assign[member[.maxFileSize], literal[1L]]
else begin[{]
assign[member[.maxFileSize], call[multipartConfig.getMaxFileSize, parameter[]]]
end[}]
local_variable[type[long], maxRequestSize]
if[binary_operation[call[multipartConfig.getMaxRequestSize, parameter[]], ==, literal[null]]] begin[{]
assign[member[.maxRequestSize], literal[1L]]
else begin[{]
assign[member[.maxRequestSize], call[multipartConfig.getMaxRequestSize, parameter[]]]
end[}]
local_variable[type[int], fileSizeThreshold]
if[binary_operation[call[multipartConfig.getFileSizeThreshold, parameter[]], ==, literal[null]]] begin[{]
assign[member[.fileSizeThreshold], literal[0]]
else begin[{]
assign[member[.fileSizeThreshold], call[multipartConfig.getFileSizeThreshold, parameter[]]]
end[}]
local_variable[type[MultipartConfigElement], multipartConfigElement]
call[servlet.setMultipartConfig, parameter[member[.multipartConfigElement]]]
else begin[{]
None
end[}]
local_variable[type[List], servletInitParams]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebAppInitParam, sub_type=None)), name=initParam)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=WebAppInitParam, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParamName, postfix_operators=[], prefix_operators=[], qualifier=initParamElement, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setParamName, postfix_operators=[], prefix_operators=[], qualifier=initParam, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParamValue, postfix_operators=[], prefix_operators=[], qualifier=initParamElement, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setParamValue, postfix_operators=[], prefix_operators=[], qualifier=initParam, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=initParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addInitParam, postfix_operators=[], prefix_operators=[], qualifier=servlet, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=servletInitParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=initParamElement)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ParamValueType, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[parseServlets] operator[SEP] Keyword[final] identifier[ServletType] identifier[servletType] , Keyword[final] identifier[WebApp] identifier[webApp] operator[SEP] {
Keyword[final] identifier[WebAppServlet] identifier[servlet] operator[=] Keyword[new] identifier[WebAppServlet] operator[SEP] operator[SEP] operator[SEP] identifier[servlet] operator[SEP] identifier[setServletName] operator[SEP] identifier[servletType] operator[SEP] identifier[getServletName] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[servletType] operator[SEP] identifier[getServletClass] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[servlet] operator[SEP] identifier[setServletClassName] operator[SEP] identifier[servletType] operator[SEP] identifier[getServletClass] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[webApp] operator[SEP] identifier[addServlet] operator[SEP] identifier[servlet] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[jspFile] operator[=] identifier[servletType] operator[SEP] identifier[getJspFile] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jspFile] operator[!=] Other[null] operator[SEP] {
identifier[WebAppJspServlet] identifier[jspServlet] operator[=] Keyword[new] identifier[WebAppJspServlet] operator[SEP] operator[SEP] operator[SEP] identifier[jspServlet] operator[SEP] identifier[setServletName] operator[SEP] identifier[servletType] operator[SEP] identifier[getServletName] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[jspServlet] operator[SEP] identifier[setJspPath] operator[SEP] identifier[jspFile] operator[SEP] operator[SEP] identifier[webApp] operator[SEP] identifier[addServlet] operator[SEP] identifier[jspServlet] operator[SEP] operator[SEP]
}
}
identifier[servlet] operator[SEP] identifier[setLoadOnStartup] operator[SEP] identifier[servletType] operator[SEP] identifier[getLoadOnStartup] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[servletType] operator[SEP] identifier[getAsyncSupported] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[servlet] operator[SEP] identifier[setAsyncSupported] operator[SEP] identifier[servletType] operator[SEP] identifier[getAsyncSupported] operator[SEP] operator[SEP] operator[SEP] identifier[isValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[MultipartConfigType] identifier[multipartConfig] operator[=] identifier[servletType] operator[SEP] identifier[getMultipartConfig] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[multipartConfig] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[location] operator[SEP] Keyword[if] operator[SEP] identifier[multipartConfig] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[location] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
identifier[location] operator[=] identifier[multipartConfig] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[long] identifier[maxFileSize] operator[SEP] Keyword[if] operator[SEP] identifier[multipartConfig] operator[SEP] identifier[getMaxFileSize] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[maxFileSize] operator[=] operator[-] Other[1L] operator[SEP]
}
Keyword[else] {
identifier[maxFileSize] operator[=] identifier[multipartConfig] operator[SEP] identifier[getMaxFileSize] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[long] identifier[maxRequestSize] operator[SEP] Keyword[if] operator[SEP] identifier[multipartConfig] operator[SEP] identifier[getMaxRequestSize] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[maxRequestSize] operator[=] operator[-] Other[1L] operator[SEP]
}
Keyword[else] {
identifier[maxRequestSize] operator[=] identifier[multipartConfig] operator[SEP] identifier[getMaxRequestSize] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[fileSizeThreshold] operator[SEP] Keyword[if] operator[SEP] identifier[multipartConfig] operator[SEP] identifier[getFileSizeThreshold] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[fileSizeThreshold] operator[=] Other[0] operator[SEP]
}
Keyword[else] {
identifier[fileSizeThreshold] operator[=] identifier[multipartConfig] operator[SEP] identifier[getFileSizeThreshold] operator[SEP] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP]
}
identifier[MultipartConfigElement] identifier[multipartConfigElement] operator[=] Keyword[new] identifier[MultipartConfigElement] operator[SEP] identifier[location] , identifier[maxFileSize] , identifier[maxRequestSize] , identifier[fileSizeThreshold] operator[SEP] operator[SEP] identifier[servlet] operator[SEP] identifier[setMultipartConfig] operator[SEP] identifier[multipartConfigElement] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[ParamValueType] operator[>] identifier[servletInitParams] operator[=] identifier[servletType] operator[SEP] identifier[getInitParam] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ParamValueType] identifier[initParamElement] operator[:] identifier[servletInitParams] operator[SEP] {
Keyword[final] identifier[WebAppInitParam] identifier[initParam] operator[=] Keyword[new] identifier[WebAppInitParam] operator[SEP] operator[SEP] operator[SEP] identifier[initParam] operator[SEP] identifier[setParamName] operator[SEP] identifier[initParamElement] operator[SEP] identifier[getParamName] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[initParam] operator[SEP] identifier[setParamValue] operator[SEP] identifier[initParamElement] operator[SEP] identifier[getParamValue] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[servlet] operator[SEP] identifier[addInitParam] operator[SEP] identifier[initParam] operator[SEP] operator[SEP]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.