code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
@Override
public void insertArchive(JarScriptArchive jarScriptArchive) throws IOException {
Objects.requireNonNull(jarScriptArchive, "jarScriptArchive");
ScriptModuleSpec moduleSpec = jarScriptArchive.getModuleSpec();
ModuleId moduleId = moduleSpec.getModuleId();
Path jarFilePath;
try {
jarFilePath = Paths.get(jarScriptArchive.getRootUrl().toURI());
} catch (URISyntaxException e) {
throw new IOException(e);
}
int shardNum = calculateShardNum(moduleId);
byte[] jarBytes = Files.readAllBytes(jarFilePath);
byte[] hash = calculateHash(jarBytes);
Map<String, Object> columns = new HashMap<String, Object>();
columns.put(Columns.module_id.name(), moduleId.toString());
columns.put(Columns.module_name.name(), moduleId.getName());
columns.put(Columns.module_version.name(), moduleId.getVersion());
columns.put(Columns.shard_num.name(), shardNum);
columns.put(Columns.last_update.name(), jarScriptArchive.getCreateTime());
columns.put(Columns.archive_content_hash.name(), hash);
columns.put(Columns.archive_content.name(), jarBytes);
String serialized = getConfig().getModuleSpecSerializer().serialize(moduleSpec);
columns.put(Columns.module_spec.name(), serialized);
try {
cassandra.upsert(moduleId.toString(), columns);
} catch (Exception e) {
throw new IOException(e);
}
} | class class_name[name] begin[{]
method[insertArchive, return_type[void], modifier[public], parameter[jarScriptArchive]] begin[{]
call[Objects.requireNonNull, parameter[member[.jarScriptArchive], literal["jarScriptArchive"]]]
local_variable[type[ScriptModuleSpec], moduleSpec]
local_variable[type[ModuleId], moduleId]
local_variable[type[Path], jarFilePath]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jarFilePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRootUrl, postfix_operators=[], prefix_operators=[], qualifier=jarScriptArchive, selectors=[MethodInvocation(arguments=[], member=toURI, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=Paths, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
local_variable[type[int], shardNum]
local_variable[type[byte], jarBytes]
local_variable[type[byte], hash]
local_variable[type[Map], columns]
call[columns.put, parameter[call[Columns.module_id.name, parameter[]], call[moduleId.toString, parameter[]]]]
call[columns.put, parameter[call[Columns.module_name.name, parameter[]], call[moduleId.getName, parameter[]]]]
call[columns.put, parameter[call[Columns.module_version.name, parameter[]], call[moduleId.getVersion, parameter[]]]]
call[columns.put, parameter[call[Columns.shard_num.name, parameter[]], member[.shardNum]]]
call[columns.put, parameter[call[Columns.last_update.name, parameter[]], call[jarScriptArchive.getCreateTime, parameter[]]]]
call[columns.put, parameter[call[Columns.archive_content_hash.name, parameter[]], member[.hash]]]
call[columns.put, parameter[call[Columns.archive_content.name, parameter[]], member[.jarBytes]]]
local_variable[type[String], serialized]
call[columns.put, parameter[call[Columns.module_spec.name, parameter[]], member[.serialized]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=moduleId, selectors=[], type_arguments=None), MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=upsert, postfix_operators=[], prefix_operators=[], qualifier=cassandra, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, 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[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[insertArchive] operator[SEP] identifier[JarScriptArchive] identifier[jarScriptArchive] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[jarScriptArchive] , literal[String] operator[SEP] operator[SEP] identifier[ScriptModuleSpec] identifier[moduleSpec] operator[=] identifier[jarScriptArchive] operator[SEP] identifier[getModuleSpec] operator[SEP] operator[SEP] operator[SEP] identifier[ModuleId] identifier[moduleId] operator[=] identifier[moduleSpec] operator[SEP] identifier[getModuleId] operator[SEP] operator[SEP] operator[SEP] identifier[Path] identifier[jarFilePath] operator[SEP] Keyword[try] {
identifier[jarFilePath] operator[=] identifier[Paths] operator[SEP] identifier[get] operator[SEP] identifier[jarScriptArchive] operator[SEP] identifier[getRootUrl] operator[SEP] operator[SEP] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[int] identifier[shardNum] operator[=] identifier[calculateShardNum] operator[SEP] identifier[moduleId] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[jarBytes] operator[=] identifier[Files] operator[SEP] identifier[readAllBytes] operator[SEP] identifier[jarFilePath] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[hash] operator[=] identifier[calculateHash] operator[SEP] identifier[jarBytes] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[columns] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[put] operator[SEP] identifier[Columns] operator[SEP] identifier[module_id] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[moduleId] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[put] operator[SEP] identifier[Columns] operator[SEP] identifier[module_name] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[moduleId] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[put] operator[SEP] identifier[Columns] operator[SEP] identifier[module_version] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[moduleId] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[put] operator[SEP] identifier[Columns] operator[SEP] identifier[shard_num] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[shardNum] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[put] operator[SEP] identifier[Columns] operator[SEP] identifier[last_update] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[jarScriptArchive] operator[SEP] identifier[getCreateTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[put] operator[SEP] identifier[Columns] operator[SEP] identifier[archive_content_hash] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[hash] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[put] operator[SEP] identifier[Columns] operator[SEP] identifier[archive_content] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[jarBytes] operator[SEP] operator[SEP] identifier[String] identifier[serialized] operator[=] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getModuleSpecSerializer] operator[SEP] operator[SEP] operator[SEP] identifier[serialize] operator[SEP] identifier[moduleSpec] operator[SEP] operator[SEP] identifier[columns] operator[SEP] identifier[put] operator[SEP] identifier[Columns] operator[SEP] identifier[module_spec] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[serialized] operator[SEP] operator[SEP] Keyword[try] {
identifier[cassandra] operator[SEP] identifier[upsert] operator[SEP] identifier[moduleId] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[columns] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public String getDictCanon() {
if (DictTerm_Type.featOkTst && ((DictTerm_Type)jcasType).casFeat_DictCanon == null)
jcasType.jcas.throwFeatMissing("DictCanon", "org.apache.uima.conceptMapper.DictTerm");
return jcasType.ll_cas.ll_getStringValue(addr, ((DictTerm_Type)jcasType).casFeatCode_DictCanon);} | class class_name[name] begin[{]
method[getDictCanon, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[DictTerm_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DictTerm_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["DictCanon"], literal["org.apache.uima.conceptMapper.DictTerm"]]]
else begin[{]
None
end[}]
return[call[jcasType.ll_cas.ll_getStringValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DictTerm_Type, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getDictCanon] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[DictTerm_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[DictTerm_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_DictCanon] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_getStringValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[DictTerm_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_DictCanon] operator[SEP] operator[SEP]
}
|
@Override
protected void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
// Setup service - will handle
getAndSetRESTHandlerContainer(request);
// We have special logic for the context root
if ("/".equals(request.getPathInfo())) {
// We only handle GET requests on the context root
//Note: By design we're not checking for authorized roles here, because we're only exposing which URLs are available
if ("GET".equals(request.getMethod())) {
listRegisteredHandlers(response);
} else {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
}
} else {
handleWithDelegate(request, response);
}
} | class class_name[name] begin[{]
method[service, return_type[void], modifier[protected], parameter[request, response]] begin[{]
call[.getAndSetRESTHandlerContainer, parameter[member[.request]]]
if[literal["/"]] begin[{]
if[literal["GET"]] begin[{]
call[.listRegisteredHandlers, parameter[member[.response]]]
else begin[{]
call[response.sendError, parameter[member[HttpServletResponse.SC_METHOD_NOT_ALLOWED]]]
end[}]
else begin[{]
call[.handleWithDelegate, parameter[member[.request], member[.response]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[service] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[request] , Keyword[final] identifier[HttpServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[ServletException] , identifier[IOException] {
identifier[getAndSetRESTHandlerContainer] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[request] operator[SEP] identifier[getPathInfo] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[request] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[listRegisteredHandlers] operator[SEP] identifier[response] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[response] operator[SEP] identifier[sendError] operator[SEP] identifier[HttpServletResponse] operator[SEP] identifier[SC_METHOD_NOT_ALLOWED] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[handleWithDelegate] operator[SEP] identifier[request] , identifier[response] operator[SEP] operator[SEP]
}
}
|
private void installLexicalHandler ()
{
XMLReader parent = getParent();
if (parent == null) {
throw new NullPointerException("No parent for filter");
}
// try to register for lexical events
for (int i = 0; i < LEXICAL_HANDLER_NAMES.length; i++) {
try {
parent.setProperty(LEXICAL_HANDLER_NAMES[i], this);
break;
}
catch (SAXNotRecognizedException ex) {
// ignore
}
catch (SAXNotSupportedException ex) {
// ignore
}
}
} | class class_name[name] begin[{]
method[installLexicalHandler, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[XMLReader], parent]
if[binary_operation[member[.parent], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No parent for filter")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=LEXICAL_HANDLER_NAMES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['SAXNotRecognizedException'])), CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['SAXNotSupportedException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=LEXICAL_HANDLER_NAMES, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[installLexicalHandler] operator[SEP] operator[SEP] {
identifier[XMLReader] identifier[parent] operator[=] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parent] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[LEXICAL_HANDLER_NAMES] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[try] {
identifier[parent] operator[SEP] identifier[setProperty] operator[SEP] identifier[LEXICAL_HANDLER_NAMES] operator[SEP] identifier[i] operator[SEP] , Keyword[this] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SAXNotRecognizedException] identifier[ex] operator[SEP] {
}
Keyword[catch] operator[SEP] identifier[SAXNotSupportedException] identifier[ex] operator[SEP] {
}
}
}
|
public final void addInvBsTxExTxc(final List<SalesInvoiceServiceLine> pTxdLns,
final Long pCatId, final Double pSubt, final Double pSubtFc,
final Double pPercent, final AccSettings pAs,
final TaxDestination pTxRules) {
SalesInvoiceServiceLine txdLn = null;
for (SalesInvoiceServiceLine tdl : pTxdLns) {
if (tdl.getItsId().equals(pCatId)) {
txdLn = tdl;
}
}
if (txdLn == null) {
txdLn = new SalesInvoiceServiceLine();
txdLn.setItsId(pCatId);
InvItemTaxCategory tc = new InvItemTaxCategory();
tc.setItsId(pCatId);
txdLn.setTaxCategory(tc);
pTxdLns.add(txdLn);
}
BigDecimal bd100 = new BigDecimal("100.00");
BigDecimal txv = BigDecimal.valueOf(pSubt).multiply(BigDecimal
.valueOf(pPercent)).divide(bd100, pAs.getPricePrecision(),
pTxRules.getSalTaxRoundMode());
txdLn.setTotalTaxes(txdLn.getTotalTaxes().add(txv));
BigDecimal txvf = BigDecimal.valueOf(pSubtFc).multiply(BigDecimal
.valueOf(pPercent)).divide(bd100, pAs.getPricePrecision(),
pTxRules.getSalTaxRoundMode());
txdLn.setForeignTotalTaxes(txdLn.getForeignTotalTaxes().add(txvf));
} | class class_name[name] begin[{]
method[addInvBsTxExTxc, return_type[void], modifier[final public], parameter[pTxdLns, pCatId, pSubt, pSubtFc, pPercent, pAs, pTxRules]] begin[{]
local_variable[type[SalesInvoiceServiceLine], txdLn]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getItsId, postfix_operators=[], prefix_operators=[], qualifier=tdl, selectors=[MethodInvocation(arguments=[MemberReference(member=pCatId, 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=Assignment(expressionl=MemberReference(member=txdLn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=tdl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=pTxdLns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tdl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SalesInvoiceServiceLine, sub_type=None))), label=None)
if[binary_operation[member[.txdLn], ==, literal[null]]] begin[{]
assign[member[.txdLn], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SalesInvoiceServiceLine, sub_type=None))]
call[txdLn.setItsId, parameter[member[.pCatId]]]
local_variable[type[InvItemTaxCategory], tc]
call[tc.setItsId, parameter[member[.pCatId]]]
call[txdLn.setTaxCategory, parameter[member[.tc]]]
call[pTxdLns.add, parameter[member[.txdLn]]]
else begin[{]
None
end[}]
local_variable[type[BigDecimal], bd100]
local_variable[type[BigDecimal], txv]
call[txdLn.setTotalTaxes, parameter[call[txdLn.getTotalTaxes, parameter[]]]]
local_variable[type[BigDecimal], txvf]
call[txdLn.setForeignTotalTaxes, parameter[call[txdLn.getForeignTotalTaxes, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[addInvBsTxExTxc] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[SalesInvoiceServiceLine] operator[>] identifier[pTxdLns] , Keyword[final] identifier[Long] identifier[pCatId] , Keyword[final] identifier[Double] identifier[pSubt] , Keyword[final] identifier[Double] identifier[pSubtFc] , Keyword[final] identifier[Double] identifier[pPercent] , Keyword[final] identifier[AccSettings] identifier[pAs] , Keyword[final] identifier[TaxDestination] identifier[pTxRules] operator[SEP] {
identifier[SalesInvoiceServiceLine] identifier[txdLn] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[SalesInvoiceServiceLine] identifier[tdl] operator[:] identifier[pTxdLns] operator[SEP] {
Keyword[if] operator[SEP] identifier[tdl] operator[SEP] identifier[getItsId] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[pCatId] operator[SEP] operator[SEP] {
identifier[txdLn] operator[=] identifier[tdl] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[txdLn] operator[==] Other[null] operator[SEP] {
identifier[txdLn] operator[=] Keyword[new] identifier[SalesInvoiceServiceLine] operator[SEP] operator[SEP] operator[SEP] identifier[txdLn] operator[SEP] identifier[setItsId] operator[SEP] identifier[pCatId] operator[SEP] operator[SEP] identifier[InvItemTaxCategory] identifier[tc] operator[=] Keyword[new] identifier[InvItemTaxCategory] operator[SEP] operator[SEP] operator[SEP] identifier[tc] operator[SEP] identifier[setItsId] operator[SEP] identifier[pCatId] operator[SEP] operator[SEP] identifier[txdLn] operator[SEP] identifier[setTaxCategory] operator[SEP] identifier[tc] operator[SEP] operator[SEP] identifier[pTxdLns] operator[SEP] identifier[add] operator[SEP] identifier[txdLn] operator[SEP] operator[SEP]
}
identifier[BigDecimal] identifier[bd100] operator[=] Keyword[new] identifier[BigDecimal] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[BigDecimal] identifier[txv] operator[=] identifier[BigDecimal] operator[SEP] identifier[valueOf] operator[SEP] identifier[pSubt] operator[SEP] operator[SEP] identifier[multiply] operator[SEP] identifier[BigDecimal] operator[SEP] identifier[valueOf] operator[SEP] identifier[pPercent] operator[SEP] operator[SEP] operator[SEP] identifier[divide] operator[SEP] identifier[bd100] , identifier[pAs] operator[SEP] identifier[getPricePrecision] operator[SEP] operator[SEP] , identifier[pTxRules] operator[SEP] identifier[getSalTaxRoundMode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[txdLn] operator[SEP] identifier[setTotalTaxes] operator[SEP] identifier[txdLn] operator[SEP] identifier[getTotalTaxes] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[txv] operator[SEP] operator[SEP] operator[SEP] identifier[BigDecimal] identifier[txvf] operator[=] identifier[BigDecimal] operator[SEP] identifier[valueOf] operator[SEP] identifier[pSubtFc] operator[SEP] operator[SEP] identifier[multiply] operator[SEP] identifier[BigDecimal] operator[SEP] identifier[valueOf] operator[SEP] identifier[pPercent] operator[SEP] operator[SEP] operator[SEP] identifier[divide] operator[SEP] identifier[bd100] , identifier[pAs] operator[SEP] identifier[getPricePrecision] operator[SEP] operator[SEP] , identifier[pTxRules] operator[SEP] identifier[getSalTaxRoundMode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[txdLn] operator[SEP] identifier[setForeignTotalTaxes] operator[SEP] identifier[txdLn] operator[SEP] identifier[getForeignTotalTaxes] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[txvf] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(ReservationCoverageGroup reservationCoverageGroup, ProtocolMarshaller protocolMarshaller) {
if (reservationCoverageGroup == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(reservationCoverageGroup.getAttributes(), ATTRIBUTES_BINDING);
protocolMarshaller.marshall(reservationCoverageGroup.getCoverage(), COVERAGE_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[reservationCoverageGroup, protocolMarshaller]] begin[{]
if[binary_operation[member[.reservationCoverageGroup], ==, 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=getAttributes, postfix_operators=[], prefix_operators=[], qualifier=reservationCoverageGroup, selectors=[], type_arguments=None), MemberReference(member=ATTRIBUTES_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCoverage, postfix_operators=[], prefix_operators=[], qualifier=reservationCoverageGroup, selectors=[], type_arguments=None), MemberReference(member=COVERAGE_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[ReservationCoverageGroup] identifier[reservationCoverageGroup] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[reservationCoverageGroup] 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[reservationCoverageGroup] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] , identifier[ATTRIBUTES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[reservationCoverageGroup] operator[SEP] identifier[getCoverage] operator[SEP] operator[SEP] , identifier[COVERAGE_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 double Sinc(double x) {
return Math.sin(Math.PI * x) / (Math.PI * x);
} | class class_name[name] begin[{]
method[Sinc, return_type[type[double]], modifier[public static], parameter[x]] begin[{]
return[binary_operation[call[Math.sin, parameter[binary_operation[member[Math.PI], *, member[.x]]]], /, binary_operation[member[Math.PI], *, member[.x]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[Sinc] operator[SEP] Keyword[double] identifier[x] operator[SEP] {
Keyword[return] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[Math] operator[SEP] identifier[PI] operator[*] identifier[x] operator[SEP] operator[/] operator[SEP] identifier[Math] operator[SEP] identifier[PI] operator[*] identifier[x] operator[SEP] operator[SEP]
}
|
private void addDependency(String symbol, Set<String> seen, List<String> list)
throws ServiceException {
DependencyInfo dependency = getDependencyInfo(symbol);
if (dependency == null) {
if (this.strictRequires) {
throw new ServiceException("Unknown require of " + symbol);
}
} else if (!seen.containsAll(dependency.getProvides())) {
seen.addAll(dependency.getProvides());
for (String require : dependency.getRequiredSymbols()) {
addDependency(require, seen, list);
}
list.add(dependency.getPathRelativeToClosureBase());
}
} | class class_name[name] begin[{]
method[addDependency, return_type[void], modifier[private], parameter[symbol, seen, list]] begin[{]
local_variable[type[DependencyInfo], dependency]
if[binary_operation[member[.dependency], ==, literal[null]]] begin[{]
if[THIS[member[None.strictRequires]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown require of "), operandr=MemberReference(member=symbol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServiceException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
if[call[seen.containsAll, parameter[call[dependency.getProvides, parameter[]]]]] begin[{]
call[seen.addAll, parameter[call[dependency.getProvides, parameter[]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=require, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=list, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addDependency, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRequiredSymbols, postfix_operators=[], prefix_operators=[], qualifier=dependency, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=require)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[list.add, parameter[call[dependency.getPathRelativeToClosureBase, parameter[]]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addDependency] operator[SEP] identifier[String] identifier[symbol] , identifier[Set] operator[<] identifier[String] operator[>] identifier[seen] , identifier[List] operator[<] identifier[String] operator[>] identifier[list] operator[SEP] Keyword[throws] identifier[ServiceException] {
identifier[DependencyInfo] identifier[dependency] operator[=] identifier[getDependencyInfo] operator[SEP] identifier[symbol] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dependency] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[strictRequires] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ServiceException] operator[SEP] literal[String] operator[+] identifier[symbol] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[seen] operator[SEP] identifier[containsAll] operator[SEP] identifier[dependency] operator[SEP] identifier[getProvides] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[seen] operator[SEP] identifier[addAll] operator[SEP] identifier[dependency] operator[SEP] identifier[getProvides] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[require] operator[:] identifier[dependency] operator[SEP] identifier[getRequiredSymbols] operator[SEP] operator[SEP] operator[SEP] {
identifier[addDependency] operator[SEP] identifier[require] , identifier[seen] , identifier[list] operator[SEP] operator[SEP]
}
identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[dependency] operator[SEP] identifier[getPathRelativeToClosureBase] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private static JSONArray parseStencilSetExtensions(ArrayList<String> extensions) {
if (extensions != null) {
JSONArray extensionsArray = new JSONArray();
for (String extension : extensions) {
extensionsArray.put(extension.toString());
}
return extensionsArray;
}
return new JSONArray();
} | class class_name[name] begin[{]
method[parseStencilSetExtensions, return_type[type[JSONArray]], modifier[private static], parameter[extensions]] begin[{]
if[binary_operation[member[.extensions], !=, literal[null]]] begin[{]
local_variable[type[JSONArray], extensionsArray]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=extension, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=extensionsArray, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=extensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=extension)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.extensionsArray]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSONArray, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[JSONArray] identifier[parseStencilSetExtensions] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[extensions] operator[SEP] {
Keyword[if] operator[SEP] identifier[extensions] operator[!=] Other[null] operator[SEP] {
identifier[JSONArray] identifier[extensionsArray] operator[=] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[extension] operator[:] identifier[extensions] operator[SEP] {
identifier[extensionsArray] operator[SEP] identifier[put] operator[SEP] identifier[extension] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[extensionsArray] operator[SEP]
}
Keyword[return] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP]
}
|
protected static NumberValue multiply(NumberValue multiplicand, NumberValue multiplier) {
if (multiplicand==null) {
throw new ArithmeticException("The multiplicand cannot be null");
}
if (multiplier==null) {
throw new ArithmeticException("The multiplier cannot be null");
}
return new DefaultNumberValue(
multiplicand.numberValueExact(BigDecimal.class).multiply(multiplier.numberValue(BigDecimal.class)));
} | class class_name[name] begin[{]
method[multiply, return_type[type[NumberValue]], modifier[static protected], parameter[multiplicand, multiplier]] begin[{]
if[binary_operation[member[.multiplicand], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The multiplicand cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArithmeticException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.multiplier], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The multiplier cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArithmeticException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BigDecimal, sub_type=None))], member=numberValueExact, postfix_operators=[], prefix_operators=[], qualifier=multiplicand, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BigDecimal, sub_type=None))], member=numberValue, postfix_operators=[], prefix_operators=[], qualifier=multiplier, selectors=[], type_arguments=None)], member=multiply, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultNumberValue, sub_type=None))]
end[}]
END[}] | Keyword[protected] Keyword[static] identifier[NumberValue] identifier[multiply] operator[SEP] identifier[NumberValue] identifier[multiplicand] , identifier[NumberValue] identifier[multiplier] operator[SEP] {
Keyword[if] operator[SEP] identifier[multiplicand] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ArithmeticException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[multiplier] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ArithmeticException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[DefaultNumberValue] operator[SEP] identifier[multiplicand] operator[SEP] identifier[numberValueExact] operator[SEP] identifier[BigDecimal] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[multiply] operator[SEP] identifier[multiplier] operator[SEP] identifier[numberValue] operator[SEP] identifier[BigDecimal] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static boolean esPDF(File file) {
boolean ret = false;
FileReader reader = null;
try {
reader= new FileReader(file);
char[] buffer = new char[4];
reader.read(buffer, 0, 4);
ret = ("%PDF".equals(String.valueOf(buffer)));
} catch (FileNotFoundException e) {
log.error("Error: no se encuentra el fichero " + file.getAbsolutePath());
} catch (IOException e) {
log.error("Error leyendo el fichero " + file.getAbsolutePath());
} finally {
try {
reader.close();
} catch (IOException e) {
log.error("Error cerrando el fichero " + file.getAbsolutePath());
}
}
return ret;
} | class class_name[name] begin[{]
method[esPDF, return_type[type[boolean]], modifier[public static], parameter[file]] begin[{]
local_variable[type[boolean], ret]
local_variable[type[FileReader], reader]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=file, 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=FileReader, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=char)), name=buffer)], modifiers=set(), type=BasicType(dimensions=[None], name=char)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], member=read, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%PDF")), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error: no se encuentra el fichero "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['FileNotFoundException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error leyendo el fichero "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error cerrando el fichero "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)], label=None, resources=None)
return[member[.ret]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[esPDF] operator[SEP] identifier[File] identifier[file] operator[SEP] {
Keyword[boolean] identifier[ret] operator[=] literal[boolean] operator[SEP] identifier[FileReader] identifier[reader] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[reader] operator[=] Keyword[new] identifier[FileReader] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[char] operator[SEP] Other[4] operator[SEP] operator[SEP] identifier[reader] operator[SEP] identifier[read] operator[SEP] identifier[buffer] , Other[0] , Other[4] operator[SEP] operator[SEP] identifier[ret] operator[=] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[FileNotFoundException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
identifier[reader] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public static LoadBalancer getLoadBalancer(ConsumerBootstrap consumerBootstrap) {
try {
String loadBalancer = consumerBootstrap.getConsumerConfig().getLoadBalancer();
ExtensionClass<LoadBalancer> ext = ExtensionLoaderFactory
.getExtensionLoader(LoadBalancer.class).getExtensionClass(loadBalancer);
if (ext == null) {
throw ExceptionUtils.buildRuntime("consumer.loadBalancer",
loadBalancer, "Unsupported loadBalancer of client!");
}
return ext.getExtInstance(new Class[] { ConsumerBootstrap.class }, new Object[] { consumerBootstrap });
} catch (SofaRpcRuntimeException e) {
throw e;
} catch (Throwable e) {
throw new SofaRpcRuntimeException(e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[getLoadBalancer, return_type[type[LoadBalancer]], modifier[public static], parameter[consumerBootstrap]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getConsumerConfig, postfix_operators=[], prefix_operators=[], qualifier=consumerBootstrap, selectors=[MethodInvocation(arguments=[], member=getLoadBalancer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=loadBalancer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LoadBalancer, sub_type=None))], member=getExtensionLoader, postfix_operators=[], prefix_operators=[], qualifier=ExtensionLoaderFactory, selectors=[MethodInvocation(arguments=[MemberReference(member=loadBalancer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getExtensionClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=ext)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=LoadBalancer, sub_type=None))], dimensions=[], name=ExtensionClass, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ext, 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=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="consumer.loadBalancer"), MemberReference(member=loadBalancer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported loadBalancer of client!")], member=buildRuntime, postfix_operators=[], prefix_operators=[], qualifier=ExceptionUtils, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConsumerBootstrap, sub_type=None))]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Class, sub_type=None)), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=consumerBootstrap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=getExtInstance, postfix_operators=[], prefix_operators=[], qualifier=ext, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SofaRpcRuntimeException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SofaRpcRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[LoadBalancer] identifier[getLoadBalancer] operator[SEP] identifier[ConsumerBootstrap] identifier[consumerBootstrap] operator[SEP] {
Keyword[try] {
identifier[String] identifier[loadBalancer] operator[=] identifier[consumerBootstrap] operator[SEP] identifier[getConsumerConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getLoadBalancer] operator[SEP] operator[SEP] operator[SEP] identifier[ExtensionClass] operator[<] identifier[LoadBalancer] operator[>] identifier[ext] operator[=] identifier[ExtensionLoaderFactory] operator[SEP] identifier[getExtensionLoader] operator[SEP] identifier[LoadBalancer] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getExtensionClass] operator[SEP] identifier[loadBalancer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ext] operator[==] Other[null] operator[SEP] {
Keyword[throw] identifier[ExceptionUtils] operator[SEP] identifier[buildRuntime] operator[SEP] literal[String] , identifier[loadBalancer] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ext] operator[SEP] identifier[getExtInstance] operator[SEP] Keyword[new] identifier[Class] operator[SEP] operator[SEP] {
identifier[ConsumerBootstrap] operator[SEP] Keyword[class]
} , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[consumerBootstrap]
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SofaRpcRuntimeException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SofaRpcRuntimeException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
protected Iterator<Map.Entry<K, V>> createEntrySetIterator() {
if (size() == 0) {
return EmptyIterator.INSTANCE;
}
return new EntrySetIterator<K, V>(this);
} | class class_name[name] begin[{]
method[createEntrySetIterator, return_type[type[Iterator]], modifier[protected], parameter[]] begin[{]
if[binary_operation[call[.size, parameter[]], ==, literal[0]]] begin[{]
return[member[EmptyIterator.INSTANCE]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=K, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=EntrySetIterator, sub_type=None))]
end[}]
END[}] | Keyword[protected] identifier[Iterator] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] operator[>] identifier[createEntrySetIterator] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[EmptyIterator] operator[SEP] identifier[INSTANCE] operator[SEP]
}
Keyword[return] Keyword[new] identifier[EntrySetIterator] operator[<] identifier[K] , identifier[V] operator[>] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
|
private JPanel getStatusPanel()
{
if (statusPanel == null)
{
statusPanel = new JPanel();
GridBagLayout gbl_statusPanel = new GridBagLayout();
gbl_statusPanel.columnWidths = new int[]{550, 91, 0};
gbl_statusPanel.rowHeights = new int[]{19, 0};
gbl_statusPanel.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
gbl_statusPanel.rowWeights = new double[]{0.0, Double.MIN_VALUE};
statusPanel.setLayout(gbl_statusPanel);
GridBagConstraints gbc_statusText = new GridBagConstraints();
gbc_statusText.fill = GridBagConstraints.HORIZONTAL;
gbc_statusText.anchor = GridBagConstraints.EAST;
gbc_statusText.gridx = 0;
gbc_statusText.gridy = 0;
statusPanel.add(getStatusText(), gbc_statusText);
}
return statusPanel;
} | class class_name[name] begin[{]
method[getStatusPanel, return_type[type[JPanel]], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.statusPanel], ==, literal[null]]] begin[{]
assign[member[.statusPanel], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JPanel, sub_type=None))]
local_variable[type[GridBagLayout], gbl_statusPanel]
assign[member[gbl_statusPanel.columnWidths], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=550), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=91), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))]
assign[member[gbl_statusPanel.rowHeights], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=19), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))]
assign[member[gbl_statusPanel.columnWeights], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), MemberReference(member=MIN_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=double))]
assign[member[gbl_statusPanel.rowWeights], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.0), MemberReference(member=MIN_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=double))]
call[statusPanel.setLayout, parameter[member[.gbl_statusPanel]]]
local_variable[type[GridBagConstraints], gbc_statusText]
assign[member[gbc_statusText.fill], member[GridBagConstraints.HORIZONTAL]]
assign[member[gbc_statusText.anchor], member[GridBagConstraints.EAST]]
assign[member[gbc_statusText.gridx], literal[0]]
assign[member[gbc_statusText.gridy], literal[0]]
call[statusPanel.add, parameter[call[.getStatusText, parameter[]], member[.gbc_statusText]]]
else begin[{]
None
end[}]
return[member[.statusPanel]]
end[}]
END[}] | Keyword[private] identifier[JPanel] identifier[getStatusPanel] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[statusPanel] operator[==] Other[null] operator[SEP] {
identifier[statusPanel] operator[=] Keyword[new] identifier[JPanel] operator[SEP] operator[SEP] operator[SEP] identifier[GridBagLayout] identifier[gbl_statusPanel] operator[=] Keyword[new] identifier[GridBagLayout] operator[SEP] operator[SEP] operator[SEP] identifier[gbl_statusPanel] operator[SEP] identifier[columnWidths] operator[=] Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
Other[550] , Other[91] , Other[0]
} operator[SEP] identifier[gbl_statusPanel] operator[SEP] identifier[rowHeights] operator[=] Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
Other[19] , Other[0]
} operator[SEP] identifier[gbl_statusPanel] operator[SEP] identifier[columnWeights] operator[=] Keyword[new] Keyword[double] operator[SEP] operator[SEP] {
literal[Float] , literal[Float] , identifier[Double] operator[SEP] identifier[MIN_VALUE]
} operator[SEP] identifier[gbl_statusPanel] operator[SEP] identifier[rowWeights] operator[=] Keyword[new] Keyword[double] operator[SEP] operator[SEP] {
literal[Float] , identifier[Double] operator[SEP] identifier[MIN_VALUE]
} operator[SEP] identifier[statusPanel] operator[SEP] identifier[setLayout] operator[SEP] identifier[gbl_statusPanel] operator[SEP] operator[SEP] identifier[GridBagConstraints] identifier[gbc_statusText] operator[=] Keyword[new] identifier[GridBagConstraints] operator[SEP] operator[SEP] operator[SEP] identifier[gbc_statusText] operator[SEP] identifier[fill] operator[=] identifier[GridBagConstraints] operator[SEP] identifier[HORIZONTAL] operator[SEP] identifier[gbc_statusText] operator[SEP] identifier[anchor] operator[=] identifier[GridBagConstraints] operator[SEP] identifier[EAST] operator[SEP] identifier[gbc_statusText] operator[SEP] identifier[gridx] operator[=] Other[0] operator[SEP] identifier[gbc_statusText] operator[SEP] identifier[gridy] operator[=] Other[0] operator[SEP] identifier[statusPanel] operator[SEP] identifier[add] operator[SEP] identifier[getStatusText] operator[SEP] operator[SEP] , identifier[gbc_statusText] operator[SEP] operator[SEP]
}
Keyword[return] identifier[statusPanel] operator[SEP]
}
|
public static InitialisersFinder newInstance(final Collection<MethodNode> methodsOfAnalysedClass,
final CandidatesInitialisersMapping candidatesInitialisersMapping) {
final String msgTemplate = "Argument '%s' must not be null!";
checkNotNull(methodsOfAnalysedClass, format(msgTemplate, "methodsOfAnalysedClass"));
checkNotNull(candidatesInitialisersMapping, format(msgTemplate, "variableInitialiserMapping"));
return new InitialisersFinder(methodsOfAnalysedClass, candidatesInitialisersMapping);
} | class class_name[name] begin[{]
method[newInstance, return_type[type[InitialisersFinder]], modifier[public static], parameter[methodsOfAnalysedClass, candidatesInitialisersMapping]] begin[{]
local_variable[type[String], msgTemplate]
call[.checkNotNull, parameter[member[.methodsOfAnalysedClass], call[.format, parameter[member[.msgTemplate], literal["methodsOfAnalysedClass"]]]]]
call[.checkNotNull, parameter[member[.candidatesInitialisersMapping], call[.format, parameter[member[.msgTemplate], literal["variableInitialiserMapping"]]]]]
return[ClassCreator(arguments=[MemberReference(member=methodsOfAnalysedClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=candidatesInitialisersMapping, 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=InitialisersFinder, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InitialisersFinder] identifier[newInstance] operator[SEP] Keyword[final] identifier[Collection] operator[<] identifier[MethodNode] operator[>] identifier[methodsOfAnalysedClass] , Keyword[final] identifier[CandidatesInitialisersMapping] identifier[candidatesInitialisersMapping] operator[SEP] {
Keyword[final] identifier[String] identifier[msgTemplate] operator[=] literal[String] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[methodsOfAnalysedClass] , identifier[format] operator[SEP] identifier[msgTemplate] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[candidatesInitialisersMapping] , identifier[format] operator[SEP] identifier[msgTemplate] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[InitialisersFinder] operator[SEP] identifier[methodsOfAnalysedClass] , identifier[candidatesInitialisersMapping] operator[SEP] operator[SEP]
}
|
public Country getCountry() {
if (null == _country && null == country) { _country = Country.DE; }
return null == country ? _country : country.get();
} | class class_name[name] begin[{]
method[getCountry, return_type[type[Country]], modifier[public], parameter[]] begin[{]
if[binary_operation[binary_operation[literal[null], ==, member[._country]], &&, binary_operation[literal[null], ==, member[.country]]]] begin[{]
assign[member[._country], member[Country.DE]]
else begin[{]
None
end[}]
return[TernaryExpression(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MemberReference(member=country, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), if_false=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=country, selectors=[], type_arguments=None), if_true=MemberReference(member=_country, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[public] identifier[Country] identifier[getCountry] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[_country] operator[&&] Other[null] operator[==] identifier[country] operator[SEP] {
identifier[_country] operator[=] identifier[Country] operator[SEP] identifier[DE] operator[SEP]
}
Keyword[return] Other[null] operator[==] identifier[country] operator[?] identifier[_country] operator[:] identifier[country] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
|
private Resource newResource(final String resourcePath) {
return new Resource(this, /* length unknown */ -1L) {
/** The module reader proxy. */
private ModuleReaderProxy moduleReaderProxy;
@Override
public String getPath() {
return resourcePath;
}
@Override
public String getPathRelativeToClasspathElement() {
return resourcePath;
}
@Override
public synchronized ByteBuffer read() throws IOException {
if (skipClasspathElement) {
// Shouldn't happen
throw new IOException("Module could not be opened");
}
markAsOpen();
try {
moduleReaderProxy = moduleReaderProxyRecycler.acquire();
// ModuleReader#read(String name) internally calls:
// InputStream is = open(name); return ByteBuffer.wrap(is.readAllBytes());
byteBuffer = moduleReaderProxy.read(resourcePath);
length = byteBuffer.remaining();
return byteBuffer;
} catch (final SecurityException | OutOfMemoryError e) {
close();
throw new IOException("Could not open " + this, e);
}
}
@Override
synchronized InputStreamOrByteBufferAdapter openOrRead() throws IOException {
return new InputStreamOrByteBufferAdapter(open());
}
@Override
public synchronized InputStream open() throws IOException {
if (skipClasspathElement) {
// Shouldn't happen
throw new IOException("Module could not be opened");
}
markAsOpen();
try {
moduleReaderProxy = moduleReaderProxyRecycler.acquire();
inputStream = new InputStreamResourceCloser(this, moduleReaderProxy.open(resourcePath));
// Length cannot be obtained from ModuleReader
length = -1L;
return inputStream;
} catch (final SecurityException e) {
close();
throw new IOException("Could not open " + this, e);
}
}
@Override
public synchronized byte[] load() throws IOException {
try {
read();
final byte[] byteArray = byteBufferToByteArray();
length = byteArray.length;
return byteArray;
} finally {
close();
}
}
@Override
public synchronized void close() {
super.close(); // Close inputStream
if (byteBuffer != null) {
if (moduleReaderProxy != null) {
// Release any open ByteBuffer
moduleReaderProxy.release(byteBuffer);
}
byteBuffer = null;
}
if (moduleReaderProxy != null) {
// Recycle the (open) ModuleReaderProxy instance.
moduleReaderProxyRecycler.recycle(moduleReaderProxy);
// Don't call ModuleReaderProxy#close(), leave the ModuleReaderProxy open in the recycler.
// Just set the ref to null here. The ModuleReaderProxy will be closed by
// ClasspathElementModule#close().
moduleReaderProxy = null;
}
markAsClosed();
}
};
} | class class_name[name] begin[{]
method[newResource, return_type[type[Resource]], modifier[private], parameter[resourcePath]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1L)], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=moduleReaderProxy)], documentation=/** The module reader proxy. */, modifiers={'private'}, type=ReferenceType(arguments=None, dimensions=[], name=ModuleReaderProxy, sub_type=None)), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=resourcePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getPath, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=resourcePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getPathRelativeToClasspathElement, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MemberReference(member=skipClasspathElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Module could not be opened")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=markAsOpen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=moduleReaderProxy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=acquire, postfix_operators=[], prefix_operators=[], qualifier=moduleReaderProxyRecycler, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=byteBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=resourcePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=moduleReaderProxy, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=remaining, postfix_operators=[], prefix_operators=[], qualifier=byteBuffer, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MemberReference(member=byteBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not open "), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SecurityException', 'OutOfMemoryError']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'synchronized', 'public'}, name=read, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None), throws=['IOException'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamOrByteBufferAdapter, sub_type=None)), label=None)], documentation=None, modifiers={'synchronized'}, name=openOrRead, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=InputStreamOrByteBufferAdapter, sub_type=None), throws=['IOException'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MemberReference(member=skipClasspathElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Module could not be opened")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=markAsOpen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=moduleReaderProxy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=acquire, postfix_operators=[], prefix_operators=[], qualifier=moduleReaderProxyRecycler, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[MemberReference(member=resourcePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=open, postfix_operators=[], prefix_operators=[], qualifier=moduleReaderProxy, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamResourceCloser, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1L)), label=None), ReturnStatement(expression=MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not open "), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SecurityException']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'synchronized', 'public'}, name=open, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), throws=['IOException'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=read, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=byteBufferToByteArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=byteArray)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=byteArray, selectors=[])), label=None), ReturnStatement(expression=MemberReference(member=byteArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)], documentation=None, modifiers={'synchronized', 'public'}, name=load, parameters=[], return_type=BasicType(dimensions=[None], name=byte), throws=['IOException'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=SuperMethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=byteBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=moduleReaderProxy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=byteBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=release, postfix_operators=[], prefix_operators=[], qualifier=moduleReaderProxy, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=byteBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=moduleReaderProxy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=moduleReaderProxy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recycle, postfix_operators=[], prefix_operators=[], qualifier=moduleReaderProxyRecycler, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=moduleReaderProxy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=markAsClosed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'synchronized', 'public'}, name=close, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Resource, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[Resource] identifier[newResource] operator[SEP] Keyword[final] identifier[String] identifier[resourcePath] operator[SEP] {
Keyword[return] Keyword[new] identifier[Resource] operator[SEP] Keyword[this] , operator[-] Other[1L] operator[SEP] {
Keyword[private] identifier[ModuleReaderProxy] identifier[moduleReaderProxy] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getPath] operator[SEP] operator[SEP] {
Keyword[return] identifier[resourcePath] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getPathRelativeToClasspathElement] operator[SEP] operator[SEP] {
Keyword[return] identifier[resourcePath] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] identifier[ByteBuffer] identifier[read] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[skipClasspathElement] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[markAsOpen] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[moduleReaderProxy] operator[=] identifier[moduleReaderProxyRecycler] operator[SEP] identifier[acquire] operator[SEP] operator[SEP] operator[SEP] identifier[byteBuffer] operator[=] identifier[moduleReaderProxy] operator[SEP] identifier[read] operator[SEP] identifier[resourcePath] operator[SEP] operator[SEP] identifier[length] operator[=] identifier[byteBuffer] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[byteBuffer] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[SecurityException] operator[|] identifier[OutOfMemoryError] identifier[e] operator[SEP] {
identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] Keyword[this] , identifier[e] operator[SEP] operator[SEP]
}
} annotation[@] identifier[Override] Keyword[synchronized] identifier[InputStreamOrByteBufferAdapter] identifier[openOrRead] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] Keyword[new] identifier[InputStreamOrByteBufferAdapter] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] identifier[InputStream] identifier[open] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[skipClasspathElement] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[markAsOpen] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[moduleReaderProxy] operator[=] identifier[moduleReaderProxyRecycler] operator[SEP] identifier[acquire] operator[SEP] operator[SEP] operator[SEP] identifier[inputStream] operator[=] Keyword[new] identifier[InputStreamResourceCloser] operator[SEP] Keyword[this] , identifier[moduleReaderProxy] operator[SEP] identifier[open] operator[SEP] identifier[resourcePath] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[=] operator[-] Other[1L] operator[SEP] Keyword[return] identifier[inputStream] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[SecurityException] identifier[e] operator[SEP] {
identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] Keyword[this] , identifier[e] operator[SEP] operator[SEP]
}
} annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] Keyword[byte] operator[SEP] operator[SEP] identifier[load] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] {
identifier[read] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[byteArray] operator[=] identifier[byteBufferToByteArray] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[=] identifier[byteArray] operator[SEP] identifier[length] operator[SEP] Keyword[return] identifier[byteArray] operator[SEP]
}
Keyword[finally] {
identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
} annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[byteBuffer] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[moduleReaderProxy] operator[!=] Other[null] operator[SEP] {
identifier[moduleReaderProxy] operator[SEP] identifier[release] operator[SEP] identifier[byteBuffer] operator[SEP] operator[SEP]
}
identifier[byteBuffer] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[moduleReaderProxy] operator[!=] Other[null] operator[SEP] {
identifier[moduleReaderProxyRecycler] operator[SEP] identifier[recycle] operator[SEP] identifier[moduleReaderProxy] operator[SEP] operator[SEP] identifier[moduleReaderProxy] operator[=] Other[null] operator[SEP]
}
identifier[markAsClosed] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public static byte[] bufferToArray(ByteBuffer buffer) {
if (buffer.hasArray() && buffer.arrayOffset() == 0 &&
buffer.array().length == buffer.remaining()) {
return buffer.array();
} else {
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
return bytes;
}
} | class class_name[name] begin[{]
method[bufferToArray, return_type[type[byte]], modifier[public static], parameter[buffer]] begin[{]
if[binary_operation[binary_operation[call[buffer.hasArray, parameter[]], &&, binary_operation[call[buffer.arrayOffset, parameter[]], ==, literal[0]]], &&, binary_operation[call[buffer.array, parameter[]], ==, call[buffer.remaining, parameter[]]]]] begin[{]
return[call[buffer.array, parameter[]]]
else begin[{]
local_variable[type[byte], bytes]
call[buffer.get, parameter[member[.bytes]]]
return[member[.bytes]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[bufferToArray] operator[SEP] identifier[ByteBuffer] identifier[buffer] operator[SEP] {
Keyword[if] operator[SEP] identifier[buffer] operator[SEP] identifier[hasArray] operator[SEP] operator[SEP] operator[&&] identifier[buffer] operator[SEP] identifier[arrayOffset] operator[SEP] operator[SEP] operator[==] Other[0] operator[&&] identifier[buffer] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[==] identifier[buffer] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[buffer] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[buffer] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[get] operator[SEP] identifier[bytes] operator[SEP] operator[SEP] Keyword[return] identifier[bytes] operator[SEP]
}
}
|
public Matrix4f shadow(Vector4f light, Matrix4fc planeTransform, Matrix4f dest) {
// compute plane equation by transforming (y = 0)
float a = planeTransform.m10();
float b = planeTransform.m11();
float c = planeTransform.m12();
float d = -a * planeTransform.m30() - b * planeTransform.m31() - c * planeTransform.m32();
return shadow(light.x, light.y, light.z, light.w, a, b, c, d, dest);
} | class class_name[name] begin[{]
method[shadow, return_type[type[Matrix4f]], modifier[public], parameter[light, planeTransform, dest]] begin[{]
local_variable[type[float], a]
local_variable[type[float], b]
local_variable[type[float], c]
local_variable[type[float], d]
return[call[.shadow, parameter[member[light.x], member[light.y], member[light.z], member[light.w], member[.a], member[.b], member[.c], member[.d], member[.dest]]]]
end[}]
END[}] | Keyword[public] identifier[Matrix4f] identifier[shadow] operator[SEP] identifier[Vector4f] identifier[light] , identifier[Matrix4fc] identifier[planeTransform] , identifier[Matrix4f] identifier[dest] operator[SEP] {
Keyword[float] identifier[a] operator[=] identifier[planeTransform] operator[SEP] identifier[m10] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[b] operator[=] identifier[planeTransform] operator[SEP] identifier[m11] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[c] operator[=] identifier[planeTransform] operator[SEP] identifier[m12] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[d] operator[=] operator[-] identifier[a] operator[*] identifier[planeTransform] operator[SEP] identifier[m30] operator[SEP] operator[SEP] operator[-] identifier[b] operator[*] identifier[planeTransform] operator[SEP] identifier[m31] operator[SEP] operator[SEP] operator[-] identifier[c] operator[*] identifier[planeTransform] operator[SEP] identifier[m32] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[shadow] operator[SEP] identifier[light] operator[SEP] identifier[x] , identifier[light] operator[SEP] identifier[y] , identifier[light] operator[SEP] identifier[z] , identifier[light] operator[SEP] identifier[w] , identifier[a] , identifier[b] , identifier[c] , identifier[d] , identifier[dest] operator[SEP] operator[SEP]
}
|
public static BigDecimal getBigDecimal(Number num, MonetaryContext moneyContext) {
BigDecimal bd = getBigDecimal(num);
if (moneyContext!=null) {
MathContext mc = getMathContext(moneyContext, RoundingMode.HALF_EVEN);
bd = new BigDecimal(bd.toString(), mc);
if (moneyContext.getMaxScale() > 0) {
LOG.fine(String.format("Got Max Scale %s", moneyContext.getMaxScale()));
bd = bd.setScale(moneyContext.getMaxScale(), mc.getRoundingMode());
}
}
return bd;
} | class class_name[name] begin[{]
method[getBigDecimal, return_type[type[BigDecimal]], modifier[public static], parameter[num, moneyContext]] begin[{]
local_variable[type[BigDecimal], bd]
if[binary_operation[member[.moneyContext], !=, literal[null]]] begin[{]
local_variable[type[MathContext], mc]
assign[member[.bd], ClassCreator(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=bd, selectors=[], type_arguments=None), MemberReference(member=mc, 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=BigDecimal, sub_type=None))]
if[binary_operation[call[moneyContext.getMaxScale, parameter[]], >, literal[0]]] begin[{]
call[LOG.fine, parameter[call[String.format, parameter[literal["Got Max Scale %s"], call[moneyContext.getMaxScale, parameter[]]]]]]
assign[member[.bd], call[bd.setScale, parameter[call[moneyContext.getMaxScale, parameter[]], call[mc.getRoundingMode, parameter[]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.bd]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[BigDecimal] identifier[getBigDecimal] operator[SEP] identifier[Number] identifier[num] , identifier[MonetaryContext] identifier[moneyContext] operator[SEP] {
identifier[BigDecimal] identifier[bd] operator[=] identifier[getBigDecimal] operator[SEP] identifier[num] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[moneyContext] operator[!=] Other[null] operator[SEP] {
identifier[MathContext] identifier[mc] operator[=] identifier[getMathContext] operator[SEP] identifier[moneyContext] , identifier[RoundingMode] operator[SEP] identifier[HALF_EVEN] operator[SEP] operator[SEP] identifier[bd] operator[=] Keyword[new] identifier[BigDecimal] operator[SEP] identifier[bd] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[mc] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[moneyContext] operator[SEP] identifier[getMaxScale] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[LOG] operator[SEP] identifier[fine] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[moneyContext] operator[SEP] identifier[getMaxScale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[bd] operator[=] identifier[bd] operator[SEP] identifier[setScale] operator[SEP] identifier[moneyContext] operator[SEP] identifier[getMaxScale] operator[SEP] operator[SEP] , identifier[mc] operator[SEP] identifier[getRoundingMode] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[bd] operator[SEP]
}
|
public boolean isBlablaButtonAllowed() {
boolean allowed = false;
for (Authentication authentication : getSecurityServiceResults()) {
for (BaseAuthorization authorization : authentication.getAuthorizations()) {
if (authorization instanceof AppAuthorization) {
allowed |= ((AppAuthorization) authorization).isBlablaButtonAllowed();
}
}
}
return allowed;
} | class class_name[name] begin[{]
method[isBlablaButtonAllowed, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[boolean], allowed]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=authorization, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=AppAuthorization, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=allowed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=|=, value=Cast(expression=MemberReference(member=authorization, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=AppAuthorization, sub_type=None))), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAuthorizations, postfix_operators=[], prefix_operators=[], qualifier=authentication, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=authorization)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BaseAuthorization, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getSecurityServiceResults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=authentication)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Authentication, sub_type=None))), label=None)
return[member[.allowed]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isBlablaButtonAllowed] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[allowed] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Authentication] identifier[authentication] operator[:] identifier[getSecurityServiceResults] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[BaseAuthorization] identifier[authorization] operator[:] identifier[authentication] operator[SEP] identifier[getAuthorizations] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[authorization] Keyword[instanceof] identifier[AppAuthorization] operator[SEP] {
identifier[allowed] operator[|=] operator[SEP] operator[SEP] identifier[AppAuthorization] operator[SEP] identifier[authorization] operator[SEP] operator[SEP] identifier[isBlablaButtonAllowed] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[allowed] operator[SEP]
}
|
public <V1, V2> Context withValues(Key<V1> k1, V1 v1, Key<V2> k2, V2 v2) {
PersistentHashArrayMappedTrie<Key<?>, Object> newKeyValueEntries =
keyValueEntries.put(k1, v1).put(k2, v2);
return new Context(this, newKeyValueEntries);
} | class class_name[name] begin[{]
method[withValues, return_type[type[Context]], modifier[public], parameter[k1, v1, k2, v2]] begin[{]
local_variable[type[PersistentHashArrayMappedTrie], newKeyValueEntries]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=newKeyValueEntries, 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=Context, sub_type=None))]
end[}]
END[}] | Keyword[public] operator[<] identifier[V1] , identifier[V2] operator[>] identifier[Context] identifier[withValues] operator[SEP] identifier[Key] operator[<] identifier[V1] operator[>] identifier[k1] , identifier[V1] identifier[v1] , identifier[Key] operator[<] identifier[V2] operator[>] identifier[k2] , identifier[V2] identifier[v2] operator[SEP] {
identifier[PersistentHashArrayMappedTrie] operator[<] identifier[Key] operator[<] operator[?] operator[>] , identifier[Object] operator[>] identifier[newKeyValueEntries] operator[=] identifier[keyValueEntries] operator[SEP] identifier[put] operator[SEP] identifier[k1] , identifier[v1] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[k2] , identifier[v2] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Context] operator[SEP] Keyword[this] , identifier[newKeyValueEntries] operator[SEP] operator[SEP]
}
|
public static boolean isNotNeedQuote(Class<?> type) {
Mirror<?> me = Mirror.me(type);
return me.isBoolean() || me.isPrimitiveNumber();
} | class class_name[name] begin[{]
method[isNotNeedQuote, return_type[type[boolean]], modifier[public static], parameter[type]] begin[{]
local_variable[type[Mirror], me]
return[binary_operation[call[me.isBoolean, parameter[]], ||, call[me.isPrimitiveNumber, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isNotNeedQuote] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[SEP] {
identifier[Mirror] operator[<] operator[?] operator[>] identifier[me] operator[=] identifier[Mirror] operator[SEP] identifier[me] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[return] identifier[me] operator[SEP] identifier[isBoolean] operator[SEP] operator[SEP] operator[||] identifier[me] operator[SEP] identifier[isPrimitiveNumber] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String format(ConfigurablePropertyAccessor bw, Object obj,
String prop) {
String key = obj.getClass().getName() + "_" + prop;
if (!cache.containsKey(key))
canFormat(bw, obj, prop);
Object val = bw.getPropertyValue(prop);
if (val == null)
return null;
if (val.getClass().isArray())
return null;
if (!cache.get(key))
return val.toString();
TypeDescriptor td = bw.getPropertyTypeDescriptor(prop);
val = get().convert(val, td, TypeDescriptor.valueOf(String.class));
return val == null ? null : val.toString();
} | class class_name[name] begin[{]
method[format, return_type[type[String]], modifier[public static], parameter[bw, obj, prop]] begin[{]
local_variable[type[String], key]
if[call[cache.containsKey, parameter[member[.key]]]] begin[{]
call[.canFormat, parameter[member[.bw], member[.obj], member[.prop]]]
else begin[{]
None
end[}]
local_variable[type[Object], val]
if[binary_operation[member[.val], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[call[val.getClass, parameter[]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[call[cache.get, parameter[member[.key]]]] begin[{]
return[call[val.toString, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[TypeDescriptor], td]
assign[member[.val], call[.get, parameter[]]]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=val, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[format] operator[SEP] identifier[ConfigurablePropertyAccessor] identifier[bw] , identifier[Object] identifier[obj] , identifier[String] identifier[prop] operator[SEP] {
identifier[String] identifier[key] operator[=] identifier[obj] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[prop] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[cache] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[canFormat] operator[SEP] identifier[bw] , identifier[obj] , identifier[prop] operator[SEP] operator[SEP] identifier[Object] identifier[val] operator[=] identifier[bw] operator[SEP] identifier[getPropertyValue] operator[SEP] identifier[prop] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[val] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[TypeDescriptor] identifier[td] operator[=] identifier[bw] operator[SEP] identifier[getPropertyTypeDescriptor] operator[SEP] identifier[prop] operator[SEP] operator[SEP] identifier[val] operator[=] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[convert] operator[SEP] identifier[val] , identifier[td] , identifier[TypeDescriptor] operator[SEP] identifier[valueOf] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[val] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[val] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public WebElementFinder by(final By theBy) {
Fields fields = new Fields(this);
fields.by = theBy;
return new WebElementFinder(fields);
} | class class_name[name] begin[{]
method[by, return_type[type[WebElementFinder]], modifier[public], parameter[theBy]] begin[{]
local_variable[type[Fields], fields]
assign[member[fields.by], member[.theBy]]
return[ClassCreator(arguments=[MemberReference(member=fields, 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=WebElementFinder, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[WebElementFinder] identifier[by] operator[SEP] Keyword[final] identifier[By] identifier[theBy] operator[SEP] {
identifier[Fields] identifier[fields] operator[=] Keyword[new] identifier[Fields] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[fields] operator[SEP] identifier[by] operator[=] identifier[theBy] operator[SEP] Keyword[return] Keyword[new] identifier[WebElementFinder] operator[SEP] identifier[fields] operator[SEP] operator[SEP]
}
|
@Override
public DoubleMatrix1D[] solve() throws Exception {
final CholeskyFactorization HFact = new CholeskyFactorization(H, new Matrix1NornRescaler());
boolean isHReducible = true;
try{
HFact.factorize();
}catch(Exception e){
isHReducible = false;
}
final DoubleMatrix1D v;// dim equals cols of A
final DoubleMatrix1D w;// dim equals rank of A
if (isHReducible) {
// Solving KKT system via elimination
DoubleMatrix1D HInvg = HFact.solve(g);
if (A != null) {
DoubleMatrix2D HInvAT = HFact.solve(AT);
DoubleMatrix2D MenoSLower = ColtUtils.subdiagonalMultiply(A, HInvAT);
DoubleMatrix1D AHInvg = ALG.mult(A, HInvg);
CholeskyFactorization MSFact = new CholeskyFactorization(MenoSLower, new Matrix1NornRescaler());
MSFact.factorize();
if(h == null){
w = MSFact.solve(ColtUtils.scalarMult(AHInvg, -1));
}else{
w = MSFact.solve(ColtUtils.add(h, AHInvg, -1));
}
v = HInvg.assign(ALG.mult(HInvAT, w), Functions.plus).assign(Mult.mult(-1));
} else {
w = null;
v = HInvg.assign(Mult.mult(-1));
}
} else {
// H is singular
// Solving the full KKT system
if(A!=null){
DoubleMatrix1D[] fullSol = this.solveAugmentedKKT();
v = fullSol[0];
w = fullSol[1];
}else{
//@TODO: try with rescaled H
throw new Exception("KKT solution failed");
}
}
// solution checking
if (this.checkKKTSolutionAccuracy && !this.checkKKTSolutionAccuracy(v, w)) {
log.error("KKT solution failed");
throw new Exception("KKT solution failed");
}
DoubleMatrix1D[] ret = new DoubleMatrix1D[2];
ret[0] = v;
ret[1] = w;
return ret;
} | class class_name[name] begin[{]
method[solve, return_type[type[DoubleMatrix1D]], modifier[public], parameter[]] begin[{]
local_variable[type[CholeskyFactorization], HFact]
local_variable[type[boolean], isHReducible]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=factorize, postfix_operators=[], prefix_operators=[], qualifier=HFact, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isHReducible, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
local_variable[type[DoubleMatrix1D], v]
local_variable[type[DoubleMatrix1D], w]
if[member[.isHReducible]] begin[{]
local_variable[type[DoubleMatrix1D], HInvg]
if[binary_operation[member[.A], !=, literal[null]]] begin[{]
local_variable[type[DoubleMatrix2D], HInvAT]
local_variable[type[DoubleMatrix2D], MenoSLower]
local_variable[type[DoubleMatrix1D], AHInvg]
local_variable[type[CholeskyFactorization], MSFact]
call[MSFact.factorize, parameter[]]
if[binary_operation[member[.h], ==, literal[null]]] begin[{]
assign[member[.w], call[MSFact.solve, parameter[call[ColtUtils.scalarMult, parameter[member[.AHInvg], literal[1]]]]]]
else begin[{]
assign[member[.w], call[MSFact.solve, parameter[call[ColtUtils.add, parameter[member[.h], member[.AHInvg], literal[1]]]]]]
end[}]
assign[member[.v], call[HInvg.assign, parameter[call[ALG.mult, parameter[member[.HInvAT], member[.w]]], member[Functions.plus]]]]
else begin[{]
assign[member[.w], literal[null]]
assign[member[.v], call[HInvg.assign, parameter[call[Mult.mult, parameter[literal[1]]]]]]
end[}]
else begin[{]
if[binary_operation[member[.A], !=, literal[null]]] begin[{]
local_variable[type[DoubleMatrix1D], fullSol]
assign[member[.v], member[.fullSol]]
assign[member[.w], member[.fullSol]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="KKT solution failed")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None)), label=None)
end[}]
end[}]
if[binary_operation[THIS[member[None.checkKKTSolutionAccuracy]], &&, THIS[call[None.checkKKTSolutionAccuracy, parameter[member[.v], member[.w]]]]]] begin[{]
call[log.error, parameter[literal["KKT solution failed"]]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="KKT solution failed")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[DoubleMatrix1D], ret]
assign[member[.ret], member[.v]]
assign[member[.ret], member[.w]]
return[member[.ret]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DoubleMatrix1D] operator[SEP] operator[SEP] identifier[solve] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[CholeskyFactorization] identifier[HFact] operator[=] Keyword[new] identifier[CholeskyFactorization] operator[SEP] identifier[H] , Keyword[new] identifier[Matrix1NornRescaler] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isHReducible] operator[=] literal[boolean] operator[SEP] Keyword[try] {
identifier[HFact] operator[SEP] identifier[factorize] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[isHReducible] operator[=] literal[boolean] operator[SEP]
}
Keyword[final] identifier[DoubleMatrix1D] identifier[v] operator[SEP] Keyword[final] identifier[DoubleMatrix1D] identifier[w] operator[SEP] Keyword[if] operator[SEP] identifier[isHReducible] operator[SEP] {
identifier[DoubleMatrix1D] identifier[HInvg] operator[=] identifier[HFact] operator[SEP] identifier[solve] operator[SEP] identifier[g] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[A] operator[!=] Other[null] operator[SEP] {
identifier[DoubleMatrix2D] identifier[HInvAT] operator[=] identifier[HFact] operator[SEP] identifier[solve] operator[SEP] identifier[AT] operator[SEP] operator[SEP] identifier[DoubleMatrix2D] identifier[MenoSLower] operator[=] identifier[ColtUtils] operator[SEP] identifier[subdiagonalMultiply] operator[SEP] identifier[A] , identifier[HInvAT] operator[SEP] operator[SEP] identifier[DoubleMatrix1D] identifier[AHInvg] operator[=] identifier[ALG] operator[SEP] identifier[mult] operator[SEP] identifier[A] , identifier[HInvg] operator[SEP] operator[SEP] identifier[CholeskyFactorization] identifier[MSFact] operator[=] Keyword[new] identifier[CholeskyFactorization] operator[SEP] identifier[MenoSLower] , Keyword[new] identifier[Matrix1NornRescaler] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[MSFact] operator[SEP] identifier[factorize] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[h] operator[==] Other[null] operator[SEP] {
identifier[w] operator[=] identifier[MSFact] operator[SEP] identifier[solve] operator[SEP] identifier[ColtUtils] operator[SEP] identifier[scalarMult] operator[SEP] identifier[AHInvg] , operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[w] operator[=] identifier[MSFact] operator[SEP] identifier[solve] operator[SEP] identifier[ColtUtils] operator[SEP] identifier[add] operator[SEP] identifier[h] , identifier[AHInvg] , operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
identifier[v] operator[=] identifier[HInvg] operator[SEP] identifier[assign] operator[SEP] identifier[ALG] operator[SEP] identifier[mult] operator[SEP] identifier[HInvAT] , identifier[w] operator[SEP] , identifier[Functions] operator[SEP] identifier[plus] operator[SEP] operator[SEP] identifier[assign] operator[SEP] identifier[Mult] operator[SEP] identifier[mult] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[w] operator[=] Other[null] operator[SEP] identifier[v] operator[=] identifier[HInvg] operator[SEP] identifier[assign] operator[SEP] identifier[Mult] operator[SEP] identifier[mult] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[A] operator[!=] Other[null] operator[SEP] {
identifier[DoubleMatrix1D] operator[SEP] operator[SEP] identifier[fullSol] operator[=] Keyword[this] operator[SEP] identifier[solveAugmentedKKT] operator[SEP] operator[SEP] operator[SEP] identifier[v] operator[=] identifier[fullSol] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[w] operator[=] identifier[fullSol] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[checkKKTSolutionAccuracy] operator[&&] operator[!] Keyword[this] operator[SEP] identifier[checkKKTSolutionAccuracy] operator[SEP] identifier[v] , identifier[w] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[DoubleMatrix1D] operator[SEP] operator[SEP] identifier[ret] operator[=] Keyword[new] identifier[DoubleMatrix1D] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[ret] operator[SEP] Other[0] operator[SEP] operator[=] identifier[v] operator[SEP] identifier[ret] operator[SEP] Other[1] operator[SEP] operator[=] identifier[w] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
|
@Override
public DescribeTrustsResult describeTrusts(DescribeTrustsRequest request) {
request = beforeClientExecution(request);
return executeDescribeTrusts(request);
} | class class_name[name] begin[{]
method[describeTrusts, return_type[type[DescribeTrustsResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDescribeTrusts, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DescribeTrustsResult] identifier[describeTrusts] operator[SEP] identifier[DescribeTrustsRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDescribeTrusts] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
void mergeClusters_(int cluster_1, int cluster2) {
// dbg_check_cluster_(cluster_1);
// dbg_check_cluster_(cluster2);
int eventQnode = getClusterEventQNode(cluster2);
if (eventQnode != -1) {
m_event_q.deleteNode(eventQnode, -1);
setClusterEventQNode_(cluster2, -1);
}
int firstEdge1 = getClusterFirstEdge(cluster_1);
int firstEdge2 = getClusterFirstEdge(cluster2);
if (firstEdge2 != -1) {// scope
int edge2 = firstEdge2;
int lastEdge = firstEdge2;
boolean bForceContinue = false;
// Delete edges that connect cluster_1 and cluster2.
do {
// dbg_check_edge_(edge2);
bForceContinue = false;
// assert(!StridedIndexTypeCollection.isValidElement(getEdgeSweepNode(edge2)));
int end = getEdgeEnd(edge2, cluster2);
int nextEdge2 = getNextEdgeEx(edge2, end);
if (getEdgeCluster(edge2, (end + 1) & 1) == cluster_1) { // Snapping
// clusters
// that
// are
// connected
// with
// an
// edge
// Delete
// the
// edge.
disconnectEdge_(edge2);
int edgeOrigins2 = getEdgeOriginVertices(edge2);
m_edge_vertices.deleteList(edgeOrigins2);
deleteEdge_(edge2);
if (edge2 == nextEdge2) {// deleted last edge connecting to
// the cluster2 (all connections
// are degenerate)
firstEdge2 = -1;
break;
}
if (firstEdge2 == edge2) {
firstEdge2 = getClusterFirstEdge(cluster2);
lastEdge = nextEdge2;
bForceContinue = true;
}
} else {
assert (edge2 != getClusterFirstEdge(cluster_1));
}
edge2 = nextEdge2;
} while (edge2 != lastEdge || bForceContinue);
if (firstEdge2 != -1) {
// set the cluster to the edge ends
do {
int end = getEdgeEnd(edge2, cluster2);
int nextEdge2 = getNextEdgeEx(edge2, end);
assert (edge2 != getClusterFirstEdge(cluster_1));
setEdgeCluster_(edge2, end, cluster_1);
edge2 = nextEdge2;
} while (edge2 != lastEdge);
firstEdge1 = getClusterFirstEdge(cluster_1);
if (firstEdge1 != -1) {
int next1 = getNextEdge(firstEdge1, cluster_1);
int next2 = getNextEdge(firstEdge2, cluster_1);
if (next1 == firstEdge1) {
setClusterFirstEdge_(cluster_1, firstEdge2);
addEdgeToClusterImpl_(firstEdge1, cluster_1);
setClusterFirstEdge_(cluster_1, firstEdge1);
} else if (next2 == firstEdge2) {
addEdgeToClusterImpl_(firstEdge2, cluster_1);
}
setNextEdge_(firstEdge2, cluster_1, next1);
setPrevEdge_(next1, cluster_1, firstEdge2);
setNextEdge_(firstEdge1, cluster_1, next2);
setPrevEdge_(next2, cluster_1, firstEdge1);
} else {
setClusterFirstEdge_(cluster_1, firstEdge2);
}
}
}
int vertices1 = getClusterVertices(cluster_1);
int vertices2 = getClusterVertices(cluster2);
// Update cluster info on vertices.
for (int vh = m_cluster_vertices.getFirst(vertices2); vh != -1; vh = m_cluster_vertices
.getNext(vh)) {
int v = m_cluster_vertices.getElement(vh);
m_shape.setUserIndex(v, m_vertex_cluster_index, cluster_1);
}
m_cluster_vertices.concatenateLists(vertices1, vertices2);
deleteCluster_(cluster2);
// dbg_check_cluster_(cluster_1);
} | class class_name[name] begin[{]
method[mergeClusters_, return_type[void], modifier[default], parameter[cluster_1, cluster2]] begin[{]
local_variable[type[int], eventQnode]
if[binary_operation[member[.eventQnode], !=, literal[1]]] begin[{]
call[m_event_q.deleteNode, parameter[member[.eventQnode], literal[1]]]
call[.setClusterEventQNode_, parameter[member[.cluster2], literal[1]]]
else begin[{]
None
end[}]
local_variable[type[int], firstEdge1]
local_variable[type[int], firstEdge2]
if[binary_operation[member[.firstEdge2], !=, literal[1]]] begin[{]
local_variable[type[int], edge2]
local_variable[type[int], lastEdge]
local_variable[type[boolean], bForceContinue]
do[binary_operation[binary_operation[member[.edge2], !=, member[.lastEdge]], ||, member[.bForceContinue]]] begin[{]
assign[member[.bForceContinue], literal[false]]
local_variable[type[int], end]
local_variable[type[int], nextEdge2]
if[binary_operation[call[.getEdgeCluster, parameter[member[.edge2], binary_operation[binary_operation[member[.end], +, literal[1]], &, literal[1]]]], ==, member[.cluster_1]]] begin[{]
call[.disconnectEdge_, parameter[member[.edge2]]]
local_variable[type[int], edgeOrigins2]
call[m_edge_vertices.deleteList, parameter[member[.edgeOrigins2]]]
call[.deleteEdge_, parameter[member[.edge2]]]
if[binary_operation[member[.edge2], ==, member[.nextEdge2]]] begin[{]
assign[member[.firstEdge2], literal[1]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.firstEdge2], ==, member[.edge2]]] begin[{]
assign[member[.firstEdge2], call[.getClusterFirstEdge, parameter[member[.cluster2]]]]
assign[member[.lastEdge], member[.nextEdge2]]
assign[member[.bForceContinue], literal[true]]
else begin[{]
None
end[}]
else begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=edge2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=cluster_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getClusterFirstEdge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=!=), label=None, value=None)
end[}]
assign[member[.edge2], member[.nextEdge2]]
end[}]
if[binary_operation[member[.firstEdge2], !=, literal[1]]] begin[{]
do[binary_operation[member[.edge2], !=, member[.lastEdge]]] begin[{]
local_variable[type[int], end]
local_variable[type[int], nextEdge2]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=edge2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=cluster_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getClusterFirstEdge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=!=), label=None, value=None)
call[.setEdgeCluster_, parameter[member[.edge2], member[.end], member[.cluster_1]]]
assign[member[.edge2], member[.nextEdge2]]
end[}]
assign[member[.firstEdge1], call[.getClusterFirstEdge, parameter[member[.cluster_1]]]]
if[binary_operation[member[.firstEdge1], !=, literal[1]]] begin[{]
local_variable[type[int], next1]
local_variable[type[int], next2]
if[binary_operation[member[.next1], ==, member[.firstEdge1]]] begin[{]
call[.setClusterFirstEdge_, parameter[member[.cluster_1], member[.firstEdge2]]]
call[.addEdgeToClusterImpl_, parameter[member[.firstEdge1], member[.cluster_1]]]
call[.setClusterFirstEdge_, parameter[member[.cluster_1], member[.firstEdge1]]]
else begin[{]
if[binary_operation[member[.next2], ==, member[.firstEdge2]]] begin[{]
call[.addEdgeToClusterImpl_, parameter[member[.firstEdge2], member[.cluster_1]]]
else begin[{]
None
end[}]
end[}]
call[.setNextEdge_, parameter[member[.firstEdge2], member[.cluster_1], member[.next1]]]
call[.setPrevEdge_, parameter[member[.next1], member[.cluster_1], member[.firstEdge2]]]
call[.setNextEdge_, parameter[member[.firstEdge1], member[.cluster_1], member[.next2]]]
call[.setPrevEdge_, parameter[member[.next2], member[.cluster_1], member[.firstEdge1]]]
else begin[{]
call[.setClusterFirstEdge_, parameter[member[.cluster_1], member[.firstEdge2]]]
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[int], vertices1]
local_variable[type[int], vertices2]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=vh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getElement, postfix_operators=[], prefix_operators=[], qualifier=m_cluster_vertices, selectors=[], type_arguments=None), name=v)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m_vertex_cluster_index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cluster_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setUserIndex, postfix_operators=[], prefix_operators=[], qualifier=m_shape, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=vh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[MemberReference(member=vertices2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFirst, postfix_operators=[], prefix_operators=[], qualifier=m_cluster_vertices, selectors=[], type_arguments=None), name=vh)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=vh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=vh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getNext, postfix_operators=[], prefix_operators=[], qualifier=m_cluster_vertices, selectors=[], type_arguments=None))]), label=None)
call[m_cluster_vertices.concatenateLists, parameter[member[.vertices1], member[.vertices2]]]
call[.deleteCluster_, parameter[member[.cluster2]]]
end[}]
END[}] | Keyword[void] identifier[mergeClusters_] operator[SEP] Keyword[int] identifier[cluster_1] , Keyword[int] identifier[cluster2] operator[SEP] {
Keyword[int] identifier[eventQnode] operator[=] identifier[getClusterEventQNode] operator[SEP] identifier[cluster2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[eventQnode] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[m_event_q] operator[SEP] identifier[deleteNode] operator[SEP] identifier[eventQnode] , operator[-] Other[1] operator[SEP] operator[SEP] identifier[setClusterEventQNode_] operator[SEP] identifier[cluster2] , operator[-] Other[1] operator[SEP] operator[SEP]
}
Keyword[int] identifier[firstEdge1] operator[=] identifier[getClusterFirstEdge] operator[SEP] identifier[cluster_1] operator[SEP] operator[SEP] Keyword[int] identifier[firstEdge2] operator[=] identifier[getClusterFirstEdge] operator[SEP] identifier[cluster2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstEdge2] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[int] identifier[edge2] operator[=] identifier[firstEdge2] operator[SEP] Keyword[int] identifier[lastEdge] operator[=] identifier[firstEdge2] operator[SEP] Keyword[boolean] identifier[bForceContinue] operator[=] literal[boolean] operator[SEP] Keyword[do] {
identifier[bForceContinue] operator[=] literal[boolean] operator[SEP] Keyword[int] identifier[end] operator[=] identifier[getEdgeEnd] operator[SEP] identifier[edge2] , identifier[cluster2] operator[SEP] operator[SEP] Keyword[int] identifier[nextEdge2] operator[=] identifier[getNextEdgeEx] operator[SEP] identifier[edge2] , identifier[end] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[getEdgeCluster] operator[SEP] identifier[edge2] , operator[SEP] identifier[end] operator[+] Other[1] operator[SEP] operator[&] Other[1] operator[SEP] operator[==] identifier[cluster_1] operator[SEP] {
identifier[disconnectEdge_] operator[SEP] identifier[edge2] operator[SEP] operator[SEP] Keyword[int] identifier[edgeOrigins2] operator[=] identifier[getEdgeOriginVertices] operator[SEP] identifier[edge2] operator[SEP] operator[SEP] identifier[m_edge_vertices] operator[SEP] identifier[deleteList] operator[SEP] identifier[edgeOrigins2] operator[SEP] operator[SEP] identifier[deleteEdge_] operator[SEP] identifier[edge2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[edge2] operator[==] identifier[nextEdge2] operator[SEP] {
identifier[firstEdge2] operator[=] operator[-] Other[1] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[firstEdge2] operator[==] identifier[edge2] operator[SEP] {
identifier[firstEdge2] operator[=] identifier[getClusterFirstEdge] operator[SEP] identifier[cluster2] operator[SEP] operator[SEP] identifier[lastEdge] operator[=] identifier[nextEdge2] operator[SEP] identifier[bForceContinue] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] {
Keyword[assert] operator[SEP] identifier[edge2] operator[!=] identifier[getClusterFirstEdge] operator[SEP] identifier[cluster_1] operator[SEP] operator[SEP] operator[SEP]
}
identifier[edge2] operator[=] identifier[nextEdge2] operator[SEP]
}
Keyword[while] operator[SEP] identifier[edge2] operator[!=] identifier[lastEdge] operator[||] identifier[bForceContinue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstEdge2] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[do] {
Keyword[int] identifier[end] operator[=] identifier[getEdgeEnd] operator[SEP] identifier[edge2] , identifier[cluster2] operator[SEP] operator[SEP] Keyword[int] identifier[nextEdge2] operator[=] identifier[getNextEdgeEx] operator[SEP] identifier[edge2] , identifier[end] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[edge2] operator[!=] identifier[getClusterFirstEdge] operator[SEP] identifier[cluster_1] operator[SEP] operator[SEP] operator[SEP] identifier[setEdgeCluster_] operator[SEP] identifier[edge2] , identifier[end] , identifier[cluster_1] operator[SEP] operator[SEP] identifier[edge2] operator[=] identifier[nextEdge2] operator[SEP]
}
Keyword[while] operator[SEP] identifier[edge2] operator[!=] identifier[lastEdge] operator[SEP] operator[SEP] identifier[firstEdge1] operator[=] identifier[getClusterFirstEdge] operator[SEP] identifier[cluster_1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstEdge1] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[int] identifier[next1] operator[=] identifier[getNextEdge] operator[SEP] identifier[firstEdge1] , identifier[cluster_1] operator[SEP] operator[SEP] Keyword[int] identifier[next2] operator[=] identifier[getNextEdge] operator[SEP] identifier[firstEdge2] , identifier[cluster_1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[next1] operator[==] identifier[firstEdge1] operator[SEP] {
identifier[setClusterFirstEdge_] operator[SEP] identifier[cluster_1] , identifier[firstEdge2] operator[SEP] operator[SEP] identifier[addEdgeToClusterImpl_] operator[SEP] identifier[firstEdge1] , identifier[cluster_1] operator[SEP] operator[SEP] identifier[setClusterFirstEdge_] operator[SEP] identifier[cluster_1] , identifier[firstEdge1] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[next2] operator[==] identifier[firstEdge2] operator[SEP] {
identifier[addEdgeToClusterImpl_] operator[SEP] identifier[firstEdge2] , identifier[cluster_1] operator[SEP] operator[SEP]
}
identifier[setNextEdge_] operator[SEP] identifier[firstEdge2] , identifier[cluster_1] , identifier[next1] operator[SEP] operator[SEP] identifier[setPrevEdge_] operator[SEP] identifier[next1] , identifier[cluster_1] , identifier[firstEdge2] operator[SEP] operator[SEP] identifier[setNextEdge_] operator[SEP] identifier[firstEdge1] , identifier[cluster_1] , identifier[next2] operator[SEP] operator[SEP] identifier[setPrevEdge_] operator[SEP] identifier[next2] , identifier[cluster_1] , identifier[firstEdge1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[setClusterFirstEdge_] operator[SEP] identifier[cluster_1] , identifier[firstEdge2] operator[SEP] operator[SEP]
}
}
}
Keyword[int] identifier[vertices1] operator[=] identifier[getClusterVertices] operator[SEP] identifier[cluster_1] operator[SEP] operator[SEP] Keyword[int] identifier[vertices2] operator[=] identifier[getClusterVertices] operator[SEP] identifier[cluster2] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[vh] operator[=] identifier[m_cluster_vertices] operator[SEP] identifier[getFirst] operator[SEP] identifier[vertices2] operator[SEP] operator[SEP] identifier[vh] operator[!=] operator[-] Other[1] operator[SEP] identifier[vh] operator[=] identifier[m_cluster_vertices] operator[SEP] identifier[getNext] operator[SEP] identifier[vh] operator[SEP] operator[SEP] {
Keyword[int] identifier[v] operator[=] identifier[m_cluster_vertices] operator[SEP] identifier[getElement] operator[SEP] identifier[vh] operator[SEP] operator[SEP] identifier[m_shape] operator[SEP] identifier[setUserIndex] operator[SEP] identifier[v] , identifier[m_vertex_cluster_index] , identifier[cluster_1] operator[SEP] operator[SEP]
}
identifier[m_cluster_vertices] operator[SEP] identifier[concatenateLists] operator[SEP] identifier[vertices1] , identifier[vertices2] operator[SEP] operator[SEP] identifier[deleteCluster_] operator[SEP] identifier[cluster2] operator[SEP] operator[SEP]
}
|
protected String extractLocation(Map<String, List<String>> headers) throws MalformedURLException {
for (Map.Entry<String, List<String>> head : headers.entrySet()) {
if ("Location".equalsIgnoreCase(head.getKey())) {
List<String> locs = head.getValue();
if (locs != null && locs.size() > 0) {
String location = locs.get(0);
if (location != null) {
return location;
} else {
return null;
}
}
}
}
return null;
} | class class_name[name] begin[{]
method[extractLocation, return_type[type[String]], modifier[protected], parameter[headers]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=head, selectors=[], type_arguments=None)], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="Location"), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=head, selectors=[], type_arguments=None), name=locs)], 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)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=locs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=locs, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=locs, selectors=[], type_arguments=None), name=location)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=headers, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=head)], 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[extractLocation] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[headers] operator[SEP] Keyword[throws] identifier[MalformedURLException] {
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[List] operator[<] identifier[String] operator[>] operator[>] identifier[head] operator[:] identifier[headers] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[head] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[locs] operator[=] identifier[head] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[locs] operator[!=] Other[null] operator[&&] identifier[locs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[String] identifier[location] operator[=] identifier[locs] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[location] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[location] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public static Matcher<? super MethodInvocationTree> sameArgument(
final int index1, final int index2) {
return new Matcher<MethodInvocationTree>() {
@Override
public boolean matches(MethodInvocationTree methodInvocationTree, VisitorState state) {
List<? extends ExpressionTree> args = methodInvocationTree.getArguments();
return ASTHelpers.sameVariable(args.get(index1), args.get(index2));
}
};
} | class class_name[name] begin[{]
method[sameArgument, return_type[type[Matcher]], modifier[public static], parameter[index1, index2]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getArguments, postfix_operators=[], prefix_operators=[], qualifier=methodInvocationTree, selectors=[], type_arguments=None), name=args)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=ExpressionTree, sub_type=None))], dimensions=[], name=List, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=index1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=index2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=args, selectors=[], type_arguments=None)], member=sameVariable, postfix_operators=[], prefix_operators=[], qualifier=ASTHelpers, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=matches, parameters=[FormalParameter(annotations=[], modifiers=set(), name=methodInvocationTree, type=ReferenceType(arguments=None, dimensions=[], name=MethodInvocationTree, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=state, type=ReferenceType(arguments=None, dimensions=[], name=VisitorState, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=MethodInvocationTree, sub_type=None))], dimensions=None, name=Matcher, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Matcher] operator[<] operator[?] Keyword[super] identifier[MethodInvocationTree] operator[>] identifier[sameArgument] operator[SEP] Keyword[final] Keyword[int] identifier[index1] , Keyword[final] Keyword[int] identifier[index2] operator[SEP] {
Keyword[return] Keyword[new] identifier[Matcher] operator[<] identifier[MethodInvocationTree] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[matches] operator[SEP] identifier[MethodInvocationTree] identifier[methodInvocationTree] , identifier[VisitorState] identifier[state] operator[SEP] {
identifier[List] operator[<] operator[?] Keyword[extends] identifier[ExpressionTree] operator[>] identifier[args] operator[=] identifier[methodInvocationTree] operator[SEP] identifier[getArguments] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ASTHelpers] operator[SEP] identifier[sameVariable] operator[SEP] identifier[args] operator[SEP] identifier[get] operator[SEP] identifier[index1] operator[SEP] , identifier[args] operator[SEP] identifier[get] operator[SEP] identifier[index2] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public static void extract( DMatrixRMaj src,
int rows[] , int rowsSize ,
int cols[] , int colsSize , DMatrixRMaj dst ) {
if( rowsSize != dst.numRows || colsSize != dst.numCols )
throw new MatrixDimensionException("Unexpected number of rows and/or columns in dst matrix");
int indexDst = 0;
for (int i = 0; i < rowsSize; i++) {
int indexSrcRow = src.numCols*rows[i];
for (int j = 0; j < colsSize; j++) {
dst.data[indexDst++] = src.data[indexSrcRow + cols[j]];
}
}
} | class class_name[name] begin[{]
method[extract, return_type[void], modifier[public static], parameter[src, rows, rowsSize, cols, colsSize, dst]] begin[{]
if[binary_operation[binary_operation[member[.rowsSize], !=, member[dst.numRows]], ||, binary_operation[member[.colsSize], !=, member[dst.numCols]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected number of rows and/or columns in dst matrix")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MatrixDimensionException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], indexDst]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=numCols, postfix_operators=[], prefix_operators=[], qualifier=src, selectors=[]), operandr=MemberReference(member=rows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*), name=indexSrcRow)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=dst, selectors=[ArraySelector(index=MemberReference(member=indexDst, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=src, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=indexSrcRow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=+))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=colsSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=rowsSize, 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[static] Keyword[void] identifier[extract] operator[SEP] identifier[DMatrixRMaj] identifier[src] , Keyword[int] identifier[rows] operator[SEP] operator[SEP] , Keyword[int] identifier[rowsSize] , Keyword[int] identifier[cols] operator[SEP] operator[SEP] , Keyword[int] identifier[colsSize] , identifier[DMatrixRMaj] identifier[dst] operator[SEP] {
Keyword[if] operator[SEP] identifier[rowsSize] operator[!=] identifier[dst] operator[SEP] identifier[numRows] operator[||] identifier[colsSize] operator[!=] identifier[dst] operator[SEP] identifier[numCols] operator[SEP] Keyword[throw] Keyword[new] identifier[MatrixDimensionException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[indexDst] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[rowsSize] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[indexSrcRow] operator[=] identifier[src] operator[SEP] identifier[numCols] operator[*] identifier[rows] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[colsSize] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[dst] operator[SEP] identifier[data] operator[SEP] identifier[indexDst] operator[++] operator[SEP] operator[=] identifier[src] operator[SEP] identifier[data] operator[SEP] identifier[indexSrcRow] operator[+] identifier[cols] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
private static Map<String, String> getConfServerBasePathMap(String app, String version, String env, String key) {
Map<String, String> parameterMap = new LinkedHashMap<String, String>();
parameterMap.put(Constants.VERSION, version);
parameterMap.put(Constants.APP, app);
parameterMap.put(Constants.ENV, env);
parameterMap.put(Constants.KEY, key);
return parameterMap;
} | class class_name[name] begin[{]
method[getConfServerBasePathMap, return_type[type[Map]], modifier[private static], parameter[app, version, env, key]] begin[{]
local_variable[type[Map], parameterMap]
call[parameterMap.put, parameter[member[Constants.VERSION], member[.version]]]
call[parameterMap.put, parameter[member[Constants.APP], member[.app]]]
call[parameterMap.put, parameter[member[Constants.ENV], member[.env]]]
call[parameterMap.put, parameter[member[Constants.KEY], member[.key]]]
return[member[.parameterMap]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[getConfServerBasePathMap] operator[SEP] identifier[String] identifier[app] , identifier[String] identifier[version] , identifier[String] identifier[env] , identifier[String] identifier[key] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[parameterMap] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[parameterMap] operator[SEP] identifier[put] operator[SEP] identifier[Constants] operator[SEP] identifier[VERSION] , identifier[version] operator[SEP] operator[SEP] identifier[parameterMap] operator[SEP] identifier[put] operator[SEP] identifier[Constants] operator[SEP] identifier[APP] , identifier[app] operator[SEP] operator[SEP] identifier[parameterMap] operator[SEP] identifier[put] operator[SEP] identifier[Constants] operator[SEP] identifier[ENV] , identifier[env] operator[SEP] operator[SEP] identifier[parameterMap] operator[SEP] identifier[put] operator[SEP] identifier[Constants] operator[SEP] identifier[KEY] , identifier[key] operator[SEP] operator[SEP] Keyword[return] identifier[parameterMap] operator[SEP]
}
|
public void run() {
InputStream in = null;
OutputStream out = null;
try {
in = socket.getInputStream();
out = socket.getOutputStream();
try {
String line;
line = readLine(in);
if (DEBUG_ON) debug("header: " + line);
if (line.startsWith("GET") &&
(options & GassServer.READ_ENABLE) != 0) {
// copy to client
String path =
line.substring(4, line.indexOf(' ', 4) );
do {
line = readLine(in);
if (DEBUG_ON) debug("header (get): " + line);
} while ( (line.length() != 0)
&& (line.charAt(0) != '\r')
&& (line.charAt(0) != '\n') );
transfer(out, path);
} else if (line.startsWith("PUT") &&
( ((options & GassServer.WRITE_ENABLE) != 0) ||
((options & GassServer.CLIENT_SHUTDOWN_ENABLE) != 0) )) {
// copy from client
String path =
line.substring(4, line.indexOf(' ', 4) );
transfer(in, path, false, out);
writeln(out, OKHEADER);
} else if (line.startsWith("POST") &&
( ((options & GassServer.WRITE_ENABLE) != 0) ||
((options & GassServer.STDOUT_ENABLE) != 0) ||
((options & GassServer.STDERR_ENABLE) != 0) ||
((options & GassServer.CLIENT_SHUTDOWN_ENABLE) != 0) )) {
// append from client
int index = line.indexOf('?') + 1;
String path =
line.substring(index, line.indexOf(' ', index) );
transfer(in, path, true, out);
writeln(out, OKHEADER);
} else {
writeln(out, "HTTP/1.1 400 Bad Request" + CRLF);
}
} catch (FileNotFoundException ex) {
logger.debug("FileNotFoundException occured: " + ex.getMessage(), ex);
StringBuffer buf = new StringBuffer(HEADER404)
.append(CONNECTION_CLOSE)
.append(SERVER)
.append(CONTENT_HTML)
.append(CONTENT_LENGTH).append(" ").append(MSG404.length())
.append(CRLF).append(CRLF)
.append(MSG404);
out.write(buf.toString().getBytes());
out.flush();
} catch (AuthorizationException ex) {
logger.debug("Exception occured: Authorization failed");
writeln(out, "HTTP/1.1 401 Authorization Failed" + CRLF);
} catch (Exception ex) {
logger.debug("Exception occured: " + ex.getMessage(), ex);
writeln(out, "HTTP/1.1 400 " + ex.getMessage() + CRLF);
}
} catch (IOException e) {
logger.error("Error writing response: " + e.getMessage(), e);
} finally {
try {
socket.close();
} catch (IOException e) {}
}
} | class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[InputStream], in]
local_variable[type[OutputStream], out]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getOutputStream, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None)), label=None), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MemberReference(member=DEBUG_ON, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="header: "), operandr=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="GET")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=READ_ENABLE, postfix_operators=[], prefix_operators=[], qualifier=GassServer, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PUT")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=WRITE_ENABLE, postfix_operators=[], prefix_operators=[], qualifier=GassServer, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=CLIENT_SHUTDOWN_ENABLE, postfix_operators=[], prefix_operators=[], qualifier=GassServer, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operator=||), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="POST")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=WRITE_ENABLE, postfix_operators=[], prefix_operators=[], qualifier=GassServer, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=STDOUT_ENABLE, postfix_operators=[], prefix_operators=[], qualifier=GassServer, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operator=||), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=STDERR_ENABLE, postfix_operators=[], prefix_operators=[], qualifier=GassServer, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operator=||), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=CLIENT_SHUTDOWN_ENABLE, postfix_operators=[], prefix_operators=[], qualifier=GassServer, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operator=||), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="HTTP/1.1 400 Bad Request"), operandr=MemberReference(member=CRLF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=writeln, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='?')], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=transfer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=OKHEADER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeln, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=transfer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=OKHEADER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeln, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), DoStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MemberReference(member=DEBUG_ON, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="header (get): "), operandr=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None))]), condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\r'), operator=!=), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n'), operator=!=), operator=&&), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=transfer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="FileNotFoundException occured: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=HEADER404, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=CONNECTION_CLOSE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=SERVER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CONTENT_HTML, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CONTENT_LENGTH, 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=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=MSG404, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CRLF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CRLF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=MSG404, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=StringBuffer, sub_type=None)), name=buf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuffer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[MethodInvocation(arguments=[], member=getBytes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=write, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['FileNotFoundException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception occured: Authorization failed")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="HTTP/1.1 401 Authorization Failed"), operandr=MemberReference(member=CRLF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=writeln, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['AuthorizationException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception occured: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="HTTP/1.1 400 "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), operator=+), operandr=MemberReference(member=CRLF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=writeln, postfix_operators=[], prefix_operators=[], qualifier=, 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)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error writing response: "), 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=[])], 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=['IOException']))], finally_block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[InputStream] identifier[in] operator[=] Other[null] operator[SEP] identifier[OutputStream] identifier[out] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[in] operator[=] identifier[socket] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[=] identifier[socket] operator[SEP] identifier[getOutputStream] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[String] identifier[line] operator[SEP] identifier[line] operator[=] identifier[readLine] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DEBUG_ON] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[line] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[options] operator[&] identifier[GassServer] operator[SEP] identifier[READ_ENABLE] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[line] operator[SEP] identifier[substring] operator[SEP] Other[4] , identifier[line] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , Other[4] operator[SEP] operator[SEP] operator[SEP] Keyword[do] {
identifier[line] operator[=] identifier[readLine] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DEBUG_ON] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[line] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[line] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[!=] literal[String] operator[SEP] operator[&&] operator[SEP] identifier[line] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[!=] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[transfer] operator[SEP] identifier[out] , identifier[path] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[SEP] operator[SEP] operator[SEP] identifier[options] operator[&] identifier[GassServer] operator[SEP] identifier[WRITE_ENABLE] operator[SEP] operator[!=] Other[0] operator[SEP] operator[||] operator[SEP] operator[SEP] identifier[options] operator[&] identifier[GassServer] operator[SEP] identifier[CLIENT_SHUTDOWN_ENABLE] operator[SEP] operator[!=] Other[0] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[line] operator[SEP] identifier[substring] operator[SEP] Other[4] , identifier[line] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , Other[4] operator[SEP] operator[SEP] operator[SEP] identifier[transfer] operator[SEP] identifier[in] , identifier[path] , literal[boolean] , identifier[out] operator[SEP] operator[SEP] identifier[writeln] operator[SEP] identifier[out] , identifier[OKHEADER] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] operator[SEP] operator[SEP] operator[SEP] identifier[options] operator[&] identifier[GassServer] operator[SEP] identifier[WRITE_ENABLE] operator[SEP] operator[!=] Other[0] operator[SEP] operator[||] operator[SEP] operator[SEP] identifier[options] operator[&] identifier[GassServer] operator[SEP] identifier[STDOUT_ENABLE] operator[SEP] operator[!=] Other[0] operator[SEP] operator[||] operator[SEP] operator[SEP] identifier[options] operator[&] identifier[GassServer] operator[SEP] identifier[STDERR_ENABLE] operator[SEP] operator[!=] Other[0] operator[SEP] operator[||] operator[SEP] operator[SEP] identifier[options] operator[&] identifier[GassServer] operator[SEP] identifier[CLIENT_SHUTDOWN_ENABLE] operator[SEP] operator[!=] Other[0] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[line] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] operator[SEP] identifier[String] identifier[path] operator[=] identifier[line] operator[SEP] identifier[substring] operator[SEP] identifier[index] , identifier[line] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[index] operator[SEP] operator[SEP] operator[SEP] identifier[transfer] operator[SEP] identifier[in] , identifier[path] , literal[boolean] , identifier[out] operator[SEP] operator[SEP] identifier[writeln] operator[SEP] identifier[out] , identifier[OKHEADER] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[writeln] operator[SEP] identifier[out] , literal[String] operator[+] identifier[CRLF] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[FileNotFoundException] identifier[ex] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[buf] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] identifier[HEADER404] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[CONNECTION_CLOSE] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[SERVER] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[CONTENT_HTML] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[CONTENT_LENGTH] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[MSG404] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[CRLF] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[CRLF] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[MSG404] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AuthorizationException] identifier[ex] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writeln] operator[SEP] identifier[out] , literal[String] operator[+] identifier[CRLF] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[ex] operator[SEP] operator[SEP] identifier[writeln] operator[SEP] identifier[out] , literal[String] operator[+] identifier[ex] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[+] identifier[CRLF] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
identifier[socket] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
}
}
}
|
public static String doGET(final URL url, final Properties requestProps, final Integer timeout, boolean includeHeaders, boolean ignoreBody)
throws Exception {
return doRequest(url, requestProps, timeout, includeHeaders, ignoreBody, "GET");
} | class class_name[name] begin[{]
method[doGET, return_type[type[String]], modifier[public static], parameter[url, requestProps, timeout, includeHeaders, ignoreBody]] begin[{]
return[call[.doRequest, parameter[member[.url], member[.requestProps], member[.timeout], member[.includeHeaders], member[.ignoreBody], literal["GET"]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[doGET] operator[SEP] Keyword[final] identifier[URL] identifier[url] , Keyword[final] identifier[Properties] identifier[requestProps] , Keyword[final] identifier[Integer] identifier[timeout] , Keyword[boolean] identifier[includeHeaders] , Keyword[boolean] identifier[ignoreBody] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[return] identifier[doRequest] operator[SEP] identifier[url] , identifier[requestProps] , identifier[timeout] , identifier[includeHeaders] , identifier[ignoreBody] , literal[String] operator[SEP] operator[SEP]
}
|
@Override
protected void startNewPage()
{
super.startNewPage();
pagebox = createBlock(body, curpage, false);
pagebox.setStyle(createPageStyle());
body.addSubBox(pagebox);
} | class class_name[name] begin[{]
method[startNewPage, return_type[void], modifier[protected], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=startNewPage, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
assign[member[.pagebox], call[.createBlock, parameter[member[.body], member[.curpage], literal[false]]]]
call[pagebox.setStyle, parameter[call[.createPageStyle, parameter[]]]]
call[body.addSubBox, parameter[member[.pagebox]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[startNewPage] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[startNewPage] operator[SEP] operator[SEP] operator[SEP] identifier[pagebox] operator[=] identifier[createBlock] operator[SEP] identifier[body] , identifier[curpage] , literal[boolean] operator[SEP] operator[SEP] identifier[pagebox] operator[SEP] identifier[setStyle] operator[SEP] identifier[createPageStyle] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] identifier[addSubBox] operator[SEP] identifier[pagebox] operator[SEP] operator[SEP]
}
|
protected final T getDefaultStats(OnDemandStatsProducer producer) {
try {
return getStatsClass().cast(producer.getDefaultStats());
} catch (ClassCastException e) {
LOGGER.error("getDefaultStats(): Unexpected stats type", e);
return null;
}
} | class class_name[name] begin[{]
method[getDefaultStats, return_type[type[T]], modifier[final protected], parameter[producer]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getStatsClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDefaultStats, postfix_operators=[], prefix_operators=[], qualifier=producer, selectors=[], type_arguments=None)], member=cast, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getDefaultStats(): Unexpected stats type"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassCastException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[final] identifier[T] identifier[getDefaultStats] operator[SEP] identifier[OnDemandStatsProducer] identifier[producer] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[getStatsClass] operator[SEP] operator[SEP] operator[SEP] identifier[cast] operator[SEP] identifier[producer] operator[SEP] identifier[getDefaultStats] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassCastException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
protected DriverContext buildContext(
DriverConfigLoader configLoader,
List<TypeCodec<?>> typeCodecs,
NodeStateListener nodeStateListener,
SchemaChangeListener schemaChangeListener,
RequestTracker requestTracker,
Map<String, String> localDatacenters,
Map<String, Predicate<Node>> nodeFilters,
ClassLoader classLoader) {
return new DefaultDriverContext(
configLoader,
typeCodecs,
nodeStateListener,
schemaChangeListener,
requestTracker,
localDatacenters,
nodeFilters,
classLoader);
} | class class_name[name] begin[{]
method[buildContext, return_type[type[DriverContext]], modifier[protected], parameter[configLoader, typeCodecs, nodeStateListener, schemaChangeListener, requestTracker, localDatacenters, nodeFilters, classLoader]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=configLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=typeCodecs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nodeStateListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=schemaChangeListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requestTracker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=localDatacenters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nodeFilters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=classLoader, 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=DefaultDriverContext, sub_type=None))]
end[}]
END[}] | Keyword[protected] identifier[DriverContext] identifier[buildContext] operator[SEP] identifier[DriverConfigLoader] identifier[configLoader] , identifier[List] operator[<] identifier[TypeCodec] operator[<] operator[?] operator[>] operator[>] identifier[typeCodecs] , identifier[NodeStateListener] identifier[nodeStateListener] , identifier[SchemaChangeListener] identifier[schemaChangeListener] , identifier[RequestTracker] identifier[requestTracker] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[localDatacenters] , identifier[Map] operator[<] identifier[String] , identifier[Predicate] operator[<] identifier[Node] operator[>] operator[>] identifier[nodeFilters] , identifier[ClassLoader] identifier[classLoader] operator[SEP] {
Keyword[return] Keyword[new] identifier[DefaultDriverContext] operator[SEP] identifier[configLoader] , identifier[typeCodecs] , identifier[nodeStateListener] , identifier[schemaChangeListener] , identifier[requestTracker] , identifier[localDatacenters] , identifier[nodeFilters] , identifier[classLoader] operator[SEP] operator[SEP]
}
|
public static byte[] getFileByteContent(InputStream is, String encoding) throws IOException{
byte[] buffer = new byte[1024];
int len;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
while((len = is.read(buffer)) != -1){
outputStream.write(buffer, 0, len);
}
outputStream.close();
is.close();
return outputStream.toByteArray();
} | class class_name[name] begin[{]
method[getFileByteContent, return_type[type[byte]], modifier[public static], parameter[is, encoding]] begin[{]
local_variable[type[byte], buffer]
local_variable[type[int], len]
local_variable[type[ByteArrayOutputStream], outputStream]
while[binary_operation[assign[member[.len], call[is.read, parameter[member[.buffer]]]], !=, literal[1]]] begin[{]
call[outputStream.write, parameter[member[.buffer], literal[0], member[.len]]]
end[}]
call[outputStream.close, parameter[]]
call[is.close, parameter[]]
return[call[outputStream.toByteArray, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[getFileByteContent] operator[SEP] identifier[InputStream] identifier[is] , identifier[String] identifier[encoding] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[1024] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[SEP] identifier[ByteArrayOutputStream] identifier[outputStream] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[len] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[outputStream] operator[SEP] identifier[write] operator[SEP] identifier[buffer] , Other[0] , identifier[len] operator[SEP] operator[SEP]
}
identifier[outputStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[is] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[outputStream] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
@Deprecated
public StringBuffer format(CurrencyAmount currAmt, StringBuffer toAppendTo, FieldPosition pos) {
return format(currAmt.getNumber().doubleValue(), currAmt.getCurrency(), toAppendTo, pos);
} | class class_name[name] begin[{]
method[format, return_type[type[StringBuffer]], modifier[public], parameter[currAmt, toAppendTo, pos]] begin[{]
return[call[.format, parameter[call[currAmt.getNumber, parameter[]], call[currAmt.getCurrency, parameter[]], member[.toAppendTo], member[.pos]]]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[Deprecated] Keyword[public] identifier[StringBuffer] identifier[format] operator[SEP] identifier[CurrencyAmount] identifier[currAmt] , identifier[StringBuffer] identifier[toAppendTo] , identifier[FieldPosition] identifier[pos] operator[SEP] {
Keyword[return] identifier[format] operator[SEP] identifier[currAmt] operator[SEP] identifier[getNumber] operator[SEP] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] , identifier[currAmt] operator[SEP] identifier[getCurrency] operator[SEP] operator[SEP] , identifier[toAppendTo] , identifier[pos] operator[SEP] operator[SEP]
}
|
public static Set<TypeDef> executablesToInterfaces(DslContext context, Collection<ExecutableElement> elements) {
Map<String, TypeDef> byName = new LinkedHashMap<String, TypeDef>();
for (ExecutableElement current : elements) {
TypeDef clazz = executableToInterface(context, current);
InterfaceName interfaceName = current.getAnnotation(InterfaceName.class);
String name = interfaceName != null ? clazz.getPackageName() + "." + interfaceName.value() : clazz.getFullyQualifiedName();
if (byName.containsKey(name)) {
TypeDef other = byName.remove(name);
byName.put(name, Merge.CLASSES.apply(new TypeDef[]{other, clazz}));
} else {
byName.put(name, clazz);
}
}
return new LinkedHashSet<TypeDef>(byName.values());
} | class class_name[name] begin[{]
method[executablesToInterfaces, return_type[type[Set]], modifier[public static], parameter[context, elements]] begin[{]
local_variable[type[Map], byName]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=executableToInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=clazz)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeDef, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InterfaceName, sub_type=None))], member=getAnnotation, postfix_operators=[], prefix_operators=[], qualifier=current, selectors=[], type_arguments=None), name=interfaceName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InterfaceName, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=interfaceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MethodInvocation(arguments=[], member=getFullyQualifiedName, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPackageName, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MethodInvocation(arguments=[], member=value, postfix_operators=[], prefix_operators=[], qualifier=interfaceName, selectors=[], type_arguments=None), operator=+)), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=byName, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=byName, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=byName, selectors=[], type_arguments=None), name=other)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypeDef, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TypeDef, sub_type=None))], member=apply, postfix_operators=[], prefix_operators=[], qualifier=Merge.CLASSES, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=byName, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=elements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=current)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExecutableElement, sub_type=None))), label=None)
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=byName, 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=TypeDef, sub_type=None))], dimensions=None, name=LinkedHashSet, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[TypeDef] operator[>] identifier[executablesToInterfaces] operator[SEP] identifier[DslContext] identifier[context] , identifier[Collection] operator[<] identifier[ExecutableElement] operator[>] identifier[elements] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[TypeDef] operator[>] identifier[byName] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[TypeDef] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ExecutableElement] identifier[current] operator[:] identifier[elements] operator[SEP] {
identifier[TypeDef] identifier[clazz] operator[=] identifier[executableToInterface] operator[SEP] identifier[context] , identifier[current] operator[SEP] operator[SEP] identifier[InterfaceName] identifier[interfaceName] operator[=] identifier[current] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[InterfaceName] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[String] identifier[name] operator[=] identifier[interfaceName] operator[!=] Other[null] operator[?] identifier[clazz] operator[SEP] identifier[getPackageName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[interfaceName] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[:] identifier[clazz] operator[SEP] identifier[getFullyQualifiedName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[byName] operator[SEP] identifier[containsKey] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
identifier[TypeDef] identifier[other] operator[=] identifier[byName] operator[SEP] identifier[remove] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[byName] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[Merge] operator[SEP] identifier[CLASSES] operator[SEP] identifier[apply] operator[SEP] Keyword[new] identifier[TypeDef] operator[SEP] operator[SEP] {
identifier[other] , identifier[clazz]
} operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[byName] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[clazz] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[LinkedHashSet] operator[<] identifier[TypeDef] operator[>] operator[SEP] identifier[byName] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public String convertOBPYoaOrentToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
} | class class_name[name] begin[{]
method[convertOBPYoaOrentToString, return_type[type[String]], modifier[public], parameter[eDataType, instanceValue]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=instanceValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=instanceValue, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] identifier[String] identifier[convertOBPYoaOrentToString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[Object] identifier[instanceValue] operator[SEP] {
Keyword[return] identifier[instanceValue] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[instanceValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.opengis.net/citygml/transportation/1.0", name = "TransportationComplex", substitutionHeadNamespace = "http://www.opengis.net/citygml/transportation/1.0", substitutionHeadName = "_TransportationObject")
public JAXBElement<TransportationComplexType> createTransportationComplex(TransportationComplexType value) {
return new JAXBElement<TransportationComplexType>(_TransportationComplex_QNAME, TransportationComplexType.class, null, value);
} | class class_name[name] begin[{]
method[createTransportationComplex, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_TransportationComplex_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TransportationComplexType, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=TransportationComplexType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] , identifier[substitutionHeadNamespace] operator[=] literal[String] , identifier[substitutionHeadName] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[TransportationComplexType] operator[>] identifier[createTransportationComplex] operator[SEP] identifier[TransportationComplexType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[TransportationComplexType] operator[>] operator[SEP] identifier[_TransportationComplex_QNAME] , identifier[TransportationComplexType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
private void checkForCompletion() {
final String methodName = "checkForCompletion(): ";
// mark the list complete if that was the last awaited key
if (actualIndices.isEmpty()) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName + "setting state=COMPLETE");
state = failedKeys == null
? COMPLETE
: COMPLETE_WITH_FAILURES; // state change must be last action
}
} | class class_name[name] begin[{]
method[checkForCompletion, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[String], methodName]
if[call[actualIndices.isEmpty, parameter[]]] begin[{]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[member[.methodName], +, literal["setting state=COMPLETE"]]]]
else begin[{]
None
end[}]
assign[member[.state], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=failedKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=COMPLETE_WITH_FAILURES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=COMPLETE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[checkForCompletion] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[methodName] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[actualIndices] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , identifier[methodName] operator[+] literal[String] operator[SEP] operator[SEP] identifier[state] operator[=] identifier[failedKeys] operator[==] Other[null] operator[?] identifier[COMPLETE] operator[:] identifier[COMPLETE_WITH_FAILURES] operator[SEP]
}
}
|
public ConsulResponse<List<HealthCheck>> getNodeChecks(final String node,
final String datacenter,
final String tag,
final RequestOptions requestOptions) {
final URI uri = createURI("/node/" + node);
final HttpRequestBuilder httpRequestBuilder = RequestUtils
.getHttpRequestBuilder(datacenter, tag, requestOptions, "");
final HTTP.Response httpResponse = HTTP.getResponse(uri.toString() + "?" + httpRequestBuilder.paramString());
if (httpResponse == null || httpResponse.code() != 200) {
die("Unable to retrieve the service", uri, httpResponse);
}
return RequestUtils.consulResponseList(HealthCheck.class, httpResponse);
} | class class_name[name] begin[{]
method[getNodeChecks, return_type[type[ConsulResponse]], modifier[public], parameter[node, datacenter, tag, requestOptions]] begin[{]
local_variable[type[URI], uri]
local_variable[type[HttpRequestBuilder], httpRequestBuilder]
local_variable[type[HTTP], httpResponse]
if[binary_operation[binary_operation[member[.httpResponse], ==, literal[null]], ||, binary_operation[call[httpResponse.code, parameter[]], !=, literal[200]]]] begin[{]
call[.die, parameter[literal["Unable to retrieve the service"], member[.uri], member[.httpResponse]]]
else begin[{]
None
end[}]
return[call[RequestUtils.consulResponseList, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HealthCheck, sub_type=None)), member[.httpResponse]]]]
end[}]
END[}] | Keyword[public] identifier[ConsulResponse] operator[<] identifier[List] operator[<] identifier[HealthCheck] operator[>] operator[>] identifier[getNodeChecks] operator[SEP] Keyword[final] identifier[String] identifier[node] , Keyword[final] identifier[String] identifier[datacenter] , Keyword[final] identifier[String] identifier[tag] , Keyword[final] identifier[RequestOptions] identifier[requestOptions] operator[SEP] {
Keyword[final] identifier[URI] identifier[uri] operator[=] identifier[createURI] operator[SEP] literal[String] operator[+] identifier[node] operator[SEP] operator[SEP] Keyword[final] identifier[HttpRequestBuilder] identifier[httpRequestBuilder] operator[=] identifier[RequestUtils] operator[SEP] identifier[getHttpRequestBuilder] operator[SEP] identifier[datacenter] , identifier[tag] , identifier[requestOptions] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[HTTP] operator[SEP] identifier[Response] identifier[httpResponse] operator[=] identifier[HTTP] operator[SEP] identifier[getResponse] operator[SEP] identifier[uri] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[httpRequestBuilder] operator[SEP] identifier[paramString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[httpResponse] operator[==] Other[null] operator[||] identifier[httpResponse] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[!=] Other[200] operator[SEP] {
identifier[die] operator[SEP] literal[String] , identifier[uri] , identifier[httpResponse] operator[SEP] operator[SEP]
}
Keyword[return] identifier[RequestUtils] operator[SEP] identifier[consulResponseList] operator[SEP] identifier[HealthCheck] operator[SEP] Keyword[class] , identifier[httpResponse] operator[SEP] operator[SEP]
}
|
public static final TimeFragment newInstance(int theme, int hour, int minute, boolean isClientSpecified24HourTime, boolean is24HourTime) {
TimeFragment f = new TimeFragment();
Bundle b = new Bundle();
b.putInt("theme", theme);
b.putInt("hour", hour);
b.putInt("minute", minute);
b.putBoolean("isClientSpecified24HourTime", isClientSpecified24HourTime);
b.putBoolean("is24HourTime", is24HourTime);
f.setArguments(b);
return f;
} | class class_name[name] begin[{]
method[newInstance, return_type[type[TimeFragment]], modifier[final public static], parameter[theme, hour, minute, isClientSpecified24HourTime, is24HourTime]] begin[{]
local_variable[type[TimeFragment], f]
local_variable[type[Bundle], b]
call[b.putInt, parameter[literal["theme"], member[.theme]]]
call[b.putInt, parameter[literal["hour"], member[.hour]]]
call[b.putInt, parameter[literal["minute"], member[.minute]]]
call[b.putBoolean, parameter[literal["isClientSpecified24HourTime"], member[.isClientSpecified24HourTime]]]
call[b.putBoolean, parameter[literal["is24HourTime"], member[.is24HourTime]]]
call[f.setArguments, parameter[member[.b]]]
return[member[.f]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[TimeFragment] identifier[newInstance] operator[SEP] Keyword[int] identifier[theme] , Keyword[int] identifier[hour] , Keyword[int] identifier[minute] , Keyword[boolean] identifier[isClientSpecified24HourTime] , Keyword[boolean] identifier[is24HourTime] operator[SEP] {
identifier[TimeFragment] identifier[f] operator[=] Keyword[new] identifier[TimeFragment] operator[SEP] operator[SEP] operator[SEP] identifier[Bundle] identifier[b] operator[=] Keyword[new] identifier[Bundle] operator[SEP] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[putInt] operator[SEP] literal[String] , identifier[theme] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[putInt] operator[SEP] literal[String] , identifier[hour] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[putInt] operator[SEP] literal[String] , identifier[minute] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[putBoolean] operator[SEP] literal[String] , identifier[isClientSpecified24HourTime] operator[SEP] operator[SEP] identifier[b] operator[SEP] identifier[putBoolean] operator[SEP] literal[String] , identifier[is24HourTime] operator[SEP] operator[SEP] identifier[f] operator[SEP] identifier[setArguments] operator[SEP] identifier[b] operator[SEP] operator[SEP] Keyword[return] identifier[f] operator[SEP]
}
|
public static android.view.View createView(Context context, Object screen) {
return createView(context, screen.getClass());
} | class class_name[name] begin[{]
method[createView, return_type[type[android]], modifier[public static], parameter[context, screen]] begin[{]
return[call[.createView, parameter[member[.context], call[screen.getClass, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[android] operator[SEP] identifier[view] operator[SEP] identifier[View] identifier[createView] operator[SEP] identifier[Context] identifier[context] , identifier[Object] identifier[screen] operator[SEP] {
Keyword[return] identifier[createView] operator[SEP] identifier[context] , identifier[screen] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private static int[] add(int[] a, int[] b) {
int[] c = new int[a.length + b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, a.length, b.length);
return c;
} | class class_name[name] begin[{]
method[add, return_type[type[int]], modifier[private static], parameter[a, b]] begin[{]
local_variable[type[int], c]
call[System.arraycopy, parameter[member[.a], literal[0], member[.c], literal[0], member[a.length]]]
call[System.arraycopy, parameter[member[.b], literal[0], member[.c], member[a.length], member[b.length]]]
return[member[.c]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[int] operator[SEP] operator[SEP] identifier[add] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[a] , Keyword[int] operator[SEP] operator[SEP] identifier[b] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[c] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[a] operator[SEP] identifier[length] operator[+] identifier[b] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[a] , Other[0] , identifier[c] , Other[0] , identifier[a] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[b] , Other[0] , identifier[c] , identifier[a] operator[SEP] identifier[length] , identifier[b] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[c] operator[SEP]
}
|
public OvhBillDetail deposit_depositId_paidBills_billId_details_billDetailId_GET(String depositId, String billId, String billDetailId) throws IOException {
String qPath = "/me/deposit/{depositId}/paidBills/{billId}/details/{billDetailId}";
StringBuilder sb = path(qPath, depositId, billId, billDetailId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBillDetail.class);
} | class class_name[name] begin[{]
method[deposit_depositId_paidBills_billId_details_billDetailId_GET, return_type[type[OvhBillDetail]], modifier[public], parameter[depositId, billId, billDetailId]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhBillDetail, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[OvhBillDetail] identifier[deposit_depositId_paidBills_billId_details_billDetailId_GET] operator[SEP] identifier[String] identifier[depositId] , identifier[String] identifier[billId] , identifier[String] identifier[billDetailId] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[depositId] , identifier[billId] , identifier[billDetailId] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhBillDetail] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static IllegalTypeException newIllegalTypeException(String message, Object... args) {
return newIllegalTypeException(null, message, args);
} | class class_name[name] begin[{]
method[newIllegalTypeException, return_type[type[IllegalTypeException]], modifier[public static], parameter[message, args]] begin[{]
return[call[.newIllegalTypeException, parameter[literal[null], member[.message], member[.args]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[IllegalTypeException] identifier[newIllegalTypeException] operator[SEP] identifier[String] identifier[message] , identifier[Object] operator[...] identifier[args] operator[SEP] {
Keyword[return] identifier[newIllegalTypeException] operator[SEP] Other[null] , identifier[message] , identifier[args] operator[SEP] operator[SEP]
}
|
static void export(String path, DbConn cnx) throws JqmXmlException
{
if (cnx == null)
{
throw new IllegalArgumentException("database connection cannot be null");
}
export(path, JobDef.select(cnx, "jd_select_all"), cnx);
} | class class_name[name] begin[{]
method[export, return_type[void], modifier[static], parameter[path, cnx]] begin[{]
if[binary_operation[member[.cnx], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="database connection cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.export, parameter[member[.path], call[JobDef.select, parameter[member[.cnx], literal["jd_select_all"]]], member[.cnx]]]
end[}]
END[}] | Keyword[static] Keyword[void] identifier[export] operator[SEP] identifier[String] identifier[path] , identifier[DbConn] identifier[cnx] operator[SEP] Keyword[throws] identifier[JqmXmlException] {
Keyword[if] operator[SEP] identifier[cnx] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[export] operator[SEP] identifier[path] , identifier[JobDef] operator[SEP] identifier[select] operator[SEP] identifier[cnx] , literal[String] operator[SEP] , identifier[cnx] operator[SEP] operator[SEP]
}
|
public <T> Key<T> getKey(final T entity) {
T unwrapped = entity;
if (unwrapped instanceof ProxiedEntityReference) {
final ProxiedEntityReference proxy = (ProxiedEntityReference) unwrapped;
return (Key<T>) proxy.__getKey();
}
unwrapped = ProxyHelper.unwrap(unwrapped);
if (unwrapped instanceof Key) {
return (Key<T>) unwrapped;
}
final Object id = getId(unwrapped);
final Class<T> aClass = (Class<T>) unwrapped.getClass();
return id == null ? null : new Key<T>(aClass, getCollectionName(aClass), id);
} | class class_name[name] begin[{]
method[getKey, return_type[type[Key]], modifier[public], parameter[entity]] begin[{]
local_variable[type[T], unwrapped]
if[binary_operation[member[.unwrapped], instanceof, type[ProxiedEntityReference]]] begin[{]
local_variable[type[ProxiedEntityReference], proxy]
return[Cast(expression=MethodInvocation(arguments=[], member=__getKey, postfix_operators=[], prefix_operators=[], qualifier=proxy, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Key, sub_type=None))]
else begin[{]
None
end[}]
assign[member[.unwrapped], call[ProxyHelper.unwrap, parameter[member[.unwrapped]]]]
if[binary_operation[member[.unwrapped], instanceof, type[Key]]] begin[{]
return[Cast(expression=MemberReference(member=unwrapped, 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=Key, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[Object], id]
local_variable[type[Class], aClass]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=ClassCreator(arguments=[MemberReference(member=aClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=aClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCollectionName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=Key, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[Key] operator[<] identifier[T] operator[>] identifier[getKey] operator[SEP] Keyword[final] identifier[T] identifier[entity] operator[SEP] {
identifier[T] identifier[unwrapped] operator[=] identifier[entity] operator[SEP] Keyword[if] operator[SEP] identifier[unwrapped] Keyword[instanceof] identifier[ProxiedEntityReference] operator[SEP] {
Keyword[final] identifier[ProxiedEntityReference] identifier[proxy] operator[=] operator[SEP] identifier[ProxiedEntityReference] operator[SEP] identifier[unwrapped] operator[SEP] Keyword[return] operator[SEP] identifier[Key] operator[<] identifier[T] operator[>] operator[SEP] identifier[proxy] operator[SEP] identifier[__getKey] operator[SEP] operator[SEP] operator[SEP]
}
identifier[unwrapped] operator[=] identifier[ProxyHelper] operator[SEP] identifier[unwrap] operator[SEP] identifier[unwrapped] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[unwrapped] Keyword[instanceof] identifier[Key] operator[SEP] {
Keyword[return] operator[SEP] identifier[Key] operator[<] identifier[T] operator[>] operator[SEP] identifier[unwrapped] operator[SEP]
}
Keyword[final] identifier[Object] identifier[id] operator[=] identifier[getId] operator[SEP] identifier[unwrapped] operator[SEP] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[aClass] operator[=] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] operator[SEP] identifier[unwrapped] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[id] operator[==] Other[null] operator[?] Other[null] operator[:] Keyword[new] identifier[Key] operator[<] identifier[T] operator[>] operator[SEP] identifier[aClass] , identifier[getCollectionName] operator[SEP] identifier[aClass] operator[SEP] , identifier[id] operator[SEP] operator[SEP]
}
|
public void set(String row []) throws BatchException {
if(row.length<4) {throw new BatchException("Row of MiscID_XRef is too short");}
id = row[0];
sponsor = row[1];
created = row[2];
renewal = row[3];
} | class class_name[name] begin[{]
method[set, return_type[void], modifier[public], parameter[row]] begin[{]
if[binary_operation[member[row.length], <, literal[4]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Row of MiscID_XRef is too short")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BatchException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.id], member[.row]]
assign[member[.sponsor], member[.row]]
assign[member[.created], member[.row]]
assign[member[.renewal], member[.row]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[set] operator[SEP] identifier[String] identifier[row] operator[SEP] operator[SEP] operator[SEP] Keyword[throws] identifier[BatchException] {
Keyword[if] operator[SEP] identifier[row] operator[SEP] identifier[length] operator[<] Other[4] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BatchException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[id] operator[=] identifier[row] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[sponsor] operator[=] identifier[row] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[created] operator[=] identifier[row] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[renewal] operator[=] identifier[row] operator[SEP] Other[3] operator[SEP] operator[SEP]
}
|
public List<GraphicInfo> connectionPerfectionizer(SHAPE_TYPE sourceShapeType,
SHAPE_TYPE targetShapeType,
GraphicInfo sourceGraphicInfo,
GraphicInfo targetGraphicInfo,
List<GraphicInfo> graphicInfoList) {
Shape shapeFirst = createShape(sourceShapeType,
sourceGraphicInfo);
Shape shapeLast = createShape(targetShapeType,
targetGraphicInfo);
if (graphicInfoList != null && graphicInfoList.size() > 0) {
GraphicInfo graphicInfoFirst = graphicInfoList.get(0);
GraphicInfo graphicInfoLast = graphicInfoList.get(graphicInfoList.size() - 1);
if (shapeFirst != null) {
graphicInfoFirst.setX(shapeFirst.getBounds2D().getCenterX());
graphicInfoFirst.setY(shapeFirst.getBounds2D().getCenterY());
}
if (shapeLast != null) {
graphicInfoLast.setX(shapeLast.getBounds2D().getCenterX());
graphicInfoLast.setY(shapeLast.getBounds2D().getCenterY());
}
Point p = null;
if (shapeFirst != null) {
Line2D.Double lineFirst = new Line2D.Double(graphicInfoFirst.getX(),
graphicInfoFirst.getY(),
graphicInfoList.get(1).getX(),
graphicInfoList.get(1).getY());
p = getIntersection(shapeFirst,
lineFirst);
if (p != null) {
graphicInfoFirst.setX(p.getX());
graphicInfoFirst.setY(p.getY());
}
}
if (shapeLast != null) {
Line2D.Double lineLast = new Line2D.Double(graphicInfoLast.getX(),
graphicInfoLast.getY(),
graphicInfoList.get(graphicInfoList.size() - 2).getX(),
graphicInfoList.get(graphicInfoList.size() - 2).getY());
p = getIntersection(shapeLast,
lineLast);
if (p != null) {
graphicInfoLast.setX(p.getX());
graphicInfoLast.setY(p.getY());
}
}
}
return graphicInfoList;
} | class class_name[name] begin[{]
method[connectionPerfectionizer, return_type[type[List]], modifier[public], parameter[sourceShapeType, targetShapeType, sourceGraphicInfo, targetGraphicInfo, graphicInfoList]] begin[{]
local_variable[type[Shape], shapeFirst]
local_variable[type[Shape], shapeLast]
if[binary_operation[binary_operation[member[.graphicInfoList], !=, literal[null]], &&, binary_operation[call[graphicInfoList.size, parameter[]], >, literal[0]]]] begin[{]
local_variable[type[GraphicInfo], graphicInfoFirst]
local_variable[type[GraphicInfo], graphicInfoLast]
if[binary_operation[member[.shapeFirst], !=, literal[null]]] begin[{]
call[graphicInfoFirst.setX, parameter[call[shapeFirst.getBounds2D, parameter[]]]]
call[graphicInfoFirst.setY, parameter[call[shapeFirst.getBounds2D, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.shapeLast], !=, literal[null]]] begin[{]
call[graphicInfoLast.setX, parameter[call[shapeLast.getBounds2D, parameter[]]]]
call[graphicInfoLast.setY, parameter[call[shapeLast.getBounds2D, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[Point], p]
if[binary_operation[member[.shapeFirst], !=, literal[null]]] begin[{]
local_variable[type[Line2D], lineFirst]
assign[member[.p], call[.getIntersection, parameter[member[.shapeFirst], member[.lineFirst]]]]
if[binary_operation[member[.p], !=, literal[null]]] begin[{]
call[graphicInfoFirst.setX, parameter[call[p.getX, parameter[]]]]
call[graphicInfoFirst.setY, parameter[call[p.getY, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.shapeLast], !=, literal[null]]] begin[{]
local_variable[type[Line2D], lineLast]
assign[member[.p], call[.getIntersection, parameter[member[.shapeLast], member[.lineLast]]]]
if[binary_operation[member[.p], !=, literal[null]]] begin[{]
call[graphicInfoLast.setX, parameter[call[p.getX, parameter[]]]]
call[graphicInfoLast.setY, parameter[call[p.getY, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.graphicInfoList]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[GraphicInfo] operator[>] identifier[connectionPerfectionizer] operator[SEP] identifier[SHAPE_TYPE] identifier[sourceShapeType] , identifier[SHAPE_TYPE] identifier[targetShapeType] , identifier[GraphicInfo] identifier[sourceGraphicInfo] , identifier[GraphicInfo] identifier[targetGraphicInfo] , identifier[List] operator[<] identifier[GraphicInfo] operator[>] identifier[graphicInfoList] operator[SEP] {
identifier[Shape] identifier[shapeFirst] operator[=] identifier[createShape] operator[SEP] identifier[sourceShapeType] , identifier[sourceGraphicInfo] operator[SEP] operator[SEP] identifier[Shape] identifier[shapeLast] operator[=] identifier[createShape] operator[SEP] identifier[targetShapeType] , identifier[targetGraphicInfo] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[graphicInfoList] operator[!=] Other[null] operator[&&] identifier[graphicInfoList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[GraphicInfo] identifier[graphicInfoFirst] operator[=] identifier[graphicInfoList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[GraphicInfo] identifier[graphicInfoLast] operator[=] identifier[graphicInfoList] operator[SEP] identifier[get] operator[SEP] identifier[graphicInfoList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[shapeFirst] operator[!=] Other[null] operator[SEP] {
identifier[graphicInfoFirst] operator[SEP] identifier[setX] operator[SEP] identifier[shapeFirst] operator[SEP] identifier[getBounds2D] operator[SEP] operator[SEP] operator[SEP] identifier[getCenterX] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[graphicInfoFirst] operator[SEP] identifier[setY] operator[SEP] identifier[shapeFirst] operator[SEP] identifier[getBounds2D] operator[SEP] operator[SEP] operator[SEP] identifier[getCenterY] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[shapeLast] operator[!=] Other[null] operator[SEP] {
identifier[graphicInfoLast] operator[SEP] identifier[setX] operator[SEP] identifier[shapeLast] operator[SEP] identifier[getBounds2D] operator[SEP] operator[SEP] operator[SEP] identifier[getCenterX] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[graphicInfoLast] operator[SEP] identifier[setY] operator[SEP] identifier[shapeLast] operator[SEP] identifier[getBounds2D] operator[SEP] operator[SEP] operator[SEP] identifier[getCenterY] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Point] identifier[p] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[shapeFirst] operator[!=] Other[null] operator[SEP] {
identifier[Line2D] operator[SEP] identifier[Double] identifier[lineFirst] operator[=] Keyword[new] identifier[Line2D] operator[SEP] identifier[Double] operator[SEP] identifier[graphicInfoFirst] operator[SEP] identifier[getX] operator[SEP] operator[SEP] , identifier[graphicInfoFirst] operator[SEP] identifier[getY] operator[SEP] operator[SEP] , identifier[graphicInfoList] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[getX] operator[SEP] operator[SEP] , identifier[graphicInfoList] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[p] operator[=] identifier[getIntersection] operator[SEP] identifier[shapeFirst] , identifier[lineFirst] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[!=] Other[null] operator[SEP] {
identifier[graphicInfoFirst] operator[SEP] identifier[setX] operator[SEP] identifier[p] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[graphicInfoFirst] operator[SEP] identifier[setY] operator[SEP] identifier[p] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[shapeLast] operator[!=] Other[null] operator[SEP] {
identifier[Line2D] operator[SEP] identifier[Double] identifier[lineLast] operator[=] Keyword[new] identifier[Line2D] operator[SEP] identifier[Double] operator[SEP] identifier[graphicInfoLast] operator[SEP] identifier[getX] operator[SEP] operator[SEP] , identifier[graphicInfoLast] operator[SEP] identifier[getY] operator[SEP] operator[SEP] , identifier[graphicInfoList] operator[SEP] identifier[get] operator[SEP] identifier[graphicInfoList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[SEP] identifier[getX] operator[SEP] operator[SEP] , identifier[graphicInfoList] operator[SEP] identifier[get] operator[SEP] identifier[graphicInfoList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[p] operator[=] identifier[getIntersection] operator[SEP] identifier[shapeLast] , identifier[lineLast] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[!=] Other[null] operator[SEP] {
identifier[graphicInfoLast] operator[SEP] identifier[setX] operator[SEP] identifier[p] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[graphicInfoLast] operator[SEP] identifier[setY] operator[SEP] identifier[p] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[graphicInfoList] operator[SEP]
}
|
public void fitOnSequences(Integer[][] sequences) {
documentCount += 1;
for (Integer[] sequence: sequences) {
Set<Integer> sequenceSet = new HashSet<>(Arrays.asList(sequence));
for (Integer index: sequenceSet)
indexDocs.put(index, indexDocs.get(index) + 1);
}
} | class class_name[name] begin[{]
method[fitOnSequences, return_type[void], modifier[public], parameter[sequences]] begin[{]
assign[member[.documentCount], literal[1]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=sequence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashSet, sub_type=None)), name=sequenceSet)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=[], name=Set, sub_type=None)), ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=indexDocs, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=put, postfix_operators=[], prefix_operators=[], qualifier=indexDocs, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=sequenceSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=index)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=sequences, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=sequence)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Integer, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[fitOnSequences] operator[SEP] identifier[Integer] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sequences] operator[SEP] {
identifier[documentCount] operator[+=] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[Integer] operator[SEP] operator[SEP] identifier[sequence] operator[:] identifier[sequences] operator[SEP] {
identifier[Set] operator[<] identifier[Integer] operator[>] identifier[sequenceSet] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[sequence] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Integer] identifier[index] operator[:] identifier[sequenceSet] operator[SEP] identifier[indexDocs] operator[SEP] identifier[put] operator[SEP] identifier[index] , identifier[indexDocs] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP]
}
}
|
public SwitchBuilder setDefault(Statement body) {
Preconditions.checkState(defaultCaseBody == null);
defaultCaseBody = body;
return this;
} | class class_name[name] begin[{]
method[setDefault, return_type[type[SwitchBuilder]], modifier[public], parameter[body]] begin[{]
call[Preconditions.checkState, parameter[binary_operation[member[.defaultCaseBody], ==, literal[null]]]]
assign[member[.defaultCaseBody], member[.body]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[SwitchBuilder] identifier[setDefault] operator[SEP] identifier[Statement] identifier[body] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[defaultCaseBody] operator[==] Other[null] operator[SEP] operator[SEP] identifier[defaultCaseBody] operator[=] identifier[body] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static String defaultOrigin(HttpServerExchange exchange) {
String host = NetworkUtils.formatPossibleIpv6Address(exchange.getHostName());
String protocol = exchange.getRequestScheme();
int port = exchange.getHostPort();
//This browser set header should not need IPv6 escaping
StringBuilder allowedOrigin = new StringBuilder(256);
allowedOrigin.append(protocol).append("://").append(host);
if (!isDefaultPort(port, protocol)) {
allowedOrigin.append(':').append(port);
}
return allowedOrigin.toString();
} | class class_name[name] begin[{]
method[defaultOrigin, return_type[type[String]], modifier[public static], parameter[exchange]] begin[{]
local_variable[type[String], host]
local_variable[type[String], protocol]
local_variable[type[int], port]
local_variable[type[StringBuilder], allowedOrigin]
call[allowedOrigin.append, parameter[member[.protocol]]]
if[call[.isDefaultPort, parameter[member[.port], member[.protocol]]]] begin[{]
call[allowedOrigin.append, parameter[literal[':']]]
else begin[{]
None
end[}]
return[call[allowedOrigin.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[defaultOrigin] operator[SEP] identifier[HttpServerExchange] identifier[exchange] operator[SEP] {
identifier[String] identifier[host] operator[=] identifier[NetworkUtils] operator[SEP] identifier[formatPossibleIpv6Address] operator[SEP] identifier[exchange] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[protocol] operator[=] identifier[exchange] operator[SEP] identifier[getRequestScheme] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[port] operator[=] identifier[exchange] operator[SEP] identifier[getHostPort] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[allowedOrigin] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] Other[256] operator[SEP] operator[SEP] identifier[allowedOrigin] operator[SEP] identifier[append] operator[SEP] identifier[protocol] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[host] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isDefaultPort] operator[SEP] identifier[port] , identifier[protocol] operator[SEP] operator[SEP] {
identifier[allowedOrigin] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[port] operator[SEP] operator[SEP]
}
Keyword[return] identifier[allowedOrigin] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public ReservationUtilizationGroup withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | class class_name[name] begin[{]
method[withAttributes, return_type[type[ReservationUtilizationGroup]], modifier[public], parameter[attributes]] begin[{]
call[.setAttributes, parameter[member[.attributes]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ReservationUtilizationGroup] identifier[withAttributes] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[attributes] operator[SEP] {
identifier[setAttributes] operator[SEP] identifier[attributes] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public <TArg0, TArg1, TArg2> void fire(TriggerWithParameters3<TArg0, TArg1, TArg2, T> trigger, TArg0 arg0, TArg1 arg1, TArg2 arg2) {
assert trigger != null : TRIGGER_IS_NULL;
publicFire(trigger.getTrigger(), arg0, arg1, arg2);
} | class class_name[name] begin[{]
method[fire, return_type[void], modifier[public], parameter[trigger, arg0, arg1, arg2]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=trigger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=MemberReference(member=TRIGGER_IS_NULL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))
call[.publicFire, parameter[call[trigger.getTrigger, parameter[]], member[.arg0], member[.arg1], member[.arg2]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[TArg0] , identifier[TArg1] , identifier[TArg2] operator[>] Keyword[void] identifier[fire] operator[SEP] identifier[TriggerWithParameters3] operator[<] identifier[TArg0] , identifier[TArg1] , identifier[TArg2] , identifier[T] operator[>] identifier[trigger] , identifier[TArg0] identifier[arg0] , identifier[TArg1] identifier[arg1] , identifier[TArg2] identifier[arg2] operator[SEP] {
Keyword[assert] identifier[trigger] operator[!=] Other[null] operator[:] identifier[TRIGGER_IS_NULL] operator[SEP] identifier[publicFire] operator[SEP] identifier[trigger] operator[SEP] identifier[getTrigger] operator[SEP] operator[SEP] , identifier[arg0] , identifier[arg1] , identifier[arg2] operator[SEP] operator[SEP]
}
|
public PermissionProfile updatePermissionProfile(String accountId, String permissionProfileId, PermissionProfile permissionProfile) throws ApiException {
return updatePermissionProfile(accountId, permissionProfileId, permissionProfile, null);
} | class class_name[name] begin[{]
method[updatePermissionProfile, return_type[type[PermissionProfile]], modifier[public], parameter[accountId, permissionProfileId, permissionProfile]] begin[{]
return[call[.updatePermissionProfile, parameter[member[.accountId], member[.permissionProfileId], member[.permissionProfile], literal[null]]]]
end[}]
END[}] | Keyword[public] identifier[PermissionProfile] identifier[updatePermissionProfile] operator[SEP] identifier[String] identifier[accountId] , identifier[String] identifier[permissionProfileId] , identifier[PermissionProfile] identifier[permissionProfile] operator[SEP] Keyword[throws] identifier[ApiException] {
Keyword[return] identifier[updatePermissionProfile] operator[SEP] identifier[accountId] , identifier[permissionProfileId] , identifier[permissionProfile] , Other[null] operator[SEP] operator[SEP]
}
|
@Override
public void execute(Runnable command) {
threadPoolController.resumeIfPaused();
threadPool.execute(createWrappedRunnable(command));
} | class class_name[name] begin[{]
method[execute, return_type[void], modifier[public], parameter[command]] begin[{]
call[threadPoolController.resumeIfPaused, parameter[]]
call[threadPool.execute, parameter[call[.createWrappedRunnable, parameter[member[.command]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[execute] operator[SEP] identifier[Runnable] identifier[command] operator[SEP] {
identifier[threadPoolController] operator[SEP] identifier[resumeIfPaused] operator[SEP] operator[SEP] operator[SEP] identifier[threadPool] operator[SEP] identifier[execute] operator[SEP] identifier[createWrappedRunnable] operator[SEP] identifier[command] operator[SEP] operator[SEP] operator[SEP]
}
|
private Collection<DetailInfo> getDetailInfosForPage(CmsResource containerPage) {
if (m_detailInfosByPage == null) {
m_detailInfosByPage = ArrayListMultimap.create();
for (DetailInfo detailInfo : m_detailInfos) {
m_detailInfosByPage.put(detailInfo.getDetailPageInfo().getUri(), detailInfo);
}
}
String folderPath = CmsResource.getParentFolder(containerPage.getRootPath());
Collection<DetailInfo> result = m_detailInfosByPage.get(containerPage.getRootPath());
if (result.isEmpty()) {
result = m_detailInfosByPage.get(folderPath);
}
return result;
} | class class_name[name] begin[{]
method[getDetailInfosForPage, return_type[type[Collection]], modifier[private], parameter[containerPage]] begin[{]
if[binary_operation[member[.m_detailInfosByPage], ==, literal[null]]] begin[{]
assign[member[.m_detailInfosByPage], call[ArrayListMultimap.create, parameter[]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDetailPageInfo, postfix_operators=[], prefix_operators=[], qualifier=detailInfo, selectors=[MethodInvocation(arguments=[], member=getUri, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=detailInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=m_detailInfosByPage, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=m_detailInfos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=detailInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DetailInfo, sub_type=None))), label=None)
else begin[{]
None
end[}]
local_variable[type[String], folderPath]
local_variable[type[Collection], result]
if[call[result.isEmpty, parameter[]]] begin[{]
assign[member[.result], call[m_detailInfosByPage.get, parameter[member[.folderPath]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[private] identifier[Collection] operator[<] identifier[DetailInfo] operator[>] identifier[getDetailInfosForPage] operator[SEP] identifier[CmsResource] identifier[containerPage] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_detailInfosByPage] operator[==] Other[null] operator[SEP] {
identifier[m_detailInfosByPage] operator[=] identifier[ArrayListMultimap] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[DetailInfo] identifier[detailInfo] operator[:] identifier[m_detailInfos] operator[SEP] {
identifier[m_detailInfosByPage] operator[SEP] identifier[put] operator[SEP] identifier[detailInfo] operator[SEP] identifier[getDetailPageInfo] operator[SEP] operator[SEP] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] , identifier[detailInfo] operator[SEP] operator[SEP]
}
}
identifier[String] identifier[folderPath] operator[=] identifier[CmsResource] operator[SEP] identifier[getParentFolder] operator[SEP] identifier[containerPage] operator[SEP] identifier[getRootPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[DetailInfo] operator[>] identifier[result] operator[=] identifier[m_detailInfosByPage] operator[SEP] identifier[get] operator[SEP] identifier[containerPage] operator[SEP] identifier[getRootPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[m_detailInfosByPage] operator[SEP] identifier[get] operator[SEP] identifier[folderPath] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public CPInstance fetchByC_LtD_S_Last(long CPDefinitionId,
Date displayDate, int status,
OrderByComparator<CPInstance> orderByComparator) {
int count = countByC_LtD_S(CPDefinitionId, displayDate, status);
if (count == 0) {
return null;
}
List<CPInstance> list = findByC_LtD_S(CPDefinitionId, displayDate,
status, count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} | class class_name[name] begin[{]
method[fetchByC_LtD_S_Last, return_type[type[CPInstance]], modifier[public], parameter[CPDefinitionId, displayDate, status, orderByComparator]] begin[{]
local_variable[type[int], count]
if[binary_operation[member[.count], ==, literal[0]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[List], list]
if[call[list.isEmpty, parameter[]]] begin[{]
return[call[list.get, parameter[literal[0]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CPInstance] identifier[fetchByC_LtD_S_Last] operator[SEP] Keyword[long] identifier[CPDefinitionId] , identifier[Date] identifier[displayDate] , Keyword[int] identifier[status] , identifier[OrderByComparator] operator[<] identifier[CPInstance] operator[>] identifier[orderByComparator] operator[SEP] {
Keyword[int] identifier[count] operator[=] identifier[countByC_LtD_S] operator[SEP] identifier[CPDefinitionId] , identifier[displayDate] , identifier[status] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[List] operator[<] identifier[CPInstance] operator[>] identifier[list] operator[=] identifier[findByC_LtD_S] operator[SEP] identifier[CPDefinitionId] , identifier[displayDate] , identifier[status] , identifier[count] operator[-] Other[1] , identifier[count] , identifier[orderByComparator] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[list] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[list] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public String getInternalTimeString(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return null;
}
if (length == 0) {
// binary send 00:00:00 as 0.
if (columnInfo.getDecimals() == 0) {
return "00:00:00";
} else {
StringBuilder value = new StringBuilder("00:00:00.");
int decimal = columnInfo.getDecimals();
while (decimal-- > 0) {
value.append("0");
}
return value.toString();
}
}
String rawValue = new String(buf, pos, length, StandardCharsets.UTF_8);
if ("0000-00-00".equals(rawValue)) {
return null;
}
int day = ((buf[pos + 1] & 0xff)
| ((buf[pos + 2] & 0xff) << 8)
| ((buf[pos + 3] & 0xff) << 16)
| ((buf[pos + 4] & 0xff) << 24));
int hour = buf[pos + 5];
int timeHour = hour + day * 24;
String hourString;
if (timeHour < 10) {
hourString = "0" + timeHour;
} else {
hourString = Integer.toString(timeHour);
}
String minuteString;
int minutes = buf[pos + 6];
if (minutes < 10) {
minuteString = "0" + minutes;
} else {
minuteString = Integer.toString(minutes);
}
String secondString;
int seconds = buf[pos + 7];
if (seconds < 10) {
secondString = "0" + seconds;
} else {
secondString = Integer.toString(seconds);
}
int microseconds = 0;
if (length > 8) {
microseconds = ((buf[pos + 8] & 0xff)
| (buf[pos + 9] & 0xff) << 8
| (buf[pos + 10] & 0xff) << 16
| (buf[pos + 11] & 0xff) << 24);
}
StringBuilder microsecondString = new StringBuilder(Integer.toString(microseconds));
while (microsecondString.length() < 6) {
microsecondString.insert(0, "0");
}
boolean negative = (buf[pos] == 0x01);
return (negative ? "-" : "") + (hourString + ":" + minuteString + ":" + secondString + "."
+ microsecondString);
} | class class_name[name] begin[{]
method[getInternalTimeString, return_type[type[String]], modifier[public], parameter[columnInfo]] begin[{]
if[call[.lastValueWasNull, parameter[]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.length], ==, literal[0]]] begin[{]
if[binary_operation[call[columnInfo.getDecimals, parameter[]], ==, literal[0]]] begin[{]
return[literal["00:00:00"]]
else begin[{]
local_variable[type[StringBuilder], value]
local_variable[type[int], decimal]
while[binary_operation[member[.decimal], >, literal[0]]] begin[{]
call[value.append, parameter[literal["0"]]]
end[}]
return[call[value.toString, parameter[]]]
end[}]
else begin[{]
None
end[}]
local_variable[type[String], rawValue]
if[literal["0000-00-00"]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], day]
local_variable[type[int], hour]
local_variable[type[int], timeHour]
local_variable[type[String], hourString]
if[binary_operation[member[.timeHour], <, literal[10]]] begin[{]
assign[member[.hourString], binary_operation[literal["0"], +, member[.timeHour]]]
else begin[{]
assign[member[.hourString], call[Integer.toString, parameter[member[.timeHour]]]]
end[}]
local_variable[type[String], minuteString]
local_variable[type[int], minutes]
if[binary_operation[member[.minutes], <, literal[10]]] begin[{]
assign[member[.minuteString], binary_operation[literal["0"], +, member[.minutes]]]
else begin[{]
assign[member[.minuteString], call[Integer.toString, parameter[member[.minutes]]]]
end[}]
local_variable[type[String], secondString]
local_variable[type[int], seconds]
if[binary_operation[member[.seconds], <, literal[10]]] begin[{]
assign[member[.secondString], binary_operation[literal["0"], +, member[.seconds]]]
else begin[{]
assign[member[.secondString], call[Integer.toString, parameter[member[.seconds]]]]
end[}]
local_variable[type[int], microseconds]
if[binary_operation[member[.length], >, literal[8]]] begin[{]
assign[member[.microseconds], binary_operation[binary_operation[binary_operation[binary_operation[member[.buf], &, literal[0xff]], |, binary_operation[binary_operation[member[.buf], &, literal[0xff]], <<, literal[8]]], |, binary_operation[binary_operation[member[.buf], &, literal[0xff]], <<, literal[16]]], |, binary_operation[binary_operation[member[.buf], &, literal[0xff]], <<, literal[24]]]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], microsecondString]
while[binary_operation[call[microsecondString.length, parameter[]], <, literal[6]]] begin[{]
call[microsecondString.insert, parameter[literal[0], literal["0"]]]
end[}]
local_variable[type[boolean], negative]
return[binary_operation[TernaryExpression(condition=MemberReference(member=negative, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-")), +, binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.hourString], +, literal[":"]], +, member[.minuteString]], +, literal[":"]], +, member[.secondString]], +, literal["."]], +, member[.microsecondString]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getInternalTimeString] operator[SEP] identifier[ColumnInformation] identifier[columnInfo] operator[SEP] {
Keyword[if] operator[SEP] identifier[lastValueWasNull] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[columnInfo] operator[SEP] identifier[getDecimals] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] {
identifier[StringBuilder] identifier[value] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[decimal] operator[=] identifier[columnInfo] operator[SEP] identifier[getDecimals] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[decimal] operator[--] operator[>] Other[0] operator[SEP] {
identifier[value] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[String] identifier[rawValue] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[buf] , identifier[pos] , identifier[length] , identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[rawValue] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[int] identifier[day] operator[=] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[1] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[|] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[2] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[8] operator[SEP] operator[|] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[3] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[16] operator[SEP] operator[|] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[4] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[24] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[hour] operator[=] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[5] operator[SEP] operator[SEP] Keyword[int] identifier[timeHour] operator[=] identifier[hour] operator[+] identifier[day] operator[*] Other[24] operator[SEP] identifier[String] identifier[hourString] operator[SEP] Keyword[if] operator[SEP] identifier[timeHour] operator[<] Other[10] operator[SEP] {
identifier[hourString] operator[=] literal[String] operator[+] identifier[timeHour] operator[SEP]
}
Keyword[else] {
identifier[hourString] operator[=] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[timeHour] operator[SEP] operator[SEP]
}
identifier[String] identifier[minuteString] operator[SEP] Keyword[int] identifier[minutes] operator[=] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[6] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[minutes] operator[<] Other[10] operator[SEP] {
identifier[minuteString] operator[=] literal[String] operator[+] identifier[minutes] operator[SEP]
}
Keyword[else] {
identifier[minuteString] operator[=] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[minutes] operator[SEP] operator[SEP]
}
identifier[String] identifier[secondString] operator[SEP] Keyword[int] identifier[seconds] operator[=] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[7] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[seconds] operator[<] Other[10] operator[SEP] {
identifier[secondString] operator[=] literal[String] operator[+] identifier[seconds] operator[SEP]
}
Keyword[else] {
identifier[secondString] operator[=] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[seconds] operator[SEP] operator[SEP]
}
Keyword[int] identifier[microseconds] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[length] operator[>] Other[8] operator[SEP] {
identifier[microseconds] operator[=] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[8] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[|] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[9] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[8] operator[|] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[10] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[16] operator[|] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[+] Other[11] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[24] operator[SEP] operator[SEP]
}
identifier[StringBuilder] identifier[microsecondString] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[microseconds] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[microsecondString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<] Other[6] operator[SEP] {
identifier[microsecondString] operator[SEP] identifier[insert] operator[SEP] Other[0] , literal[String] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[negative] operator[=] operator[SEP] identifier[buf] operator[SEP] identifier[pos] operator[SEP] operator[==] literal[Integer] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[negative] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[+] operator[SEP] identifier[hourString] operator[+] literal[String] operator[+] identifier[minuteString] operator[+] literal[String] operator[+] identifier[secondString] operator[+] literal[String] operator[+] identifier[microsecondString] operator[SEP] operator[SEP]
}
|
PreparedStatement getPreparedStatement(final SqlContext sqlContext) throws SQLException {
Connection conn = null;
if (sqlContext.getDbAlias() != null) {
conn = getConnection(sqlContext.getDbAlias());
} else {
conn = getConnection();
}
if (conn == null) {
throw new IllegalArgumentException(sqlContext.getDbAlias());
}
PreparedStatement stmt = null;
switch (sqlContext.getSqlKind()) {
case INSERT:
case BULK_INSERT:
case BATCH_INSERT:
if (sqlContext.hasGeneratedKeyColumns()) {
stmt = conn.prepareStatement(sqlContext.getExecutableSql(), sqlContext.getGeneratedKeyColumns());
} else {
stmt = conn.prepareStatement(sqlContext.getExecutableSql(), Statement.RETURN_GENERATED_KEYS);
}
break;
case SELECT:
stmt = conn.prepareStatement(sqlContext.getExecutableSql(),
sqlContext.getResultSetType(),
sqlContext.getResultSetConcurrency());
break;
default:
stmt = conn.prepareStatement(sqlContext.getExecutableSql());
break;
}
return sqlFilterManager.doPreparedStatement(sqlContext, stmt);
} | class class_name[name] begin[{]
method[getPreparedStatement, return_type[type[PreparedStatement]], modifier[default], parameter[sqlContext]] begin[{]
local_variable[type[Connection], conn]
if[binary_operation[call[sqlContext.getDbAlias, parameter[]], !=, literal[null]]] begin[{]
assign[member[.conn], call[.getConnection, parameter[call[sqlContext.getDbAlias, parameter[]]]]]
else begin[{]
assign[member[.conn], call[.getConnection, parameter[]]]
end[}]
if[binary_operation[member[.conn], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getDbAlias, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None)], 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[PreparedStatement], stmt]
SwitchStatement(cases=[SwitchStatementCase(case=['INSERT', 'BULK_INSERT', 'BATCH_INSERT'], statements=[IfStatement(condition=MethodInvocation(arguments=[], member=hasGeneratedKeyColumns, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getExecutableSql, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None), MemberReference(member=RETURN_GENERATED_KEYS, postfix_operators=[], prefix_operators=[], qualifier=Statement, selectors=[])], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getExecutableSql, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getGeneratedKeyColumns, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None)], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None)), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['SELECT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getExecutableSql, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getResultSetType, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getResultSetConcurrency, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None)], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getExecutableSql, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None)], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[], member=getSqlKind, postfix_operators=[], prefix_operators=[], qualifier=sqlContext, selectors=[], type_arguments=None), label=None)
return[call[sqlFilterManager.doPreparedStatement, parameter[member[.sqlContext], member[.stmt]]]]
end[}]
END[}] | identifier[PreparedStatement] identifier[getPreparedStatement] operator[SEP] Keyword[final] identifier[SqlContext] identifier[sqlContext] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[Connection] identifier[conn] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[sqlContext] operator[SEP] identifier[getDbAlias] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[conn] operator[=] identifier[getConnection] operator[SEP] identifier[sqlContext] operator[SEP] identifier[getDbAlias] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[conn] operator[=] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[conn] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[sqlContext] operator[SEP] identifier[getDbAlias] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[PreparedStatement] identifier[stmt] operator[=] Other[null] operator[SEP] Keyword[switch] operator[SEP] identifier[sqlContext] operator[SEP] identifier[getSqlKind] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[INSERT] operator[:] Keyword[case] identifier[BULK_INSERT] operator[:] Keyword[case] identifier[BATCH_INSERT] operator[:] Keyword[if] operator[SEP] identifier[sqlContext] operator[SEP] identifier[hasGeneratedKeyColumns] operator[SEP] operator[SEP] operator[SEP] {
identifier[stmt] operator[=] identifier[conn] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[sqlContext] operator[SEP] identifier[getExecutableSql] operator[SEP] operator[SEP] , identifier[sqlContext] operator[SEP] identifier[getGeneratedKeyColumns] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[stmt] operator[=] identifier[conn] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[sqlContext] operator[SEP] identifier[getExecutableSql] operator[SEP] operator[SEP] , identifier[Statement] operator[SEP] identifier[RETURN_GENERATED_KEYS] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[SELECT] operator[:] identifier[stmt] operator[=] identifier[conn] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[sqlContext] operator[SEP] identifier[getExecutableSql] operator[SEP] operator[SEP] , identifier[sqlContext] operator[SEP] identifier[getResultSetType] operator[SEP] operator[SEP] , identifier[sqlContext] operator[SEP] identifier[getResultSetConcurrency] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[stmt] operator[=] identifier[conn] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[sqlContext] operator[SEP] identifier[getExecutableSql] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[return] identifier[sqlFilterManager] operator[SEP] identifier[doPreparedStatement] operator[SEP] identifier[sqlContext] , identifier[stmt] operator[SEP] operator[SEP]
}
|
public static HttpHost getHost(HttpRequest request) {
HttpHost httpHost = UriUtils.extractHost(request.getRequestLine().getUri());
String scheme = httpHost.getSchemeName();
String host = httpHost.getHostName();
int port = httpHost.getPort();
Header[] headers = request.getHeaders(HttpHeaders.HOST);
if (headers != null && headers.length != 0) {
String headerValue = headers[0].getValue();
String[] splitted = headerValue.split(":");
host = splitted[0];
if (splitted.length > 1) {
port = Integer.parseInt(splitted[1]);
} else {
port = -1;
}
}
return new HttpHost(host, port, scheme);
} | class class_name[name] begin[{]
method[getHost, return_type[type[HttpHost]], modifier[public static], parameter[request]] begin[{]
local_variable[type[HttpHost], httpHost]
local_variable[type[String], scheme]
local_variable[type[String], host]
local_variable[type[int], port]
local_variable[type[Header], headers]
if[binary_operation[binary_operation[member[.headers], !=, literal[null]], &&, binary_operation[member[headers.length], !=, literal[0]]]] begin[{]
local_variable[type[String], headerValue]
local_variable[type[String], splitted]
assign[member[.host], member[.splitted]]
if[binary_operation[member[splitted.length], >, literal[1]]] begin[{]
assign[member[.port], call[Integer.parseInt, parameter[member[.splitted]]]]
else begin[{]
assign[member[.port], literal[1]]
end[}]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HttpHost, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[HttpHost] identifier[getHost] operator[SEP] identifier[HttpRequest] identifier[request] operator[SEP] {
identifier[HttpHost] identifier[httpHost] operator[=] identifier[UriUtils] operator[SEP] identifier[extractHost] operator[SEP] identifier[request] operator[SEP] identifier[getRequestLine] operator[SEP] operator[SEP] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[scheme] operator[=] identifier[httpHost] operator[SEP] identifier[getSchemeName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[host] operator[=] identifier[httpHost] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[port] operator[=] identifier[httpHost] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] identifier[Header] operator[SEP] operator[SEP] identifier[headers] operator[=] identifier[request] operator[SEP] identifier[getHeaders] operator[SEP] identifier[HttpHeaders] operator[SEP] identifier[HOST] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[headers] operator[!=] Other[null] operator[&&] identifier[headers] operator[SEP] identifier[length] operator[!=] Other[0] operator[SEP] {
identifier[String] identifier[headerValue] operator[=] identifier[headers] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[splitted] operator[=] identifier[headerValue] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[host] operator[=] identifier[splitted] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[splitted] operator[SEP] identifier[length] operator[>] Other[1] operator[SEP] {
identifier[port] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[splitted] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[port] operator[=] operator[-] Other[1] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[HttpHost] operator[SEP] identifier[host] , identifier[port] , identifier[scheme] operator[SEP] operator[SEP]
}
|
public void init() {
pocessorMap.clear();
//標準のフィールドプロセッサを登録する。
registerProcessor(XlsSheetName.class, new SheetNameProcessor());
registerProcessor(XlsCell.class, new CellProcessor());
registerProcessor(XlsLabelledCell.class, new LabelledCellProcessor());
registerProcessor(XlsHorizontalRecords.class, new HorizontalRecordsProcessor());
registerProcessor(XlsVerticalRecords.class, new VerticalRecordsProcessor());
registerProcessor(XlsIterateTables.class, new IterateTablesProcessor());
registerProcessor(XlsArrayCells.class, new ArrayCellsProcessor());
registerProcessor(XlsLabelledArrayCells.class, new LabelledArrayCellsProcessor());
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[]] begin[{]
call[pocessorMap.clear, parameter[]]
call[.registerProcessor, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XlsSheetName, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SheetNameProcessor, sub_type=None))]]
call[.registerProcessor, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XlsCell, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CellProcessor, sub_type=None))]]
call[.registerProcessor, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XlsLabelledCell, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LabelledCellProcessor, sub_type=None))]]
call[.registerProcessor, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XlsHorizontalRecords, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HorizontalRecordsProcessor, sub_type=None))]]
call[.registerProcessor, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XlsVerticalRecords, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VerticalRecordsProcessor, sub_type=None))]]
call[.registerProcessor, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XlsIterateTables, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IterateTablesProcessor, sub_type=None))]]
call[.registerProcessor, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XlsArrayCells, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArrayCellsProcessor, sub_type=None))]]
call[.registerProcessor, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XlsLabelledArrayCells, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LabelledArrayCellsProcessor, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[init] operator[SEP] operator[SEP] {
identifier[pocessorMap] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[registerProcessor] operator[SEP] identifier[XlsSheetName] operator[SEP] Keyword[class] , Keyword[new] identifier[SheetNameProcessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerProcessor] operator[SEP] identifier[XlsCell] operator[SEP] Keyword[class] , Keyword[new] identifier[CellProcessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerProcessor] operator[SEP] identifier[XlsLabelledCell] operator[SEP] Keyword[class] , Keyword[new] identifier[LabelledCellProcessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerProcessor] operator[SEP] identifier[XlsHorizontalRecords] operator[SEP] Keyword[class] , Keyword[new] identifier[HorizontalRecordsProcessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerProcessor] operator[SEP] identifier[XlsVerticalRecords] operator[SEP] Keyword[class] , Keyword[new] identifier[VerticalRecordsProcessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerProcessor] operator[SEP] identifier[XlsIterateTables] operator[SEP] Keyword[class] , Keyword[new] identifier[IterateTablesProcessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerProcessor] operator[SEP] identifier[XlsArrayCells] operator[SEP] Keyword[class] , Keyword[new] identifier[ArrayCellsProcessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerProcessor] operator[SEP] identifier[XlsLabelledArrayCells] operator[SEP] Keyword[class] , Keyword[new] identifier[LabelledArrayCellsProcessor] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public MessageBuffer<ChannelBuffer> getLoginBuffer(
InetSocketAddress localUDPAddress) throws Exception
{
ChannelBuffer loginBuffer;
ChannelBuffer credentials = NettyUtils.writeStrings(username, password,
connectionKey);
if (null != localUDPAddress)
{
ChannelBuffer udpAddressBuffer = NettyUtils
.writeSocketAddress(localUDPAddress);
loginBuffer = ChannelBuffers.wrappedBuffer(credentials,
udpAddressBuffer);
}
else
{
loginBuffer = credentials;
}
return new NettyMessageBuffer(loginBuffer);
} | class class_name[name] begin[{]
method[getLoginBuffer, return_type[type[MessageBuffer]], modifier[public], parameter[localUDPAddress]] begin[{]
local_variable[type[ChannelBuffer], loginBuffer]
local_variable[type[ChannelBuffer], credentials]
if[binary_operation[literal[null], !=, member[.localUDPAddress]]] begin[{]
local_variable[type[ChannelBuffer], udpAddressBuffer]
assign[member[.loginBuffer], call[ChannelBuffers.wrappedBuffer, parameter[member[.credentials], member[.udpAddressBuffer]]]]
else begin[{]
assign[member[.loginBuffer], member[.credentials]]
end[}]
return[ClassCreator(arguments=[MemberReference(member=loginBuffer, 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=NettyMessageBuffer, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[MessageBuffer] operator[<] identifier[ChannelBuffer] operator[>] identifier[getLoginBuffer] operator[SEP] identifier[InetSocketAddress] identifier[localUDPAddress] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[ChannelBuffer] identifier[loginBuffer] operator[SEP] identifier[ChannelBuffer] identifier[credentials] operator[=] identifier[NettyUtils] operator[SEP] identifier[writeStrings] operator[SEP] identifier[username] , identifier[password] , identifier[connectionKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[localUDPAddress] operator[SEP] {
identifier[ChannelBuffer] identifier[udpAddressBuffer] operator[=] identifier[NettyUtils] operator[SEP] identifier[writeSocketAddress] operator[SEP] identifier[localUDPAddress] operator[SEP] operator[SEP] identifier[loginBuffer] operator[=] identifier[ChannelBuffers] operator[SEP] identifier[wrappedBuffer] operator[SEP] identifier[credentials] , identifier[udpAddressBuffer] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[loginBuffer] operator[=] identifier[credentials] operator[SEP]
}
Keyword[return] Keyword[new] identifier[NettyMessageBuffer] operator[SEP] identifier[loginBuffer] operator[SEP] operator[SEP]
}
|
public static int getAvailablePort() {
for (int i = 0; i < 50; i++) {
try (ServerSocket serverSocket = new ServerSocket(0)) {
int port = serverSocket.getLocalPort();
if (port != 0) {
return port;
}
}
catch (IOException ignored) {}
}
throw new RuntimeException("Could not find a free permitted port on the machine.");
} | class class_name[name] begin[{]
method[getAvailablePort, return_type[type[int]], modifier[public static], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getLocalPort, postfix_operators=[], prefix_operators=[], qualifier=serverSocket, selectors=[], type_arguments=None), name=port)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=port, 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=MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignored, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=serverSocket, type=ReferenceType(arguments=None, dimensions=[], name=ServerSocket, sub_type=None), value=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServerSocket, sub_type=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=50), 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)
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not find a free permitted port on the machine.")], 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)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[getAvailablePort] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Other[50] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[try] operator[SEP] identifier[ServerSocket] identifier[serverSocket] operator[=] Keyword[new] identifier[ServerSocket] operator[SEP] Other[0] operator[SEP] operator[SEP] {
Keyword[int] identifier[port] operator[=] identifier[serverSocket] operator[SEP] identifier[getLocalPort] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[port] operator[!=] Other[0] operator[SEP] {
Keyword[return] identifier[port] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ignored] operator[SEP] {
}
}
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public LocaleEncodingMappingListType<WebFragmentType<T>> getOrCreateLocaleEncodingMappingList()
{
List<Node> nodeList = childNode.get("locale-encoding-mapping-list");
if (nodeList != null && nodeList.size() > 0)
{
return new LocaleEncodingMappingListTypeImpl<WebFragmentType<T>>(this, "locale-encoding-mapping-list", childNode, nodeList.get(0));
}
return createLocaleEncodingMappingList();
} | class class_name[name] begin[{]
method[getOrCreateLocaleEncodingMappingList, return_type[type[LocaleEncodingMappingListType]], modifier[public], parameter[]] begin[{]
local_variable[type[List], nodeList]
if[binary_operation[binary_operation[member[.nodeList], !=, literal[null]], &&, binary_operation[call[nodeList.size, parameter[]], >, literal[0]]]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="locale-encoding-mapping-list"), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=nodeList, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=WebFragmentType, sub_type=None))], dimensions=None, name=LocaleEncodingMappingListTypeImpl, sub_type=None))]
else begin[{]
None
end[}]
return[call[.createLocaleEncodingMappingList, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[LocaleEncodingMappingListType] operator[<] identifier[WebFragmentType] operator[<] identifier[T] operator[>] operator[>] identifier[getOrCreateLocaleEncodingMappingList] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodeList] operator[!=] Other[null] operator[&&] identifier[nodeList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[LocaleEncodingMappingListTypeImpl] operator[<] identifier[WebFragmentType] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[nodeList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createLocaleEncodingMappingList] operator[SEP] operator[SEP] operator[SEP]
}
|
private void mute(AddOnModel model) {
IdentificationManager.getInstance()
.getIdentification(this)
.map(id -> new EventMinimalImpl(SoundIDs.MuteEvent.type, id, SoundIDs.MuteEvent.descriptors))
.map(eventMinimal -> eventMinimal.addResource(
new ResourceMinimalImpl<>(SoundIDs.MuteEvent.resourceSelector, eventMinimal.getSource(), model, null)))
.ifPresent(event -> getMain().getEventDistributor().fireEventConcurrently(event));
} | class class_name[name] begin[{]
method[mute, return_type[void], modifier[private], parameter[model]] begin[{]
call[IdentificationManager.getInstance, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[mute] operator[SEP] identifier[AddOnModel] identifier[model] operator[SEP] {
identifier[IdentificationManager] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getIdentification] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[id] operator[->] Keyword[new] identifier[EventMinimalImpl] operator[SEP] identifier[SoundIDs] operator[SEP] identifier[MuteEvent] operator[SEP] identifier[type] , identifier[id] , identifier[SoundIDs] operator[SEP] identifier[MuteEvent] operator[SEP] identifier[descriptors] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[eventMinimal] operator[->] identifier[eventMinimal] operator[SEP] identifier[addResource] operator[SEP] Keyword[new] identifier[ResourceMinimalImpl] operator[<] operator[>] operator[SEP] identifier[SoundIDs] operator[SEP] identifier[MuteEvent] operator[SEP] identifier[resourceSelector] , identifier[eventMinimal] operator[SEP] identifier[getSource] operator[SEP] operator[SEP] , identifier[model] , Other[null] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ifPresent] operator[SEP] identifier[event] operator[->] identifier[getMain] operator[SEP] operator[SEP] operator[SEP] identifier[getEventDistributor] operator[SEP] operator[SEP] operator[SEP] identifier[fireEventConcurrently] operator[SEP] identifier[event] operator[SEP] operator[SEP] operator[SEP]
}
|
public StreamPlan transferRanges(InetAddress to, String keyspace, Collection<Range<Token>> ranges, String... columnFamilies)
{
return transferRanges(to, to, keyspace, ranges, columnFamilies);
} | class class_name[name] begin[{]
method[transferRanges, return_type[type[StreamPlan]], modifier[public], parameter[to, keyspace, ranges, columnFamilies]] begin[{]
return[call[.transferRanges, parameter[member[.to], member[.to], member[.keyspace], member[.ranges], member[.columnFamilies]]]]
end[}]
END[}] | Keyword[public] identifier[StreamPlan] identifier[transferRanges] operator[SEP] identifier[InetAddress] identifier[to] , identifier[String] identifier[keyspace] , identifier[Collection] operator[<] identifier[Range] operator[<] identifier[Token] operator[>] operator[>] identifier[ranges] , identifier[String] operator[...] identifier[columnFamilies] operator[SEP] {
Keyword[return] identifier[transferRanges] operator[SEP] identifier[to] , identifier[to] , identifier[keyspace] , identifier[ranges] , identifier[columnFamilies] operator[SEP] operator[SEP]
}
|
public static Date str2DateUnmatch2Null(String strDate) {
Date date;
try {
date = str2Date(strDate);
} catch (Exception e) {
throw new TimeMatchFormatException("[" + strDate + "] date auto parse exception", e);
}
return date;
} | class class_name[name] begin[{]
method[str2DateUnmatch2Null, return_type[type[Date]], modifier[public static], parameter[strDate]] begin[{]
local_variable[type[Date], date]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=strDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=str2Date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="["), operandr=MemberReference(member=strDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] date auto parse exception"), 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=TimeMatchFormatException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.date]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Date] identifier[str2DateUnmatch2Null] operator[SEP] identifier[String] identifier[strDate] operator[SEP] {
identifier[Date] identifier[date] operator[SEP] Keyword[try] {
identifier[date] operator[=] identifier[str2Date] operator[SEP] identifier[strDate] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TimeMatchFormatException] operator[SEP] literal[String] operator[+] identifier[strDate] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[date] operator[SEP]
}
|
public static void createMarkers(final IJavaProject javaProject, final SortedBugCollection theCollection, final ISchedulingRule rule, IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return;
}
final List<MarkerParameter> bugParameters = createBugParameters(javaProject, theCollection, monitor);
if (monitor.isCanceled()) {
return;
}
WorkspaceJob wsJob = new WorkspaceJob("Creating SpotBugs markers") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor1) throws CoreException {
IProject project = javaProject.getProject();
try {
new MarkerReporter(bugParameters, theCollection, project).run(monitor1);
} catch (CoreException e) {
FindbugsPlugin.getDefault().logException(e, "Core exception on add marker");
return e.getStatus();
}
return monitor1.isCanceled()? Status.CANCEL_STATUS : Status.OK_STATUS;
}
};
wsJob.setRule(rule);
wsJob.setSystem(true);
wsJob.setUser(false);
wsJob.schedule();
} | class class_name[name] begin[{]
method[createMarkers, return_type[void], modifier[public static], parameter[javaProject, theCollection, rule, monitor]] begin[{]
if[call[monitor.isCanceled, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[List], bugParameters]
if[call[monitor.isCanceled, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[WorkspaceJob], wsJob]
call[wsJob.setRule, parameter[member[.rule]]]
call[wsJob.setSystem, parameter[literal[true]]]
call[wsJob.setUser, parameter[literal[false]]]
call[wsJob.schedule, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[createMarkers] operator[SEP] Keyword[final] identifier[IJavaProject] identifier[javaProject] , Keyword[final] identifier[SortedBugCollection] identifier[theCollection] , Keyword[final] identifier[ISchedulingRule] identifier[rule] , identifier[IProgressMonitor] identifier[monitor] operator[SEP] {
Keyword[if] operator[SEP] identifier[monitor] operator[SEP] identifier[isCanceled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[MarkerParameter] operator[>] identifier[bugParameters] operator[=] identifier[createBugParameters] operator[SEP] identifier[javaProject] , identifier[theCollection] , identifier[monitor] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[monitor] operator[SEP] identifier[isCanceled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[WorkspaceJob] identifier[wsJob] operator[=] Keyword[new] identifier[WorkspaceJob] operator[SEP] literal[String] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[IStatus] identifier[runInWorkspace] operator[SEP] identifier[IProgressMonitor] identifier[monitor1] operator[SEP] Keyword[throws] identifier[CoreException] {
identifier[IProject] identifier[project] operator[=] identifier[javaProject] operator[SEP] identifier[getProject] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[new] identifier[MarkerReporter] operator[SEP] identifier[bugParameters] , identifier[theCollection] , identifier[project] operator[SEP] operator[SEP] identifier[run] operator[SEP] identifier[monitor1] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CoreException] identifier[e] operator[SEP] {
identifier[FindbugsPlugin] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] identifier[logException] operator[SEP] identifier[e] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[monitor1] operator[SEP] identifier[isCanceled] operator[SEP] operator[SEP] operator[?] identifier[Status] operator[SEP] identifier[CANCEL_STATUS] operator[:] identifier[Status] operator[SEP] identifier[OK_STATUS] operator[SEP]
}
} operator[SEP] identifier[wsJob] operator[SEP] identifier[setRule] operator[SEP] identifier[rule] operator[SEP] operator[SEP] identifier[wsJob] operator[SEP] identifier[setSystem] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[wsJob] operator[SEP] identifier[setUser] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[wsJob] operator[SEP] identifier[schedule] operator[SEP] operator[SEP] operator[SEP]
}
|
public HalConfiguration withRenderSingleLinksFor(LinkRelation relation, RenderSingleLinks renderSingleLinks) {
Assert.notNull(relation, "Link relation must not be null!");
Assert.notNull(renderSingleLinks, "RenderSingleLinks must not be null!");
return withRenderSingleLinksFor(relation.value(), renderSingleLinks);
} | class class_name[name] begin[{]
method[withRenderSingleLinksFor, return_type[type[HalConfiguration]], modifier[public], parameter[relation, renderSingleLinks]] begin[{]
call[Assert.notNull, parameter[member[.relation], literal["Link relation must not be null!"]]]
call[Assert.notNull, parameter[member[.renderSingleLinks], literal["RenderSingleLinks must not be null!"]]]
return[call[.withRenderSingleLinksFor, parameter[call[relation.value, parameter[]], member[.renderSingleLinks]]]]
end[}]
END[}] | Keyword[public] identifier[HalConfiguration] identifier[withRenderSingleLinksFor] operator[SEP] identifier[LinkRelation] identifier[relation] , identifier[RenderSingleLinks] identifier[renderSingleLinks] operator[SEP] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[relation] , literal[String] operator[SEP] operator[SEP] identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[renderSingleLinks] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[withRenderSingleLinksFor] operator[SEP] identifier[relation] operator[SEP] identifier[value] operator[SEP] operator[SEP] , identifier[renderSingleLinks] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
protected void setParameters(PreparedStatement stmt, Object[] params) throws SQLException {
for (int i = 0; i < params.length; i++) {
if(params[i] == null){
stmt.setObject(i + 1, null);
} else {
Class<?> propertType = params[i].getClass();
@SuppressWarnings("rawtypes")
ValueType valueType = MirageUtil.getValueType(propertType, null, dialect, valueTypes);
if(valueType != null){
valueType.set(propertType, stmt, params[i], i + 1);
} else {
if(logger.isWarnEnabled()) {
logger.warn("valueType for " + propertType.getName() + " not found.");
}
}
}
}
} | class class_name[name] begin[{]
method[setParameters, return_type[void], modifier[protected], parameter[stmt, params]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=propertType)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), LocalVariableDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="rawtypes"), name=SuppressWarnings)], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=propertType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=dialect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=valueTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getValueType, postfix_operators=[], prefix_operators=[], qualifier=MirageUtil, selectors=[], type_arguments=None), name=valueType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ValueType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=valueType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isWarnEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="valueType for "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=propertType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" not found."), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=propertType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=set, postfix_operators=[], prefix_operators=[], qualifier=valueType, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=setObject, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] Keyword[void] identifier[setParameters] operator[SEP] identifier[PreparedStatement] identifier[stmt] , identifier[Object] operator[SEP] operator[SEP] identifier[params] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[params] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[params] operator[SEP] identifier[i] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[stmt] operator[SEP] identifier[setObject] operator[SEP] identifier[i] operator[+] Other[1] , Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Class] operator[<] operator[?] operator[>] identifier[propertType] operator[=] identifier[params] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[ValueType] identifier[valueType] operator[=] identifier[MirageUtil] operator[SEP] identifier[getValueType] operator[SEP] identifier[propertType] , Other[null] , identifier[dialect] , identifier[valueTypes] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[valueType] operator[!=] Other[null] operator[SEP] {
identifier[valueType] operator[SEP] identifier[set] operator[SEP] identifier[propertType] , identifier[stmt] , identifier[params] operator[SEP] identifier[i] operator[SEP] , identifier[i] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isWarnEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[propertType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
}
}
|
protected Object newInstance(Constructor constructor, Object[] parameters) throws InstantiationException, IllegalAccessException,
InvocationTargetException {
if (allowNonPublicClasses) {
constructor.setAccessible(true);
}
return constructor.newInstance(parameters);
} | class class_name[name] begin[{]
method[newInstance, return_type[type[Object]], modifier[protected], parameter[constructor, parameters]] begin[{]
if[member[.allowNonPublicClasses]] begin[{]
call[constructor.setAccessible, parameter[literal[true]]]
else begin[{]
None
end[}]
return[call[constructor.newInstance, parameter[member[.parameters]]]]
end[}]
END[}] | Keyword[protected] identifier[Object] identifier[newInstance] operator[SEP] identifier[Constructor] identifier[constructor] , identifier[Object] operator[SEP] operator[SEP] identifier[parameters] operator[SEP] Keyword[throws] identifier[InstantiationException] , identifier[IllegalAccessException] , identifier[InvocationTargetException] {
Keyword[if] operator[SEP] identifier[allowNonPublicClasses] operator[SEP] {
identifier[constructor] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] identifier[constructor] operator[SEP] identifier[newInstance] operator[SEP] identifier[parameters] operator[SEP] operator[SEP]
}
|
@Override
public void validateUpdate(final ResourcePool newPool) {
super.validateUpdate(newPool);
SizedResourcePool sizedPool = (SizedResourcePool)newPool;
// Ensure unit type has not changed
if (!this.getUnit().getClass().equals(sizedPool.getUnit().getClass())) {
throw new IllegalArgumentException("ResourcePool for " + sizedPool.getType() + " with ResourceUnit '"
+ sizedPool.getUnit() + "' can not replace '" + this.getUnit() + "'");
}
// Ensure replacement has positive space
if (sizedPool.getSize() <= 0) {
throw new IllegalArgumentException("ResourcePool for " + sizedPool.getType()
+ " must specify space greater than 0");
}
} | class class_name[name] begin[{]
method[validateUpdate, return_type[void], modifier[public], parameter[newPool]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=newPool, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=validateUpdate, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[SizedResourcePool], sizedPool]
if[THIS[call[None.getUnit, parameter[]]call[None.getClass, parameter[]]call[None.equals, parameter[call[sizedPool.getUnit, parameter[]]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ResourcePool for "), operandr=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=sizedPool, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" with ResourceUnit '"), operator=+), operandr=MethodInvocation(arguments=[], member=getUnit, postfix_operators=[], prefix_operators=[], qualifier=sizedPool, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' can not replace '"), operator=+), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getUnit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[call[sizedPool.getSize, parameter[]], <=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ResourcePool for "), operandr=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=sizedPool, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" must specify space greater than 0"), 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[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[validateUpdate] operator[SEP] Keyword[final] identifier[ResourcePool] identifier[newPool] operator[SEP] {
Keyword[super] operator[SEP] identifier[validateUpdate] operator[SEP] identifier[newPool] operator[SEP] operator[SEP] identifier[SizedResourcePool] identifier[sizedPool] operator[=] operator[SEP] identifier[SizedResourcePool] operator[SEP] identifier[newPool] operator[SEP] Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[sizedPool] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[sizedPool] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[sizedPool] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[sizedPool] operator[SEP] identifier[getSize] operator[SEP] operator[SEP] operator[<=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[sizedPool] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public void reset() {
this.getElement().clear();
Grid.driver().findElement(By.tagName("body")).click();
this.calendar = Calendar.getInstance();
this.getElement().click();
} | class class_name[name] begin[{]
method[reset, return_type[void], modifier[public], parameter[]] begin[{]
THIS[call[None.getElement, parameter[]]call[None.clear, parameter[]]]
call[Grid.driver, parameter[]]
assign[THIS[member[None.calendar]], call[Calendar.getInstance, parameter[]]]
THIS[call[None.getElement, parameter[]]call[None.click, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[reset] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[Grid] operator[SEP] identifier[driver] operator[SEP] operator[SEP] operator[SEP] identifier[findElement] operator[SEP] identifier[By] operator[SEP] identifier[tagName] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[click] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[calendar] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] operator[SEP] identifier[click] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String decode(String encoded_string)
throws InvalidPasswordDecodingException, UnsupportedCryptoAlgorithmException {
/*
* check input:
*
* -- encoded_string: any string, any length, cannot be null,
* must start with valid (supported) crypto algorithm tag
*/
if (encoded_string == null) {
// don't accept null password
throw new InvalidPasswordDecodingException();
}
String crypto_algorithm = getCryptoAlgorithm(encoded_string);
if (crypto_algorithm == null) {
// don't accept decoded password
throw new InvalidPasswordDecodingException();
}
// valid input ... decode password
logger.logp(Level.FINEST, PasswordUtil.class.getName(), "decode", "before invoking decode_password : crypto_algorithm : " + crypto_algorithm + "\nencoded_string : "
+ encoded_string);
String decoded_string = decode_password(removeCryptoAlgorithmTag(encoded_string), crypto_algorithm);
if (decoded_string == null) {
// In order to log the error information when "custom" encryption is invoked prior to the service is activated,
// this error check was moved to here.
if (!isValidCryptoAlgorithm(crypto_algorithm)) {
// don't accept unsupported crypto algorithm
throw new UnsupportedCryptoAlgorithmException();
} else {
throw new InvalidPasswordDecodingException();
}
}
return decoded_string;
} | class class_name[name] begin[{]
method[decode, return_type[type[String]], modifier[public static], parameter[encoded_string]] begin[{]
if[binary_operation[member[.encoded_string], ==, literal[null]]] 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=InvalidPasswordDecodingException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], crypto_algorithm]
if[binary_operation[member[.crypto_algorithm], ==, literal[null]]] 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=InvalidPasswordDecodingException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[logger.logp, parameter[member[Level.FINEST], 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=PasswordUtil, sub_type=None)), literal["decode"], binary_operation[binary_operation[binary_operation[literal["before invoking decode_password : crypto_algorithm : "], +, member[.crypto_algorithm]], +, literal["\nencoded_string : "]], +, member[.encoded_string]]]]
local_variable[type[String], decoded_string]
if[binary_operation[member[.decoded_string], ==, literal[null]]] begin[{]
if[call[.isValidCryptoAlgorithm, parameter[member[.crypto_algorithm]]]] 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=UnsupportedCryptoAlgorithmException, sub_type=None)), label=None)
else 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=InvalidPasswordDecodingException, sub_type=None)), label=None)
end[}]
else begin[{]
None
end[}]
return[member[.decoded_string]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[decode] operator[SEP] identifier[String] identifier[encoded_string] operator[SEP] Keyword[throws] identifier[InvalidPasswordDecodingException] , identifier[UnsupportedCryptoAlgorithmException] {
Keyword[if] operator[SEP] identifier[encoded_string] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidPasswordDecodingException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[crypto_algorithm] operator[=] identifier[getCryptoAlgorithm] operator[SEP] identifier[encoded_string] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[crypto_algorithm] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidPasswordDecodingException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINEST] , identifier[PasswordUtil] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , literal[String] , literal[String] operator[+] identifier[crypto_algorithm] operator[+] literal[String] operator[+] identifier[encoded_string] operator[SEP] operator[SEP] identifier[String] identifier[decoded_string] operator[=] identifier[decode_password] operator[SEP] identifier[removeCryptoAlgorithmTag] operator[SEP] identifier[encoded_string] operator[SEP] , identifier[crypto_algorithm] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[decoded_string] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isValidCryptoAlgorithm] operator[SEP] identifier[crypto_algorithm] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedCryptoAlgorithmException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[InvalidPasswordDecodingException] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[decoded_string] operator[SEP]
}
|
@Nullable
public static Type evaluateJavaLangType(@Nonnull final String name) {
Check.notEmpty(name, "name");
Type ret = null;
for (final Type type : JAVA_LANG_VALUE_TYPES) {
if (type.getName().equals(name.replace("java.lang.", ""))) {
ret = type;
break;
}
}
return ret;
} | class class_name[name] begin[{]
method[evaluateJavaLangType, return_type[type[Type]], modifier[public static], parameter[name]] begin[{]
call[Check.notEmpty, parameter[member[.name], literal["name"]]]
local_variable[type[Type], ret]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.lang."), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=replace, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None)], 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=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=JAVA_LANG_VALUE_TYPES, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=type)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Type, sub_type=None))), label=None)
return[member[.ret]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[Type] identifier[evaluateJavaLangType] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[String] identifier[name] operator[SEP] {
identifier[Check] operator[SEP] identifier[notEmpty] operator[SEP] identifier[name] , literal[String] operator[SEP] operator[SEP] identifier[Type] identifier[ret] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Type] identifier[type] operator[:] identifier[JAVA_LANG_VALUE_TYPES] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[ret] operator[=] identifier[type] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[ret] operator[SEP]
}
|
@Override
public GetTagKeysResult getTagKeys(GetTagKeysRequest request) {
request = beforeClientExecution(request);
return executeGetTagKeys(request);
} | class class_name[name] begin[{]
method[getTagKeys, return_type[type[GetTagKeysResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeGetTagKeys, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[GetTagKeysResult] identifier[getTagKeys] operator[SEP] identifier[GetTagKeysRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeGetTagKeys] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static ApiRoom getRoomAgent(Room sfsRoom) {
Object roomAgent = sfsRoom.getProperty(APIKey.ROOM);
if(roomAgent == null)
throw new RuntimeException("Can not get user agent");
return (ApiRoom)roomAgent;
} | class class_name[name] begin[{]
method[getRoomAgent, return_type[type[ApiRoom]], modifier[public static], parameter[sfsRoom]] begin[{]
local_variable[type[Object], roomAgent]
if[binary_operation[member[.roomAgent], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Can not get user agent")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[Cast(expression=MemberReference(member=roomAgent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ApiRoom, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ApiRoom] identifier[getRoomAgent] operator[SEP] identifier[Room] identifier[sfsRoom] operator[SEP] {
identifier[Object] identifier[roomAgent] operator[=] identifier[sfsRoom] operator[SEP] identifier[getProperty] operator[SEP] identifier[APIKey] operator[SEP] identifier[ROOM] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[roomAgent] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[ApiRoom] operator[SEP] identifier[roomAgent] operator[SEP]
}
|
void pathsToAttempt(Multimap<Path, String> sink, Location location) {
Path base = fileSystem.getPath(location.getBase());
String path = location.getPath();
while (!path.isEmpty()) {
String parent = path.substring(0, path.lastIndexOf('/', path.length() - 2) + 1);
String profilePath = parent + name + ".wire";
sink.put(base, profilePath);
path = parent;
}
} | class class_name[name] begin[{]
method[pathsToAttempt, return_type[void], modifier[default], parameter[sink, location]] begin[{]
local_variable[type[Path], base]
local_variable[type[String], path]
while[call[path.isEmpty, parameter[]]] begin[{]
local_variable[type[String], parent]
local_variable[type[String], profilePath]
call[sink.put, parameter[member[.base], member[.profilePath]]]
assign[member[.path], member[.parent]]
end[}]
end[}]
END[}] | Keyword[void] identifier[pathsToAttempt] operator[SEP] identifier[Multimap] operator[<] identifier[Path] , identifier[String] operator[>] identifier[sink] , identifier[Location] identifier[location] operator[SEP] {
identifier[Path] identifier[base] operator[=] identifier[fileSystem] operator[SEP] identifier[getPath] operator[SEP] identifier[location] operator[SEP] identifier[getBase] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[path] operator[=] identifier[location] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[path] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[parent] operator[=] identifier[path] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[path] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] , identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] identifier[String] identifier[profilePath] operator[=] identifier[parent] operator[+] identifier[name] operator[+] literal[String] operator[SEP] identifier[sink] operator[SEP] identifier[put] operator[SEP] identifier[base] , identifier[profilePath] operator[SEP] operator[SEP] identifier[path] operator[=] identifier[parent] operator[SEP]
}
}
|
public static Map<String,byte[]> collectLogs( String karafData ) throws IOException {
Map<String,byte[]> logFiles = new HashMap<>( 2 );
if( ! Utils.isEmptyOrWhitespaces( karafData )) {
String[] names = { "karaf.log", "roboconf.log" };
for( String name : names ) {
File log = new File( karafData, AgentConstants.KARAF_LOGS_DIRECTORY + "/" + name );
if( ! log.exists())
continue;
String content = Utils.readFileContent( log );
logFiles.put( name, content.getBytes( StandardCharsets.UTF_8 ));
}
}
return logFiles;
} | class class_name[name] begin[{]
method[collectLogs, return_type[type[Map]], modifier[public static], parameter[karafData]] begin[{]
local_variable[type[Map], logFiles]
if[call[Utils.isEmptyOrWhitespaces, parameter[member[.karafData]]]] begin[{]
local_variable[type[String], names]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=karafData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=KARAF_LOGS_DIRECTORY, postfix_operators=[], prefix_operators=[], qualifier=AgentConstants, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=log)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=['!'], qualifier=log, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readFileContent, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), name=content)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=StandardCharsets, selectors=[])], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=logFiles, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=names, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.logFiles]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[collectLogs] operator[SEP] identifier[String] identifier[karafData] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Map] operator[<] identifier[String] , Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[logFiles] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Utils] operator[SEP] identifier[isEmptyOrWhitespaces] operator[SEP] identifier[karafData] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[names] operator[=] {
literal[String] , literal[String]
} operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[name] operator[:] identifier[names] operator[SEP] {
identifier[File] identifier[log] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[karafData] , identifier[AgentConstants] operator[SEP] identifier[KARAF_LOGS_DIRECTORY] operator[+] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[log] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] identifier[String] identifier[content] operator[=] identifier[Utils] operator[SEP] identifier[readFileContent] operator[SEP] identifier[log] operator[SEP] operator[SEP] identifier[logFiles] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[content] operator[SEP] identifier[getBytes] operator[SEP] identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[logFiles] operator[SEP]
}
|
public java.util.List<String> getNodeGroupsToRetain() {
if (nodeGroupsToRetain == null) {
nodeGroupsToRetain = new com.amazonaws.internal.SdkInternalList<String>();
}
return nodeGroupsToRetain;
} | class class_name[name] begin[{]
method[getNodeGroupsToRetain, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.nodeGroupsToRetain], ==, literal[null]]] begin[{]
assign[member[.nodeGroupsToRetain], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.nodeGroupsToRetain]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[getNodeGroupsToRetain] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[nodeGroupsToRetain] operator[==] Other[null] operator[SEP] {
identifier[nodeGroupsToRetain] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[nodeGroupsToRetain] operator[SEP]
}
|
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
// Write out element count, and any hidden stuff
s.defaultWriteObject();
// Write out array length, for compatibility with 1.5 version
s.writeInt(Math.max(2, size + 1));
// Write out all elements in the "proper order".
for (int i = 0; i < size; i++)
s.writeObject(queue[i]);
} | class class_name[name] begin[{]
method[writeObject, return_type[void], modifier[private], parameter[s]] begin[{]
call[s.defaultWriteObject, parameter[]]
call[s.writeInt, parameter[call[Math.max, parameter[literal[2], binary_operation[member[.size], +, literal[1]]]]]]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=queue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[writeObject] operator[SEP] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[ObjectOutputStream] identifier[s] operator[SEP] Keyword[throws] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[IOException] {
identifier[s] operator[SEP] identifier[defaultWriteObject] operator[SEP] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[writeInt] operator[SEP] identifier[Math] operator[SEP] identifier[max] operator[SEP] Other[2] , identifier[size] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[size] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[s] operator[SEP] identifier[writeObject] operator[SEP] identifier[queue] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void exit(TraceComponent tc, String methodName) {
if(isTracing()) SibTr.exit(tc, methodName);
} | class class_name[name] begin[{]
method[exit, return_type[void], modifier[public static], parameter[tc, methodName]] begin[{]
if[call[.isTracing, parameter[]]] begin[{]
call[SibTr.exit, parameter[member[.tc], member[.methodName]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[exit] operator[SEP] identifier[TraceComponent] identifier[tc] , identifier[String] identifier[methodName] operator[SEP] {
Keyword[if] operator[SEP] identifier[isTracing] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , identifier[methodName] operator[SEP] operator[SEP]
}
|
protected MethodSecurityExpressionOperations createSecurityExpressionRoot(
Authentication authentication, MethodInvocation invocation) {
MethodSecurityExpressionRoot root = new MethodSecurityExpressionRoot(
authentication);
root.setThis(invocation.getThis());
root.setPermissionEvaluator(getPermissionEvaluator());
root.setTrustResolver(getTrustResolver());
root.setRoleHierarchy(getRoleHierarchy());
root.setDefaultRolePrefix(getDefaultRolePrefix());
return root;
} | class class_name[name] begin[{]
method[createSecurityExpressionRoot, return_type[type[MethodSecurityExpressionOperations]], modifier[protected], parameter[authentication, invocation]] begin[{]
local_variable[type[MethodSecurityExpressionRoot], root]
call[root.setThis, parameter[call[invocation.getThis, parameter[]]]]
call[root.setPermissionEvaluator, parameter[call[.getPermissionEvaluator, parameter[]]]]
call[root.setTrustResolver, parameter[call[.getTrustResolver, parameter[]]]]
call[root.setRoleHierarchy, parameter[call[.getRoleHierarchy, parameter[]]]]
call[root.setDefaultRolePrefix, parameter[call[.getDefaultRolePrefix, parameter[]]]]
return[member[.root]]
end[}]
END[}] | Keyword[protected] identifier[MethodSecurityExpressionOperations] identifier[createSecurityExpressionRoot] operator[SEP] identifier[Authentication] identifier[authentication] , identifier[MethodInvocation] identifier[invocation] operator[SEP] {
identifier[MethodSecurityExpressionRoot] identifier[root] operator[=] Keyword[new] identifier[MethodSecurityExpressionRoot] operator[SEP] identifier[authentication] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[setThis] operator[SEP] identifier[invocation] operator[SEP] identifier[getThis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[setPermissionEvaluator] operator[SEP] identifier[getPermissionEvaluator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[setTrustResolver] operator[SEP] identifier[getTrustResolver] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[setRoleHierarchy] operator[SEP] identifier[getRoleHierarchy] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[root] operator[SEP] identifier[setDefaultRolePrefix] operator[SEP] identifier[getDefaultRolePrefix] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[root] operator[SEP]
}
|
@EnsuresNonNull("predicateFactory")
private JavaScriptPredicateFactory getPredicateFactory()
{
// JavaScript configuration should be checked when it's actually used because someone might still want Druid
// nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled.
Preconditions.checkState(config.isEnabled(), "JavaScript is disabled");
JavaScriptPredicateFactory syncedFnPredicateFactory = predicateFactory;
if (syncedFnPredicateFactory == null) {
synchronized (config) {
syncedFnPredicateFactory = predicateFactory;
if (syncedFnPredicateFactory == null) {
syncedFnPredicateFactory = new JavaScriptPredicateFactory(function, extractionFn);
predicateFactory = syncedFnPredicateFactory;
}
}
}
return syncedFnPredicateFactory;
} | class class_name[name] begin[{]
method[getPredicateFactory, return_type[type[JavaScriptPredicateFactory]], modifier[private], parameter[]] begin[{]
call[Preconditions.checkState, parameter[call[config.isEnabled, parameter[]], literal["JavaScript is disabled"]]]
local_variable[type[JavaScriptPredicateFactory], syncedFnPredicateFactory]
if[binary_operation[member[.syncedFnPredicateFactory], ==, literal[null]]] begin[{]
SYNCHRONIZED[member[.config]] BEGIN[{]
assign[member[.syncedFnPredicateFactory], member[.predicateFactory]]
if[binary_operation[member[.syncedFnPredicateFactory], ==, literal[null]]] begin[{]
assign[member[.syncedFnPredicateFactory], ClassCreator(arguments=[MemberReference(member=function, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=extractionFn, 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=JavaScriptPredicateFactory, sub_type=None))]
assign[member[.predicateFactory], member[.syncedFnPredicateFactory]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
return[member[.syncedFnPredicateFactory]]
end[}]
END[}] | annotation[@] identifier[EnsuresNonNull] operator[SEP] literal[String] operator[SEP] Keyword[private] identifier[JavaScriptPredicateFactory] identifier[getPredicateFactory] operator[SEP] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[config] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[JavaScriptPredicateFactory] identifier[syncedFnPredicateFactory] operator[=] identifier[predicateFactory] operator[SEP] Keyword[if] operator[SEP] identifier[syncedFnPredicateFactory] operator[==] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[config] operator[SEP] {
identifier[syncedFnPredicateFactory] operator[=] identifier[predicateFactory] operator[SEP] Keyword[if] operator[SEP] identifier[syncedFnPredicateFactory] operator[==] Other[null] operator[SEP] {
identifier[syncedFnPredicateFactory] operator[=] Keyword[new] identifier[JavaScriptPredicateFactory] operator[SEP] identifier[function] , identifier[extractionFn] operator[SEP] operator[SEP] identifier[predicateFactory] operator[=] identifier[syncedFnPredicateFactory] operator[SEP]
}
}
}
Keyword[return] identifier[syncedFnPredicateFactory] operator[SEP]
}
|
public void rewriteLinks() throws CmsException {
init();
List<CmsRelation> relationsToCorrect = findRelationsFromTargetToSource();
// group relations by the structure id of their source
Multimap<CmsUUID, CmsRelation> relationsBySourceId = ArrayListMultimap.create();
for (CmsRelation relation : relationsToCorrect) {
LOG.info(
"Found relation which needs to be corrected: "
+ relation.getSourcePath()
+ " -> "
+ relation.getTargetPath()
+ " ["
+ relation.getType().getName()
+ "]");
relationsBySourceId.put(relation.getSourceId(), relation);
}
// make sure we have a lock on the target folder before doing any write operations
CmsLock lock = m_cms.getLock(m_targetPath);
if (lock.isUnlocked() || !lock.isOwnedBy(m_cms.getRequestContext().getCurrentUser())) {
// fail if locked by another user
m_cms.lockResource(m_targetPath);
}
for (CmsUUID structureId : relationsBySourceId.keySet()) {
Collection<CmsRelation> relationsForResource = relationsBySourceId.get(structureId);
CmsResource resource = null;
try {
resource = getResource(structureId);
rewriteLinks(resource, relationsForResource);
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
if (!m_rewriteAllXmlContents) {
return;
}
for (Map.Entry<CmsUUID, CmsResource> entry : m_cachedResources.entrySet()) {
CmsUUID key = entry.getKey();
CmsResource resource = entry.getValue();
if (isInTargets(resource.getRootPath()) && !m_rewrittenContent.contains(key)) {
I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(resource.getTypeId());
// rewrite content for other files so
if (resType instanceof A_CmsResourceTypeLinkParseable) {
try {
CmsFile file = m_cms.readFile(resource);
if (resType instanceof CmsResourceTypeXmlContent) {
CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);
try {
content.validateXmlStructure(new CmsXmlEntityResolver(m_cms));
} catch (CmsException e) {
LOG.info("XML content was corrected automatically for resource " + file.getRootPath());
content.setAutoCorrectionEnabled(true);
content.correctXmlStructure(m_cms);
file.setContents(content.marshal());
}
}
m_cms.writeFile(file);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
}
copyLocaleRelations();
} | class class_name[name] begin[{]
method[rewriteLinks, return_type[void], modifier[public], parameter[]] begin[{]
call[.init, parameter[]]
local_variable[type[List], relationsToCorrect]
local_variable[type[Multimap], relationsBySourceId]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Found relation which needs to be corrected: "), operandr=MethodInvocation(arguments=[], member=getSourcePath, postfix_operators=[], prefix_operators=[], qualifier=relation, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" -> "), operator=+), operandr=MethodInvocation(arguments=[], member=getTargetPath, postfix_operators=[], prefix_operators=[], qualifier=relation, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ["), operator=+), operandr=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=relation, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]"), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSourceId, postfix_operators=[], prefix_operators=[], qualifier=relation, selectors=[], type_arguments=None), MemberReference(member=relation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=relationsBySourceId, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=relationsToCorrect, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=relation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsRelation, sub_type=None))), label=None)
local_variable[type[CmsLock], lock]
if[binary_operation[call[lock.isUnlocked, parameter[]], ||, call[lock.isOwnedBy, parameter[call[m_cms.getRequestContext, parameter[]]]]]] begin[{]
call[m_cms.lockResource, parameter[member[.m_targetPath]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=structureId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=relationsBySourceId, selectors=[], type_arguments=None), name=relationsForResource)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CmsRelation, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=resource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsResource, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=structureId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=relationsForResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=rewriteLinks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=relationsBySourceId, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=structureId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsUUID, sub_type=None))), label=None)
if[member[.m_rewriteAllXmlContents]] begin[{]
return[None]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsUUID, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=resource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsResource, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRootPath, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None)], member=isInTargets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=m_rewrittenContent, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResourceManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTypeId, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None)], member=getResourceType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=resType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=I_CmsResourceType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=resType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=A_CmsResourceTypeLinkParseable, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readFile, postfix_operators=[], prefix_operators=[], qualifier=m_cms, selectors=[], type_arguments=None), name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsFile, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=resType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CmsResourceTypeXmlContent, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=m_cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmarshal, postfix_operators=[], prefix_operators=[], qualifier=CmsXmlContentFactory, selectors=[], type_arguments=None), name=content)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsXmlContent, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=m_cms, 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=CmsXmlEntityResolver, sub_type=None))], member=validateXmlStructure, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="XML content was corrected automatically for resource "), operandr=MethodInvocation(arguments=[], member=getRootPath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setAutoCorrectionEnabled, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=m_cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=correctXmlStructure, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=marshal, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None)], member=setContents, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CmsException']))], finally_block=None, label=None, resources=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeFile, postfix_operators=[], prefix_operators=[], qualifier=m_cms, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CmsException']))], finally_block=None, label=None, resources=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=m_cachedResources, 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=CmsUUID, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CmsResource, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
call[.copyLocaleRelations, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[rewriteLinks] operator[SEP] operator[SEP] Keyword[throws] identifier[CmsException] {
identifier[init] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[CmsRelation] operator[>] identifier[relationsToCorrect] operator[=] identifier[findRelationsFromTargetToSource] operator[SEP] operator[SEP] operator[SEP] identifier[Multimap] operator[<] identifier[CmsUUID] , identifier[CmsRelation] operator[>] identifier[relationsBySourceId] operator[=] identifier[ArrayListMultimap] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CmsRelation] identifier[relation] operator[:] identifier[relationsToCorrect] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[relation] operator[SEP] identifier[getSourcePath] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[relation] operator[SEP] identifier[getTargetPath] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[relation] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[relationsBySourceId] operator[SEP] identifier[put] operator[SEP] identifier[relation] operator[SEP] identifier[getSourceId] operator[SEP] operator[SEP] , identifier[relation] operator[SEP] operator[SEP]
}
identifier[CmsLock] identifier[lock] operator[=] identifier[m_cms] operator[SEP] identifier[getLock] operator[SEP] identifier[m_targetPath] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lock] operator[SEP] identifier[isUnlocked] operator[SEP] operator[SEP] operator[||] operator[!] identifier[lock] operator[SEP] identifier[isOwnedBy] operator[SEP] identifier[m_cms] operator[SEP] identifier[getRequestContext] operator[SEP] operator[SEP] operator[SEP] identifier[getCurrentUser] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_cms] operator[SEP] identifier[lockResource] operator[SEP] identifier[m_targetPath] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[CmsUUID] identifier[structureId] operator[:] identifier[relationsBySourceId] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Collection] operator[<] identifier[CmsRelation] operator[>] identifier[relationsForResource] operator[=] identifier[relationsBySourceId] operator[SEP] identifier[get] operator[SEP] identifier[structureId] operator[SEP] operator[SEP] identifier[CmsResource] identifier[resource] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[resource] operator[=] identifier[getResource] operator[SEP] identifier[structureId] operator[SEP] operator[SEP] identifier[rewriteLinks] operator[SEP] identifier[resource] , identifier[relationsForResource] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[m_rewriteAllXmlContents] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[CmsUUID] , identifier[CmsResource] operator[>] identifier[entry] operator[:] identifier[m_cachedResources] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[CmsUUID] identifier[key] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[CmsResource] identifier[resource] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isInTargets] operator[SEP] identifier[resource] operator[SEP] identifier[getRootPath] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[m_rewrittenContent] operator[SEP] identifier[contains] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[I_CmsResourceType] identifier[resType] operator[=] identifier[OpenCms] operator[SEP] identifier[getResourceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getResourceType] operator[SEP] identifier[resource] operator[SEP] identifier[getTypeId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resType] Keyword[instanceof] identifier[A_CmsResourceTypeLinkParseable] operator[SEP] {
Keyword[try] {
identifier[CmsFile] identifier[file] operator[=] identifier[m_cms] operator[SEP] identifier[readFile] operator[SEP] identifier[resource] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resType] Keyword[instanceof] identifier[CmsResourceTypeXmlContent] operator[SEP] {
identifier[CmsXmlContent] identifier[content] operator[=] identifier[CmsXmlContentFactory] operator[SEP] identifier[unmarshal] operator[SEP] identifier[m_cms] , identifier[file] operator[SEP] operator[SEP] Keyword[try] {
identifier[content] operator[SEP] identifier[validateXmlStructure] operator[SEP] Keyword[new] identifier[CmsXmlEntityResolver] operator[SEP] identifier[m_cms] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CmsException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getRootPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[setAutoCorrectionEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[correctXmlStructure] operator[SEP] identifier[m_cms] operator[SEP] operator[SEP] identifier[file] operator[SEP] identifier[setContents] operator[SEP] identifier[content] operator[SEP] identifier[marshal] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[m_cms] operator[SEP] identifier[writeFile] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CmsException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
}
identifier[copyLocaleRelations] operator[SEP] operator[SEP] operator[SEP]
}
|
private static InetAddress buildBenchmarkAddr() {
InetAddress tmp = null;
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
outer: while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
if (!networkInterface.isLoopback()) {
continue;
}
Enumeration<NetworkInterface> subInterfaces = networkInterface.getSubInterfaces();
while (subInterfaces.hasMoreElements()) {
NetworkInterface subLoopback = subInterfaces.nextElement();
if (subLoopback.getDisplayName().contains("benchmark")) {
tmp = subLoopback.getInetAddresses().nextElement();
System.out.println("\nResolved benchmark address to " + tmp + " on "
+ subLoopback.getDisplayName() + "\n\n");
break outer;
}
}
}
} catch (SocketException se) {
System.out.println("\nWARNING: Error trying to resolve benchmark interface \n" + se);
}
if (tmp == null) {
try {
System.out.println(
"\nWARNING: Unable to resolve benchmark interface, defaulting to localhost");
tmp = InetAddress.getLocalHost();
} catch (UnknownHostException uhe) {
throw new RuntimeException(uhe);
}
}
return tmp;
} | class class_name[name] begin[{]
method[buildBenchmarkAddr, return_type[type[InetAddress]], modifier[private static], parameter[]] begin[{]
local_variable[type[InetAddress], tmp]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNetworkInterfaces, postfix_operators=[], prefix_operators=[], qualifier=NetworkInterface, selectors=[], type_arguments=None), name=networkInterfaces)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=None))], dimensions=[], name=Enumeration, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=networkInterfaces, selectors=[], type_arguments=None), name=networkInterface)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isLoopback, postfix_operators=[], prefix_operators=['!'], qualifier=networkInterface, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSubInterfaces, postfix_operators=[], prefix_operators=[], qualifier=networkInterface, selectors=[], type_arguments=None), name=subInterfaces)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=None))], dimensions=[], name=Enumeration, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=subInterfaces, selectors=[], type_arguments=None), name=subLoopback)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=getDisplayName, postfix_operators=[], prefix_operators=[], qualifier=subLoopback, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="benchmark")], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getInetAddresses, postfix_operators=[], prefix_operators=[], qualifier=subLoopback, selectors=[MethodInvocation(arguments=[], member=nextElement, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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="\nResolved benchmark address to "), operandr=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" on "), operator=+), operandr=MethodInvocation(arguments=[], member=getDisplayName, postfix_operators=[], prefix_operators=[], qualifier=subLoopback, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n\n"), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), BreakStatement(goto=outer, label=None)]))]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=subInterfaces, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=networkInterfaces, selectors=[], type_arguments=None), label=outer)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nWARNING: Error trying to resolve benchmark interface \n"), operandr=MemberReference(member=se, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=se, types=['SocketException']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.tmp], ==, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\nWARNING: Unable to resolve benchmark interface, defaulting to localhost")], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getLocalHost, postfix_operators=[], prefix_operators=[], qualifier=InetAddress, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=uhe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=uhe, types=['UnknownHostException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.tmp]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[InetAddress] identifier[buildBenchmarkAddr] operator[SEP] operator[SEP] {
identifier[InetAddress] identifier[tmp] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[Enumeration] operator[<] identifier[NetworkInterface] operator[>] identifier[networkInterfaces] operator[=] identifier[NetworkInterface] operator[SEP] identifier[getNetworkInterfaces] operator[SEP] operator[SEP] operator[SEP] identifier[outer] operator[:] Keyword[while] operator[SEP] identifier[networkInterfaces] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[NetworkInterface] identifier[networkInterface] operator[=] identifier[networkInterfaces] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[networkInterface] operator[SEP] identifier[isLoopback] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[Enumeration] operator[<] identifier[NetworkInterface] operator[>] identifier[subInterfaces] operator[=] identifier[networkInterface] operator[SEP] identifier[getSubInterfaces] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[subInterfaces] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[NetworkInterface] identifier[subLoopback] operator[=] identifier[subInterfaces] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[subLoopback] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[tmp] operator[=] identifier[subLoopback] operator[SEP] identifier[getInetAddresses] operator[SEP] operator[SEP] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[tmp] operator[+] literal[String] operator[+] identifier[subLoopback] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[break] identifier[outer] operator[SEP]
}
}
}
}
Keyword[catch] operator[SEP] identifier[SocketException] identifier[se] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[se] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[tmp] operator[==] Other[null] operator[SEP] {
Keyword[try] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[tmp] operator[=] identifier[InetAddress] operator[SEP] identifier[getLocalHost] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnknownHostException] identifier[uhe] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[uhe] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[tmp] operator[SEP]
}
|
private void updateMinMax() {
if(values.length == 0) {
return; // Keep invalid.
}
min = max = values[0];
for(int i = 1; i < values.length; i++) {
int v = values[i];
min = min < v ? min : v;
max = max > v ? max : v;
}
} | class class_name[name] begin[{]
method[updateMinMax, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[values.length], ==, literal[0]]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[.min], assign[member[.max], member[.values]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=v)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=min, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), if_false=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=max, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[updateMinMax] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[values] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[min] operator[=] identifier[max] operator[=] identifier[values] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[values] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[v] operator[=] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[min] operator[=] identifier[min] operator[<] identifier[v] operator[?] identifier[min] operator[:] identifier[v] operator[SEP] identifier[max] operator[=] identifier[max] operator[>] identifier[v] operator[?] identifier[max] operator[:] identifier[v] operator[SEP]
}
}
|
protected boolean shouldRegisterJspServlet() {
return this.jsp != null && this.jsp.getRegistered() && ClassUtils
.isPresent(this.jsp.getClassName(), getClass().getClassLoader());
} | class class_name[name] begin[{]
method[shouldRegisterJspServlet, return_type[type[boolean]], modifier[protected], parameter[]] begin[{]
return[binary_operation[binary_operation[binary_operation[THIS[member[None.jsp]], !=, literal[null]], &&, THIS[member[None.jsp]call[None.getRegistered, parameter[]]]], &&, call[ClassUtils.isPresent, parameter[THIS[member[None.jsp]call[None.getClassName, parameter[]]], call[.getClass, parameter[]]]]]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[shouldRegisterJspServlet] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[jsp] operator[!=] Other[null] operator[&&] Keyword[this] operator[SEP] identifier[jsp] operator[SEP] identifier[getRegistered] operator[SEP] operator[SEP] operator[&&] identifier[ClassUtils] operator[SEP] identifier[isPresent] operator[SEP] Keyword[this] operator[SEP] identifier[jsp] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] , identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public GenThread[] prepare(JobConf conf, Text key, Text value)
throws IOException {
this.rtc = new GenWriterRunTimeConstants();
super.prepare(conf, key, value, rtc);
rtc.task_name = key.toString() + rtc.taskID;
rtc.roll_interval = conf.getLong(WRITER_ROLL_INTERVAL_KEY,
DEFAULT_ROLL_INTERVAL_SEC) * 1000;
rtc.sync_interval = conf.getLong(WRITER_SYNC_INTERVAL_KEY,
DEFAULT_SYNC_INTERVAL_SEC) * 1000;
rtc.max_time = conf.getLong(MAX_TIME_SEC_KEY, DEFAULT_MAX_TIME_SEC) * 1000;
rtc.data_rate = conf.getLong(WRITER_DATARATE_KEY, DEFAULT_DATA_RATE) * 1024;
rtc.input = value.toString();
LOG.info("data rate: " + rtc.data_rate);
GenWriterThread[] threads = new GenWriterThread[(int)rtc.nthreads];
for (int i=0; i<rtc.nthreads; i++) {
threads[i] = new GenWriterThread(conf,
new Path(new Path(rtc.input, rtc.task_name),
rtc.task_name + "_" + i), rtc.task_name, i, rtc);
}
return threads;
} | class class_name[name] begin[{]
method[prepare, return_type[type[GenThread]], modifier[public], parameter[conf, key, value]] begin[{]
assign[THIS[member[None.rtc]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GenWriterRunTimeConstants, sub_type=None))]
SuperMethodInvocation(arguments=[MemberReference(member=conf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rtc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepare, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
assign[member[rtc.task_name], binary_operation[call[key.toString, parameter[]], +, member[rtc.taskID]]]
assign[member[rtc.roll_interval], binary_operation[call[conf.getLong, parameter[member[.WRITER_ROLL_INTERVAL_KEY], member[.DEFAULT_ROLL_INTERVAL_SEC]]], *, literal[1000]]]
assign[member[rtc.sync_interval], binary_operation[call[conf.getLong, parameter[member[.WRITER_SYNC_INTERVAL_KEY], member[.DEFAULT_SYNC_INTERVAL_SEC]]], *, literal[1000]]]
assign[member[rtc.max_time], binary_operation[call[conf.getLong, parameter[member[.MAX_TIME_SEC_KEY], member[.DEFAULT_MAX_TIME_SEC]]], *, literal[1000]]]
assign[member[rtc.data_rate], binary_operation[call[conf.getLong, parameter[member[.WRITER_DATARATE_KEY], member[.DEFAULT_DATA_RATE]]], *, literal[1024]]]
assign[member[rtc.input], call[value.toString, parameter[]]]
call[LOG.info, parameter[binary_operation[literal["data rate: "], +, member[rtc.data_rate]]]]
local_variable[type[GenWriterThread], threads]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=threads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[MemberReference(member=conf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=rtc, selectors=[]), MemberReference(member=task_name, postfix_operators=[], prefix_operators=[], qualifier=rtc, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Path, sub_type=None)), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=task_name, postfix_operators=[], prefix_operators=[], qualifier=rtc, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="_"), operator=+), operandr=MemberReference(member=i, 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=Path, sub_type=None)), MemberReference(member=task_name, postfix_operators=[], prefix_operators=[], qualifier=rtc, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rtc, 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=GenWriterThread, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nthreads, postfix_operators=[], prefix_operators=[], qualifier=rtc, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.threads]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[GenThread] operator[SEP] operator[SEP] identifier[prepare] operator[SEP] identifier[JobConf] identifier[conf] , identifier[Text] identifier[key] , identifier[Text] identifier[value] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[this] operator[SEP] identifier[rtc] operator[=] Keyword[new] identifier[GenWriterRunTimeConstants] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[prepare] operator[SEP] identifier[conf] , identifier[key] , identifier[value] , identifier[rtc] operator[SEP] operator[SEP] identifier[rtc] operator[SEP] identifier[task_name] operator[=] identifier[key] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[+] identifier[rtc] operator[SEP] identifier[taskID] operator[SEP] identifier[rtc] operator[SEP] identifier[roll_interval] operator[=] identifier[conf] operator[SEP] identifier[getLong] operator[SEP] identifier[WRITER_ROLL_INTERVAL_KEY] , identifier[DEFAULT_ROLL_INTERVAL_SEC] operator[SEP] operator[*] Other[1000] operator[SEP] identifier[rtc] operator[SEP] identifier[sync_interval] operator[=] identifier[conf] operator[SEP] identifier[getLong] operator[SEP] identifier[WRITER_SYNC_INTERVAL_KEY] , identifier[DEFAULT_SYNC_INTERVAL_SEC] operator[SEP] operator[*] Other[1000] operator[SEP] identifier[rtc] operator[SEP] identifier[max_time] operator[=] identifier[conf] operator[SEP] identifier[getLong] operator[SEP] identifier[MAX_TIME_SEC_KEY] , identifier[DEFAULT_MAX_TIME_SEC] operator[SEP] operator[*] Other[1000] operator[SEP] identifier[rtc] operator[SEP] identifier[data_rate] operator[=] identifier[conf] operator[SEP] identifier[getLong] operator[SEP] identifier[WRITER_DATARATE_KEY] , identifier[DEFAULT_DATA_RATE] operator[SEP] operator[*] Other[1024] operator[SEP] identifier[rtc] operator[SEP] identifier[input] operator[=] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[rtc] operator[SEP] identifier[data_rate] operator[SEP] operator[SEP] identifier[GenWriterThread] operator[SEP] operator[SEP] identifier[threads] operator[=] Keyword[new] identifier[GenWriterThread] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[rtc] operator[SEP] identifier[nthreads] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[rtc] operator[SEP] identifier[nthreads] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[threads] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[GenWriterThread] operator[SEP] identifier[conf] , Keyword[new] identifier[Path] operator[SEP] Keyword[new] identifier[Path] operator[SEP] identifier[rtc] operator[SEP] identifier[input] , identifier[rtc] operator[SEP] identifier[task_name] operator[SEP] , identifier[rtc] operator[SEP] identifier[task_name] operator[+] literal[String] operator[+] identifier[i] operator[SEP] , identifier[rtc] operator[SEP] identifier[task_name] , identifier[i] , identifier[rtc] operator[SEP] operator[SEP]
}
Keyword[return] identifier[threads] operator[SEP]
}
|
public ServiceFuture<VpnGatewayInner> getByResourceGroupAsync(String resourceGroupName, String gatewayName, final ServiceCallback<VpnGatewayInner> serviceCallback) {
return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, gatewayName), serviceCallback);
} | class class_name[name] begin[{]
method[getByResourceGroupAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, gatewayName, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.getByResourceGroupWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.gatewayName]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[VpnGatewayInner] operator[>] identifier[getByResourceGroupAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[gatewayName] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[VpnGatewayInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[getByResourceGroupWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[gatewayName] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
private List<IAtom> getUnion(List<IAtom> list1, List<IAtom> list2) {
// FIXME: the JavaDoc does not describe what happens: that vec1 gets to be the union!
// jm: pretty sure retainAll would do the trick here but don't want to change the
// functionality as item only present in list1 are not removed (i.e. not union)
List<IAtom> is = new ArrayList<IAtom>(list1);
for (int f = list2.size() - 1; f > -1; f--) {
if (!list1.contains(list2.get(f))) is.add(list2.get(f));
}
return is;
} | class class_name[name] begin[{]
method[getUnion, return_type[type[List]], modifier[private], parameter[list1, list2]] begin[{]
local_variable[type[List], is]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=list2, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=list1, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=list2, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=>), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=list2, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), name=f)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=f, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.is]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[IAtom] operator[>] identifier[getUnion] operator[SEP] identifier[List] operator[<] identifier[IAtom] operator[>] identifier[list1] , identifier[List] operator[<] identifier[IAtom] operator[>] identifier[list2] operator[SEP] {
identifier[List] operator[<] identifier[IAtom] operator[>] identifier[is] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[IAtom] operator[>] operator[SEP] identifier[list1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[f] operator[=] identifier[list2] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[f] operator[>] operator[-] Other[1] operator[SEP] identifier[f] operator[--] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[list1] operator[SEP] identifier[contains] operator[SEP] identifier[list2] operator[SEP] identifier[get] operator[SEP] identifier[f] operator[SEP] operator[SEP] operator[SEP] identifier[is] operator[SEP] identifier[add] operator[SEP] identifier[list2] operator[SEP] identifier[get] operator[SEP] identifier[f] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[is] operator[SEP]
}
|
public synchronized int read() throws IOException
{
int b;
if (_pos >=_avail)
fill();
if (_pos >=_avail)
b=-1;
else
b=_buf[_pos++]&255;
return b;
} | class class_name[name] begin[{]
method[read, return_type[type[int]], modifier[synchronized public], parameter[]] begin[{]
local_variable[type[int], b]
if[binary_operation[member[._pos], >=, member[._avail]]] begin[{]
call[.fill, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[._pos], >=, member[._avail]]] begin[{]
assign[member[.b], literal[1]]
else begin[{]
assign[member[.b], binary_operation[member[._buf], &, literal[255]]]
end[}]
return[member[.b]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[int] identifier[read] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[b] operator[SEP] Keyword[if] operator[SEP] identifier[_pos] operator[>=] identifier[_avail] operator[SEP] identifier[fill] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_pos] operator[>=] identifier[_avail] operator[SEP] identifier[b] operator[=] operator[-] Other[1] operator[SEP] Keyword[else] identifier[b] operator[=] identifier[_buf] operator[SEP] identifier[_pos] operator[++] operator[SEP] operator[&] Other[255] operator[SEP] Keyword[return] identifier[b] operator[SEP]
}
|
public static <T, R> Ix<R> forloop(T seed, IxPredicate<? super T> condition,
IxFunction<? super T, ? extends T> next,
IxFunction<? super T, ? extends R> selector) {
return new IxForloop<T, R>(seed, nullCheck(condition, "condition is null"),
nullCheck(selector, "selector is null"), nullCheck(next, "next is null"));
} | class class_name[name] begin[{]
method[forloop, return_type[type[Ix]], modifier[public static], parameter[seed, condition, next, selector]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=seed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=condition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="condition is null")], member=nullCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=selector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="selector is null")], member=nullCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="next is null")], member=nullCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None))], dimensions=None, name=IxForloop, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[R] operator[>] identifier[Ix] operator[<] identifier[R] operator[>] identifier[forloop] operator[SEP] identifier[T] identifier[seed] , identifier[IxPredicate] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[condition] , identifier[IxFunction] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[T] operator[>] identifier[next] , identifier[IxFunction] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[R] operator[>] identifier[selector] operator[SEP] {
Keyword[return] Keyword[new] identifier[IxForloop] operator[<] identifier[T] , identifier[R] operator[>] operator[SEP] identifier[seed] , identifier[nullCheck] operator[SEP] identifier[condition] , literal[String] operator[SEP] , identifier[nullCheck] operator[SEP] identifier[selector] , literal[String] operator[SEP] , identifier[nullCheck] operator[SEP] identifier[next] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public String getProperty(String name) {
if (propertyCache.containsKey(name)) {
return (String) propertyCache.get(name);
}
String[] propName = parsePropertyName(name);
// Search for this property by traversing down the XML heirarchy.
Element element = doc.getRootElement();
for (int i = 0; i < propName.length; i++) {
element = element.getChild(propName[i]);
if (element == null) {
// This node doesn't match this part of the property name which
// indicates this property doesn't exist so return null.
return null;
}
}
// At this point, we found a matching property, so return its value.
// Empty strings are returned as null.
String value = element.getText();
if ("".equals(value)) {
return null;
} else {
// Add to cache so that getting property next time is fast.
value = value.trim();
propertyCache.put(name, value);
return value;
}
} | class class_name[name] begin[{]
method[getProperty, return_type[type[String]], modifier[public], parameter[name]] begin[{]
if[call[propertyCache.containsKey, parameter[member[.name]]]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=propertyCache, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], propName]
local_variable[type[Element], element]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=propName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=getChild, postfix_operators=[], prefix_operators=[], qualifier=element, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=propName, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[String], value]
if[literal[""]] begin[{]
return[literal[null]]
else begin[{]
assign[member[.value], call[value.trim, parameter[]]]
call[propertyCache.put, parameter[member[.name], member[.value]]]
return[member[.value]]
end[}]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getProperty] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[propertyCache] operator[SEP] identifier[containsKey] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[String] operator[SEP] identifier[propertyCache] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[propName] operator[=] identifier[parsePropertyName] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[Element] identifier[element] operator[=] identifier[doc] operator[SEP] identifier[getRootElement] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[propName] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[element] operator[=] identifier[element] operator[SEP] identifier[getChild] operator[SEP] identifier[propName] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[element] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
identifier[String] identifier[value] operator[=] identifier[element] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
identifier[value] operator[=] identifier[value] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[propertyCache] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
}
|
@Override
public CharSequence getDisplayContents() {
AddressBookParsedResult result = (AddressBookParsedResult) getResult();
StringBuilder contents = new StringBuilder(100);
ParsedResult.maybeAppend(result.getNames(), contents);
int namesLength = contents.length();
String pronunciation = result.getPronunciation();
if (pronunciation != null && !pronunciation.isEmpty()) {
contents.append("\n(");
contents.append(pronunciation);
contents.append(')');
}
ParsedResult.maybeAppend(result.getTitle(), contents);
ParsedResult.maybeAppend(result.getOrg(), contents);
ParsedResult.maybeAppend(result.getAddresses(), contents);
String[] numbers = result.getPhoneNumbers();
if (numbers != null) {
for (String number : numbers) {
if (number != null) {
ParsedResult.maybeAppend(formatPhone(number), contents);
}
}
}
ParsedResult.maybeAppend(result.getEmails(), contents);
ParsedResult.maybeAppend(result.getURLs(), contents);
String birthday = result.getBirthday();
if (birthday != null && !birthday.isEmpty()) {
long date = parseDate(birthday);
if (date >= 0L) {
ParsedResult.maybeAppend(DateFormat.getDateInstance(DateFormat.MEDIUM).format(date), contents);
}
}
ParsedResult.maybeAppend(result.getNote(), contents);
if (namesLength > 0) {
// Bold the full name to make it stand out a bit.
Spannable styled = new SpannableString(contents.toString());
styled.setSpan(new StyleSpan(Typeface.BOLD), 0, namesLength, 0);
return styled;
} else {
return contents.toString();
}
} | class class_name[name] begin[{]
method[getDisplayContents, return_type[type[CharSequence]], modifier[public], parameter[]] begin[{]
local_variable[type[AddressBookParsedResult], result]
local_variable[type[StringBuilder], contents]
call[ParsedResult.maybeAppend, parameter[call[result.getNames, parameter[]], member[.contents]]]
local_variable[type[int], namesLength]
local_variable[type[String], pronunciation]
if[binary_operation[binary_operation[member[.pronunciation], !=, literal[null]], &&, call[pronunciation.isEmpty, parameter[]]]] begin[{]
call[contents.append, parameter[literal["\n("]]]
call[contents.append, parameter[member[.pronunciation]]]
call[contents.append, parameter[literal[')']]]
else begin[{]
None
end[}]
call[ParsedResult.maybeAppend, parameter[call[result.getTitle, parameter[]], member[.contents]]]
call[ParsedResult.maybeAppend, parameter[call[result.getOrg, parameter[]], member[.contents]]]
call[ParsedResult.maybeAppend, parameter[call[result.getAddresses, parameter[]], member[.contents]]]
local_variable[type[String], numbers]
if[binary_operation[member[.numbers], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=number, 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=[MethodInvocation(arguments=[MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=formatPhone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=contents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=maybeAppend, postfix_operators=[], prefix_operators=[], qualifier=ParsedResult, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=numbers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=number)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
call[ParsedResult.maybeAppend, parameter[call[result.getEmails, parameter[]], member[.contents]]]
call[ParsedResult.maybeAppend, parameter[call[result.getURLs, parameter[]], member[.contents]]]
local_variable[type[String], birthday]
if[binary_operation[binary_operation[member[.birthday], !=, literal[null]], &&, call[birthday.isEmpty, parameter[]]]] begin[{]
local_variable[type[long], date]
if[binary_operation[member[.date], >=, literal[0L]]] begin[{]
call[ParsedResult.maybeAppend, parameter[call[DateFormat.getDateInstance, parameter[member[DateFormat.MEDIUM]]], member[.contents]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[ParsedResult.maybeAppend, parameter[call[result.getNote, parameter[]], member[.contents]]]
if[binary_operation[member[.namesLength], >, literal[0]]] begin[{]
local_variable[type[Spannable], styled]
call[styled.setSpan, parameter[ClassCreator(arguments=[MemberReference(member=BOLD, postfix_operators=[], prefix_operators=[], qualifier=Typeface, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StyleSpan, sub_type=None)), literal[0], member[.namesLength], literal[0]]]
return[member[.styled]]
else begin[{]
return[call[contents.toString, parameter[]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CharSequence] identifier[getDisplayContents] operator[SEP] operator[SEP] {
identifier[AddressBookParsedResult] identifier[result] operator[=] operator[SEP] identifier[AddressBookParsedResult] operator[SEP] identifier[getResult] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[contents] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] Other[100] operator[SEP] operator[SEP] identifier[ParsedResult] operator[SEP] identifier[maybeAppend] operator[SEP] identifier[result] operator[SEP] identifier[getNames] operator[SEP] operator[SEP] , identifier[contents] operator[SEP] operator[SEP] Keyword[int] identifier[namesLength] operator[=] identifier[contents] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[pronunciation] operator[=] identifier[result] operator[SEP] identifier[getPronunciation] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pronunciation] operator[!=] Other[null] operator[&&] operator[!] identifier[pronunciation] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[contents] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[contents] operator[SEP] identifier[append] operator[SEP] identifier[pronunciation] operator[SEP] operator[SEP] identifier[contents] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ParsedResult] operator[SEP] identifier[maybeAppend] operator[SEP] identifier[result] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , identifier[contents] operator[SEP] operator[SEP] identifier[ParsedResult] operator[SEP] identifier[maybeAppend] operator[SEP] identifier[result] operator[SEP] identifier[getOrg] operator[SEP] operator[SEP] , identifier[contents] operator[SEP] operator[SEP] identifier[ParsedResult] operator[SEP] identifier[maybeAppend] operator[SEP] identifier[result] operator[SEP] identifier[getAddresses] operator[SEP] operator[SEP] , identifier[contents] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[numbers] operator[=] identifier[result] operator[SEP] identifier[getPhoneNumbers] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[numbers] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[number] operator[:] identifier[numbers] operator[SEP] {
Keyword[if] operator[SEP] identifier[number] operator[!=] Other[null] operator[SEP] {
identifier[ParsedResult] operator[SEP] identifier[maybeAppend] operator[SEP] identifier[formatPhone] operator[SEP] identifier[number] operator[SEP] , identifier[contents] operator[SEP] operator[SEP]
}
}
}
identifier[ParsedResult] operator[SEP] identifier[maybeAppend] operator[SEP] identifier[result] operator[SEP] identifier[getEmails] operator[SEP] operator[SEP] , identifier[contents] operator[SEP] operator[SEP] identifier[ParsedResult] operator[SEP] identifier[maybeAppend] operator[SEP] identifier[result] operator[SEP] identifier[getURLs] operator[SEP] operator[SEP] , identifier[contents] operator[SEP] operator[SEP] identifier[String] identifier[birthday] operator[=] identifier[result] operator[SEP] identifier[getBirthday] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[birthday] operator[!=] Other[null] operator[&&] operator[!] identifier[birthday] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[long] identifier[date] operator[=] identifier[parseDate] operator[SEP] identifier[birthday] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[date] operator[>=] Other[0L] operator[SEP] {
identifier[ParsedResult] operator[SEP] identifier[maybeAppend] operator[SEP] identifier[DateFormat] operator[SEP] identifier[getDateInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[MEDIUM] operator[SEP] operator[SEP] identifier[format] operator[SEP] identifier[date] operator[SEP] , identifier[contents] operator[SEP] operator[SEP]
}
}
identifier[ParsedResult] operator[SEP] identifier[maybeAppend] operator[SEP] identifier[result] operator[SEP] identifier[getNote] operator[SEP] operator[SEP] , identifier[contents] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[namesLength] operator[>] Other[0] operator[SEP] {
identifier[Spannable] identifier[styled] operator[=] Keyword[new] identifier[SpannableString] operator[SEP] identifier[contents] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[styled] operator[SEP] identifier[setSpan] operator[SEP] Keyword[new] identifier[StyleSpan] operator[SEP] identifier[Typeface] operator[SEP] identifier[BOLD] operator[SEP] , Other[0] , identifier[namesLength] , Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[styled] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[contents] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.