code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static void setBadHostsAndRacks(Set<String> racks,
Set<String> hosts) {
badRacks = racks;
badHosts = hosts;
}
|
class class_name[name] begin[{]
method[setBadHostsAndRacks, return_type[void], modifier[public static], parameter[racks, hosts]] begin[{]
assign[member[.badRacks], member[.racks]]
assign[member[.badHosts], member[.hosts]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[setBadHostsAndRacks] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[racks] , identifier[Set] operator[<] identifier[String] operator[>] identifier[hosts] operator[SEP] {
identifier[badRacks] operator[=] identifier[racks] operator[SEP] identifier[badHosts] operator[=] identifier[hosts] operator[SEP]
}
|
public static final boolean isFolderType(int typeId) {
try {
return OpenCms.getResourceManager().getResourceType(typeId).isFolder();
} catch (CmsLoaderException e) {
if (LOG.isWarnEnabled()) {
LOG.warn(Messages.get().getBundle().key(Messages.ERR_UNKNOWN_RESOURCE_TYPE_1, new Integer(typeId)), e);
}
}
return false;
}
|
class class_name[name] begin[{]
method[isFolderType, return_type[type[boolean]], modifier[final public static], parameter[typeId]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getResourceManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MemberReference(member=typeId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResourceType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=isFolder, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isWarnEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[], member=getBundle, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=ERR_UNKNOWN_RESOURCE_TYPE_1, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), ClassCreator(arguments=[MemberReference(member=typeId, 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=Integer, sub_type=None))], member=key, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CmsLoaderException']))], finally_block=None, label=None, resources=None)
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[final] Keyword[boolean] identifier[isFolderType] operator[SEP] Keyword[int] identifier[typeId] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[OpenCms] operator[SEP] identifier[getResourceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getResourceType] operator[SEP] identifier[typeId] operator[SEP] operator[SEP] identifier[isFolder] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CmsLoaderException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isWarnEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_UNKNOWN_RESOURCE_TYPE_1] , Keyword[new] identifier[Integer] operator[SEP] identifier[typeId] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
protected void findCreds() {
if (System.getProperty(ACCESS_KEY) != null && System.getProperty(ACCESS_SECRET) != null) {
accessKey = System.getProperty(ACCESS_KEY);
secretKey = System.getProperty(ACCESS_SECRET);
}
else if (System.getenv(AWS_ACCESS_KEY) != null && System.getenv(AWS_SECRET_KEY) != null) {
accessKey = System.getenv(AWS_ACCESS_KEY);
secretKey = System.getenv(AWS_SECRET_KEY);
}
}
|
class class_name[name] begin[{]
method[findCreds, return_type[void], modifier[protected], parameter[]] begin[{]
if[binary_operation[binary_operation[call[System.getProperty, parameter[member[.ACCESS_KEY]]], !=, literal[null]], &&, binary_operation[call[System.getProperty, parameter[member[.ACCESS_SECRET]]], !=, literal[null]]]] begin[{]
assign[member[.accessKey], call[System.getProperty, parameter[member[.ACCESS_KEY]]]]
assign[member[.secretKey], call[System.getProperty, parameter[member[.ACCESS_SECRET]]]]
else begin[{]
if[binary_operation[binary_operation[call[System.getenv, parameter[member[.AWS_ACCESS_KEY]]], !=, literal[null]], &&, binary_operation[call[System.getenv, parameter[member[.AWS_SECRET_KEY]]], !=, literal[null]]]] begin[{]
assign[member[.accessKey], call[System.getenv, parameter[member[.AWS_ACCESS_KEY]]]]
assign[member[.secretKey], call[System.getenv, parameter[member[.AWS_SECRET_KEY]]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[findCreds] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[ACCESS_KEY] operator[SEP] operator[!=] Other[null] operator[&&] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[ACCESS_SECRET] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[accessKey] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[ACCESS_KEY] operator[SEP] operator[SEP] identifier[secretKey] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[ACCESS_SECRET] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[System] operator[SEP] identifier[getenv] operator[SEP] identifier[AWS_ACCESS_KEY] operator[SEP] operator[!=] Other[null] operator[&&] identifier[System] operator[SEP] identifier[getenv] operator[SEP] identifier[AWS_SECRET_KEY] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[accessKey] operator[=] identifier[System] operator[SEP] identifier[getenv] operator[SEP] identifier[AWS_ACCESS_KEY] operator[SEP] operator[SEP] identifier[secretKey] operator[=] identifier[System] operator[SEP] identifier[getenv] operator[SEP] identifier[AWS_SECRET_KEY] operator[SEP] operator[SEP]
}
}
|
public static String doDelete(String host, String path,
Map<String, String> headers,
Map<String, String> queries,
Map<String, String> body) throws Exception {
return EntityUtils.toString(doDeleteResponse(host, path, headers, queries, JsonUtils.toJSON(body)).getEntity(), "utf-8");
}
|
class class_name[name] begin[{]
method[doDelete, return_type[type[String]], modifier[public static], parameter[host, path, headers, queries, body]] begin[{]
return[call[EntityUtils.toString, parameter[call[.doDeleteResponse, parameter[member[.host], member[.path], member[.headers], member[.queries], call[JsonUtils.toJSON, parameter[member[.body]]]]], literal["utf-8"]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[doDelete] operator[SEP] identifier[String] identifier[host] , identifier[String] identifier[path] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[headers] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[queries] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[body] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[return] identifier[EntityUtils] operator[SEP] identifier[toString] operator[SEP] identifier[doDeleteResponse] operator[SEP] identifier[host] , identifier[path] , identifier[headers] , identifier[queries] , identifier[JsonUtils] operator[SEP] identifier[toJSON] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] identifier[getEntity] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
|
public void update(long aStarted, long aDaemon, long aCurrent){
current.setValueAsLong(aCurrent);
started.setValueAsLong(aStarted);
daemon.setValueAsLong(aDaemon);
minCurrent.setValueIfLesserThanCurrentAsLong(aCurrent);
maxCurrent.setValueIfGreaterThanCurrentAsLong(aCurrent);
}
|
class class_name[name] begin[{]
method[update, return_type[void], modifier[public], parameter[aStarted, aDaemon, aCurrent]] begin[{]
call[current.setValueAsLong, parameter[member[.aCurrent]]]
call[started.setValueAsLong, parameter[member[.aStarted]]]
call[daemon.setValueAsLong, parameter[member[.aDaemon]]]
call[minCurrent.setValueIfLesserThanCurrentAsLong, parameter[member[.aCurrent]]]
call[maxCurrent.setValueIfGreaterThanCurrentAsLong, parameter[member[.aCurrent]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[update] operator[SEP] Keyword[long] identifier[aStarted] , Keyword[long] identifier[aDaemon] , Keyword[long] identifier[aCurrent] operator[SEP] {
identifier[current] operator[SEP] identifier[setValueAsLong] operator[SEP] identifier[aCurrent] operator[SEP] operator[SEP] identifier[started] operator[SEP] identifier[setValueAsLong] operator[SEP] identifier[aStarted] operator[SEP] operator[SEP] identifier[daemon] operator[SEP] identifier[setValueAsLong] operator[SEP] identifier[aDaemon] operator[SEP] operator[SEP] identifier[minCurrent] operator[SEP] identifier[setValueIfLesserThanCurrentAsLong] operator[SEP] identifier[aCurrent] operator[SEP] operator[SEP] identifier[maxCurrent] operator[SEP] identifier[setValueIfGreaterThanCurrentAsLong] operator[SEP] identifier[aCurrent] operator[SEP] operator[SEP]
}
|
static DataSetDto toDataSetDto(final IDataSet dataSet) {
List<List<Object>> table = new ArrayList<>(dataSet.rowCount());
for (IDsRow r : dataSet) {
List<Object> row = new ArrayList<>(r.cellCount());
for (IDsCell c : r) {
row.add(c.getValue().get());
}
table.add(row);
}
DataSetDto dto = new DataSetDto();
dto.table = table;
dto.dataModelId = dataSet.getDataModelId().toString();
dto.name = dataSet.getName();
return dto;
}
|
class class_name[name] begin[{]
method[toDataSetDto, return_type[type[DataSetDto]], modifier[static], parameter[dataSet]] begin[{]
local_variable[type[List], table]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=cellCount, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), name=row)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[MethodInvocation(arguments=[], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=row, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=c)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IDsCell, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=dataSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=r)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IDsRow, sub_type=None))), label=None)
local_variable[type[DataSetDto], dto]
assign[member[dto.table], member[.table]]
assign[member[dto.dataModelId], call[dataSet.getDataModelId, parameter[]]]
assign[member[dto.name], call[dataSet.getName, parameter[]]]
return[member[.dto]]
end[}]
END[}]
|
Keyword[static] identifier[DataSetDto] identifier[toDataSetDto] operator[SEP] Keyword[final] identifier[IDataSet] identifier[dataSet] operator[SEP] {
identifier[List] operator[<] identifier[List] operator[<] identifier[Object] operator[>] operator[>] identifier[table] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[dataSet] operator[SEP] identifier[rowCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[IDsRow] identifier[r] operator[:] identifier[dataSet] operator[SEP] {
identifier[List] operator[<] identifier[Object] operator[>] identifier[row] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[r] operator[SEP] identifier[cellCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[IDsCell] identifier[c] operator[:] identifier[r] operator[SEP] {
identifier[row] operator[SEP] identifier[add] operator[SEP] identifier[c] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[table] operator[SEP] identifier[add] operator[SEP] identifier[row] operator[SEP] operator[SEP]
}
identifier[DataSetDto] identifier[dto] operator[=] Keyword[new] identifier[DataSetDto] operator[SEP] operator[SEP] operator[SEP] identifier[dto] operator[SEP] identifier[table] operator[=] identifier[table] operator[SEP] identifier[dto] operator[SEP] identifier[dataModelId] operator[=] identifier[dataSet] operator[SEP] identifier[getDataModelId] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[dto] operator[SEP] identifier[name] operator[=] identifier[dataSet] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[dto] operator[SEP]
}
|
public static DatasourceDependencyBuilder kafkaDependency(final List<Datasource> datasources) {
return new DatasourceDependencyBuilder()
.withDatasources(datasources)
.withType(DatasourceDependency.TYPE_QUEUE)
.withSubtype(DatasourceDependency.SUBTYPE_KAFKA);
}
|
class class_name[name] begin[{]
method[kafkaDependency, return_type[type[DatasourceDependencyBuilder]], modifier[public static], parameter[datasources]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=datasources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withDatasources, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=TYPE_QUEUE, postfix_operators=[], prefix_operators=[], qualifier=DatasourceDependency, selectors=[])], member=withType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=SUBTYPE_KAFKA, postfix_operators=[], prefix_operators=[], qualifier=DatasourceDependency, selectors=[])], member=withSubtype, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DatasourceDependencyBuilder, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DatasourceDependencyBuilder] identifier[kafkaDependency] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Datasource] operator[>] identifier[datasources] operator[SEP] {
Keyword[return] Keyword[new] identifier[DatasourceDependencyBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[withDatasources] operator[SEP] identifier[datasources] operator[SEP] operator[SEP] identifier[withType] operator[SEP] identifier[DatasourceDependency] operator[SEP] identifier[TYPE_QUEUE] operator[SEP] operator[SEP] identifier[withSubtype] operator[SEP] identifier[DatasourceDependency] operator[SEP] identifier[SUBTYPE_KAFKA] operator[SEP] operator[SEP]
}
|
public Pipeline<T> set(int index, Function<T, T> function) {
return set(index, function.getClass().getName(), function);
}
|
class class_name[name] begin[{]
method[set, return_type[type[Pipeline]], modifier[public], parameter[index, function]] begin[{]
return[call[.set, parameter[member[.index], call[function.getClass, parameter[]], member[.function]]]]
end[}]
END[}]
|
Keyword[public] identifier[Pipeline] operator[<] identifier[T] operator[>] identifier[set] operator[SEP] Keyword[int] identifier[index] , identifier[Function] operator[<] identifier[T] , identifier[T] operator[>] identifier[function] operator[SEP] {
Keyword[return] identifier[set] operator[SEP] identifier[index] , identifier[function] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[function] operator[SEP] operator[SEP]
}
|
public static void setIconImage(final String resourceName, final Window window)
throws IOException
{
final InputStream isLogo = ClassExtensions.getResourceAsStream(resourceName);
final BufferedImage biLogo = ImageIO.read(isLogo);
window.setIconImage(biLogo);
}
|
class class_name[name] begin[{]
method[setIconImage, return_type[void], modifier[public static], parameter[resourceName, window]] begin[{]
local_variable[type[InputStream], isLogo]
local_variable[type[BufferedImage], biLogo]
call[window.setIconImage, parameter[member[.biLogo]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[setIconImage] operator[SEP] Keyword[final] identifier[String] identifier[resourceName] , Keyword[final] identifier[Window] identifier[window] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[InputStream] identifier[isLogo] operator[=] identifier[ClassExtensions] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[resourceName] operator[SEP] operator[SEP] Keyword[final] identifier[BufferedImage] identifier[biLogo] operator[=] identifier[ImageIO] operator[SEP] identifier[read] operator[SEP] identifier[isLogo] operator[SEP] operator[SEP] identifier[window] operator[SEP] identifier[setIconImage] operator[SEP] identifier[biLogo] operator[SEP] operator[SEP]
}
|
public List<String> getMatchingRecordFields(String namespaceRegex, String scopeRegex, String metricRegex, String tagKeyRegex,
String tagValueRegex, FieldSelector type, int limit) throws IOException, TokenExpiredException {
StringBuilder urlBuilder = _buildBaseUrl(namespaceRegex, scopeRegex, metricRegex, tagKeyRegex, tagValueRegex, limit);
urlBuilder.append("&type=").append(type.name().toLowerCase(Locale.ENGLISH));
String requestUrl = urlBuilder.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl, null);
assertValidResponse(response, requestUrl);
return fromJson(response.getResult(), new TypeReference<List<String>>() { });
}
|
class class_name[name] begin[{]
method[getMatchingRecordFields, return_type[type[List]], modifier[public], parameter[namespaceRegex, scopeRegex, metricRegex, tagKeyRegex, tagValueRegex, type, limit]] begin[{]
local_variable[type[StringBuilder], urlBuilder]
call[urlBuilder.append, parameter[literal["&type="]]]
local_variable[type[String], requestUrl]
local_variable[type[ArgusResponse], response]
call[.assertValidResponse, parameter[member[.response], member[.requestUrl]]]
return[call[.fromJson, parameter[call[response.getResult, parameter[]], ClassCreator(arguments=[], body=[], 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=String, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=None, name=TypeReference, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getMatchingRecordFields] operator[SEP] identifier[String] identifier[namespaceRegex] , identifier[String] identifier[scopeRegex] , identifier[String] identifier[metricRegex] , identifier[String] identifier[tagKeyRegex] , identifier[String] identifier[tagValueRegex] , identifier[FieldSelector] identifier[type] , Keyword[int] identifier[limit] operator[SEP] Keyword[throws] identifier[IOException] , identifier[TokenExpiredException] {
identifier[StringBuilder] identifier[urlBuilder] operator[=] identifier[_buildBaseUrl] operator[SEP] identifier[namespaceRegex] , identifier[scopeRegex] , identifier[metricRegex] , identifier[tagKeyRegex] , identifier[tagValueRegex] , identifier[limit] operator[SEP] operator[SEP] identifier[urlBuilder] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[type] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[Locale] operator[SEP] identifier[ENGLISH] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[requestUrl] operator[=] identifier[urlBuilder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[ArgusResponse] identifier[response] operator[=] identifier[getClient] operator[SEP] operator[SEP] operator[SEP] identifier[executeHttpRequest] operator[SEP] identifier[ArgusHttpClient] operator[SEP] identifier[RequestType] operator[SEP] identifier[GET] , identifier[requestUrl] , Other[null] operator[SEP] operator[SEP] identifier[assertValidResponse] operator[SEP] identifier[response] , identifier[requestUrl] operator[SEP] operator[SEP] Keyword[return] identifier[fromJson] operator[SEP] identifier[response] operator[SEP] identifier[getResult] operator[SEP] operator[SEP] , Keyword[new] identifier[TypeReference] operator[<] identifier[List] operator[<] identifier[String] operator[>] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] operator[SEP]
}
|
public QueryPersistor augment(DomainObjectMatch<?> domainObjectMatch, String as) {
if (this.augmentations == null)
this.augmentations = new HashMap<DomainObjectMatch<?>, String>();
this.augmentations.put(domainObjectMatch, as);
return this;
}
|
class class_name[name] begin[{]
method[augment, return_type[type[QueryPersistor]], modifier[public], parameter[domainObjectMatch, as]] begin[{]
if[binary_operation[THIS[member[None.augmentations]], ==, literal[null]]] begin[{]
assign[THIS[member[None.augmentations]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=DomainObjectMatch, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.augmentations]call[None.put, parameter[member[.domainObjectMatch], member[.as]]]]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[QueryPersistor] identifier[augment] operator[SEP] identifier[DomainObjectMatch] operator[<] operator[?] operator[>] identifier[domainObjectMatch] , identifier[String] identifier[as] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[augmentations] operator[==] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[augmentations] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[DomainObjectMatch] operator[<] operator[?] operator[>] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[augmentations] operator[SEP] identifier[put] operator[SEP] identifier[domainObjectMatch] , identifier[as] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private String getTokenOrBlank(final List<String> tokens, final int reverseIndex) {
final int length = tokens.size();
final int index = length - reverseIndex - 1;
if (index >= 0 && length > 0 && index < length) {
return tokens.get(index);
}
return "";
}
|
class class_name[name] begin[{]
method[getTokenOrBlank, return_type[type[String]], modifier[private], parameter[tokens, reverseIndex]] begin[{]
local_variable[type[int], length]
local_variable[type[int], index]
if[binary_operation[binary_operation[binary_operation[member[.index], >=, literal[0]], &&, binary_operation[member[.length], >, literal[0]]], &&, binary_operation[member[.index], <, member[.length]]]] begin[{]
return[call[tokens.get, parameter[member[.index]]]]
else begin[{]
None
end[}]
return[literal[""]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[getTokenOrBlank] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[tokens] , Keyword[final] Keyword[int] identifier[reverseIndex] operator[SEP] {
Keyword[final] Keyword[int] identifier[length] operator[=] identifier[tokens] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[index] operator[=] identifier[length] operator[-] identifier[reverseIndex] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[>=] Other[0] operator[&&] identifier[length] operator[>] Other[0] operator[&&] identifier[index] operator[<] identifier[length] operator[SEP] {
Keyword[return] identifier[tokens] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
Keyword[return] literal[String] operator[SEP]
}
|
protected static String getStringPropertyFromProperties(
Properties propertiesParam,
String propertyKeyParam
) {
if(propertiesParam == null || propertiesParam.isEmpty()) {
return null;
}
return propertiesParam.getProperty(propertyKeyParam);
}
|
class class_name[name] begin[{]
method[getStringPropertyFromProperties, return_type[type[String]], modifier[static protected], parameter[propertiesParam, propertyKeyParam]] begin[{]
if[binary_operation[binary_operation[member[.propertiesParam], ==, literal[null]], ||, call[propertiesParam.isEmpty, parameter[]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[propertiesParam.getProperty, parameter[member[.propertyKeyParam]]]]
end[}]
END[}]
|
Keyword[protected] Keyword[static] identifier[String] identifier[getStringPropertyFromProperties] operator[SEP] identifier[Properties] identifier[propertiesParam] , identifier[String] identifier[propertyKeyParam] operator[SEP] {
Keyword[if] operator[SEP] identifier[propertiesParam] operator[==] Other[null] operator[||] identifier[propertiesParam] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[propertiesParam] operator[SEP] identifier[getProperty] operator[SEP] identifier[propertyKeyParam] operator[SEP] operator[SEP]
}
|
protected void addPackageTreeLinks(Content contentTree) {
//Do nothing if only unnamed package is used
if (isUnnamedPackage()) {
return;
}
if (!classesOnly) {
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
contents.packageHierarchies);
contentTree.addContent(span);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.horizontal);
int i = 0;
for (PackageElement pkg : packages) {
// If the package name length is 0 or if -nodeprecated option
// is set and the package is marked as deprecated, do not include
// the page in the list of package hierarchies.
if (pkg.isUnnamed() ||
(configuration.nodeprecated && utils.isDeprecated(pkg))) {
i++;
continue;
}
DocPath link = pathString(pkg, DocPaths.PACKAGE_TREE);
Content li = HtmlTree.LI(getHyperLink(link,
new StringContent(utils.getPackageName(pkg))));
if (i < packages.size() - 1) {
li.addContent(", ");
}
ul.addContent(li);
i++;
}
contentTree.addContent(ul);
}
}
|
class class_name[name] begin[{]
method[addPackageTreeLinks, return_type[void], modifier[protected], parameter[contentTree]] begin[{]
if[call[.isUnnamedPackage, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[member[.classesOnly]] begin[{]
local_variable[type[Content], span]
call[contentTree.addContent, parameter[member[.span]]]
local_variable[type[HtmlTree], ul]
call[ul.addStyle, parameter[member[HtmlStyle.horizontal]]]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isUnnamed, postfix_operators=[], prefix_operators=[], qualifier=pkg, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=nodeprecated, postfix_operators=[], prefix_operators=[], qualifier=configuration, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=pkg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isDeprecated, postfix_operators=[], prefix_operators=[], qualifier=utils, selectors=[], type_arguments=None), operator=&&), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=pkg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PACKAGE_TREE, postfix_operators=[], prefix_operators=[], qualifier=DocPaths, selectors=[])], member=pathString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=link)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DocPath, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=link, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=pkg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPackageName, postfix_operators=[], prefix_operators=[], qualifier=utils, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringContent, sub_type=None))], member=getHyperLink, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=LI, postfix_operators=[], prefix_operators=[], qualifier=HtmlTree, selectors=[], type_arguments=None), name=li)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Content, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=packages, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", ")], member=addContent, postfix_operators=[], prefix_operators=[], qualifier=li, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=li, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addContent, postfix_operators=[], prefix_operators=[], qualifier=ul, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=packages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=pkg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PackageElement, sub_type=None))), label=None)
call[contentTree.addContent, parameter[member[.ul]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[addPackageTreeLinks] operator[SEP] identifier[Content] identifier[contentTree] operator[SEP] {
Keyword[if] operator[SEP] identifier[isUnnamedPackage] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[classesOnly] operator[SEP] {
identifier[Content] identifier[span] operator[=] identifier[HtmlTree] operator[SEP] identifier[SPAN] operator[SEP] identifier[HtmlStyle] operator[SEP] identifier[packageHierarchyLabel] , identifier[contents] operator[SEP] identifier[packageHierarchies] operator[SEP] operator[SEP] identifier[contentTree] operator[SEP] identifier[addContent] operator[SEP] identifier[span] operator[SEP] operator[SEP] identifier[HtmlTree] identifier[ul] operator[=] Keyword[new] identifier[HtmlTree] operator[SEP] identifier[HtmlTag] operator[SEP] identifier[UL] operator[SEP] operator[SEP] identifier[ul] operator[SEP] identifier[addStyle] operator[SEP] identifier[HtmlStyle] operator[SEP] identifier[horizontal] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[PackageElement] identifier[pkg] operator[:] identifier[packages] operator[SEP] {
Keyword[if] operator[SEP] identifier[pkg] operator[SEP] identifier[isUnnamed] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[configuration] operator[SEP] identifier[nodeprecated] operator[&&] identifier[utils] operator[SEP] identifier[isDeprecated] operator[SEP] identifier[pkg] operator[SEP] operator[SEP] operator[SEP] {
identifier[i] operator[++] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[DocPath] identifier[link] operator[=] identifier[pathString] operator[SEP] identifier[pkg] , identifier[DocPaths] operator[SEP] identifier[PACKAGE_TREE] operator[SEP] operator[SEP] identifier[Content] identifier[li] operator[=] identifier[HtmlTree] operator[SEP] identifier[LI] operator[SEP] identifier[getHyperLink] operator[SEP] identifier[link] , Keyword[new] identifier[StringContent] operator[SEP] identifier[utils] operator[SEP] identifier[getPackageName] operator[SEP] identifier[pkg] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[<] identifier[packages] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] {
identifier[li] operator[SEP] identifier[addContent] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ul] operator[SEP] identifier[addContent] operator[SEP] identifier[li] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP]
}
identifier[contentTree] operator[SEP] identifier[addContent] operator[SEP] identifier[ul] operator[SEP] operator[SEP]
}
}
|
public static void fill(Object entity) {
final Class<?> entityClass = entity.getClass();
if (N.isEntity(entityClass) == false) {
throw new IllegalArgumentException(entityClass.getCanonicalName() + " is not a valid entity class with property getter/setter method");
}
Type<Object> type = null;
Class<?> parameterClass = null;
Object propValue = null;
for (Method method : ClassUtil.getPropSetMethodList(entityClass).values()) {
parameterClass = method.getParameterTypes()[0];
type = N.typeOf(parameterClass);
if (String.class.equals(parameterClass)) {
propValue = N.uuid().substring(0, 16);
} else if (boolean.class.equals(parameterClass) || Boolean.class.equals(parameterClass)) {
propValue = RAND.nextInt() % 2 == 0 ? false : true;
} else if (char.class.equals(parameterClass) || Character.class.equals(parameterClass)) {
propValue = (char) ('a' + RAND.nextInt() % 26);
} else if (int.class.equals(parameterClass) || Integer.class.equals(parameterClass)) {
propValue = RAND.nextInt();
} else if (long.class.equals(parameterClass) || Long.class.equals(parameterClass)) {
propValue = RAND.nextLong();
} else if (float.class.equals(parameterClass) || Float.class.equals(parameterClass)) {
propValue = RAND.nextFloat();
} else if (double.class.equals(parameterClass) || Double.class.equals(parameterClass)) {
propValue = RAND.nextDouble();
} else if (byte.class.equals(parameterClass) || Byte.class.equals(parameterClass)) {
propValue = Integer.valueOf(RAND.nextInt()).byteValue();
} else if (short.class.equals(parameterClass) || Short.class.equals(parameterClass)) {
propValue = Integer.valueOf(RAND.nextInt()).shortValue();
} else if (Number.class.isAssignableFrom(parameterClass)) {
propValue = type.valueOf(String.valueOf(RAND.nextInt()));
} else if (java.util.Date.class.isAssignableFrom(parameterClass) || Calendar.class.isAssignableFrom(parameterClass)) {
propValue = type.valueOf(String.valueOf(System.currentTimeMillis()));
} else if (N.isEntity(parameterClass)) {
propValue = fill(parameterClass);
} else {
propValue = type.defaultValue();
}
ClassUtil.setPropValue(entity, method, propValue);
}
}
|
class class_name[name] begin[{]
method[fill, return_type[void], modifier[public static], parameter[entity]] begin[{]
local_variable[type[Class], entityClass]
if[binary_operation[call[N.isEntity, parameter[member[.entityClass]]], ==, literal[false]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCanonicalName, postfix_operators=[], prefix_operators=[], qualifier=entityClass, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is not a valid entity class with property getter/setter method"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Type], type]
local_variable[type[Class], parameterClass]
local_variable[type[Object], propValue]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=typeOf, postfix_operators=[], prefix_operators=[], qualifier=N, selectors=[], type_arguments=None)), label=None), IfStatement(condition=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), else_statement=IfStatement(condition=BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=boolean)), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Boolean, sub_type=None)), operator=||), else_statement=IfStatement(condition=BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=char)), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Character, sub_type=None)), operator=||), else_statement=IfStatement(condition=BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=int)), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None)), operator=||), else_statement=IfStatement(condition=BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=long)), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Long, sub_type=None)), operator=||), else_statement=IfStatement(condition=BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=float)), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Float, sub_type=None)), operator=||), else_statement=IfStatement(condition=BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=double)), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Double, sub_type=None)), operator=||), else_statement=IfStatement(condition=BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=byte)), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Byte, sub_type=None)), operator=||), else_statement=IfStatement(condition=BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=BasicType(dimensions=[], name=short)), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Short, sub_type=None)), operator=||), else_statement=IfStatement(condition=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Number, sub_type=None)), else_statement=IfStatement(condition=BinaryOperation(operandl=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=java.util, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None)), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Calendar, sub_type=None)), operator=||), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isEntity, postfix_operators=[], prefix_operators=[], qualifier=N, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=defaultValue, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=parameterClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fill, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=RAND, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=RAND, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[MethodInvocation(arguments=[], member=shortValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=RAND, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[MethodInvocation(arguments=[], member=byteValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=nextDouble, postfix_operators=[], prefix_operators=[], qualifier=RAND, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=nextFloat, postfix_operators=[], prefix_operators=[], qualifier=RAND, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=nextLong, postfix_operators=[], prefix_operators=[], qualifier=RAND, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=RAND, selectors=[], type_arguments=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='a'), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=RAND, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=26), operator=%), operator=+), type=BasicType(dimensions=[], name=char))), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=RAND, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=%), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false))), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=uuid, postfix_operators=[], prefix_operators=[], qualifier=N, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16)], member=substring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=propValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPropValue, postfix_operators=[], prefix_operators=[], qualifier=ClassUtil, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=entityClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPropSetMethodList, postfix_operators=[], prefix_operators=[], qualifier=ClassUtil, selectors=[MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[fill] operator[SEP] identifier[Object] identifier[entity] operator[SEP] {
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[entityClass] operator[=] identifier[entity] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[N] operator[SEP] identifier[isEntity] operator[SEP] identifier[entityClass] operator[SEP] operator[==] literal[boolean] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[entityClass] operator[SEP] identifier[getCanonicalName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[Type] operator[<] identifier[Object] operator[>] identifier[type] operator[=] Other[null] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[parameterClass] operator[=] Other[null] operator[SEP] identifier[Object] identifier[propValue] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[Method] identifier[method] operator[:] identifier[ClassUtil] operator[SEP] identifier[getPropSetMethodList] operator[SEP] identifier[entityClass] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[parameterClass] operator[=] identifier[method] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[type] operator[=] identifier[N] operator[SEP] identifier[typeOf] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[N] operator[SEP] identifier[uuid] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[0] , Other[16] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[boolean] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[||] identifier[Boolean] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[RAND] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[%] Other[2] operator[==] Other[0] operator[?] literal[boolean] operator[:] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[char] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[||] identifier[Character] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] literal[String] operator[+] identifier[RAND] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[%] Other[26] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[int] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[||] identifier[Integer] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[RAND] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[long] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[||] identifier[Long] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[RAND] operator[SEP] identifier[nextLong] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[float] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[||] identifier[Float] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[RAND] operator[SEP] identifier[nextFloat] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[double] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[||] identifier[Double] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[RAND] operator[SEP] identifier[nextDouble] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[byte] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[||] identifier[Byte] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[RAND] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[byteValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[short] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[||] identifier[Short] operator[SEP] Keyword[class] operator[SEP] identifier[equals] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[RAND] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[shortValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[Number] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[type] operator[SEP] identifier[valueOf] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[RAND] operator[SEP] identifier[nextInt] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Date] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[parameterClass] operator[SEP] operator[||] identifier[Calendar] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[type] operator[SEP] identifier[valueOf] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[N] operator[SEP] identifier[isEntity] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP] {
identifier[propValue] operator[=] identifier[fill] operator[SEP] identifier[parameterClass] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[propValue] operator[=] identifier[type] operator[SEP] identifier[defaultValue] operator[SEP] operator[SEP] operator[SEP]
}
identifier[ClassUtil] operator[SEP] identifier[setPropValue] operator[SEP] identifier[entity] , identifier[method] , identifier[propValue] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("unchecked")
public Class<? extends T> defineClass() {
if (generatedClass == null) {
synchronized (this) {
if (generatedClass == null) {
try {
// first check that the proxy has not already been created
generatedClass = (Class<? extends T>) classLoader.loadClass(this.className);
} catch (ClassNotFoundException e) {
buildClassDefinition();
if (protectionDomain == null) {
generatedClass = (Class<? extends T>) classFile.define();
} else {
generatedClass = (Class<? extends T>) classFile.define(protectionDomain);
}
afterClassLoad(generatedClass);
}
classFile = null;
}
}
}
return generatedClass;
}
|
class class_name[name] begin[{]
method[defineClass, return_type[type[Class]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.generatedClass], ==, literal[null]]] begin[{]
SYNCHRONIZED[THIS[]] BEGIN[{]
if[binary_operation[member[.generatedClass], ==, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=generatedClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=className, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=loadClass, postfix_operators=[], prefix_operators=[], qualifier=classLoader, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Class, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=buildClassDefinition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=protectionDomain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=generatedClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=protectionDomain, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=define, postfix_operators=[], prefix_operators=[], qualifier=classFile, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Class, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=generatedClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=define, postfix_operators=[], prefix_operators=[], qualifier=classFile, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Class, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=generatedClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=afterClassLoad, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
assign[member[.classFile], literal[null]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
return[member[.generatedClass]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] identifier[defineClass] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[generatedClass] operator[==] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] identifier[generatedClass] operator[==] Other[null] operator[SEP] {
Keyword[try] {
identifier[generatedClass] operator[=] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] operator[SEP] identifier[classLoader] operator[SEP] identifier[loadClass] operator[SEP] Keyword[this] operator[SEP] identifier[className] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
identifier[buildClassDefinition] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[protectionDomain] operator[==] Other[null] operator[SEP] {
identifier[generatedClass] operator[=] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] operator[SEP] identifier[classFile] operator[SEP] identifier[define] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[generatedClass] operator[=] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] operator[SEP] identifier[classFile] operator[SEP] identifier[define] operator[SEP] identifier[protectionDomain] operator[SEP] operator[SEP]
}
identifier[afterClassLoad] operator[SEP] identifier[generatedClass] operator[SEP] operator[SEP]
}
identifier[classFile] operator[=] Other[null] operator[SEP]
}
}
}
Keyword[return] identifier[generatedClass] operator[SEP]
}
|
public static JavaRDD<String> listPaths(JavaSparkContext sc, String path, boolean recursive, Set<String> allowedExtensions) throws IOException {
return listPaths(sc, path, recursive, allowedExtensions, sc.hadoopConfiguration());
}
|
class class_name[name] begin[{]
method[listPaths, return_type[type[JavaRDD]], modifier[public static], parameter[sc, path, recursive, allowedExtensions]] begin[{]
return[call[.listPaths, parameter[member[.sc], member[.path], member[.recursive], member[.allowedExtensions], call[sc.hadoopConfiguration, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[JavaRDD] operator[<] identifier[String] operator[>] identifier[listPaths] operator[SEP] identifier[JavaSparkContext] identifier[sc] , identifier[String] identifier[path] , Keyword[boolean] identifier[recursive] , identifier[Set] operator[<] identifier[String] operator[>] identifier[allowedExtensions] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[listPaths] operator[SEP] identifier[sc] , identifier[path] , identifier[recursive] , identifier[allowedExtensions] , identifier[sc] operator[SEP] identifier[hadoopConfiguration] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public CalendarDays plus(CalendarDays other) {
return CalendarDays.of(Math.addExact(this.days, other.days));
}
|
class class_name[name] begin[{]
method[plus, return_type[type[CalendarDays]], modifier[public], parameter[other]] begin[{]
return[call[CalendarDays.of, parameter[call[Math.addExact, parameter[THIS[member[None.days]], member[other.days]]]]]]
end[}]
END[}]
|
Keyword[public] identifier[CalendarDays] identifier[plus] operator[SEP] identifier[CalendarDays] identifier[other] operator[SEP] {
Keyword[return] identifier[CalendarDays] operator[SEP] identifier[of] operator[SEP] identifier[Math] operator[SEP] identifier[addExact] operator[SEP] Keyword[this] operator[SEP] identifier[days] , identifier[other] operator[SEP] identifier[days] operator[SEP] operator[SEP] operator[SEP]
}
|
@SneakyThrows
protected String generateToken(final Service service, final Map<String, String> parameters) {
val ticketId = parameters.get(CasProtocolConstants.PARAMETER_TICKET);
return this.tokenTicketBuilder.build(ticketId, service);
}
|
class class_name[name] begin[{]
method[generateToken, return_type[type[String]], modifier[protected], parameter[service, parameters]] begin[{]
local_variable[type[val], ticketId]
return[THIS[member[None.tokenTicketBuilder]call[None.build, parameter[member[.ticketId], member[.service]]]]]
end[}]
END[}]
|
annotation[@] identifier[SneakyThrows] Keyword[protected] identifier[String] identifier[generateToken] operator[SEP] Keyword[final] identifier[Service] identifier[service] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[parameters] operator[SEP] {
identifier[val] identifier[ticketId] operator[=] identifier[parameters] operator[SEP] identifier[get] operator[SEP] identifier[CasProtocolConstants] operator[SEP] identifier[PARAMETER_TICKET] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[tokenTicketBuilder] operator[SEP] identifier[build] operator[SEP] identifier[ticketId] , identifier[service] operator[SEP] operator[SEP]
}
|
public static double[] add(double[] array, double element) {
double[] newArray = (double[])copyArrayGrow1(array, Double.TYPE);
newArray[newArray.length - 1] = element;
return newArray;
}
|
class class_name[name] begin[{]
method[add, return_type[type[double]], modifier[public static], parameter[array, element]] begin[{]
local_variable[type[double], newArray]
assign[member[.newArray], member[.element]]
return[member[.newArray]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[double] operator[SEP] operator[SEP] identifier[add] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[array] , Keyword[double] identifier[element] operator[SEP] {
Keyword[double] operator[SEP] operator[SEP] identifier[newArray] operator[=] operator[SEP] Keyword[double] operator[SEP] operator[SEP] operator[SEP] identifier[copyArrayGrow1] operator[SEP] identifier[array] , identifier[Double] operator[SEP] identifier[TYPE] operator[SEP] operator[SEP] identifier[newArray] operator[SEP] identifier[newArray] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[=] identifier[element] operator[SEP] Keyword[return] identifier[newArray] operator[SEP]
}
|
private void showErrorText(@Nullable final CharSequence errorText) {
if (textInputLayout != null) {
if (TextUtils.isEmpty(errorText)) {
textInputLayout.setError(null);
textInputLayout.setErrorEnabled(false);
adaptHelperTextColor();
} else {
textInputLayout.setHelperText(null);
textInputLayout.setHelperTextEnabled(false);
textInputLayout.setError(errorText);
textInputLayout.setErrorEnabled(true);
}
}
}
|
class class_name[name] begin[{]
method[showErrorText, return_type[void], modifier[private], parameter[errorText]] begin[{]
if[binary_operation[member[.textInputLayout], !=, literal[null]]] begin[{]
if[call[TextUtils.isEmpty, parameter[member[.errorText]]]] begin[{]
call[textInputLayout.setError, parameter[literal[null]]]
call[textInputLayout.setErrorEnabled, parameter[literal[false]]]
call[.adaptHelperTextColor, parameter[]]
else begin[{]
call[textInputLayout.setHelperText, parameter[literal[null]]]
call[textInputLayout.setHelperTextEnabled, parameter[literal[false]]]
call[textInputLayout.setError, parameter[member[.errorText]]]
call[textInputLayout.setErrorEnabled, parameter[literal[true]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[showErrorText] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[CharSequence] identifier[errorText] operator[SEP] {
Keyword[if] operator[SEP] identifier[textInputLayout] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[TextUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[errorText] operator[SEP] operator[SEP] {
identifier[textInputLayout] operator[SEP] identifier[setError] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[textInputLayout] operator[SEP] identifier[setErrorEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[adaptHelperTextColor] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[textInputLayout] operator[SEP] identifier[setHelperText] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[textInputLayout] operator[SEP] identifier[setHelperTextEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[textInputLayout] operator[SEP] identifier[setError] operator[SEP] identifier[errorText] operator[SEP] operator[SEP] identifier[textInputLayout] operator[SEP] identifier[setErrorEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
}
|
public static String propToColumn(String propName) {
char[] arr = propName.toCharArray();
for(int i = 0; i < arr.length; i++) {
if(Character.isUpperCase(arr[i])) {
String s1 = propName.substring(0, i);
String s = "_" + Character.toLowerCase(arr[i]);
String s2 = propName.substring(i+1);
return propToColumn(s1 + s + s2);
}
}
return propName;
}
|
class class_name[name] begin[{]
method[propToColumn, return_type[type[String]], modifier[public static], parameter[propName]] begin[{]
local_variable[type[char], arr]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=arr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=isUpperCase, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None), 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), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=propName, selectors=[], type_arguments=None), name=s1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="_"), operandr=MethodInvocation(arguments=[MemberReference(member=arr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=toLowerCase, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None), operator=+), name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=propName, selectors=[], type_arguments=None), name=s2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=s1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=MemberReference(member=s2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=propToColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=arr, 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[.propName]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[propToColumn] operator[SEP] identifier[String] identifier[propName] operator[SEP] {
Keyword[char] operator[SEP] operator[SEP] identifier[arr] operator[=] identifier[propName] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[arr] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[Character] operator[SEP] identifier[isUpperCase] operator[SEP] identifier[arr] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[s1] operator[=] identifier[propName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[i] operator[SEP] operator[SEP] identifier[String] identifier[s] operator[=] literal[String] operator[+] identifier[Character] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[arr] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[s2] operator[=] identifier[propName] operator[SEP] identifier[substring] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[return] identifier[propToColumn] operator[SEP] identifier[s1] operator[+] identifier[s] operator[+] identifier[s2] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[propName] operator[SEP]
}
|
protected static double computeH(final int i, double[] dist_i, double[] pij_i, double mbeta) {
double sumP = 0.;
// Skip point "i", break loop in two:
for(int j = 0; j < i; j++) {
sumP += (pij_i[j] = FastMath.exp(dist_i[j] * mbeta));
}
for(int j = i + 1; j < dist_i.length; j++) {
sumP += (pij_i[j] = FastMath.exp(dist_i[j] * mbeta));
}
if(!(sumP > 0)) {
// All pij are zero. Bad news.
return Double.NEGATIVE_INFINITY;
}
final double s = 1. / sumP; // Scaling factor
double sum = 0.;
// While we could skip pi[i], it should be 0 anyway.
for(int j = 0; j < dist_i.length; j++) {
sum += dist_i[j] * (pij_i[j] *= s);
}
return FastMath.log(sumP) - mbeta * sum;
}
|
class class_name[name] begin[{]
method[computeH, return_type[type[double]], modifier[static protected], parameter[i, dist_i, pij_i, mbeta]] begin[{]
local_variable[type[double], sumP]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sumP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Assignment(expressionl=MemberReference(member=pij_i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=dist_i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=mbeta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)], member=exp, postfix_operators=[], prefix_operators=[], qualifier=FastMath, selectors=[], type_arguments=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, 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)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sumP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Assignment(expressionl=MemberReference(member=pij_i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=dist_i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=mbeta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)], member=exp, postfix_operators=[], prefix_operators=[], qualifier=FastMath, selectors=[], type_arguments=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=dist_i, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[member[.sumP], >, literal[0]]] begin[{]
return[member[Double.NEGATIVE_INFINITY]]
else begin[{]
None
end[}]
local_variable[type[double], s]
local_variable[type[double], sum]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=dist_i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Assignment(expressionl=MemberReference(member=pij_i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=*=, value=MemberReference(member=s, 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=length, postfix_operators=[], prefix_operators=[], qualifier=dist_i, 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)
return[binary_operation[call[FastMath.log, parameter[member[.sumP]]], -, binary_operation[member[.mbeta], *, member[.sum]]]]
end[}]
END[}]
|
Keyword[protected] Keyword[static] Keyword[double] identifier[computeH] operator[SEP] Keyword[final] Keyword[int] identifier[i] , Keyword[double] operator[SEP] operator[SEP] identifier[dist_i] , Keyword[double] operator[SEP] operator[SEP] identifier[pij_i] , Keyword[double] identifier[mbeta] operator[SEP] {
Keyword[double] identifier[sumP] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[i] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[sumP] operator[+=] operator[SEP] identifier[pij_i] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[FastMath] operator[SEP] identifier[exp] operator[SEP] identifier[dist_i] operator[SEP] identifier[j] operator[SEP] operator[*] identifier[mbeta] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[i] operator[+] Other[1] operator[SEP] identifier[j] operator[<] identifier[dist_i] operator[SEP] identifier[length] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[sumP] operator[+=] operator[SEP] identifier[pij_i] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[FastMath] operator[SEP] identifier[exp] operator[SEP] identifier[dist_i] operator[SEP] identifier[j] operator[SEP] operator[*] identifier[mbeta] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[sumP] operator[>] Other[0] operator[SEP] operator[SEP] {
Keyword[return] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP]
}
Keyword[final] Keyword[double] identifier[s] operator[=] literal[Float] operator[/] identifier[sumP] operator[SEP] Keyword[double] identifier[sum] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[dist_i] operator[SEP] identifier[length] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[sum] operator[+=] identifier[dist_i] operator[SEP] identifier[j] operator[SEP] operator[*] operator[SEP] identifier[pij_i] operator[SEP] identifier[j] operator[SEP] operator[*=] identifier[s] operator[SEP] operator[SEP]
}
Keyword[return] identifier[FastMath] operator[SEP] identifier[log] operator[SEP] identifier[sumP] operator[SEP] operator[-] identifier[mbeta] operator[*] identifier[sum] operator[SEP]
}
|
public static List<Class> resolveHierarchy(Class<?> type) {
Class<?> superclass = type.getSuperclass();
List<Class> hierarchy = new ArrayList<>();
if (superclass != null) {
populateHierarchyInterfaces(type, hierarchy);
while (superclass != Object.class) {
populateHierarchyInterfaces(superclass, hierarchy);
superclass = superclass.getSuperclass();
}
} else if (type.isInterface()) {
populateHierarchyInterfaces(type, hierarchy);
}
if (type.isArray()) {
if (!type.getComponentType().isPrimitive()) {
hierarchy.add(Object[].class);
}
} else {
hierarchy.add(Object.class);
}
return hierarchy;
}
|
class class_name[name] begin[{]
method[resolveHierarchy, return_type[type[List]], modifier[public static], parameter[type]] begin[{]
local_variable[type[Class], superclass]
local_variable[type[List], hierarchy]
if[binary_operation[member[.superclass], !=, literal[null]]] begin[{]
call[.populateHierarchyInterfaces, parameter[member[.type], member[.hierarchy]]]
while[binary_operation[member[.superclass], !=, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]] begin[{]
call[.populateHierarchyInterfaces, parameter[member[.superclass], member[.hierarchy]]]
assign[member[.superclass], call[superclass.getSuperclass, parameter[]]]
end[}]
else begin[{]
if[call[type.isInterface, parameter[]]] begin[{]
call[.populateHierarchyInterfaces, parameter[member[.type], member[.hierarchy]]]
else begin[{]
None
end[}]
end[}]
if[call[type.isArray, parameter[]]] begin[{]
if[call[type.getComponentType, parameter[]]] begin[{]
call[hierarchy.add, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
else begin[{]
call[hierarchy.add, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
end[}]
return[member[.hierarchy]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[Class] operator[>] identifier[resolveHierarchy] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[SEP] {
identifier[Class] operator[<] operator[?] operator[>] identifier[superclass] operator[=] identifier[type] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Class] operator[>] identifier[hierarchy] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[superclass] operator[!=] Other[null] operator[SEP] {
identifier[populateHierarchyInterfaces] operator[SEP] identifier[type] , identifier[hierarchy] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[superclass] operator[!=] identifier[Object] operator[SEP] Keyword[class] operator[SEP] {
identifier[populateHierarchyInterfaces] operator[SEP] identifier[superclass] , identifier[hierarchy] operator[SEP] operator[SEP] identifier[superclass] operator[=] identifier[superclass] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[SEP] {
identifier[populateHierarchyInterfaces] operator[SEP] identifier[type] , identifier[hierarchy] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[type] operator[SEP] identifier[getComponentType] operator[SEP] operator[SEP] operator[SEP] identifier[isPrimitive] operator[SEP] operator[SEP] operator[SEP] {
identifier[hierarchy] operator[SEP] identifier[add] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[hierarchy] operator[SEP] identifier[add] operator[SEP] identifier[Object] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
Keyword[return] identifier[hierarchy] operator[SEP]
}
|
private static ImageDescriptor createUnManagedCached(String prefix,
String name)
{
return new CachedImageDescriptor(create(prefix, name, true));
}
|
class class_name[name] begin[{]
method[createUnManagedCached, return_type[type[ImageDescriptor]], modifier[private static], parameter[prefix, name]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=create, 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=CachedImageDescriptor, sub_type=None))]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[ImageDescriptor] identifier[createUnManagedCached] operator[SEP] identifier[String] identifier[prefix] , identifier[String] identifier[name] operator[SEP] {
Keyword[return] Keyword[new] identifier[CachedImageDescriptor] operator[SEP] identifier[create] operator[SEP] identifier[prefix] , identifier[name] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void encodeBegin(FacesContext context) throws IOException {
// Initialize attributes
String src = (String) getAttributes().get("src");
// src is mandatory
if (null == src)
throw new IllegalStateException("The src attribute is mandatory for the Jawr image path tag. ");
HttpServletRequest request = ((HttpServletRequest) context.getExternalContext().getRequest());
BinaryResourcesHandler imgRsHandler = getBinaryResourcesHandler(context);
// Refresh the config if needed
RendererRequestUtils.refreshConfigIfNeeded(request, imgRsHandler.getConfig());
render(context);
super.encodeBegin(context);
// Reset the Thread local for the Jawr context
ThreadLocalJawrContext.reset();
}
|
class class_name[name] begin[{]
method[encodeBegin, return_type[void], modifier[public], parameter[context]] begin[{]
local_variable[type[String], src]
if[binary_operation[literal[null], ==, member[.src]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The src attribute is mandatory for the Jawr image path tag. ")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[HttpServletRequest], request]
local_variable[type[BinaryResourcesHandler], imgRsHandler]
call[RendererRequestUtils.refreshConfigIfNeeded, parameter[member[.request], call[imgRsHandler.getConfig, parameter[]]]]
call[.render, parameter[member[.context]]]
SuperMethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encodeBegin, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[ThreadLocalJawrContext.reset, parameter[]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[encodeBegin] operator[SEP] identifier[FacesContext] identifier[context] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[src] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[src] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[HttpServletRequest] identifier[request] operator[=] operator[SEP] operator[SEP] identifier[HttpServletRequest] operator[SEP] identifier[context] operator[SEP] identifier[getExternalContext] operator[SEP] operator[SEP] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[BinaryResourcesHandler] identifier[imgRsHandler] operator[=] identifier[getBinaryResourcesHandler] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[RendererRequestUtils] operator[SEP] identifier[refreshConfigIfNeeded] operator[SEP] identifier[request] , identifier[imgRsHandler] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[render] operator[SEP] identifier[context] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[encodeBegin] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[ThreadLocalJawrContext] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP]
}
|
public float[] DM_RPKG(int isword, int nword, int decimalScale)
throws IOException {
// from DM_RPKG
// read the data packing type
float[] data;
int ipktyp = DM_RINT(isword);
int iiword = isword + 1;
int lendat = nword - 1;
if (ipktyp == MDGNON) { // no packing
data = new float[lendat];
DM_RFLT(iiword, data);
return data;
}
int iiw;
int irw;
if (ipktyp == MDGDIF) {
iiw = 4;
irw = 3;
} else if (ipktyp == MDGRB2) {
iiw = 4;
irw = 1;
} else {
iiw = 3;
irw = 2;
}
int[] iarray = new int[iiw];
float[] rarray = new float[irw];
DM_RINT(iiword, iarray);
iiword = iiword + iiw;
lendat = lendat - iiw;
DM_RFLT(iiword, rarray);
iiword = iiword + irw;
lendat = lendat - irw;
if (ipktyp == MDGRB2) {
data = unpackGrib2Data(iiword, lendat, iarray, rarray);
return data;
}
int nbits = iarray[0];
int misflg = iarray[1];
boolean miss = misflg != 0;
int kxky = iarray[2];
// int mword = kxky;
int kx = 0;
if (iiw == 4) {
kx = iarray[3];
}
float ref = rarray[0];
float scale = rarray[1];
float difmin = 0;
if (irw == 3) {
difmin = rarray[2];
}
data = unpackData(iiword, lendat, ipktyp, kxky, nbits, ref, scale,
miss, difmin, kx, decimalScale);
return data;
}
|
class class_name[name] begin[{]
method[DM_RPKG, return_type[type[float]], modifier[public], parameter[isword, nword, decimalScale]] begin[{]
local_variable[type[float], data]
local_variable[type[int], ipktyp]
local_variable[type[int], iiword]
local_variable[type[int], lendat]
if[binary_operation[member[.ipktyp], ==, member[.MDGNON]]] begin[{]
assign[member[.data], ArrayCreator(dimensions=[MemberReference(member=lendat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=float))]
call[.DM_RFLT, parameter[member[.iiword], member[.data]]]
return[member[.data]]
else begin[{]
None
end[}]
local_variable[type[int], iiw]
local_variable[type[int], irw]
if[binary_operation[member[.ipktyp], ==, member[.MDGDIF]]] begin[{]
assign[member[.iiw], literal[4]]
assign[member[.irw], literal[3]]
else begin[{]
if[binary_operation[member[.ipktyp], ==, member[.MDGRB2]]] begin[{]
assign[member[.iiw], literal[4]]
assign[member[.irw], literal[1]]
else begin[{]
assign[member[.iiw], literal[3]]
assign[member[.irw], literal[2]]
end[}]
end[}]
local_variable[type[int], iarray]
local_variable[type[float], rarray]
call[.DM_RINT, parameter[member[.iiword], member[.iarray]]]
assign[member[.iiword], binary_operation[member[.iiword], +, member[.iiw]]]
assign[member[.lendat], binary_operation[member[.lendat], -, member[.iiw]]]
call[.DM_RFLT, parameter[member[.iiword], member[.rarray]]]
assign[member[.iiword], binary_operation[member[.iiword], +, member[.irw]]]
assign[member[.lendat], binary_operation[member[.lendat], -, member[.irw]]]
if[binary_operation[member[.ipktyp], ==, member[.MDGRB2]]] begin[{]
assign[member[.data], call[.unpackGrib2Data, parameter[member[.iiword], member[.lendat], member[.iarray], member[.rarray]]]]
return[member[.data]]
else begin[{]
None
end[}]
local_variable[type[int], nbits]
local_variable[type[int], misflg]
local_variable[type[boolean], miss]
local_variable[type[int], kxky]
local_variable[type[int], kx]
if[binary_operation[member[.iiw], ==, literal[4]]] begin[{]
assign[member[.kx], member[.iarray]]
else begin[{]
None
end[}]
local_variable[type[float], ref]
local_variable[type[float], scale]
local_variable[type[float], difmin]
if[binary_operation[member[.irw], ==, literal[3]]] begin[{]
assign[member[.difmin], member[.rarray]]
else begin[{]
None
end[}]
assign[member[.data], call[.unpackData, parameter[member[.iiword], member[.lendat], member[.ipktyp], member[.kxky], member[.nbits], member[.ref], member[.scale], member[.miss], member[.difmin], member[.kx], member[.decimalScale]]]]
return[member[.data]]
end[}]
END[}]
|
Keyword[public] Keyword[float] operator[SEP] operator[SEP] identifier[DM_RPKG] operator[SEP] Keyword[int] identifier[isword] , Keyword[int] identifier[nword] , Keyword[int] identifier[decimalScale] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[float] operator[SEP] operator[SEP] identifier[data] operator[SEP] Keyword[int] identifier[ipktyp] operator[=] identifier[DM_RINT] operator[SEP] identifier[isword] operator[SEP] operator[SEP] Keyword[int] identifier[iiword] operator[=] identifier[isword] operator[+] Other[1] operator[SEP] Keyword[int] identifier[lendat] operator[=] identifier[nword] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[ipktyp] operator[==] identifier[MDGNON] operator[SEP] {
identifier[data] operator[=] Keyword[new] Keyword[float] operator[SEP] identifier[lendat] operator[SEP] operator[SEP] identifier[DM_RFLT] operator[SEP] identifier[iiword] , identifier[data] operator[SEP] operator[SEP] Keyword[return] identifier[data] operator[SEP]
}
Keyword[int] identifier[iiw] operator[SEP] Keyword[int] identifier[irw] operator[SEP] Keyword[if] operator[SEP] identifier[ipktyp] operator[==] identifier[MDGDIF] operator[SEP] {
identifier[iiw] operator[=] Other[4] operator[SEP] identifier[irw] operator[=] Other[3] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ipktyp] operator[==] identifier[MDGRB2] operator[SEP] {
identifier[iiw] operator[=] Other[4] operator[SEP] identifier[irw] operator[=] Other[1] operator[SEP]
}
Keyword[else] {
identifier[iiw] operator[=] Other[3] operator[SEP] identifier[irw] operator[=] Other[2] operator[SEP]
}
Keyword[int] operator[SEP] operator[SEP] identifier[iarray] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[iiw] operator[SEP] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[rarray] operator[=] Keyword[new] Keyword[float] operator[SEP] identifier[irw] operator[SEP] operator[SEP] identifier[DM_RINT] operator[SEP] identifier[iiword] , identifier[iarray] operator[SEP] operator[SEP] identifier[iiword] operator[=] identifier[iiword] operator[+] identifier[iiw] operator[SEP] identifier[lendat] operator[=] identifier[lendat] operator[-] identifier[iiw] operator[SEP] identifier[DM_RFLT] operator[SEP] identifier[iiword] , identifier[rarray] operator[SEP] operator[SEP] identifier[iiword] operator[=] identifier[iiword] operator[+] identifier[irw] operator[SEP] identifier[lendat] operator[=] identifier[lendat] operator[-] identifier[irw] operator[SEP] Keyword[if] operator[SEP] identifier[ipktyp] operator[==] identifier[MDGRB2] operator[SEP] {
identifier[data] operator[=] identifier[unpackGrib2Data] operator[SEP] identifier[iiword] , identifier[lendat] , identifier[iarray] , identifier[rarray] operator[SEP] operator[SEP] Keyword[return] identifier[data] operator[SEP]
}
Keyword[int] identifier[nbits] operator[=] identifier[iarray] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] identifier[misflg] operator[=] identifier[iarray] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[boolean] identifier[miss] operator[=] identifier[misflg] operator[!=] Other[0] operator[SEP] Keyword[int] identifier[kxky] operator[=] identifier[iarray] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[int] identifier[kx] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[iiw] operator[==] Other[4] operator[SEP] {
identifier[kx] operator[=] identifier[iarray] operator[SEP] Other[3] operator[SEP] operator[SEP]
}
Keyword[float] identifier[ref] operator[=] identifier[rarray] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[float] identifier[scale] operator[=] identifier[rarray] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[float] identifier[difmin] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[irw] operator[==] Other[3] operator[SEP] {
identifier[difmin] operator[=] identifier[rarray] operator[SEP] Other[2] operator[SEP] operator[SEP]
}
identifier[data] operator[=] identifier[unpackData] operator[SEP] identifier[iiword] , identifier[lendat] , identifier[ipktyp] , identifier[kxky] , identifier[nbits] , identifier[ref] , identifier[scale] , identifier[miss] , identifier[difmin] , identifier[kx] , identifier[decimalScale] operator[SEP] operator[SEP] Keyword[return] identifier[data] operator[SEP]
}
|
public static <T> Set<T> minus(Set<T> self, Object removeMe) {
Comparator comparator = (self instanceof SortedSet) ? ((SortedSet) self).comparator() : null;
final Set<T> ansSet = createSimilarSet(self);
for (T t : self) {
boolean areEqual = (comparator != null)? (comparator.compare(t, removeMe) == 0) : coercedEquals(t, removeMe);
if (!areEqual) ansSet.add(t);
}
return ansSet;
}
|
class class_name[name] begin[{]
method[minus, return_type[type[Set]], modifier[public static], parameter[self, removeMe]] begin[{]
local_variable[type[Comparator], comparator]
local_variable[type[Set], ansSet]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=comparator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=removeMe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=coercedEquals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=removeMe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compare, postfix_operators=[], prefix_operators=[], qualifier=comparator, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===)), name=areEqual)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MemberReference(member=areEqual, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=ansSet, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=self, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))), label=None)
return[member[.ansSet]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Set] operator[<] identifier[T] operator[>] identifier[minus] operator[SEP] identifier[Set] operator[<] identifier[T] operator[>] identifier[self] , identifier[Object] identifier[removeMe] operator[SEP] {
identifier[Comparator] identifier[comparator] operator[=] operator[SEP] identifier[self] Keyword[instanceof] identifier[SortedSet] operator[SEP] operator[?] operator[SEP] operator[SEP] identifier[SortedSet] operator[SEP] identifier[self] operator[SEP] operator[SEP] identifier[comparator] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[T] operator[>] identifier[ansSet] operator[=] identifier[createSimilarSet] operator[SEP] identifier[self] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[T] identifier[t] operator[:] identifier[self] operator[SEP] {
Keyword[boolean] identifier[areEqual] operator[=] operator[SEP] identifier[comparator] operator[!=] Other[null] operator[SEP] operator[?] operator[SEP] identifier[comparator] operator[SEP] identifier[compare] operator[SEP] identifier[t] , identifier[removeMe] operator[SEP] operator[==] Other[0] operator[SEP] operator[:] identifier[coercedEquals] operator[SEP] identifier[t] , identifier[removeMe] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[areEqual] operator[SEP] identifier[ansSet] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ansSet] operator[SEP]
}
|
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
{
in.defaultReadObject();
byte[] tempEyeCatcher = new byte[Constants.EYE_CATCHER_LENGTH];
//d164415start
int bytesRead = 0;
for (int offset = 0; offset < Constants.EYE_CATCHER_LENGTH; offset += bytesRead)
{
bytesRead = in.read(tempEyeCatcher, offset, Constants.EYE_CATCHER_LENGTH - offset);
if (bytesRead == -1)
{
throw new IOException("end of input stream while reading eye catcher");
}
} //d164415 end
for (int i = 0; i < EYECATCHER.length; i++)
{
if (tempEyeCatcher[i] != EYECATCHER[i])
{
String eyeCatcherString = new String(tempEyeCatcher);
throw new IOException("Invalid eye catcher '" + eyeCatcherString + "' in handle input stream");
}
}
// Get websphere platform and version ID from header.
in.readShort(); // platform
ivActualVersion = in.readShort();
//d158086 added version checking
if ((ivActualVersion != Constants.HANDLE_V1) && (ivActualVersion != Constants.HANDLE_V2))
{
throw new java.io.InvalidObjectException("Handle data stream is not of the correct version, this client should be updated.");
}
//d158086
// Now read in EJBObject from the input stream using HandleDelegate object.
//d164668 allow 2nd change for type 1 handles. If stub doesn't connect use findby logic
try {
ivEjbObject = HandleHelper.lookupHandleDelegate().readEJBObject(in);
} catch (IOException ioe)
{
// FFDCFilter.processException(t, CLASS_NAME + "readObject", "406", this);
if (ivActualVersion != Constants.HANDLE_V1)
{
throw ioe;
}
}
// if actual version is version 1, then we need to read in the
// additional data.
if (ivActualVersion == Constants.HANDLE_V1)
{
// Null out the reference since we do not have a portable way
// of knowing whether reference was obtained from the ORB
// and the version ID indicates this is a non-robust
// handle. So, we need to force the getEJBObject method to
// get a new reference by looking up home and doing a find
// by primary key.
ivEjbObject = null; //p125891
ivHomeHandle = (HomeHandle) in.readObject();
ivKey = (Serializable) in.readObject();
}
}
|
class class_name[name] begin[{]
method[readObject, return_type[void], modifier[private], parameter[in]] begin[{]
call[in.defaultReadObject, parameter[]]
local_variable[type[byte], tempEyeCatcher]
local_variable[type[int], bytesRead]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bytesRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=tempEyeCatcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=EYE_CATCHER_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=read, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bytesRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="end of input stream while reading eye catcher")], 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)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=EYE_CATCHER_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=offset)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=bytesRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tempEyeCatcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=EYECATCHER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=tempEyeCatcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), name=eyeCatcherString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid eye catcher '"), operandr=MemberReference(member=eyeCatcherString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' in handle input stream"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=EYECATCHER, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[in.readShort, parameter[]]
assign[member[.ivActualVersion], call[in.readShort, parameter[]]]
if[binary_operation[binary_operation[member[.ivActualVersion], !=, member[Constants.HANDLE_V1]], &&, binary_operation[member[.ivActualVersion], !=, member[Constants.HANDLE_V2]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Handle data stream is not of the correct version, this client should be updated.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=io, sub_type=ReferenceType(arguments=None, dimensions=None, name=InvalidObjectException, sub_type=None)))), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ivEjbObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=lookupHandleDelegate, postfix_operators=[], prefix_operators=[], qualifier=HandleHelper, selectors=[MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readEJBObject, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ivActualVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=HANDLE_V1, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=ioe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ioe, types=['IOException']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.ivActualVersion], ==, member[Constants.HANDLE_V1]]] begin[{]
assign[member[.ivEjbObject], literal[null]]
assign[member[.ivHomeHandle], Cast(expression=MethodInvocation(arguments=[], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=HomeHandle, sub_type=None))]
assign[member[.ivKey], Cast(expression=MethodInvocation(arguments=[], member=readObject, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Serializable, sub_type=None))]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[readObject] operator[SEP] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[ObjectInputStream] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ClassNotFoundException] {
identifier[in] operator[SEP] identifier[defaultReadObject] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[tempEyeCatcher] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[Constants] operator[SEP] identifier[EYE_CATCHER_LENGTH] operator[SEP] operator[SEP] Keyword[int] identifier[bytesRead] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[offset] operator[=] Other[0] operator[SEP] identifier[offset] operator[<] identifier[Constants] operator[SEP] identifier[EYE_CATCHER_LENGTH] operator[SEP] identifier[offset] operator[+=] identifier[bytesRead] operator[SEP] {
identifier[bytesRead] operator[=] identifier[in] operator[SEP] identifier[read] operator[SEP] identifier[tempEyeCatcher] , identifier[offset] , identifier[Constants] operator[SEP] identifier[EYE_CATCHER_LENGTH] operator[-] identifier[offset] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bytesRead] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] 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[EYECATCHER] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[tempEyeCatcher] operator[SEP] identifier[i] operator[SEP] operator[!=] identifier[EYECATCHER] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
identifier[String] identifier[eyeCatcherString] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[tempEyeCatcher] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[eyeCatcherString] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
identifier[in] operator[SEP] identifier[readShort] operator[SEP] operator[SEP] operator[SEP] identifier[ivActualVersion] operator[=] identifier[in] operator[SEP] identifier[readShort] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[ivActualVersion] operator[!=] identifier[Constants] operator[SEP] identifier[HANDLE_V1] operator[SEP] operator[&&] operator[SEP] identifier[ivActualVersion] operator[!=] identifier[Constants] operator[SEP] identifier[HANDLE_V2] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[InvalidObjectException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[ivEjbObject] operator[=] identifier[HandleHelper] operator[SEP] identifier[lookupHandleDelegate] operator[SEP] operator[SEP] operator[SEP] identifier[readEJBObject] operator[SEP] identifier[in] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ioe] operator[SEP] {
Keyword[if] operator[SEP] identifier[ivActualVersion] operator[!=] identifier[Constants] operator[SEP] identifier[HANDLE_V1] operator[SEP] {
Keyword[throw] identifier[ioe] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[ivActualVersion] operator[==] identifier[Constants] operator[SEP] identifier[HANDLE_V1] operator[SEP] {
identifier[ivEjbObject] operator[=] Other[null] operator[SEP] identifier[ivHomeHandle] operator[=] operator[SEP] identifier[HomeHandle] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP] identifier[ivKey] operator[=] operator[SEP] identifier[Serializable] operator[SEP] identifier[in] operator[SEP] identifier[readObject] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public void visitSelect(JCFieldAccess tree) {
if (context == null || !analyzer.lambdaFieldAccessFilter(tree)) {
super.visitSelect(tree);
} else {
int prevPos = make.pos;
try {
make.at(tree);
LambdaTranslationContext lambdaContext = (LambdaTranslationContext) context;
JCTree ltree = lambdaContext.translate(tree);
if (ltree != null) {
result = ltree;
} else {
super.visitSelect(tree);
}
} finally {
make.at(prevPos);
}
}
}
|
class class_name[name] begin[{]
method[visitSelect, return_type[void], modifier[public], parameter[tree]] begin[{]
if[binary_operation[binary_operation[member[.context], ==, literal[null]], ||, call[analyzer.lambdaFieldAccessFilter, parameter[member[.tree]]]]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=visitSelect, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
else begin[{]
local_variable[type[int], prevPos]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=at, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LambdaTranslationContext, sub_type=None)), name=lambdaContext)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LambdaTranslationContext, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=translate, postfix_operators=[], prefix_operators=[], qualifier=lambdaContext, selectors=[], type_arguments=None), name=ltree)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCTree, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ltree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=SuperMethodInvocation(arguments=[MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=visitSelect, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ltree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=prevPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=at, postfix_operators=[], prefix_operators=[], qualifier=make, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[visitSelect] operator[SEP] identifier[JCFieldAccess] identifier[tree] operator[SEP] {
Keyword[if] operator[SEP] identifier[context] operator[==] Other[null] operator[||] operator[!] identifier[analyzer] operator[SEP] identifier[lambdaFieldAccessFilter] operator[SEP] identifier[tree] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[visitSelect] operator[SEP] identifier[tree] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[prevPos] operator[=] identifier[make] operator[SEP] identifier[pos] operator[SEP] Keyword[try] {
identifier[make] operator[SEP] identifier[at] operator[SEP] identifier[tree] operator[SEP] operator[SEP] identifier[LambdaTranslationContext] identifier[lambdaContext] operator[=] operator[SEP] identifier[LambdaTranslationContext] operator[SEP] identifier[context] operator[SEP] identifier[JCTree] identifier[ltree] operator[=] identifier[lambdaContext] operator[SEP] identifier[translate] operator[SEP] identifier[tree] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ltree] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[=] identifier[ltree] operator[SEP]
}
Keyword[else] {
Keyword[super] operator[SEP] identifier[visitSelect] operator[SEP] identifier[tree] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[make] operator[SEP] identifier[at] operator[SEP] identifier[prevPos] operator[SEP] operator[SEP]
}
}
}
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@JsonProperty("last_login")
public Date getLastLogin() {
return lastLogin;
}
|
class class_name[name] begin[{]
method[getLastLogin, return_type[type[Date]], modifier[public], parameter[]] begin[{]
return[member[.lastLogin]]
end[}]
END[}]
|
annotation[@] identifier[JsonFormat] operator[SEP] identifier[shape] operator[=] identifier[JsonFormat] operator[SEP] identifier[Shape] operator[SEP] identifier[STRING] , identifier[pattern] operator[=] literal[String] operator[SEP] annotation[@] identifier[JsonProperty] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Date] identifier[getLastLogin] operator[SEP] operator[SEP] {
Keyword[return] identifier[lastLogin] operator[SEP]
}
|
public static String deleteWhitespace(String str) {
if (isEmpty(str)) {
return str;
}
int sz = str.length();
char[] chs = new char[sz];
int count = 0;
for (int i = 0; i < sz; i++) {
if (!Character.isWhitespace(str.charAt(i))) {
chs[count++] = str.charAt(i);
}
}
if (count == sz) {
return str;
}
return new String(chs, 0, count);
}
|
class class_name[name] begin[{]
method[deleteWhitespace, return_type[type[String]], modifier[public static], parameter[str]] begin[{]
if[call[.isEmpty, parameter[member[.str]]]] begin[{]
return[member[.str]]
else begin[{]
None
end[}]
local_variable[type[int], sz]
local_variable[type[char], chs]
local_variable[type[int], count]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)], member=isWhitespace, postfix_operators=[], prefix_operators=['!'], qualifier=Character, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=chs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=count, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=sz, 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)
if[binary_operation[member[.count], ==, member[.sz]]] begin[{]
return[member[.str]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=chs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[deleteWhitespace] operator[SEP] identifier[String] identifier[str] operator[SEP] {
Keyword[if] operator[SEP] identifier[isEmpty] operator[SEP] identifier[str] operator[SEP] operator[SEP] {
Keyword[return] identifier[str] operator[SEP]
}
Keyword[int] identifier[sz] operator[=] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[chs] operator[=] Keyword[new] Keyword[char] operator[SEP] identifier[sz] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[sz] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[Character] operator[SEP] identifier[isWhitespace] operator[SEP] identifier[str] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
identifier[chs] operator[SEP] identifier[count] operator[++] operator[SEP] operator[=] identifier[str] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[count] operator[==] identifier[sz] operator[SEP] {
Keyword[return] identifier[str] operator[SEP]
}
Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[chs] , Other[0] , identifier[count] operator[SEP] operator[SEP]
}
|
public synchronized int getSize() {
try {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ObjectOutputStream oOut = new ObjectOutputStream(bOut);
oOut.writeObject(historyStore);
bOut.close();
return bOut.size();
} catch (IOException e) {
throw new IllegalStateException("Cannot serialize internal store: " + e,e);
}
}
|
class class_name[name] begin[{]
method[getSize, return_type[type[int]], modifier[synchronized public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByteArrayOutputStream, sub_type=None)), name=bOut)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteArrayOutputStream, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=bOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ObjectOutputStream, sub_type=None)), name=oOut)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ObjectOutputStream, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=historyStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=oOut, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=bOut, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=bOut, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot serialize internal store: "), operandr=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[int] identifier[getSize] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[ByteArrayOutputStream] identifier[bOut] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[ObjectOutputStream] identifier[oOut] operator[=] Keyword[new] identifier[ObjectOutputStream] operator[SEP] identifier[bOut] operator[SEP] operator[SEP] identifier[oOut] operator[SEP] identifier[writeObject] operator[SEP] identifier[historyStore] operator[SEP] operator[SEP] identifier[bOut] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[bOut] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[e] , identifier[e] operator[SEP] operator[SEP]
}
}
|
protected final void setDerivedEndType() {
m_endType = getPatternType().equals(PatternType.NONE) || getPatternType().equals(PatternType.INDIVIDUAL)
? EndType.SINGLE
: null != getSeriesEndDate() ? EndType.DATE : EndType.TIMES;
}
|
class class_name[name] begin[{]
method[setDerivedEndType, return_type[void], modifier[final protected], parameter[]] begin[{]
assign[member[.m_endType], TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getPatternType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=NONE, postfix_operators=[], prefix_operators=[], qualifier=PatternType, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getPatternType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=INDIVIDUAL, postfix_operators=[], prefix_operators=[], qualifier=PatternType, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=||), if_false=TernaryExpression(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operandr=MethodInvocation(arguments=[], member=getSeriesEndDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=!=), if_false=MemberReference(member=TIMES, postfix_operators=[], prefix_operators=[], qualifier=EndType, selectors=[]), if_true=MemberReference(member=DATE, postfix_operators=[], prefix_operators=[], qualifier=EndType, selectors=[])), if_true=MemberReference(member=SINGLE, postfix_operators=[], prefix_operators=[], qualifier=EndType, selectors=[]))]
end[}]
END[}]
|
Keyword[protected] Keyword[final] Keyword[void] identifier[setDerivedEndType] operator[SEP] operator[SEP] {
identifier[m_endType] operator[=] identifier[getPatternType] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[PatternType] operator[SEP] identifier[NONE] operator[SEP] operator[||] identifier[getPatternType] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[PatternType] operator[SEP] identifier[INDIVIDUAL] operator[SEP] operator[?] identifier[EndType] operator[SEP] identifier[SINGLE] operator[:] Other[null] operator[!=] identifier[getSeriesEndDate] operator[SEP] operator[SEP] operator[?] identifier[EndType] operator[SEP] identifier[DATE] operator[:] identifier[EndType] operator[SEP] identifier[TIMES] operator[SEP]
}
|
@Override
protected void parseStateVector(StreamTokenizer streamTokenizer) throws FSMParseException, IOException {
Boolean accepting = null;
for (int i = 0;
i <= acceptIndex && streamTokenizer.nextToken() == StreamTokenizer.TT_WORD && accepting == null;
i++) {
final String value = streamTokenizer.sval;
if (i == acceptIndex) {
try {
accepting = acceptValue == Integer.parseInt(value);
} catch (NumberFormatException nfe) {
throw new FSMParseException(nfe, streamTokenizer);
}
}
}
if (accepting == null) {
throw new FSMParseException(String.format(ACCEPT_INDEX_NOT_FOUND, acceptIndex), streamTokenizer);
} else {
states.put(getPartLineNumber(), accepting);
}
}
|
class class_name[name] begin[{]
method[parseStateVector, return_type[void], modifier[protected], parameter[streamTokenizer]] begin[{]
local_variable[type[Boolean], accepting]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=sval, postfix_operators=[], prefix_operators=[], qualifier=streamTokenizer, selectors=[]), name=value)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=acceptIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=accepting, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=acceptValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), operator===)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=nfe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=streamTokenizer, 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=FSMParseException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=nfe, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)]))]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=acceptIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=streamTokenizer, selectors=[], type_arguments=None), operandr=MemberReference(member=TT_WORD, postfix_operators=[], prefix_operators=[], qualifier=StreamTokenizer, selectors=[]), operator===), operator=&&), operandr=BinaryOperation(operandl=MemberReference(member=accepting, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operator=&&), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[member[.accepting], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ACCEPT_INDEX_NOT_FOUND, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=acceptIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MemberReference(member=streamTokenizer, 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=FSMParseException, sub_type=None)), label=None)
else begin[{]
call[states.put, parameter[call[.getPartLineNumber, parameter[]], member[.accepting]]]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[parseStateVector] operator[SEP] identifier[StreamTokenizer] identifier[streamTokenizer] operator[SEP] Keyword[throws] identifier[FSMParseException] , identifier[IOException] {
identifier[Boolean] identifier[accepting] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<=] identifier[acceptIndex] operator[&&] identifier[streamTokenizer] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[==] identifier[StreamTokenizer] operator[SEP] identifier[TT_WORD] operator[&&] identifier[accepting] operator[==] Other[null] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] identifier[String] identifier[value] operator[=] identifier[streamTokenizer] operator[SEP] identifier[sval] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[==] identifier[acceptIndex] operator[SEP] {
Keyword[try] {
identifier[accepting] operator[=] identifier[acceptValue] operator[==] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[nfe] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FSMParseException] operator[SEP] identifier[nfe] , identifier[streamTokenizer] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[accepting] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FSMParseException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[ACCEPT_INDEX_NOT_FOUND] , identifier[acceptIndex] operator[SEP] , identifier[streamTokenizer] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[states] operator[SEP] identifier[put] operator[SEP] identifier[getPartLineNumber] operator[SEP] operator[SEP] , identifier[accepting] operator[SEP] operator[SEP]
}
}
|
public int getCardinality() {
int cardinality = 1;
for (FieldPartitioner fieldPartitioner : fieldPartitioners) {
if (fieldPartitioner.getCardinality() == FieldPartitioner.UNKNOWN_CARDINALITY) {
return FieldPartitioner.UNKNOWN_CARDINALITY;
}
cardinality *= fieldPartitioner.getCardinality();
}
return cardinality;
}
|
class class_name[name] begin[{]
method[getCardinality, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[int], cardinality]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCardinality, postfix_operators=[], prefix_operators=[], qualifier=fieldPartitioner, selectors=[], type_arguments=None), operandr=MemberReference(member=UNKNOWN_CARDINALITY, postfix_operators=[], prefix_operators=[], qualifier=FieldPartitioner, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=UNKNOWN_CARDINALITY, postfix_operators=[], prefix_operators=[], qualifier=FieldPartitioner, selectors=[]), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=cardinality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=*=, value=MethodInvocation(arguments=[], member=getCardinality, postfix_operators=[], prefix_operators=[], qualifier=fieldPartitioner, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=fieldPartitioners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldPartitioner)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldPartitioner, sub_type=None))), label=None)
return[member[.cardinality]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[getCardinality] operator[SEP] operator[SEP] {
Keyword[int] identifier[cardinality] operator[=] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[FieldPartitioner] identifier[fieldPartitioner] operator[:] identifier[fieldPartitioners] operator[SEP] {
Keyword[if] operator[SEP] identifier[fieldPartitioner] operator[SEP] identifier[getCardinality] operator[SEP] operator[SEP] operator[==] identifier[FieldPartitioner] operator[SEP] identifier[UNKNOWN_CARDINALITY] operator[SEP] {
Keyword[return] identifier[FieldPartitioner] operator[SEP] identifier[UNKNOWN_CARDINALITY] operator[SEP]
}
identifier[cardinality] operator[*=] identifier[fieldPartitioner] operator[SEP] identifier[getCardinality] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[cardinality] operator[SEP]
}
|
public boolean the(Sampler<Boolean> variable, Ticker ticker) {
return the(variable, ticker, isQuietlyTrue());
}
|
class class_name[name] begin[{]
method[the, return_type[type[boolean]], modifier[public], parameter[variable, ticker]] begin[{]
return[call[.the, parameter[member[.variable], member[.ticker], call[.isQuietlyTrue, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[the] operator[SEP] identifier[Sampler] operator[<] identifier[Boolean] operator[>] identifier[variable] , identifier[Ticker] identifier[ticker] operator[SEP] {
Keyword[return] identifier[the] operator[SEP] identifier[variable] , identifier[ticker] , identifier[isQuietlyTrue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void main(String[] args) throws IOException {
if(args.length==0) {
System.err.println("Error: missing DESTINATION argument.");
System.err.format("usage: java -cp termsuite-core.jar %s DESTINATION%n", ResourceExporter.class.getCanonicalName());
System.exit(1);
} else {
String pathStr = args[0].replaceFirst("^~",System.getProperty("user.home"));
new ResourceExporter().exportTo(Paths.get(pathStr));
}
}
|
class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
if[binary_operation[member[args.length], ==, literal[0]]] begin[{]
call[System.err.println, parameter[literal["Error: missing DESTINATION argument."]]]
call[System.err.format, parameter[literal["usage: java -cp termsuite-core.jar %s DESTINATION%n"], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getCanonicalName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ResourceExporter, sub_type=None))]]
call[System.exit, parameter[literal[1]]]
else begin[{]
local_variable[type[String], pathStr]
ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=pathStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=Paths, selectors=[], type_arguments=None)], member=exportTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ResourceExporter, sub_type=None))
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[ResourceExporter] operator[SEP] Keyword[class] operator[SEP] identifier[getCanonicalName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[exit] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[pathStr] operator[=] identifier[args] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[replaceFirst] operator[SEP] literal[String] , identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[ResourceExporter] operator[SEP] operator[SEP] operator[SEP] identifier[exportTo] operator[SEP] identifier[Paths] operator[SEP] identifier[get] operator[SEP] identifier[pathStr] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Element redirectToDom(Closure c) {
SAXContentHandler sc = new SAXContentHandler();
with(new XMLOutput(sc),c);
return sc.getDocument().getRootElement();
}
|
class class_name[name] begin[{]
method[redirectToDom, return_type[type[Element]], modifier[public], parameter[c]] begin[{]
local_variable[type[SAXContentHandler], sc]
call[.with, parameter[ClassCreator(arguments=[MemberReference(member=sc, 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=XMLOutput, sub_type=None)), member[.c]]]
return[call[sc.getDocument, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[Element] identifier[redirectToDom] operator[SEP] identifier[Closure] identifier[c] operator[SEP] {
identifier[SAXContentHandler] identifier[sc] operator[=] Keyword[new] identifier[SAXContentHandler] operator[SEP] operator[SEP] operator[SEP] identifier[with] operator[SEP] Keyword[new] identifier[XMLOutput] operator[SEP] identifier[sc] operator[SEP] , identifier[c] operator[SEP] operator[SEP] Keyword[return] identifier[sc] operator[SEP] identifier[getDocument] operator[SEP] operator[SEP] operator[SEP] identifier[getRootElement] operator[SEP] operator[SEP] operator[SEP]
}
|
private void addComplexAsMember(Complex cx, Glyph container) {
// Create a glyph for the inner complex
Glyph inner = createComplexMember(cx, container);
for (PhysicalEntity mem : cx.getComponent())
{
if (mem instanceof Complex)
{
// Recursive call for inner complexes
addComplexAsMember((Complex) mem, inner);
}
else
{
createComplexMember(mem, inner);
}
}
}
|
class class_name[name] begin[{]
method[addComplexAsMember, return_type[void], modifier[private], parameter[cx, container]] begin[{]
local_variable[type[Glyph], inner]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Complex, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=inner, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createComplexMember, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=mem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Complex, sub_type=None)), MemberReference(member=inner, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addComplexAsMember, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getComponent, postfix_operators=[], prefix_operators=[], qualifier=cx, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=mem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PhysicalEntity, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[addComplexAsMember] operator[SEP] identifier[Complex] identifier[cx] , identifier[Glyph] identifier[container] operator[SEP] {
identifier[Glyph] identifier[inner] operator[=] identifier[createComplexMember] operator[SEP] identifier[cx] , identifier[container] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[PhysicalEntity] identifier[mem] operator[:] identifier[cx] operator[SEP] identifier[getComponent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[mem] Keyword[instanceof] identifier[Complex] operator[SEP] {
identifier[addComplexAsMember] operator[SEP] operator[SEP] identifier[Complex] operator[SEP] identifier[mem] , identifier[inner] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[createComplexMember] operator[SEP] identifier[mem] , identifier[inner] operator[SEP] operator[SEP]
}
}
}
|
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Flowable<R> publish(Function<? super Flowable<T>, ? extends Publisher<? extends R>> selector, int prefetch) {
ObjectHelper.requireNonNull(selector, "selector is null");
ObjectHelper.verifyPositive(prefetch, "prefetch");
return RxJavaPlugins.onAssembly(new FlowablePublishMulticast<T, R>(this, selector, prefetch, false));
}
|
class class_name[name] begin[{]
method[publish, return_type[type[Flowable]], modifier[final public], parameter[selector, prefetch]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.selector], literal["selector is null"]]]
call[ObjectHelper.verifyPositive, parameter[member[.prefetch], literal["prefetch"]]]
return[call[RxJavaPlugins.onAssembly, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=selector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=prefetch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[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=FlowablePublishMulticast, sub_type=None))]]]
end[}]
END[}]
|
annotation[@] identifier[CheckReturnValue] annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[FULL] operator[SEP] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[final] operator[<] identifier[R] operator[>] identifier[Flowable] operator[<] identifier[R] operator[>] identifier[publish] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[Flowable] operator[<] identifier[T] operator[>] , operator[?] Keyword[extends] identifier[Publisher] operator[<] operator[?] Keyword[extends] identifier[R] operator[>] operator[>] identifier[selector] , Keyword[int] identifier[prefetch] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[selector] , literal[String] operator[SEP] operator[SEP] identifier[ObjectHelper] operator[SEP] identifier[verifyPositive] operator[SEP] identifier[prefetch] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[RxJavaPlugins] operator[SEP] identifier[onAssembly] operator[SEP] Keyword[new] identifier[FlowablePublishMulticast] operator[<] identifier[T] , identifier[R] operator[>] operator[SEP] Keyword[this] , identifier[selector] , identifier[prefetch] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
|
protected int addPacket(OggPacket packet, int offset) {
if(packet.isBeginningOfStream()) {
isBOS = true;
}
if(packet.isEndOfStream()) {
isEOS = true;
}
// Add on in 255 byte chunks
int size = packet.getData().length;
for(int i = numLVs; i< 255; i++) {
int remains = size - offset;
int toAdd = 255;
if(remains < 255) {
toAdd = remains;
}
lvs[i] = IOUtils.fromInt(toAdd);
tmpData.write(packet.getData(), offset, toAdd);
numLVs++;
offset += toAdd;
if(toAdd < 255) {
break;
}
}
return offset;
}
|
class class_name[name] begin[{]
method[addPacket, return_type[type[int]], modifier[protected], parameter[packet, offset]] begin[{]
if[call[packet.isBeginningOfStream, parameter[]]] begin[{]
assign[member[.isBOS], literal[true]]
else begin[{]
None
end[}]
if[call[packet.isEndOfStream, parameter[]]] begin[{]
assign[member[.isEOS], literal[true]]
else begin[{]
None
end[}]
local_variable[type[int], size]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), name=remains)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=255), name=toAdd)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=remains, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=255), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=toAdd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=remains, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lvs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=toAdd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromInt, postfix_operators=[], prefix_operators=[], qualifier=IOUtils, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=packet, selectors=[], type_arguments=None), MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=toAdd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=tmpData, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=numLVs, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=toAdd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=toAdd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=255), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=255), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=numLVs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.offset]]
end[}]
END[}]
|
Keyword[protected] Keyword[int] identifier[addPacket] operator[SEP] identifier[OggPacket] identifier[packet] , Keyword[int] identifier[offset] operator[SEP] {
Keyword[if] operator[SEP] identifier[packet] operator[SEP] identifier[isBeginningOfStream] operator[SEP] operator[SEP] operator[SEP] {
identifier[isBOS] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[packet] operator[SEP] identifier[isEndOfStream] operator[SEP] operator[SEP] operator[SEP] {
identifier[isEOS] operator[=] literal[boolean] operator[SEP]
}
Keyword[int] identifier[size] operator[=] identifier[packet] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[numLVs] operator[SEP] identifier[i] operator[<] Other[255] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[remains] operator[=] identifier[size] operator[-] identifier[offset] operator[SEP] Keyword[int] identifier[toAdd] operator[=] Other[255] operator[SEP] Keyword[if] operator[SEP] identifier[remains] operator[<] Other[255] operator[SEP] {
identifier[toAdd] operator[=] identifier[remains] operator[SEP]
}
identifier[lvs] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[IOUtils] operator[SEP] identifier[fromInt] operator[SEP] identifier[toAdd] operator[SEP] operator[SEP] identifier[tmpData] operator[SEP] identifier[write] operator[SEP] identifier[packet] operator[SEP] identifier[getData] operator[SEP] operator[SEP] , identifier[offset] , identifier[toAdd] operator[SEP] operator[SEP] identifier[numLVs] operator[++] operator[SEP] identifier[offset] operator[+=] identifier[toAdd] operator[SEP] Keyword[if] operator[SEP] identifier[toAdd] operator[<] Other[255] operator[SEP] {
Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[offset] operator[SEP]
}
|
protected static void waitForDeliveryStreamToBecomeAvailable(String deliveryStreamName) throws Exception {
LOG.info("Waiting for " + deliveryStreamName + " to become ACTIVE...");
long startTime = System.currentTimeMillis();
long endTime = startTime + (10 * 60 * 1000);
while (System.currentTimeMillis() < endTime) {
try {
Thread.sleep(1000 * 20);
} catch (InterruptedException e) {
// Ignore interruption (doesn't impact deliveryStream creation)
}
DeliveryStreamDescription deliveryStreamDescription = describeDeliveryStream(deliveryStreamName);
String deliveryStreamStatus = deliveryStreamDescription.getDeliveryStreamStatus();
LOG.info(" - current state: " + deliveryStreamStatus);
if (deliveryStreamStatus.equals("ACTIVE")) {
return;
}
}
throw new AmazonServiceException("DeliveryStream " + deliveryStreamName + " never went active");
}
|
class class_name[name] begin[{]
method[waitForDeliveryStreamToBecomeAvailable, return_type[void], modifier[static protected], parameter[deliveryStreamName]] begin[{]
call[LOG.info, parameter[binary_operation[binary_operation[literal["Waiting for "], +, member[.deliveryStreamName]], +, literal[" to become ACTIVE..."]]]]
local_variable[type[long], startTime]
local_variable[type[long], endTime]
while[binary_operation[call[System.currentTimeMillis, parameter[]], <, member[.endTime]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1000), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=20), operator=*)], member=sleep, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
local_variable[type[DeliveryStreamDescription], deliveryStreamDescription]
local_variable[type[String], deliveryStreamStatus]
call[LOG.info, parameter[binary_operation[literal[" - current state: "], +, member[.deliveryStreamStatus]]]]
if[call[deliveryStreamStatus.equals, parameter[literal["ACTIVE"]]]] begin[{]
return[None]
else begin[{]
None
end[}]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DeliveryStream "), operandr=MemberReference(member=deliveryStreamName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" never went active"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AmazonServiceException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[protected] Keyword[static] Keyword[void] identifier[waitForDeliveryStreamToBecomeAvailable] operator[SEP] identifier[String] identifier[deliveryStreamName] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[deliveryStreamName] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[long] identifier[startTime] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[endTime] operator[=] identifier[startTime] operator[+] operator[SEP] Other[10] operator[*] Other[60] operator[*] Other[1000] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[<] identifier[endTime] operator[SEP] {
Keyword[try] {
identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] Other[1000] operator[*] Other[20] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
}
identifier[DeliveryStreamDescription] identifier[deliveryStreamDescription] operator[=] identifier[describeDeliveryStream] operator[SEP] identifier[deliveryStreamName] operator[SEP] operator[SEP] identifier[String] identifier[deliveryStreamStatus] operator[=] identifier[deliveryStreamDescription] operator[SEP] identifier[getDeliveryStreamStatus] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[deliveryStreamStatus] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[deliveryStreamStatus] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[AmazonServiceException] operator[SEP] literal[String] operator[+] identifier[deliveryStreamName] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
public <V> void waitUntil(Sampler<V> variable, Matcher<? super V> criteria) {
waitUntil(variable, eventually(), criteria);
}
|
class class_name[name] begin[{]
method[waitUntil, return_type[void], modifier[public], parameter[variable, criteria]] begin[{]
call[.waitUntil, parameter[member[.variable], call[.eventually, parameter[]], member[.criteria]]]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[V] operator[>] Keyword[void] identifier[waitUntil] operator[SEP] identifier[Sampler] operator[<] identifier[V] operator[>] identifier[variable] , identifier[Matcher] operator[<] operator[?] Keyword[super] identifier[V] operator[>] identifier[criteria] operator[SEP] {
identifier[waitUntil] operator[SEP] identifier[variable] , identifier[eventually] operator[SEP] operator[SEP] , identifier[criteria] operator[SEP] operator[SEP]
}
|
public final void mWS() throws RecognitionException {
try {
int _type = WS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// druidG.g:669:2: ( ( ' ' | '\\t' | NEWLINE )+ )
// druidG.g:669:4: ( ' ' | '\\t' | NEWLINE )+
{
// druidG.g:669:4: ( ' ' | '\\t' | NEWLINE )+
int cnt37=0;
loop37:
while (true) {
int alt37=4;
switch ( input.LA(1) ) {
case ' ':
{
alt37=1;
}
break;
case '\t':
{
alt37=2;
}
break;
case '\n':
case '\r':
{
alt37=3;
}
break;
}
switch (alt37) {
case 1 :
// druidG.g:669:5: ' '
{
match(' ');
}
break;
case 2 :
// druidG.g:669:11: '\\t'
{
match('\t');
}
break;
case 3 :
// druidG.g:669:18: NEWLINE
{
mNEWLINE();
}
break;
default :
if ( cnt37 >= 1 ) break loop37;
EarlyExitException eee = new EarlyExitException(37, input);
throw eee;
}
cnt37++;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
}
|
class class_name[name] begin[{]
method[mWS, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=WS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_type)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=DEFAULT_TOKEN_CHANNEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=_channel)], modifiers=set(), type=BasicType(dimensions=[], name=int)), BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=cnt37)], modifiers=set(), type=BasicType(dimensions=[], name=int)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), name=alt37)], modifiers=set(), type=BasicType(dimensions=[], name=int)), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt37, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\t')], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt37, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), label=None)]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\r')], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt37, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)), label=None)]), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\t')], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=mNEWLINE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cnt37, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>=), else_statement=None, label=None, then_statement=BreakStatement(goto=loop37, label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=37), MemberReference(member=input, 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=EarlyExitException, sub_type=None)), name=eee)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EarlyExitException, sub_type=None)), ThrowStatement(expression=MemberReference(member=eee, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])], expression=MemberReference(member=alt37, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=MemberReference(member=cnt37, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=loop37)]), StatementExpression(expression=Assignment(expressionl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=channel, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), type==, value=MemberReference(member=_channel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=None, finally_block=[], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[mWS] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[try] {
Keyword[int] identifier[_type] operator[=] identifier[WS] operator[SEP] Keyword[int] identifier[_channel] operator[=] identifier[DEFAULT_TOKEN_CHANNEL] operator[SEP] {
Keyword[int] identifier[cnt37] operator[=] Other[0] operator[SEP] identifier[loop37] operator[:] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[int] identifier[alt37] operator[=] Other[4] operator[SEP] Keyword[switch] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[SEP] {
Keyword[case] literal[String] operator[:] {
identifier[alt37] operator[=] Other[1] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] {
identifier[alt37] operator[=] Other[2] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] {
identifier[alt37] operator[=] Other[3] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[alt37] operator[SEP] {
Keyword[case] Other[1] operator[:] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] Other[2] operator[:] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] Other[3] operator[:] {
identifier[mNEWLINE] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[if] operator[SEP] identifier[cnt37] operator[>=] Other[1] operator[SEP] Keyword[break] identifier[loop37] operator[SEP] identifier[EarlyExitException] identifier[eee] operator[=] Keyword[new] identifier[EarlyExitException] operator[SEP] Other[37] , identifier[input] operator[SEP] operator[SEP] Keyword[throw] identifier[eee] operator[SEP]
}
identifier[cnt37] operator[++] operator[SEP]
}
}
identifier[state] operator[SEP] identifier[type] operator[=] identifier[_type] operator[SEP] identifier[state] operator[SEP] identifier[channel] operator[=] identifier[_channel] operator[SEP]
}
Keyword[finally] {
}
}
|
private Push findPushInLeftJoinRootedSubtree(IntermediateQuery query,
ImmutableExpression expression,
JoinOrFilterNode providerNode,
LeftJoinNode currentNode) {
QueryNode leftChild = query.getChild(currentNode, LEFT)
.orElseThrow(() -> new MinorOntopInternalBugException("Was expecting a left child"));
return query.getVariables(leftChild).containsAll(expression.getVariables())
? new Push(new Recipient(leftChild), expression)
: getProviderAsPush(providerNode, expression);
}
|
class class_name[name] begin[{]
method[findPushInLeftJoinRootedSubtree, return_type[type[Push]], modifier[private], parameter[query, expression, providerNode, currentNode]] begin[{]
local_variable[type[QueryNode], leftChild]
return[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=leftChild, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getVariables, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getVariables, postfix_operators=[], prefix_operators=[], qualifier=expression, selectors=[], type_arguments=None)], member=containsAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=MethodInvocation(arguments=[MemberReference(member=providerNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=expression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProviderAsPush, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=leftChild, 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=Recipient, sub_type=None)), MemberReference(member=expression, 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=Push, sub_type=None)))]
end[}]
END[}]
|
Keyword[private] identifier[Push] identifier[findPushInLeftJoinRootedSubtree] operator[SEP] identifier[IntermediateQuery] identifier[query] , identifier[ImmutableExpression] identifier[expression] , identifier[JoinOrFilterNode] identifier[providerNode] , identifier[LeftJoinNode] identifier[currentNode] operator[SEP] {
identifier[QueryNode] identifier[leftChild] operator[=] identifier[query] operator[SEP] identifier[getChild] operator[SEP] identifier[currentNode] , identifier[LEFT] operator[SEP] operator[SEP] identifier[orElseThrow] operator[SEP] operator[SEP] operator[SEP] operator[->] Keyword[new] identifier[MinorOntopInternalBugException] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[query] operator[SEP] identifier[getVariables] operator[SEP] identifier[leftChild] operator[SEP] operator[SEP] identifier[containsAll] operator[SEP] identifier[expression] operator[SEP] identifier[getVariables] operator[SEP] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[Push] operator[SEP] Keyword[new] identifier[Recipient] operator[SEP] identifier[leftChild] operator[SEP] , identifier[expression] operator[SEP] operator[:] identifier[getProviderAsPush] operator[SEP] identifier[providerNode] , identifier[expression] operator[SEP] operator[SEP]
}
|
public void findSSSP() {
Record<N, E> initRec = new Record<>(init, 0.0f);
if (records.put(init, initRec) != null) {
throw new IllegalStateException("Search has already been performed!");
}
SmartDynamicPriorityQueue<Record<N, E>> pq = BinaryHeap.create(graph.size());
initRec.ref = pq.referencedAdd(initRec);
while (!pq.isEmpty()) {
// Remove node with minimum distance
Record<N, E> rec = pq.extractMin();
float dist = rec.dist;
N node = rec.node;
// edge scanning
for (E edge : graph.getOutgoingEdges(node)) {
float w = edgeWeights.getEdgeWeight(edge);
float newDist = dist + w;
N tgt = graph.getTarget(edge);
Record<N, E> tgtRec = records.get(tgt);
if (tgtRec == null) {
// node has not been visited before, add a record
// and add it to the queue
tgtRec = new Record<>(tgt, newDist, edge, rec);
tgtRec.ref = pq.referencedAdd(tgtRec);
records.put(tgt, tgtRec);
} else if (newDist < tgtRec.dist) {
// using currently considered edge decreases current distance
tgtRec.dist = newDist;
tgtRec.reach = edge;
tgtRec.depth = rec.depth + 1;
tgtRec.parent = rec;
// update it's position in the queue
pq.keyChanged(tgtRec.ref);
}
}
}
}
|
class class_name[name] begin[{]
method[findSSSP, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[Record], initRec]
if[binary_operation[call[records.put, parameter[member[.init], member[.initRec]]], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Search has already been performed!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[SmartDynamicPriorityQueue], pq]
assign[member[initRec.ref], call[pq.referencedAdd, parameter[member[.initRec]]]]
while[call[pq.isEmpty, parameter[]]] begin[{]
local_variable[type[Record], rec]
local_variable[type[float], dist]
local_variable[type[N], node]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=edge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEdgeWeight, postfix_operators=[], prefix_operators=[], qualifier=edgeWeights, selectors=[], type_arguments=None), name=w)], modifiers=set(), type=BasicType(dimensions=[], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=dist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=newDist)], modifiers=set(), type=BasicType(dimensions=[], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=edge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTarget, postfix_operators=[], prefix_operators=[], qualifier=graph, selectors=[], type_arguments=None), name=tgt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=N, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tgt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=records, selectors=[], type_arguments=None), name=tgtRec)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=N, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))], dimensions=[], name=Record, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tgtRec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=newDist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dist, postfix_operators=[], prefix_operators=[], qualifier=tgtRec, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=dist, postfix_operators=[], prefix_operators=[], qualifier=tgtRec, selectors=[]), type==, value=MemberReference(member=newDist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=reach, postfix_operators=[], prefix_operators=[], qualifier=tgtRec, selectors=[]), type==, value=MemberReference(member=edge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=depth, postfix_operators=[], prefix_operators=[], qualifier=tgtRec, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=depth, postfix_operators=[], prefix_operators=[], qualifier=rec, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=tgtRec, selectors=[]), type==, value=MemberReference(member=rec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=tgtRec, selectors=[])], member=keyChanged, postfix_operators=[], prefix_operators=[], qualifier=pq, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=tgtRec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=tgt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newDist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=edge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=Record, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=tgtRec, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=tgtRec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=referencedAdd, postfix_operators=[], prefix_operators=[], qualifier=pq, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tgt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tgtRec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=records, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getOutgoingEdges, postfix_operators=[], prefix_operators=[], qualifier=graph, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=edge)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))), label=None)
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[findSSSP] operator[SEP] operator[SEP] {
identifier[Record] operator[<] identifier[N] , identifier[E] operator[>] identifier[initRec] operator[=] Keyword[new] identifier[Record] operator[<] operator[>] operator[SEP] identifier[init] , literal[Float] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[records] operator[SEP] identifier[put] operator[SEP] identifier[init] , identifier[initRec] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[SmartDynamicPriorityQueue] operator[<] identifier[Record] operator[<] identifier[N] , identifier[E] operator[>] operator[>] identifier[pq] operator[=] identifier[BinaryHeap] operator[SEP] identifier[create] operator[SEP] identifier[graph] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[initRec] operator[SEP] identifier[ref] operator[=] identifier[pq] operator[SEP] identifier[referencedAdd] operator[SEP] identifier[initRec] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[pq] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Record] operator[<] identifier[N] , identifier[E] operator[>] identifier[rec] operator[=] identifier[pq] operator[SEP] identifier[extractMin] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[dist] operator[=] identifier[rec] operator[SEP] identifier[dist] operator[SEP] identifier[N] identifier[node] operator[=] identifier[rec] operator[SEP] identifier[node] operator[SEP] Keyword[for] operator[SEP] identifier[E] identifier[edge] operator[:] identifier[graph] operator[SEP] identifier[getOutgoingEdges] operator[SEP] identifier[node] operator[SEP] operator[SEP] {
Keyword[float] identifier[w] operator[=] identifier[edgeWeights] operator[SEP] identifier[getEdgeWeight] operator[SEP] identifier[edge] operator[SEP] operator[SEP] Keyword[float] identifier[newDist] operator[=] identifier[dist] operator[+] identifier[w] operator[SEP] identifier[N] identifier[tgt] operator[=] identifier[graph] operator[SEP] identifier[getTarget] operator[SEP] identifier[edge] operator[SEP] operator[SEP] identifier[Record] operator[<] identifier[N] , identifier[E] operator[>] identifier[tgtRec] operator[=] identifier[records] operator[SEP] identifier[get] operator[SEP] identifier[tgt] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tgtRec] operator[==] Other[null] operator[SEP] {
identifier[tgtRec] operator[=] Keyword[new] identifier[Record] operator[<] operator[>] operator[SEP] identifier[tgt] , identifier[newDist] , identifier[edge] , identifier[rec] operator[SEP] operator[SEP] identifier[tgtRec] operator[SEP] identifier[ref] operator[=] identifier[pq] operator[SEP] identifier[referencedAdd] operator[SEP] identifier[tgtRec] operator[SEP] operator[SEP] identifier[records] operator[SEP] identifier[put] operator[SEP] identifier[tgt] , identifier[tgtRec] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[newDist] operator[<] identifier[tgtRec] operator[SEP] identifier[dist] operator[SEP] {
identifier[tgtRec] operator[SEP] identifier[dist] operator[=] identifier[newDist] operator[SEP] identifier[tgtRec] operator[SEP] identifier[reach] operator[=] identifier[edge] operator[SEP] identifier[tgtRec] operator[SEP] identifier[depth] operator[=] identifier[rec] operator[SEP] identifier[depth] operator[+] Other[1] operator[SEP] identifier[tgtRec] operator[SEP] identifier[parent] operator[=] identifier[rec] operator[SEP] identifier[pq] operator[SEP] identifier[keyChanged] operator[SEP] identifier[tgtRec] operator[SEP] identifier[ref] operator[SEP] operator[SEP]
}
}
}
}
|
public static String leafScoreFromDistribution(double[] classDistribution, Instances instances) {
double sum = 0, maxCount = 0;
int maxIndex = 0;
if (classDistribution != null) {
sum = Utils.sum(classDistribution);
maxIndex = Utils.maxIndex(classDistribution);
maxCount = classDistribution[maxIndex];
}
return instances.classAttribute().value(maxIndex);
}
|
class class_name[name] begin[{]
method[leafScoreFromDistribution, return_type[type[String]], modifier[public static], parameter[classDistribution, instances]] begin[{]
local_variable[type[double], sum]
local_variable[type[int], maxIndex]
if[binary_operation[member[.classDistribution], !=, literal[null]]] begin[{]
assign[member[.sum], call[Utils.sum, parameter[member[.classDistribution]]]]
assign[member[.maxIndex], call[Utils.maxIndex, parameter[member[.classDistribution]]]]
assign[member[.maxCount], member[.classDistribution]]
else begin[{]
None
end[}]
return[call[instances.classAttribute, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[leafScoreFromDistribution] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[classDistribution] , identifier[Instances] identifier[instances] operator[SEP] {
Keyword[double] identifier[sum] operator[=] Other[0] , identifier[maxCount] operator[=] Other[0] operator[SEP] Keyword[int] identifier[maxIndex] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[classDistribution] operator[!=] Other[null] operator[SEP] {
identifier[sum] operator[=] identifier[Utils] operator[SEP] identifier[sum] operator[SEP] identifier[classDistribution] operator[SEP] operator[SEP] identifier[maxIndex] operator[=] identifier[Utils] operator[SEP] identifier[maxIndex] operator[SEP] identifier[classDistribution] operator[SEP] operator[SEP] identifier[maxCount] operator[=] identifier[classDistribution] operator[SEP] identifier[maxIndex] operator[SEP] operator[SEP]
}
Keyword[return] identifier[instances] operator[SEP] identifier[classAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[SEP] identifier[maxIndex] operator[SEP] operator[SEP]
}
|
public IServletConfig getServletInfo(String string) {
if (string == null || string.isEmpty()){
Tr.debug(tc, "getServletInfo", "servlet name is null/empty. Use internal servlet name " + NULLSERVLETNAME);
string = NULLSERVLETNAME;
}
return (IServletConfig) this.servletInfo.get(string);
}
|
class class_name[name] begin[{]
method[getServletInfo, return_type[type[IServletConfig]], modifier[public], parameter[string]] begin[{]
if[binary_operation[binary_operation[member[.string], ==, literal[null]], ||, call[string.isEmpty, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["getServletInfo"], binary_operation[literal["servlet name is null/empty. Use internal servlet name "], +, member[.NULLSERVLETNAME]]]]
assign[member[.string], member[.NULLSERVLETNAME]]
else begin[{]
None
end[}]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=servletInfo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=string, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=IServletConfig, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[IServletConfig] identifier[getServletInfo] operator[SEP] identifier[String] identifier[string] operator[SEP] {
Keyword[if] operator[SEP] identifier[string] operator[==] Other[null] operator[||] identifier[string] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] , literal[String] operator[+] identifier[NULLSERVLETNAME] operator[SEP] operator[SEP] identifier[string] operator[=] identifier[NULLSERVLETNAME] operator[SEP]
}
Keyword[return] operator[SEP] identifier[IServletConfig] operator[SEP] Keyword[this] operator[SEP] identifier[servletInfo] operator[SEP] identifier[get] operator[SEP] identifier[string] operator[SEP] operator[SEP]
}
|
public static <S, T extends Plugin<S>> OrderAwarePluginRegistry<T, S> of(List<? extends T> plugins,
Comparator<? super T> comparator) {
Assert.notNull(plugins, "Plugins must not be null!");
Assert.notNull(comparator, "Comparator must not be null!");
return new OrderAwarePluginRegistry<>(plugins, comparator);
}
|
class class_name[name] begin[{]
method[of, return_type[type[OrderAwarePluginRegistry]], modifier[public static], parameter[plugins, comparator]] begin[{]
call[Assert.notNull, parameter[member[.plugins], literal["Plugins must not be null!"]]]
call[Assert.notNull, parameter[member[.comparator], literal["Comparator must not be null!"]]]
return[ClassCreator(arguments=[MemberReference(member=plugins, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=comparator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=OrderAwarePluginRegistry, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[S] , identifier[T] Keyword[extends] identifier[Plugin] operator[<] identifier[S] operator[>] operator[>] identifier[OrderAwarePluginRegistry] operator[<] identifier[T] , identifier[S] operator[>] identifier[of] operator[SEP] identifier[List] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] identifier[plugins] , identifier[Comparator] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[comparator] operator[SEP] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[plugins] , literal[String] operator[SEP] operator[SEP] identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[comparator] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[OrderAwarePluginRegistry] operator[<] operator[>] operator[SEP] identifier[plugins] , identifier[comparator] operator[SEP] operator[SEP]
}
|
public boolean crosses(Span s) {
int sstart = s.getStart();
//either s's start is in this or this' start is in s
return(!this.contains(s) && !s.contains(this) &&
(getStart() <= sstart && sstart < getEnd() ||
sstart <= getStart() && getStart() < s.getEnd()));
}
|
class class_name[name] begin[{]
method[crosses, return_type[type[boolean]], modifier[public], parameter[s]] begin[{]
local_variable[type[int], sstart]
return[binary_operation[binary_operation[THIS[call[None.contains, parameter[member[.s]]]], &&, call[s.contains, parameter[THIS[]]]], &&, binary_operation[binary_operation[binary_operation[call[.getStart, parameter[]], <=, member[.sstart]], &&, binary_operation[member[.sstart], <, call[.getEnd, parameter[]]]], ||, binary_operation[binary_operation[member[.sstart], <=, call[.getStart, parameter[]]], &&, binary_operation[call[.getStart, parameter[]], <, call[s.getEnd, parameter[]]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[crosses] operator[SEP] identifier[Span] identifier[s] operator[SEP] {
Keyword[int] identifier[sstart] operator[=] identifier[s] operator[SEP] identifier[getStart] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[contains] operator[SEP] identifier[s] operator[SEP] operator[&&] operator[!] identifier[s] operator[SEP] identifier[contains] operator[SEP] Keyword[this] operator[SEP] operator[&&] operator[SEP] identifier[getStart] operator[SEP] operator[SEP] operator[<=] identifier[sstart] operator[&&] identifier[sstart] operator[<] identifier[getEnd] operator[SEP] operator[SEP] operator[||] identifier[sstart] operator[<=] identifier[getStart] operator[SEP] operator[SEP] operator[&&] identifier[getStart] operator[SEP] operator[SEP] operator[<] identifier[s] operator[SEP] identifier[getEnd] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public final static void addAnnotationToConnection(final int position, final String annotation,
final HELM2Notation helm2notation) {
helm2notation.getListOfConnections().get(position).setAnnotation(annotation);
}
|
class class_name[name] begin[{]
method[addAnnotationToConnection, return_type[void], modifier[final public static], parameter[position, annotation, helm2notation]] begin[{]
call[helm2notation.getListOfConnections, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[static] Keyword[void] identifier[addAnnotationToConnection] operator[SEP] Keyword[final] Keyword[int] identifier[position] , Keyword[final] identifier[String] identifier[annotation] , Keyword[final] identifier[HELM2Notation] identifier[helm2notation] operator[SEP] {
identifier[helm2notation] operator[SEP] identifier[getListOfConnections] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[position] operator[SEP] operator[SEP] identifier[setAnnotation] operator[SEP] identifier[annotation] operator[SEP] operator[SEP]
}
|
public String typeArgument() throws RecognitionException {
String typeArgument = "";
try {
int first = input.index(), last = first;
int next = input.LA(1);
switch (next) {
case DRL6Lexer.QUESTION:
match(input,
DRL6Lexer.QUESTION,
null,
null,
DroolsEditorType.SYMBOL);
if (state.failed)
return typeArgument;
if (helper.validateIdentifierKey(DroolsSoftKeywords.EXTENDS)) {
match(input,
DRL6Lexer.ID,
DroolsSoftKeywords.EXTENDS,
null,
DroolsEditorType.SYMBOL);
if (state.failed)
return typeArgument;
type();
if (state.failed)
return typeArgument;
} else if (helper.validateIdentifierKey(DroolsSoftKeywords.SUPER)) {
match(input,
DRL6Lexer.ID,
DroolsSoftKeywords.SUPER,
null,
DroolsEditorType.SYMBOL);
if (state.failed)
return typeArgument;
type();
if (state.failed)
return typeArgument;
}
break;
case DRL6Lexer.ID:
type();
if (state.failed)
return typeArgument;
break;
default:
// TODO: raise error
}
last = input.LT(-1).getTokenIndex();
typeArgument = input.toString(first,
last);
} catch (RecognitionException re) {
reportError(re);
}
return typeArgument;
}
|
class class_name[name] begin[{]
method[typeArgument, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[String], typeArgument]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=index, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=first), VariableDeclarator(dimensions=[], initializer=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=last)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=next)], modifiers=set(), type=BasicType(dimensions=[], name=int)), SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=QUESTION, postfix_operators=[], prefix_operators=[], qualifier=DRL6Lexer, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=QUESTION, postfix_operators=[], prefix_operators=[], qualifier=DRL6Lexer, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=SYMBOL, postfix_operators=[], prefix_operators=[], qualifier=DroolsEditorType, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=typeArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=EXTENDS, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[])], member=validateIdentifierKey, postfix_operators=[], prefix_operators=[], qualifier=helper, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=SUPER, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[])], member=validateIdentifierKey, postfix_operators=[], prefix_operators=[], qualifier=helper, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ID, postfix_operators=[], prefix_operators=[], qualifier=DRL6Lexer, selectors=[]), MemberReference(member=SUPER, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=SYMBOL, postfix_operators=[], prefix_operators=[], qualifier=DroolsEditorType, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=typeArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=typeArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ID, postfix_operators=[], prefix_operators=[], qualifier=DRL6Lexer, selectors=[]), MemberReference(member=EXTENDS, postfix_operators=[], prefix_operators=[], qualifier=DroolsSoftKeywords, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=SYMBOL, postfix_operators=[], prefix_operators=[], qualifier=DroolsEditorType, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=typeArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=typeArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[MemberReference(member=ID, postfix_operators=[], prefix_operators=[], qualifier=DRL6Lexer, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=typeArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[])], expression=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=last, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], member=LT, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[MethodInvocation(arguments=[], member=getTokenIndex, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=typeArgument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=last, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=None, label=None, resources=None)
return[member[.typeArgument]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[typeArgument] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
identifier[String] identifier[typeArgument] operator[=] literal[String] operator[SEP] Keyword[try] {
Keyword[int] identifier[first] operator[=] identifier[input] operator[SEP] identifier[index] operator[SEP] operator[SEP] , identifier[last] operator[=] identifier[first] operator[SEP] Keyword[int] identifier[next] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[next] operator[SEP] {
Keyword[case] identifier[DRL6Lexer] operator[SEP] identifier[QUESTION] operator[:] identifier[match] operator[SEP] identifier[input] , identifier[DRL6Lexer] operator[SEP] identifier[QUESTION] , Other[null] , Other[null] , identifier[DroolsEditorType] operator[SEP] identifier[SYMBOL] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[typeArgument] operator[SEP] Keyword[if] operator[SEP] identifier[helper] operator[SEP] identifier[validateIdentifierKey] operator[SEP] identifier[DroolsSoftKeywords] operator[SEP] identifier[EXTENDS] operator[SEP] operator[SEP] {
identifier[match] operator[SEP] identifier[input] , identifier[DRL6Lexer] operator[SEP] identifier[ID] , identifier[DroolsSoftKeywords] operator[SEP] identifier[EXTENDS] , Other[null] , identifier[DroolsEditorType] operator[SEP] identifier[SYMBOL] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[typeArgument] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[typeArgument] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[helper] operator[SEP] identifier[validateIdentifierKey] operator[SEP] identifier[DroolsSoftKeywords] operator[SEP] identifier[SUPER] operator[SEP] operator[SEP] {
identifier[match] operator[SEP] identifier[input] , identifier[DRL6Lexer] operator[SEP] identifier[ID] , identifier[DroolsSoftKeywords] operator[SEP] identifier[SUPER] , Other[null] , identifier[DroolsEditorType] operator[SEP] identifier[SYMBOL] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[typeArgument] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[typeArgument] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[DRL6Lexer] operator[SEP] identifier[ID] operator[:] identifier[type] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[typeArgument] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:]
}
identifier[last] operator[=] identifier[input] operator[SEP] identifier[LT] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] identifier[getTokenIndex] operator[SEP] operator[SEP] operator[SEP] identifier[typeArgument] operator[=] identifier[input] operator[SEP] identifier[toString] operator[SEP] identifier[first] , identifier[last] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[reportError] operator[SEP] identifier[re] operator[SEP] operator[SEP]
}
Keyword[return] identifier[typeArgument] operator[SEP]
}
|
public CompletableFuture<Void> accept(T event) {
List<CompletableFuture<Void>> futures = new ArrayList<>(listeners.size());
for (ListenerHolder listener : listeners) {
if (listener.context != null) {
futures.add(listener.context.execute(() -> listener.listener.accept(event)));
} else {
listener.listener.accept(event);
}
}
return CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()]));
}
|
class class_name[name] begin[{]
method[accept, return_type[type[CompletableFuture]], modifier[public], parameter[event]] begin[{]
local_variable[type[List], futures]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=listener.listener, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=listener.listener, selectors=[], type_arguments=None), parameters=[])], member=execute, postfix_operators=[], prefix_operators=[], qualifier=listener.context, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=futures, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=listeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ListenerHolder, sub_type=None))), label=None)
return[call[CompletableFuture.allOf, parameter[call[futures.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=futures, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CompletableFuture, sub_type=None))]]]]]
end[}]
END[}]
|
Keyword[public] identifier[CompletableFuture] operator[<] identifier[Void] operator[>] identifier[accept] operator[SEP] identifier[T] identifier[event] operator[SEP] {
identifier[List] operator[<] identifier[CompletableFuture] operator[<] identifier[Void] operator[>] operator[>] identifier[futures] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[listeners] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ListenerHolder] identifier[listener] operator[:] identifier[listeners] operator[SEP] {
Keyword[if] operator[SEP] identifier[listener] operator[SEP] identifier[context] operator[!=] Other[null] operator[SEP] {
identifier[futures] operator[SEP] identifier[add] operator[SEP] identifier[listener] operator[SEP] identifier[context] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[listener] operator[SEP] identifier[listener] operator[SEP] identifier[accept] operator[SEP] identifier[event] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[listener] operator[SEP] identifier[listener] operator[SEP] identifier[accept] operator[SEP] identifier[event] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[CompletableFuture] operator[SEP] identifier[allOf] operator[SEP] identifier[futures] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[CompletableFuture] operator[SEP] identifier[futures] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private static String getDefaultNamedOutputFormatInstanceFile(JobContext job) {
return job.getConfiguration().get(DEFAULT_MO_PREFIX + FORMAT_INSTANCE_FILE, null);
}
|
class class_name[name] begin[{]
method[getDefaultNamedOutputFormatInstanceFile, return_type[type[String]], modifier[private static], parameter[job]] begin[{]
return[call[job.getConfiguration, parameter[]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[String] identifier[getDefaultNamedOutputFormatInstanceFile] operator[SEP] identifier[JobContext] identifier[job] operator[SEP] {
Keyword[return] identifier[job] operator[SEP] identifier[getConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[DEFAULT_MO_PREFIX] operator[+] identifier[FORMAT_INSTANCE_FILE] , Other[null] operator[SEP] operator[SEP]
}
|
private String subDirForId(String id) {
String path = objs + UNIX_PATH_SEPERATOR + id.substring(0, SUBDIR_POLICY);
safeMkdir(path);
return path;
}
|
class class_name[name] begin[{]
method[subDirForId, return_type[type[String]], modifier[private], parameter[id]] begin[{]
local_variable[type[String], path]
call[.safeMkdir, parameter[member[.path]]]
return[member[.path]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[subDirForId] operator[SEP] identifier[String] identifier[id] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[objs] operator[+] identifier[UNIX_PATH_SEPERATOR] operator[+] identifier[id] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[SUBDIR_POLICY] operator[SEP] operator[SEP] identifier[safeMkdir] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[return] identifier[path] operator[SEP]
}
|
public @NotNull QueryBuilder append(@NotNull String sql, @NotNull Collection<?> args) {
query.append(requireNonNull(sql));
addArguments(args);
return this;
}
|
class class_name[name] begin[{]
method[append, return_type[type[QueryBuilder]], modifier[public], parameter[sql, args]] begin[{]
call[query.append, parameter[call[.requireNonNull, parameter[member[.sql]]]]]
call[.addArguments, parameter[member[.args]]]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] annotation[@] identifier[NotNull] identifier[QueryBuilder] identifier[append] operator[SEP] annotation[@] identifier[NotNull] identifier[String] identifier[sql] , annotation[@] identifier[NotNull] identifier[Collection] operator[<] operator[?] operator[>] identifier[args] operator[SEP] {
identifier[query] operator[SEP] identifier[append] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[sql] operator[SEP] operator[SEP] operator[SEP] identifier[addArguments] operator[SEP] identifier[args] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private List<Class<? extends RelationshipInterface>> getRelationClassCandidatesForRelType(final String relType) {
List<Class<? extends RelationshipInterface>> candidates = new ArrayList();
for (final Class<? extends RelationshipInterface> candidate : getRelationshipEntities().values()) {
Relation rel = instantiate(candidate);
if (rel == null) {
continue;
}
if (rel.name().equals(relType)) {
candidates.add(candidate);
}
}
return candidates;
}
|
class class_name[name] begin[{]
method[getRelationClassCandidatesForRelType, return_type[type[List]], modifier[private], parameter[relType]] begin[{]
local_variable[type[List], candidates]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=candidate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=instantiate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=rel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Relation, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rel, 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=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=rel, selectors=[MethodInvocation(arguments=[MemberReference(member=relType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=candidate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=candidates, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getRelationshipEntities, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=candidate)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=RelationshipInterface, sub_type=None))], dimensions=[], name=Class, sub_type=None))), label=None)
return[member[.candidates]]
end[}]
END[}]
|
Keyword[private] identifier[List] operator[<] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[RelationshipInterface] operator[>] operator[>] identifier[getRelationClassCandidatesForRelType] operator[SEP] Keyword[final] identifier[String] identifier[relType] operator[SEP] {
identifier[List] operator[<] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[RelationshipInterface] operator[>] operator[>] identifier[candidates] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[RelationshipInterface] operator[>] identifier[candidate] operator[:] identifier[getRelationshipEntities] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[Relation] identifier[rel] operator[=] identifier[instantiate] operator[SEP] identifier[candidate] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rel] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[rel] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[relType] operator[SEP] operator[SEP] {
identifier[candidates] operator[SEP] identifier[add] operator[SEP] identifier[candidate] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[candidates] operator[SEP]
}
|
void timestampFormat(DateFormat format, String... attributes) {
convertWith(new DateToStringConverter(format), attributes);
convertWith(new StringToTimestampConverter(format), attributes);
}
|
class class_name[name] begin[{]
method[timestampFormat, return_type[void], modifier[default], parameter[format, attributes]] begin[{]
call[.convertWith, parameter[ClassCreator(arguments=[MemberReference(member=format, 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=DateToStringConverter, sub_type=None)), member[.attributes]]]
call[.convertWith, parameter[ClassCreator(arguments=[MemberReference(member=format, 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=StringToTimestampConverter, sub_type=None)), member[.attributes]]]
end[}]
END[}]
|
Keyword[void] identifier[timestampFormat] operator[SEP] identifier[DateFormat] identifier[format] , identifier[String] operator[...] identifier[attributes] operator[SEP] {
identifier[convertWith] operator[SEP] Keyword[new] identifier[DateToStringConverter] operator[SEP] identifier[format] operator[SEP] , identifier[attributes] operator[SEP] operator[SEP] identifier[convertWith] operator[SEP] Keyword[new] identifier[StringToTimestampConverter] operator[SEP] identifier[format] operator[SEP] , identifier[attributes] operator[SEP] operator[SEP]
}
|
public ClientTransaction sendRequest(Request request) throws SipException, TransactionUnavailableException {
ensureCorrectDialogLocalTag(request);
final ClientTransactionWrapper ctw = ra.getProviderWrapper().getNewDialogActivityClientTransaction(this,request);
if (request.getMethod().equals(Request.INVITE))
lastCancelableTransactionId = ctw.getActivityHandle();
if (tracer.isInfoEnabled()) {
tracer.info(String.valueOf(ctw)+" sending request:\n"+request);
}
wrappedDialog.sendRequest(ctw.getWrappedClientTransaction());
return ctw;
}
|
class class_name[name] begin[{]
method[sendRequest, return_type[type[ClientTransaction]], modifier[public], parameter[request]] begin[{]
call[.ensureCorrectDialogLocalTag, parameter[member[.request]]]
local_variable[type[ClientTransactionWrapper], ctw]
if[call[request.getMethod, parameter[]]] begin[{]
assign[member[.lastCancelableTransactionId], call[ctw.getActivityHandle, parameter[]]]
else begin[{]
None
end[}]
if[call[tracer.isInfoEnabled, parameter[]]] begin[{]
call[tracer.info, parameter[binary_operation[binary_operation[call[String.valueOf, parameter[member[.ctw]]], +, literal[" sending request:\n"]], +, member[.request]]]]
else begin[{]
None
end[}]
call[wrappedDialog.sendRequest, parameter[call[ctw.getWrappedClientTransaction, parameter[]]]]
return[member[.ctw]]
end[}]
END[}]
|
Keyword[public] identifier[ClientTransaction] identifier[sendRequest] operator[SEP] identifier[Request] identifier[request] operator[SEP] Keyword[throws] identifier[SipException] , identifier[TransactionUnavailableException] {
identifier[ensureCorrectDialogLocalTag] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[final] identifier[ClientTransactionWrapper] identifier[ctw] operator[=] identifier[ra] operator[SEP] identifier[getProviderWrapper] operator[SEP] operator[SEP] operator[SEP] identifier[getNewDialogActivityClientTransaction] operator[SEP] Keyword[this] , identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[Request] operator[SEP] identifier[INVITE] operator[SEP] operator[SEP] identifier[lastCancelableTransactionId] operator[=] identifier[ctw] operator[SEP] identifier[getActivityHandle] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tracer] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[tracer] operator[SEP] identifier[info] operator[SEP] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[ctw] operator[SEP] operator[+] literal[String] operator[+] identifier[request] operator[SEP] operator[SEP]
}
identifier[wrappedDialog] operator[SEP] identifier[sendRequest] operator[SEP] identifier[ctw] operator[SEP] identifier[getWrappedClientTransaction] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ctw] operator[SEP]
}
|
public boolean setMainKey(boolean bDisplayOption, Boolean boolSetModified, boolean bSetIfModified)
{
super.setMainKey(bDisplayOption, boolSetModified, bSetIfModified);
boolean bNonNulls = false; // Default to yes, all keys are null.
if (m_fldMainFile != null)
if ((m_bSetFilterIfNull) || (!m_fldMainFile.isNull()))
{
if ((bSetIfModified) || (!m_fldThisFile.isModified()) || (m_fldThisFile.isNull()))
m_fldThisFile.moveFieldToThis(m_fldMainFile, bDisplayOption, DBConstants.READ_MOVE);
if (boolSetModified != null)
m_fldThisFile.setModified(boolSetModified.booleanValue());
if (!m_fldThisFile.isNull())
bNonNulls = true; // Non null.
}
if (m_fldMainFile2 != null)
if ((m_bSetFilterIfNull) || (!m_fldMainFile2.isNull()))
{
if ((bSetIfModified) || (!m_fldThisFile2.isModified()) || (m_fldThisFile2.isNull()))
m_fldThisFile2.moveFieldToThis(m_fldMainFile2, bDisplayOption, DBConstants.READ_MOVE);
if (boolSetModified != null)
m_fldThisFile2.setModified(boolSetModified.booleanValue());
if (!m_fldThisFile2.isNull())
bNonNulls = true; // Non null.
}
if (m_fldMainFile3 != null)
if ((m_bSetFilterIfNull) || (!m_fldMainFile3.isNull()))
{
if ((bSetIfModified) || (!m_fldThisFile3.isModified()) || (m_fldThisFile3.isNull()))
m_fldThisFile3.moveFieldToThis(m_fldMainFile3, bDisplayOption, DBConstants.READ_MOVE);
if (boolSetModified != null)
m_fldThisFile3.setModified(boolSetModified.booleanValue());
if (!m_fldThisFile3.isNull())
bNonNulls = true; // Non null.
}
if (m_recordMain != null)
{
ReferenceField fieldThisRecord = this.getOwner().getReferenceField(m_recordMain);
if (m_bRefreshLastIfNotCurrent)
if (m_recordMain.getEditMode() == DBConstants.EDIT_NONE)
{ // If there is not a current record refresh the last record.
try {
Object bookmark = m_recordMain.getLastModified(DBConstants.DATA_SOURCE_HANDLE);
if (bookmark != null)
m_recordMain.setHandle(bookmark, DBConstants.DATA_SOURCE_HANDLE);
} catch (DBException ex) {
ex.printStackTrace();
}
}
if ((m_bSetFilterIfNull) || (!m_recordMain.getCounterField().isNull()))
{
if ((bSetIfModified) || (!fieldThisRecord.isModified()) || (fieldThisRecord.isNull()))
fieldThisRecord.setReference(m_recordMain, bDisplayOption, DBConstants.READ_MOVE); // Set the booking number in pax file
if (boolSetModified != null)
fieldThisRecord.setModified(boolSetModified.booleanValue());
}
if (!fieldThisRecord.isNull())
bNonNulls = true; // Non null.
}
return bNonNulls;
}
|
class class_name[name] begin[{]
method[setMainKey, return_type[type[boolean]], modifier[public], parameter[bDisplayOption, boolSetModified, bSetIfModified]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=bDisplayOption, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=boolSetModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bSetIfModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setMainKey, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[boolean], bNonNulls]
if[binary_operation[member[.m_fldMainFile], !=, literal[null]]] begin[{]
if[binary_operation[member[.m_bSetFilterIfNull], ||, call[m_fldMainFile.isNull, parameter[]]]] begin[{]
if[binary_operation[binary_operation[member[.bSetIfModified], ||, call[m_fldThisFile.isModified, parameter[]]], ||, call[m_fldThisFile.isNull, parameter[]]]] begin[{]
call[m_fldThisFile.moveFieldToThis, parameter[member[.m_fldMainFile], member[.bDisplayOption], member[DBConstants.READ_MOVE]]]
else begin[{]
None
end[}]
if[binary_operation[member[.boolSetModified], !=, literal[null]]] begin[{]
call[m_fldThisFile.setModified, parameter[call[boolSetModified.booleanValue, parameter[]]]]
else begin[{]
None
end[}]
if[call[m_fldThisFile.isNull, parameter[]]] begin[{]
assign[member[.bNonNulls], literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.m_fldMainFile2], !=, literal[null]]] begin[{]
if[binary_operation[member[.m_bSetFilterIfNull], ||, call[m_fldMainFile2.isNull, parameter[]]]] begin[{]
if[binary_operation[binary_operation[member[.bSetIfModified], ||, call[m_fldThisFile2.isModified, parameter[]]], ||, call[m_fldThisFile2.isNull, parameter[]]]] begin[{]
call[m_fldThisFile2.moveFieldToThis, parameter[member[.m_fldMainFile2], member[.bDisplayOption], member[DBConstants.READ_MOVE]]]
else begin[{]
None
end[}]
if[binary_operation[member[.boolSetModified], !=, literal[null]]] begin[{]
call[m_fldThisFile2.setModified, parameter[call[boolSetModified.booleanValue, parameter[]]]]
else begin[{]
None
end[}]
if[call[m_fldThisFile2.isNull, parameter[]]] begin[{]
assign[member[.bNonNulls], literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.m_fldMainFile3], !=, literal[null]]] begin[{]
if[binary_operation[member[.m_bSetFilterIfNull], ||, call[m_fldMainFile3.isNull, parameter[]]]] begin[{]
if[binary_operation[binary_operation[member[.bSetIfModified], ||, call[m_fldThisFile3.isModified, parameter[]]], ||, call[m_fldThisFile3.isNull, parameter[]]]] begin[{]
call[m_fldThisFile3.moveFieldToThis, parameter[member[.m_fldMainFile3], member[.bDisplayOption], member[DBConstants.READ_MOVE]]]
else begin[{]
None
end[}]
if[binary_operation[member[.boolSetModified], !=, literal[null]]] begin[{]
call[m_fldThisFile3.setModified, parameter[call[boolSetModified.booleanValue, parameter[]]]]
else begin[{]
None
end[}]
if[call[m_fldThisFile3.isNull, parameter[]]] begin[{]
assign[member[.bNonNulls], literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.m_recordMain], !=, literal[null]]] begin[{]
local_variable[type[ReferenceField], fieldThisRecord]
if[member[.m_bRefreshLastIfNotCurrent]] begin[{]
if[binary_operation[call[m_recordMain.getEditMode, parameter[]], ==, member[DBConstants.EDIT_NONE]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=DATA_SOURCE_HANDLE, postfix_operators=[], prefix_operators=[], qualifier=DBConstants, selectors=[])], member=getLastModified, postfix_operators=[], prefix_operators=[], qualifier=m_recordMain, selectors=[], type_arguments=None), name=bookmark)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bookmark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bookmark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DATA_SOURCE_HANDLE, postfix_operators=[], prefix_operators=[], qualifier=DBConstants, selectors=[])], member=setHandle, postfix_operators=[], prefix_operators=[], qualifier=m_recordMain, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['DBException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.m_bSetFilterIfNull], ||, call[m_recordMain.getCounterField, parameter[]]]] begin[{]
if[binary_operation[binary_operation[member[.bSetIfModified], ||, call[fieldThisRecord.isModified, parameter[]]], ||, call[fieldThisRecord.isNull, parameter[]]]] begin[{]
call[fieldThisRecord.setReference, parameter[member[.m_recordMain], member[.bDisplayOption], member[DBConstants.READ_MOVE]]]
else begin[{]
None
end[}]
if[binary_operation[member[.boolSetModified], !=, literal[null]]] begin[{]
call[fieldThisRecord.setModified, parameter[call[boolSetModified.booleanValue, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[call[fieldThisRecord.isNull, parameter[]]] begin[{]
assign[member[.bNonNulls], literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.bNonNulls]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[setMainKey] operator[SEP] Keyword[boolean] identifier[bDisplayOption] , identifier[Boolean] identifier[boolSetModified] , Keyword[boolean] identifier[bSetIfModified] operator[SEP] {
Keyword[super] operator[SEP] identifier[setMainKey] operator[SEP] identifier[bDisplayOption] , identifier[boolSetModified] , identifier[bSetIfModified] operator[SEP] operator[SEP] Keyword[boolean] identifier[bNonNulls] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[m_fldMainFile] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[m_bSetFilterIfNull] operator[SEP] operator[||] operator[SEP] operator[!] identifier[m_fldMainFile] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[bSetIfModified] operator[SEP] operator[||] operator[SEP] operator[!] identifier[m_fldThisFile] operator[SEP] identifier[isModified] operator[SEP] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[m_fldThisFile] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m_fldThisFile] operator[SEP] identifier[moveFieldToThis] operator[SEP] identifier[m_fldMainFile] , identifier[bDisplayOption] , identifier[DBConstants] operator[SEP] identifier[READ_MOVE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[boolSetModified] operator[!=] Other[null] operator[SEP] identifier[m_fldThisFile] operator[SEP] identifier[setModified] operator[SEP] identifier[boolSetModified] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[m_fldThisFile] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] identifier[bNonNulls] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_fldMainFile2] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[m_bSetFilterIfNull] operator[SEP] operator[||] operator[SEP] operator[!] identifier[m_fldMainFile2] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[bSetIfModified] operator[SEP] operator[||] operator[SEP] operator[!] identifier[m_fldThisFile2] operator[SEP] identifier[isModified] operator[SEP] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[m_fldThisFile2] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m_fldThisFile2] operator[SEP] identifier[moveFieldToThis] operator[SEP] identifier[m_fldMainFile2] , identifier[bDisplayOption] , identifier[DBConstants] operator[SEP] identifier[READ_MOVE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[boolSetModified] operator[!=] Other[null] operator[SEP] identifier[m_fldThisFile2] operator[SEP] identifier[setModified] operator[SEP] identifier[boolSetModified] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[m_fldThisFile2] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] identifier[bNonNulls] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_fldMainFile3] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[m_bSetFilterIfNull] operator[SEP] operator[||] operator[SEP] operator[!] identifier[m_fldMainFile3] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[bSetIfModified] operator[SEP] operator[||] operator[SEP] operator[!] identifier[m_fldThisFile3] operator[SEP] identifier[isModified] operator[SEP] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[m_fldThisFile3] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[m_fldThisFile3] operator[SEP] identifier[moveFieldToThis] operator[SEP] identifier[m_fldMainFile3] , identifier[bDisplayOption] , identifier[DBConstants] operator[SEP] identifier[READ_MOVE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[boolSetModified] operator[!=] Other[null] operator[SEP] identifier[m_fldThisFile3] operator[SEP] identifier[setModified] operator[SEP] identifier[boolSetModified] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[m_fldThisFile3] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] identifier[bNonNulls] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_recordMain] operator[!=] Other[null] operator[SEP] {
identifier[ReferenceField] identifier[fieldThisRecord] operator[=] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getReferenceField] operator[SEP] identifier[m_recordMain] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_bRefreshLastIfNotCurrent] operator[SEP] Keyword[if] operator[SEP] identifier[m_recordMain] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_NONE] operator[SEP] {
Keyword[try] {
identifier[Object] identifier[bookmark] operator[=] identifier[m_recordMain] operator[SEP] identifier[getLastModified] operator[SEP] identifier[DBConstants] operator[SEP] identifier[DATA_SOURCE_HANDLE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bookmark] operator[!=] Other[null] operator[SEP] identifier[m_recordMain] operator[SEP] identifier[setHandle] operator[SEP] identifier[bookmark] , identifier[DBConstants] operator[SEP] identifier[DATA_SOURCE_HANDLE] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[DBException] identifier[ex] operator[SEP] {
identifier[ex] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[SEP] identifier[m_bSetFilterIfNull] operator[SEP] operator[||] operator[SEP] operator[!] identifier[m_recordMain] operator[SEP] identifier[getCounterField] operator[SEP] operator[SEP] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[bSetIfModified] operator[SEP] operator[||] operator[SEP] operator[!] identifier[fieldThisRecord] operator[SEP] identifier[isModified] operator[SEP] operator[SEP] operator[SEP] operator[||] operator[SEP] identifier[fieldThisRecord] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[fieldThisRecord] operator[SEP] identifier[setReference] operator[SEP] identifier[m_recordMain] , identifier[bDisplayOption] , identifier[DBConstants] operator[SEP] identifier[READ_MOVE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[boolSetModified] operator[!=] Other[null] operator[SEP] identifier[fieldThisRecord] operator[SEP] identifier[setModified] operator[SEP] identifier[boolSetModified] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[fieldThisRecord] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[SEP] identifier[bNonNulls] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] identifier[bNonNulls] operator[SEP]
}
|
@Override
public ListAvailableZonesResult listAvailableZones(ListAvailableZonesRequest request) {
request = beforeClientExecution(request);
return executeListAvailableZones(request);
}
|
class class_name[name] begin[{]
method[listAvailableZones, return_type[type[ListAvailableZonesResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeListAvailableZones, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ListAvailableZonesResult] identifier[listAvailableZones] operator[SEP] identifier[ListAvailableZonesRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeListAvailableZones] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public ReceiveMessageRequest withAttributeNames(String... attributeNames) {
if (this.attributeNames == null) {
setAttributeNames(new com.amazonaws.internal.SdkInternalList<String>(attributeNames.length));
}
for (String ele : attributeNames) {
this.attributeNames.add(ele);
}
return this;
}
|
class class_name[name] begin[{]
method[withAttributeNames, return_type[type[ReceiveMessageRequest]], modifier[public], parameter[attributeNames]] begin[{]
if[binary_operation[THIS[member[None.attributeNames]], ==, literal[null]]] begin[{]
call[.setAttributeNames, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=attributeNames, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=attributeNames, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=attributeNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[ReceiveMessageRequest] identifier[withAttributeNames] operator[SEP] identifier[String] operator[...] identifier[attributeNames] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[attributeNames] operator[==] Other[null] operator[SEP] {
identifier[setAttributeNames] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] identifier[attributeNames] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[attributeNames] operator[SEP] {
Keyword[this] operator[SEP] identifier[attributeNames] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public Assignment outcomeToAssignment(Object[] outcome) {
Preconditions.checkArgument(outcome.length == nums.length,
"outcome %s cannot be assigned to %s (wrong number of values)", outcome, this);
return Assignment.fromSortedArrays(nums, outcome);
}
|
class class_name[name] begin[{]
method[outcomeToAssignment, return_type[type[Assignment]], modifier[public], parameter[outcome]] begin[{]
call[Preconditions.checkArgument, parameter[binary_operation[member[outcome.length], ==, member[nums.length]], literal["outcome %s cannot be assigned to %s (wrong number of values)"], member[.outcome], THIS[]]]
return[call[Assignment.fromSortedArrays, parameter[member[.nums], member[.outcome]]]]
end[}]
END[}]
|
Keyword[public] identifier[Assignment] identifier[outcomeToAssignment] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[outcome] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[outcome] operator[SEP] identifier[length] operator[==] identifier[nums] operator[SEP] identifier[length] , literal[String] , identifier[outcome] , Keyword[this] operator[SEP] operator[SEP] Keyword[return] identifier[Assignment] operator[SEP] identifier[fromSortedArrays] operator[SEP] identifier[nums] , identifier[outcome] operator[SEP] operator[SEP]
}
|
@Override
public UpdateMatchmakingConfigurationResult updateMatchmakingConfiguration(UpdateMatchmakingConfigurationRequest request) {
request = beforeClientExecution(request);
return executeUpdateMatchmakingConfiguration(request);
}
|
class class_name[name] begin[{]
method[updateMatchmakingConfiguration, return_type[type[UpdateMatchmakingConfigurationResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeUpdateMatchmakingConfiguration, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[UpdateMatchmakingConfigurationResult] identifier[updateMatchmakingConfiguration] operator[SEP] identifier[UpdateMatchmakingConfigurationRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeUpdateMatchmakingConfiguration] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private void setupTextField() {
searchFld = new CustomTextField();
GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
Glyph glyph = fontAwesome.create(FontAwesome.Glyph.SEARCH).color(Color.GRAY);
glyph.setPadding(new Insets(0, 3, 0, 5));
searchFld.setLeft(glyph);
}
|
class class_name[name] begin[{]
method[setupTextField, return_type[void], modifier[private], parameter[]] begin[{]
assign[member[.searchFld], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CustomTextField, sub_type=None))]
local_variable[type[GlyphFont], fontAwesome]
local_variable[type[Glyph], glyph]
call[glyph.setPadding, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Insets, sub_type=None))]]
call[searchFld.setLeft, parameter[member[.glyph]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[setupTextField] operator[SEP] operator[SEP] {
identifier[searchFld] operator[=] Keyword[new] identifier[CustomTextField] operator[SEP] operator[SEP] operator[SEP] identifier[GlyphFont] identifier[fontAwesome] operator[=] identifier[GlyphFontRegistry] operator[SEP] identifier[font] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Glyph] identifier[glyph] operator[=] identifier[fontAwesome] operator[SEP] identifier[create] operator[SEP] identifier[FontAwesome] operator[SEP] identifier[Glyph] operator[SEP] identifier[SEARCH] operator[SEP] operator[SEP] identifier[color] operator[SEP] identifier[Color] operator[SEP] identifier[GRAY] operator[SEP] operator[SEP] identifier[glyph] operator[SEP] identifier[setPadding] operator[SEP] Keyword[new] identifier[Insets] operator[SEP] Other[0] , Other[3] , Other[0] , Other[5] operator[SEP] operator[SEP] operator[SEP] identifier[searchFld] operator[SEP] identifier[setLeft] operator[SEP] identifier[glyph] operator[SEP] operator[SEP]
}
|
public void postProcess() {
if (foreignColumnName != null) {
foreignAutoRefresh = true;
}
if (foreignAutoRefresh && maxForeignAutoRefreshLevel == NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED) {
maxForeignAutoRefreshLevel = DatabaseField.DEFAULT_MAX_FOREIGN_AUTO_REFRESH_LEVEL;
}
}
|
class class_name[name] begin[{]
method[postProcess, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.foreignColumnName], !=, literal[null]]] begin[{]
assign[member[.foreignAutoRefresh], literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.foreignAutoRefresh], &&, binary_operation[member[.maxForeignAutoRefreshLevel], ==, member[.NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED]]]] begin[{]
assign[member[.maxForeignAutoRefreshLevel], member[DatabaseField.DEFAULT_MAX_FOREIGN_AUTO_REFRESH_LEVEL]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[postProcess] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[foreignColumnName] operator[!=] Other[null] operator[SEP] {
identifier[foreignAutoRefresh] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[foreignAutoRefresh] operator[&&] identifier[maxForeignAutoRefreshLevel] operator[==] identifier[NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED] operator[SEP] {
identifier[maxForeignAutoRefreshLevel] operator[=] identifier[DatabaseField] operator[SEP] identifier[DEFAULT_MAX_FOREIGN_AUTO_REFRESH_LEVEL] operator[SEP]
}
}
|
private String removeSpacesInDN(String DN) {
String attrs[] = DN.split(",");
StringBuilder result = new StringBuilder();
for (int i = 0; i < attrs.length; i++) {
if (attrs[i].indexOf("=") >= 0)
result.append(attrs[i].trim());
else
result.append(attrs[i]);
if (i != (attrs.length - 1))
result.append(",");
}
return result.toString();
}
|
class class_name[name] begin[{]
method[removeSpacesInDN, return_type[type[String]], modifier[private], parameter[DN]] begin[{]
local_variable[type[String], attrs]
local_variable[type[StringBuilder], result]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=attrs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="=")], member=indexOf, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=attrs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=attrs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=trim, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=attrs, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=",")], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, 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=attrs, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[result.toString, parameter[]]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[removeSpacesInDN] operator[SEP] identifier[String] identifier[DN] operator[SEP] {
identifier[String] identifier[attrs] operator[SEP] operator[SEP] operator[=] identifier[DN] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[attrs] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[attrs] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[>=] Other[0] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[attrs] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[attrs] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[!=] operator[SEP] identifier[attrs] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<SystemEventListener> getViewListenersForEventClass(Class<? extends SystemEvent> systemEvent) {
if (systemEvent == null) {
throw new NullPointerException();
}
if (viewListeners != null) {
return viewListeners.get(systemEvent);
}
return null;
}
|
class class_name[name] begin[{]
method[getViewListenersForEventClass, return_type[type[List]], modifier[public], parameter[systemEvent]] begin[{]
if[binary_operation[member[.systemEvent], ==, 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=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.viewListeners], !=, literal[null]]] begin[{]
return[call[viewListeners.get, parameter[member[.systemEvent]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[SystemEventListener] operator[>] identifier[getViewListenersForEventClass] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[SystemEvent] operator[>] identifier[systemEvent] operator[SEP] {
Keyword[if] operator[SEP] identifier[systemEvent] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[viewListeners] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[viewListeners] operator[SEP] identifier[get] operator[SEP] identifier[systemEvent] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public void setLineJoinImage(String lineJoinImage)
{
String val = setNonEmptyValueAttribute(lineJoinImage);
if (val != null)
_iState.setLineJoinImage(setNonEmptyValueAttribute(val));
}
|
class class_name[name] begin[{]
method[setLineJoinImage, return_type[void], modifier[public], parameter[lineJoinImage]] begin[{]
local_variable[type[String], val]
if[binary_operation[member[.val], !=, literal[null]]] begin[{]
call[_iState.setLineJoinImage, parameter[call[.setNonEmptyValueAttribute, parameter[member[.val]]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setLineJoinImage] operator[SEP] identifier[String] identifier[lineJoinImage] operator[SEP] {
identifier[String] identifier[val] operator[=] identifier[setNonEmptyValueAttribute] operator[SEP] identifier[lineJoinImage] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[!=] Other[null] operator[SEP] identifier[_iState] operator[SEP] identifier[setLineJoinImage] operator[SEP] identifier[setNonEmptyValueAttribute] operator[SEP] identifier[val] operator[SEP] operator[SEP] operator[SEP]
}
|
OmemoMessage.Sent createKeyTransportElement(OmemoManager.LoggedInOmemoManager managerGuard,
Set<OmemoDevice> contactsDevices,
byte[] key,
byte[] iv)
throws InterruptedException, UndecidedOmemoIdentityException, CryptoFailedException,
SmackException.NotConnectedException, SmackException.NoResponseException {
return encrypt(managerGuard, contactsDevices, key, iv, null);
}
|
class class_name[name] begin[{]
method[createKeyTransportElement, return_type[type[OmemoMessage]], modifier[default], parameter[managerGuard, contactsDevices, key, iv]] begin[{]
return[call[.encrypt, parameter[member[.managerGuard], member[.contactsDevices], member[.key], member[.iv], literal[null]]]]
end[}]
END[}]
|
identifier[OmemoMessage] operator[SEP] identifier[Sent] identifier[createKeyTransportElement] operator[SEP] identifier[OmemoManager] operator[SEP] identifier[LoggedInOmemoManager] identifier[managerGuard] , identifier[Set] operator[<] identifier[OmemoDevice] operator[>] identifier[contactsDevices] , Keyword[byte] operator[SEP] operator[SEP] identifier[key] , Keyword[byte] operator[SEP] operator[SEP] identifier[iv] operator[SEP] Keyword[throws] identifier[InterruptedException] , identifier[UndecidedOmemoIdentityException] , identifier[CryptoFailedException] , identifier[SmackException] operator[SEP] identifier[NotConnectedException] , identifier[SmackException] operator[SEP] identifier[NoResponseException] {
Keyword[return] identifier[encrypt] operator[SEP] identifier[managerGuard] , identifier[contactsDevices] , identifier[key] , identifier[iv] , Other[null] operator[SEP] operator[SEP]
}
|
public Milestone closeGroupMilestone(Object groupIdOrPath, Integer milestoneId) throws GitLabApiException {
if (milestoneId == null) {
throw new RuntimeException("milestoneId cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("state_event", MilestoneState.CLOSE);
Response response = put(Response.Status.OK, formData.asMap(),
"groups", getGroupIdOrPath(groupIdOrPath), "milestones", milestoneId);
return (response.readEntity(Milestone.class));
}
|
class class_name[name] begin[{]
method[closeGroupMilestone, return_type[type[Milestone]], modifier[public], parameter[groupIdOrPath, milestoneId]] begin[{]
if[binary_operation[member[.milestoneId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="milestoneId cannot be null")], 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[}]
local_variable[type[GitLabApiForm], formData]
local_variable[type[Response], response]
return[call[response.readEntity, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Milestone, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[Milestone] identifier[closeGroupMilestone] operator[SEP] identifier[Object] identifier[groupIdOrPath] , identifier[Integer] identifier[milestoneId] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[if] operator[SEP] identifier[milestoneId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[GitLabApiForm] identifier[formData] operator[=] Keyword[new] identifier[GitLabApiForm] operator[SEP] operator[SEP] operator[SEP] identifier[withParam] operator[SEP] literal[String] , identifier[MilestoneState] operator[SEP] identifier[CLOSE] operator[SEP] operator[SEP] identifier[Response] identifier[response] operator[=] identifier[put] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[OK] , identifier[formData] operator[SEP] identifier[asMap] operator[SEP] operator[SEP] , literal[String] , identifier[getGroupIdOrPath] operator[SEP] identifier[groupIdOrPath] operator[SEP] , literal[String] , identifier[milestoneId] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[response] operator[SEP] identifier[readEntity] operator[SEP] identifier[Milestone] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
|
public ClassNode getFromClassCache(String name) {
// We use here the class cache cachedClasses to prevent
// calls to ClassLoader#loadClass. Disabling this cache will
// cause a major performance hit.
ClassNode cached = cachedClasses.get(name);
return cached;
}
|
class class_name[name] begin[{]
method[getFromClassCache, return_type[type[ClassNode]], modifier[public], parameter[name]] begin[{]
local_variable[type[ClassNode], cached]
return[member[.cached]]
end[}]
END[}]
|
Keyword[public] identifier[ClassNode] identifier[getFromClassCache] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[ClassNode] identifier[cached] operator[=] identifier[cachedClasses] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[cached] operator[SEP]
}
|
private Set<ApiResourceMetadata> checkResource(JCodeModel bodyCodeModel, String baseUrl, RamlResource resource,
ApiResourceMetadata controller, RamlRoot document) {
Set<ApiResourceMetadata> controllers = new LinkedHashSet<>();
// append resource URL to url.
String url = baseUrl + resource.getRelativeUri();
if (controller == null && shouldCreateController(resource)) {
controller = new ApiResourceMetadata(bodyCodeModel, url, resource, document);
controllers.add(controller);
}
// extract actions for this resource
if (resource.getActions() != null && !resource.getActions().isEmpty()) {
for (RamlActionType actionType : RamlActionType.values()) {
if (resource.getActions().containsKey(actionType)) {
RamlAction childResource = resource.getActions().get(actionType);
// if we have multiple response types in the raml, this
// should produce different calls
RamlResponse response = null;
if (childResource.getResponses() != null) {
response = RamlHelper.getSuccessfulResponse(childResource);
}
if (Config.isSeperateMethodsByContentType() && response != null && response.hasBody()
&& response.getBody().size() > 1) {
for (String responseType : response.getBody().keySet()) {
controller.addApiCall(resource, actionType, childResource, responseType);
}
} else {
controller.addApiCall(resource, actionType, childResource, null);
}
}
}
}
if (resource.getResources() != null && !resource.getResources().isEmpty()) {
for (Entry<String, RamlResource> childResource : resource.getResources().entrySet()) {
controllers.addAll(checkResource(bodyCodeModel, url, childResource.getValue(), controller, document));
}
}
return controllers;
}
|
class class_name[name] begin[{]
method[checkResource, return_type[type[Set]], modifier[private], parameter[bodyCodeModel, baseUrl, resource, controller, document]] begin[{]
local_variable[type[Set], controllers]
local_variable[type[String], url]
if[binary_operation[binary_operation[member[.controller], ==, literal[null]], &&, call[.shouldCreateController, parameter[member[.resource]]]]] begin[{]
assign[member[.controller], ClassCreator(arguments=[MemberReference(member=bodyCodeModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=document, 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=ApiResourceMetadata, sub_type=None))]
call[controllers.add, parameter[member[.controller]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[resource.getActions, parameter[]], !=, literal[null]], &&, call[resource.getActions, parameter[]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getActions, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[MethodInvocation(arguments=[MemberReference(member=actionType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getActions, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[MethodInvocation(arguments=[MemberReference(member=actionType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=childResource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RamlAction, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RamlResponse, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getResponses, postfix_operators=[], prefix_operators=[], qualifier=childResource, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=childResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSuccessfulResponse, postfix_operators=[], prefix_operators=[], qualifier=RamlHelper, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isSeperateMethodsByContentType, postfix_operators=[], prefix_operators=[], qualifier=Config, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), operandr=MethodInvocation(arguments=[], member=hasBody, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getBody, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=actionType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=childResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=addApiCall, postfix_operators=[], prefix_operators=[], qualifier=controller, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=actionType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=childResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=responseType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addApiCall, postfix_operators=[], prefix_operators=[], qualifier=controller, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getBody, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[MethodInvocation(arguments=[], member=keySet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=responseType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=RamlActionType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=actionType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RamlActionType, sub_type=None))), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[resource.getResources, parameter[]], !=, literal[null]], &&, call[resource.getResources, parameter[]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=bodyCodeModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=childResource, selectors=[], type_arguments=None), MemberReference(member=controller, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=document, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=controllers, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getResources, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[MethodInvocation(arguments=[], member=entrySet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=childResource)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RamlResource, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.controllers]]
end[}]
END[}]
|
Keyword[private] identifier[Set] operator[<] identifier[ApiResourceMetadata] operator[>] identifier[checkResource] operator[SEP] identifier[JCodeModel] identifier[bodyCodeModel] , identifier[String] identifier[baseUrl] , identifier[RamlResource] identifier[resource] , identifier[ApiResourceMetadata] identifier[controller] , identifier[RamlRoot] identifier[document] operator[SEP] {
identifier[Set] operator[<] identifier[ApiResourceMetadata] operator[>] identifier[controllers] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[url] operator[=] identifier[baseUrl] operator[+] identifier[resource] operator[SEP] identifier[getRelativeUri] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[controller] operator[==] Other[null] operator[&&] identifier[shouldCreateController] operator[SEP] identifier[resource] operator[SEP] operator[SEP] {
identifier[controller] operator[=] Keyword[new] identifier[ApiResourceMetadata] operator[SEP] identifier[bodyCodeModel] , identifier[url] , identifier[resource] , identifier[document] operator[SEP] operator[SEP] identifier[controllers] operator[SEP] identifier[add] operator[SEP] identifier[controller] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[resource] operator[SEP] identifier[getActions] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] identifier[resource] operator[SEP] identifier[getActions] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[RamlActionType] identifier[actionType] operator[:] identifier[RamlActionType] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[resource] operator[SEP] identifier[getActions] operator[SEP] operator[SEP] operator[SEP] identifier[containsKey] operator[SEP] identifier[actionType] operator[SEP] operator[SEP] {
identifier[RamlAction] identifier[childResource] operator[=] identifier[resource] operator[SEP] identifier[getActions] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[actionType] operator[SEP] operator[SEP] identifier[RamlResponse] identifier[response] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[childResource] operator[SEP] identifier[getResponses] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[response] operator[=] identifier[RamlHelper] operator[SEP] identifier[getSuccessfulResponse] operator[SEP] identifier[childResource] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Config] operator[SEP] identifier[isSeperateMethodsByContentType] operator[SEP] operator[SEP] operator[&&] identifier[response] operator[!=] Other[null] operator[&&] identifier[response] operator[SEP] identifier[hasBody] operator[SEP] operator[SEP] operator[&&] identifier[response] operator[SEP] identifier[getBody] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[responseType] operator[:] identifier[response] operator[SEP] identifier[getBody] operator[SEP] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[controller] operator[SEP] identifier[addApiCall] operator[SEP] identifier[resource] , identifier[actionType] , identifier[childResource] , identifier[responseType] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[controller] operator[SEP] identifier[addApiCall] operator[SEP] identifier[resource] , identifier[actionType] , identifier[childResource] , Other[null] operator[SEP] operator[SEP]
}
}
}
}
Keyword[if] operator[SEP] identifier[resource] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] identifier[resource] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[RamlResource] operator[>] identifier[childResource] operator[:] identifier[resource] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[controllers] operator[SEP] identifier[addAll] operator[SEP] identifier[checkResource] operator[SEP] identifier[bodyCodeModel] , identifier[url] , identifier[childResource] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[controller] , identifier[document] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[controllers] operator[SEP]
}
|
private String hashAndGetName()
{
group.getInstructions().accept(this);
for (final FieldNode node: group.getFields())
hasher.putObject(node, FieldNodeFunnel.INSTANCE);
final byte[] hash = new byte[10];
hasher.hash().writeBytesTo(hash, 0, 10);
final String prefix = group.getRoot().isActionRoot()
? "Action$" : "VarInit$";
return prefix + BASE_ENCODING.encode(hash);
}
|
class class_name[name] begin[{]
method[hashAndGetName, return_type[type[String]], modifier[private], parameter[]] begin[{]
call[group.getInstructions, parameter[]]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=INSTANCE, postfix_operators=[], prefix_operators=[], qualifier=FieldNodeFunnel, selectors=[])], member=putObject, postfix_operators=[], prefix_operators=[], qualifier=hasher, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFields, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=node)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=FieldNode, sub_type=None))), label=None)
local_variable[type[byte], hash]
call[hasher.hash, parameter[]]
local_variable[type[String], prefix]
return[binary_operation[member[.prefix], +, call[BASE_ENCODING.encode, parameter[member[.hash]]]]]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[hashAndGetName] operator[SEP] operator[SEP] {
identifier[group] operator[SEP] identifier[getInstructions] operator[SEP] operator[SEP] operator[SEP] identifier[accept] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[FieldNode] identifier[node] operator[:] identifier[group] operator[SEP] identifier[getFields] operator[SEP] operator[SEP] operator[SEP] identifier[hasher] operator[SEP] identifier[putObject] operator[SEP] identifier[node] , identifier[FieldNodeFunnel] operator[SEP] identifier[INSTANCE] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[hash] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[10] operator[SEP] operator[SEP] identifier[hasher] operator[SEP] identifier[hash] operator[SEP] operator[SEP] operator[SEP] identifier[writeBytesTo] operator[SEP] identifier[hash] , Other[0] , Other[10] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[prefix] operator[=] identifier[group] operator[SEP] identifier[getRoot] operator[SEP] operator[SEP] operator[SEP] identifier[isActionRoot] operator[SEP] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] Keyword[return] identifier[prefix] operator[+] identifier[BASE_ENCODING] operator[SEP] identifier[encode] operator[SEP] identifier[hash] operator[SEP] operator[SEP]
}
|
public String generateName(String name) {
checkName(name);
names.add(name);
int count = names.count(name);
if (count == 1) {
return name;
}
return name + collisionSeparator + (count - 1);
}
|
class class_name[name] begin[{]
method[generateName, return_type[type[String]], modifier[public], parameter[name]] begin[{]
call[.checkName, parameter[member[.name]]]
call[names.add, parameter[member[.name]]]
local_variable[type[int], count]
if[binary_operation[member[.count], ==, literal[1]]] begin[{]
return[member[.name]]
else begin[{]
None
end[}]
return[binary_operation[binary_operation[member[.name], +, member[.collisionSeparator]], +, binary_operation[member[.count], -, literal[1]]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[generateName] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[checkName] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[names] operator[SEP] identifier[add] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] identifier[names] operator[SEP] identifier[count] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[name] operator[SEP]
}
Keyword[return] identifier[name] operator[+] identifier[collisionSeparator] operator[+] operator[SEP] identifier[count] operator[-] Other[1] operator[SEP] operator[SEP]
}
|
public ServiceFuture<List<VaultUsageInner>> listByVaultsAsync(String resourceGroupName, String vaultName, final ServiceCallback<List<VaultUsageInner>> serviceCallback) {
return ServiceFuture.fromResponse(listByVaultsWithServiceResponseAsync(resourceGroupName, vaultName), serviceCallback);
}
|
class class_name[name] begin[{]
method[listByVaultsAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, vaultName, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.listByVaultsWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.vaultName]]], member[.serviceCallback]]]]
end[}]
END[}]
|
Keyword[public] identifier[ServiceFuture] operator[<] identifier[List] operator[<] identifier[VaultUsageInner] operator[>] operator[>] identifier[listByVaultsAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[vaultName] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[List] operator[<] identifier[VaultUsageInner] operator[>] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[listByVaultsWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[vaultName] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public static CliDirectory fromDef(CommandDirectoryDef def) {
final Trie<CliDirectory> childDirectories = createChildDirectories(def);
final Trie<CliCommand> childCommands = createChildCommands(def);
final CliDirectory directory = new CliDirectory(def.getIdentifier(), childDirectories, childCommands);
// Link child directories to parent.
for (CliDirectory childDirectory : childDirectories.values()) {
childDirectory.setParent(directory);
}
return directory;
}
|
class class_name[name] begin[{]
method[fromDef, return_type[type[CliDirectory]], modifier[public static], parameter[def]] begin[{]
local_variable[type[Trie], childDirectories]
local_variable[type[Trie], childCommands]
local_variable[type[CliDirectory], directory]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=directory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setParent, postfix_operators=[], prefix_operators=[], qualifier=childDirectory, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=childDirectories, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=childDirectory)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CliDirectory, sub_type=None))), label=None)
return[member[.directory]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[CliDirectory] identifier[fromDef] operator[SEP] identifier[CommandDirectoryDef] identifier[def] operator[SEP] {
Keyword[final] identifier[Trie] operator[<] identifier[CliDirectory] operator[>] identifier[childDirectories] operator[=] identifier[createChildDirectories] operator[SEP] identifier[def] operator[SEP] operator[SEP] Keyword[final] identifier[Trie] operator[<] identifier[CliCommand] operator[>] identifier[childCommands] operator[=] identifier[createChildCommands] operator[SEP] identifier[def] operator[SEP] operator[SEP] Keyword[final] identifier[CliDirectory] identifier[directory] operator[=] Keyword[new] identifier[CliDirectory] operator[SEP] identifier[def] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] , identifier[childDirectories] , identifier[childCommands] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CliDirectory] identifier[childDirectory] operator[:] identifier[childDirectories] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[childDirectory] operator[SEP] identifier[setParent] operator[SEP] identifier[directory] operator[SEP] operator[SEP]
}
Keyword[return] identifier[directory] operator[SEP]
}
|
public void marshall(EndpointBatchItem endpointBatchItem, ProtocolMarshaller protocolMarshaller) {
if (endpointBatchItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(endpointBatchItem.getAddress(), ADDRESS_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getAttributes(), ATTRIBUTES_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getChannelType(), CHANNELTYPE_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getDemographic(), DEMOGRAPHIC_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getEffectiveDate(), EFFECTIVEDATE_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getEndpointStatus(), ENDPOINTSTATUS_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getId(), ID_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getLocation(), LOCATION_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getMetrics(), METRICS_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getOptOut(), OPTOUT_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getRequestId(), REQUESTID_BINDING);
protocolMarshaller.marshall(endpointBatchItem.getUser(), USER_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[endpointBatchItem, protocolMarshaller]] begin[{]
if[binary_operation[member[.endpointBatchItem], ==, 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=getAddress, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=ADDRESS_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=getAttributes, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, 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=getChannelType, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=CHANNELTYPE_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=getDemographic, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=DEMOGRAPHIC_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=getEffectiveDate, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=EFFECTIVEDATE_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=getEndpointStatus, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=ENDPOINTSTATUS_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=getId, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=ID_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=getLocation, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=LOCATION_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=getMetrics, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=METRICS_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=getOptOut, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=OPTOUT_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=getRequestId, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=REQUESTID_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=getUser, postfix_operators=[], prefix_operators=[], qualifier=endpointBatchItem, selectors=[], type_arguments=None), MemberReference(member=USER_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[EndpointBatchItem] identifier[endpointBatchItem] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[endpointBatchItem] 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[endpointBatchItem] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] , identifier[ADDRESS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] , identifier[ATTRIBUTES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getChannelType] operator[SEP] operator[SEP] , identifier[CHANNELTYPE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getDemographic] operator[SEP] operator[SEP] , identifier[DEMOGRAPHIC_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getEffectiveDate] operator[SEP] operator[SEP] , identifier[EFFECTIVEDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getEndpointStatus] operator[SEP] operator[SEP] , identifier[ENDPOINTSTATUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[ID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] , identifier[LOCATION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getMetrics] operator[SEP] operator[SEP] , identifier[METRICS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getOptOut] operator[SEP] operator[SEP] , identifier[OPTOUT_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getRequestId] operator[SEP] operator[SEP] , identifier[REQUESTID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[endpointBatchItem] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] , identifier[USER_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]
}
}
|
private IChemFile readChemFile(IChemFile cf) throws CDKException {
// have to do stuff here
try {
String line = null;
while ((line = input.readLine()) != null) {
if (line.startsWith("INChI=") || line.startsWith("InChI=")) {
// ok, the fun starts
cf = cf.getBuilder().newInstance(IChemFile.class);
// ok, we need to parse things like:
// INChI=1.12Beta/C6H6/c1-2-4-6-5-3-1/h1-6H
final String INChI = line.substring(6);
StringTokenizer tokenizer = new StringTokenizer(INChI, "/");
// ok, we expect 4 tokens
tokenizer.nextToken(); // 1.12Beta not stored since never used
final String formula = tokenizer.nextToken(); // C6H6
String connections = null;
if (tokenizer.hasMoreTokens()) {
connections = tokenizer.nextToken().substring(1); // 1-2-4-6-5-3-1
}
//final String hydrogens = tokenizer.nextToken().substring(1); // 1-6H
IAtomContainer parsedContent = inchiTool.processFormula(
cf.getBuilder().newInstance(IAtomContainer.class), formula);
if (connections != null)
inchiTool.processConnections(connections, parsedContent, -1);
IAtomContainerSet moleculeSet = cf.getBuilder().newInstance(IAtomContainerSet.class);
moleculeSet.addAtomContainer(cf.getBuilder().newInstance(IAtomContainer.class, parsedContent));
IChemModel model = cf.getBuilder().newInstance(IChemModel.class);
model.setMoleculeSet(moleculeSet);
IChemSequence sequence = cf.getBuilder().newInstance(IChemSequence.class);
sequence.addChemModel(model);
cf.addChemSequence(sequence);
}
}
} catch (IOException | IllegalArgumentException exception) {
exception.printStackTrace();
throw new CDKException("Error while reading INChI file: " + exception.getMessage(), exception);
}
return cf;
}
|
class class_name[name] begin[{]
method[readChemFile, return_type[type[IChemFile]], modifier[private], parameter[cf]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INChI=")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="InChI=")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getBuilder, postfix_operators=[], prefix_operators=[], qualifier=cf, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IChemFile, sub_type=None))], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), name=INChI)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=INChI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringTokenizer, sub_type=None)), name=tokenizer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringTokenizer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=tokenizer, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=tokenizer, selectors=[], type_arguments=None), name=formula)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=connections)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=hasMoreTokens, postfix_operators=[], prefix_operators=[], qualifier=tokenizer, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=connections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=nextToken, postfix_operators=[], prefix_operators=[], qualifier=tokenizer, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=substring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBuilder, postfix_operators=[], prefix_operators=[], qualifier=cf, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IAtomContainer, sub_type=None))], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=formula, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processFormula, postfix_operators=[], prefix_operators=[], qualifier=inchiTool, selectors=[], type_arguments=None), name=parsedContent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IAtomContainer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=connections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=connections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=parsedContent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1)], member=processConnections, postfix_operators=[], prefix_operators=[], qualifier=inchiTool, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBuilder, postfix_operators=[], prefix_operators=[], qualifier=cf, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IAtomContainerSet, sub_type=None))], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=moleculeSet)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IAtomContainerSet, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBuilder, postfix_operators=[], prefix_operators=[], qualifier=cf, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IAtomContainer, sub_type=None)), MemberReference(member=parsedContent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=addAtomContainer, postfix_operators=[], prefix_operators=[], qualifier=moleculeSet, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBuilder, postfix_operators=[], prefix_operators=[], qualifier=cf, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IChemModel, sub_type=None))], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=model)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IChemModel, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=moleculeSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setMoleculeSet, postfix_operators=[], prefix_operators=[], qualifier=model, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBuilder, postfix_operators=[], prefix_operators=[], qualifier=cf, selectors=[MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IChemSequence, sub_type=None))], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=sequence)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IChemSequence, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addChemModel, postfix_operators=[], prefix_operators=[], qualifier=sequence, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sequence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addChemSequence, postfix_operators=[], prefix_operators=[], qualifier=cf, selectors=[], type_arguments=None), label=None)]))]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=exception, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while reading INChI file: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=exception, selectors=[], type_arguments=None), operator=+), MemberReference(member=exception, 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=CDKException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['IOException', 'IllegalArgumentException']))], finally_block=None, label=None, resources=None)
return[member[.cf]]
end[}]
END[}]
|
Keyword[private] identifier[IChemFile] identifier[readChemFile] operator[SEP] identifier[IChemFile] identifier[cf] operator[SEP] Keyword[throws] identifier[CDKException] {
Keyword[try] {
identifier[String] identifier[line] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[input] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[||] identifier[line] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[cf] operator[=] identifier[cf] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IChemFile] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[INChI] operator[=] identifier[line] operator[SEP] identifier[substring] operator[SEP] Other[6] operator[SEP] operator[SEP] identifier[StringTokenizer] identifier[tokenizer] operator[=] Keyword[new] identifier[StringTokenizer] operator[SEP] identifier[INChI] , literal[String] operator[SEP] operator[SEP] identifier[tokenizer] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[formula] operator[=] identifier[tokenizer] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[connections] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[tokenizer] operator[SEP] identifier[hasMoreTokens] operator[SEP] operator[SEP] operator[SEP] {
identifier[connections] operator[=] identifier[tokenizer] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
identifier[IAtomContainer] identifier[parsedContent] operator[=] identifier[inchiTool] operator[SEP] identifier[processFormula] operator[SEP] identifier[cf] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IAtomContainer] operator[SEP] Keyword[class] operator[SEP] , identifier[formula] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[connections] operator[!=] Other[null] operator[SEP] identifier[inchiTool] operator[SEP] identifier[processConnections] operator[SEP] identifier[connections] , identifier[parsedContent] , operator[-] Other[1] operator[SEP] operator[SEP] identifier[IAtomContainerSet] identifier[moleculeSet] operator[=] identifier[cf] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IAtomContainerSet] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[moleculeSet] operator[SEP] identifier[addAtomContainer] operator[SEP] identifier[cf] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IAtomContainer] operator[SEP] Keyword[class] , identifier[parsedContent] operator[SEP] operator[SEP] operator[SEP] identifier[IChemModel] identifier[model] operator[=] identifier[cf] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IChemModel] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[model] operator[SEP] identifier[setMoleculeSet] operator[SEP] identifier[moleculeSet] operator[SEP] operator[SEP] identifier[IChemSequence] identifier[sequence] operator[=] identifier[cf] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[IChemSequence] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[sequence] operator[SEP] identifier[addChemModel] operator[SEP] identifier[model] operator[SEP] operator[SEP] identifier[cf] operator[SEP] identifier[addChemSequence] operator[SEP] identifier[sequence] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] operator[|] identifier[IllegalArgumentException] identifier[exception] operator[SEP] {
identifier[exception] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CDKException] operator[SEP] literal[String] operator[+] identifier[exception] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[exception] operator[SEP] operator[SEP]
}
Keyword[return] identifier[cf] operator[SEP]
}
|
public void addSipApplication(String sipApplicationName, SipContext sipApplication) {
DispatcherFSM.Event ev = fsm.new Event(DispatcherFSM.EventType.ADD_APP);
ev.data.put(CONTEXT_EV_DATA, sipApplication);
fsm.fireEvent(ev);
}
|
class class_name[name] begin[{]
method[addSipApplication, return_type[void], modifier[public], parameter[sipApplicationName, sipApplication]] begin[{]
local_variable[type[DispatcherFSM], ev]
call[ev.data.put, parameter[member[.CONTEXT_EV_DATA], member[.sipApplication]]]
call[fsm.fireEvent, parameter[member[.ev]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addSipApplication] operator[SEP] identifier[String] identifier[sipApplicationName] , identifier[SipContext] identifier[sipApplication] operator[SEP] {
identifier[DispatcherFSM] operator[SEP] identifier[Event] identifier[ev] operator[=] identifier[fsm] operator[SEP] Keyword[new] identifier[Event] operator[SEP] identifier[DispatcherFSM] operator[SEP] identifier[EventType] operator[SEP] identifier[ADD_APP] operator[SEP] operator[SEP] identifier[ev] operator[SEP] identifier[data] operator[SEP] identifier[put] operator[SEP] identifier[CONTEXT_EV_DATA] , identifier[sipApplication] operator[SEP] operator[SEP] identifier[fsm] operator[SEP] identifier[fireEvent] operator[SEP] identifier[ev] operator[SEP] operator[SEP]
}
|
@Conditioned
@Quand("Je passe au dessus de '(.*)-(.*)'[\\.|\\?]")
@When("I pass over '(.*)-(.*)'[\\.|\\?]")
public void passOver(String page, String elementName, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException {
passOver(Page.getInstance(page).getPageElementByKey('-' + elementName));
}
|
class class_name[name] begin[{]
method[passOver, return_type[void], modifier[public], parameter[page, elementName, conditions]] begin[{]
call[.passOver, parameter[call[Page.getInstance, parameter[member[.page]]]]]
end[}]
END[}]
|
annotation[@] identifier[Conditioned] annotation[@] identifier[Quand] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[When] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[passOver] operator[SEP] identifier[String] identifier[page] , identifier[String] identifier[elementName] , identifier[List] operator[<] identifier[GherkinStepCondition] operator[>] identifier[conditions] operator[SEP] Keyword[throws] identifier[TechnicalException] , identifier[FailureException] {
identifier[passOver] operator[SEP] identifier[Page] operator[SEP] identifier[getInstance] operator[SEP] identifier[page] operator[SEP] operator[SEP] identifier[getPageElementByKey] operator[SEP] literal[String] operator[+] identifier[elementName] operator[SEP] operator[SEP] operator[SEP]
}
|
public Pager<Milestone> getMilestones(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException {
return (new Pager<Milestone>(this, Milestone.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "milestones"));
}
|
class class_name[name] begin[{]
method[getMilestones, return_type[type[Pager]], modifier[public], parameter[projectIdOrPath, itemsPerPage]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Milestone, sub_type=None)), MemberReference(member=itemsPerPage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="projects"), MethodInvocation(arguments=[MemberReference(member=projectIdOrPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProjectIdOrPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="milestones")], 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=Milestone, sub_type=None))], dimensions=None, name=Pager, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[Pager] operator[<] identifier[Milestone] operator[>] identifier[getMilestones] operator[SEP] identifier[Object] identifier[projectIdOrPath] , Keyword[int] identifier[itemsPerPage] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[return] operator[SEP] Keyword[new] identifier[Pager] operator[<] identifier[Milestone] operator[>] operator[SEP] Keyword[this] , identifier[Milestone] operator[SEP] Keyword[class] , identifier[itemsPerPage] , Other[null] , literal[String] , identifier[getProjectIdOrPath] operator[SEP] identifier[projectIdOrPath] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public Map<Long, Post> selectPostMap(final Collection<Long> postIds, final boolean withResolve) throws SQLException {
Map<Long, Post> postMap = Maps.newHashMapWithExpectedSize(postIds.size());
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Timer.Context ctx = metrics.selectPostMapTimer.time();
StringBuilder sql = new StringBuilder(selectPostSQL).append(postsTableName).append(" WHERE ID IN (");
sql.append(inJoiner.join(postIds));
sql.append(")");
try {
conn = connectionSupplier.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql.toString());
while(rs.next()) {
Post.Builder post = postFromResultSet(rs);
postMap.put(post.getId(), withResolve ? resolve(post).build() : post.build());
}
return postMap;
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt, rs);
}
}
|
class class_name[name] begin[{]
method[selectPostMap, return_type[type[Map]], modifier[public], parameter[postIds, withResolve]] begin[{]
local_variable[type[Map], postMap]
local_variable[type[Connection], conn]
local_variable[type[Statement], stmt]
local_variable[type[ResultSet], rs]
local_variable[type[Timer], ctx]
local_variable[type[StringBuilder], sql]
call[sql.append, parameter[call[inJoiner.join, parameter[member[.postIds]]]]]
call[sql.append, parameter[literal[")"]]]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=connectionSupplier, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=createStatement, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=sql, selectors=[], type_arguments=None)], member=executeQuery, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None)), label=None), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=postFromResultSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=post)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Post, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None))), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=post, selectors=[], type_arguments=None), TernaryExpression(condition=MemberReference(member=withResolve, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=post, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=post, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resolve, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=postMap, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=postMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=stop, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=closeQuietly, postfix_operators=[], prefix_operators=[], qualifier=SQLUtil, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[Map] operator[<] identifier[Long] , identifier[Post] operator[>] identifier[selectPostMap] operator[SEP] Keyword[final] identifier[Collection] operator[<] identifier[Long] operator[>] identifier[postIds] , Keyword[final] Keyword[boolean] identifier[withResolve] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[Map] operator[<] identifier[Long] , identifier[Post] operator[>] identifier[postMap] operator[=] identifier[Maps] operator[SEP] identifier[newHashMapWithExpectedSize] operator[SEP] identifier[postIds] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Connection] identifier[conn] operator[=] Other[null] operator[SEP] identifier[Statement] identifier[stmt] operator[=] Other[null] operator[SEP] identifier[ResultSet] identifier[rs] operator[=] Other[null] operator[SEP] identifier[Timer] operator[SEP] identifier[Context] identifier[ctx] operator[=] identifier[metrics] operator[SEP] identifier[selectPostMapTimer] operator[SEP] identifier[time] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sql] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[selectPostSQL] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[postsTableName] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] identifier[inJoiner] operator[SEP] identifier[join] operator[SEP] identifier[postIds] operator[SEP] operator[SEP] operator[SEP] identifier[sql] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[conn] operator[=] identifier[connectionSupplier] operator[SEP] identifier[getConnection] operator[SEP] operator[SEP] operator[SEP] identifier[stmt] operator[=] identifier[conn] operator[SEP] identifier[createStatement] operator[SEP] operator[SEP] operator[SEP] identifier[rs] operator[=] identifier[stmt] operator[SEP] identifier[executeQuery] operator[SEP] identifier[sql] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[rs] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
identifier[Post] operator[SEP] identifier[Builder] identifier[post] operator[=] identifier[postFromResultSet] operator[SEP] identifier[rs] operator[SEP] operator[SEP] identifier[postMap] operator[SEP] identifier[put] operator[SEP] identifier[post] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[withResolve] operator[?] identifier[resolve] operator[SEP] identifier[post] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[:] identifier[post] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[postMap] operator[SEP]
}
Keyword[finally] {
identifier[ctx] operator[SEP] identifier[stop] operator[SEP] operator[SEP] operator[SEP] identifier[SQLUtil] operator[SEP] identifier[closeQuietly] operator[SEP] identifier[conn] , identifier[stmt] , identifier[rs] operator[SEP] operator[SEP]
}
}
|
@Override
public void visitCode(final Code obj) {
if (sourceLines == null) {
return;
}
if (isAbstract) {
return;
}
if (Values.STATIC_INITIALIZER.equals(methodName) || Values.CONSTRUCTOR.equals(methodName)) {
return;
}
int methodStart = srcLineAnnotation.getStartLine() - 2;
int methodLine = methodStart;
String line;
while ((methodLine >= 0) && (methodLine < sourceLines.length)) {
line = sourceLines[methodLine];
if (line.indexOf(methodName) >= 0) {
break;
}
methodLine--;
}
if (methodLine < 0) {
return;
}
for (int i = methodLine; i <= methodStart; i++) {
if ((i < 0) || (i >= sourceLines.length)) {
return;
}
line = sourceLines[i];
if (line.indexOf("final") >= 0) {
return;
}
}
changedParms = new BitSet();
super.visitCode(obj);
BugInstance bi = null;
for (int i = 0; i < firstLocalReg; i++) {
if (changedParms.get(i)) {
changedParms.clear(i);
continue;
}
String parmName = getRegisterName(obj, i);
if (bi == null) {
bi = new BugInstance(this, BugType.FP_FINAL_PARAMETERS.name(), LOW_PRIORITY).addClass(this).addMethod(this).addSourceLine(this, 0);
bugReporter.reportBug(bi);
}
bi.addString(parmName);
}
changedParms = null;
}
|
class class_name[name] begin[{]
method[visitCode, return_type[void], modifier[public], parameter[obj]] begin[{]
if[binary_operation[member[.sourceLines], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[member[.isAbstract]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[call[Values.STATIC_INITIALIZER.equals, parameter[member[.methodName]]], ||, call[Values.CONSTRUCTOR.equals, parameter[member[.methodName]]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[int], methodStart]
local_variable[type[int], methodLine]
local_variable[type[String], line]
while[binary_operation[binary_operation[member[.methodLine], >=, literal[0]], &&, binary_operation[member[.methodLine], <, member[sourceLines.length]]]] begin[{]
assign[member[.line], member[.sourceLines]]
if[binary_operation[call[line.indexOf, parameter[member[.methodName]]], >=, literal[0]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
member[.methodLine]
end[}]
if[binary_operation[member[.methodLine], <, literal[0]]] begin[{]
return[None]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=sourceLines, selectors=[]), operator=>=), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=sourceLines, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="final")], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=methodStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=methodLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.changedParms], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BitSet, sub_type=None))]
SuperMethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=visitCode, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[BugInstance], bi]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=changedParms, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=clear, postfix_operators=[], prefix_operators=[], qualifier=changedParms, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRegisterName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=parmName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=BugType.FP_FINAL_PARAMETERS, selectors=[], type_arguments=None), MemberReference(member=LOW_PRIORITY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=addClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=addMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=addSourceLine, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BugInstance, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportBug, postfix_operators=[], prefix_operators=[], qualifier=bugReporter, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parmName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addString, postfix_operators=[], prefix_operators=[], qualifier=bi, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=firstLocalReg, 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)
assign[member[.changedParms], literal[null]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[visitCode] operator[SEP] Keyword[final] identifier[Code] identifier[obj] operator[SEP] {
Keyword[if] operator[SEP] identifier[sourceLines] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isAbstract] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Values] operator[SEP] identifier[STATIC_INITIALIZER] operator[SEP] identifier[equals] operator[SEP] identifier[methodName] operator[SEP] operator[||] identifier[Values] operator[SEP] identifier[CONSTRUCTOR] operator[SEP] identifier[equals] operator[SEP] identifier[methodName] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[int] identifier[methodStart] operator[=] identifier[srcLineAnnotation] operator[SEP] identifier[getStartLine] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] Keyword[int] identifier[methodLine] operator[=] identifier[methodStart] operator[SEP] identifier[String] identifier[line] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[methodLine] operator[>=] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[methodLine] operator[<] identifier[sourceLines] operator[SEP] identifier[length] operator[SEP] operator[SEP] {
identifier[line] operator[=] identifier[sourceLines] operator[SEP] identifier[methodLine] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[indexOf] operator[SEP] identifier[methodName] operator[SEP] operator[>=] Other[0] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[methodLine] operator[--] operator[SEP]
}
Keyword[if] operator[SEP] identifier[methodLine] operator[<] Other[0] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[methodLine] operator[SEP] identifier[i] operator[<=] identifier[methodStart] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[i] operator[<] Other[0] operator[SEP] operator[||] operator[SEP] identifier[i] operator[>=] identifier[sourceLines] operator[SEP] identifier[length] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[line] operator[=] identifier[sourceLines] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[>=] Other[0] operator[SEP] {
Keyword[return] operator[SEP]
}
}
identifier[changedParms] operator[=] Keyword[new] identifier[BitSet] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[visitCode] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[BugInstance] identifier[bi] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[firstLocalReg] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[changedParms] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
identifier[changedParms] operator[SEP] identifier[clear] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[String] identifier[parmName] operator[=] identifier[getRegisterName] operator[SEP] identifier[obj] , identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bi] operator[==] Other[null] operator[SEP] {
identifier[bi] operator[=] Keyword[new] identifier[BugInstance] operator[SEP] Keyword[this] , identifier[BugType] operator[SEP] identifier[FP_FINAL_PARAMETERS] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[LOW_PRIORITY] operator[SEP] operator[SEP] identifier[addClass] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[addMethod] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[addSourceLine] operator[SEP] Keyword[this] , Other[0] operator[SEP] operator[SEP] identifier[bugReporter] operator[SEP] identifier[reportBug] operator[SEP] identifier[bi] operator[SEP] operator[SEP]
}
identifier[bi] operator[SEP] identifier[addString] operator[SEP] identifier[parmName] operator[SEP] operator[SEP]
}
identifier[changedParms] operator[=] Other[null] operator[SEP]
}
|
public DateTimeFormatter withPivotYear(Integer pivotYear) {
if (iPivotYear == pivotYear || (iPivotYear != null && iPivotYear.equals(pivotYear))) {
return this;
}
return new DateTimeFormatter(iPrinter, iParser, iLocale,
iOffsetParsed, iChrono, iZone, pivotYear, iDefaultYear);
}
|
class class_name[name] begin[{]
method[withPivotYear, return_type[type[DateTimeFormatter]], modifier[public], parameter[pivotYear]] begin[{]
if[binary_operation[binary_operation[member[.iPivotYear], ==, member[.pivotYear]], ||, binary_operation[binary_operation[member[.iPivotYear], !=, literal[null]], &&, call[iPivotYear.equals, parameter[member[.pivotYear]]]]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=iPrinter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iParser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iLocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iOffsetParsed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iChrono, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iZone, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pivotYear, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=iDefaultYear, 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=DateTimeFormatter, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[DateTimeFormatter] identifier[withPivotYear] operator[SEP] identifier[Integer] identifier[pivotYear] operator[SEP] {
Keyword[if] operator[SEP] identifier[iPivotYear] operator[==] identifier[pivotYear] operator[||] operator[SEP] identifier[iPivotYear] operator[!=] Other[null] operator[&&] identifier[iPivotYear] operator[SEP] identifier[equals] operator[SEP] identifier[pivotYear] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[return] Keyword[new] identifier[DateTimeFormatter] operator[SEP] identifier[iPrinter] , identifier[iParser] , identifier[iLocale] , identifier[iOffsetParsed] , identifier[iChrono] , identifier[iZone] , identifier[pivotYear] , identifier[iDefaultYear] operator[SEP] operator[SEP]
}
|
private static <T> List<Method> getMethods(Class<T> type, String... names) {
Assert.notNull(type, "Missing class to search for methods!");
Assert.notNullOrEmpty(names, "Missing method names to search for!");
Map<String, Method> candidates = new HashMap<>();
for (Method method : type.getMethods()) {
if (Modifier.isStatic(method.getModifiers()) &&
method.getReturnType().equals(type) &&
method.getParameterTypes().length == 1 &&
method.getParameterTypes()[0].isAssignableFrom(String.class)) {
candidates.put(method.getName(), method);
}
}
List<Method> output = new ArrayList<>();
// go in order desired
for (String name : names) {
if (candidates.containsKey(name)) {
output.add(candidates.get(name));
}
}
return output;
}
|
class class_name[name] begin[{]
method[getMethods, return_type[type[List]], modifier[private static], parameter[type, names]] begin[{]
call[Assert.notNull, parameter[member[.type], literal["Missing class to search for methods!"]]]
call[Assert.notNullOrEmpty, parameter[member[.names], literal["Missing method names to search for!"]]]
local_variable[type[Map], candidates]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getModifiers, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None)], member=isStatic, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getReturnType, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), operator=&&), operandr=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=candidates, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getMethods, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
local_variable[type[List], output]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=candidates, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=candidates, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=output, 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)
return[member[.output]]
end[}]
END[}]
|
Keyword[private] Keyword[static] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[Method] operator[>] identifier[getMethods] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[type] , identifier[String] operator[...] identifier[names] operator[SEP] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[type] , literal[String] operator[SEP] operator[SEP] identifier[Assert] operator[SEP] identifier[notNullOrEmpty] operator[SEP] identifier[names] , literal[String] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Method] operator[>] identifier[candidates] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Method] identifier[method] operator[:] identifier[type] operator[SEP] identifier[getMethods] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[Modifier] operator[SEP] identifier[isStatic] operator[SEP] identifier[method] operator[SEP] identifier[getModifiers] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[method] operator[SEP] identifier[getReturnType] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[type] operator[SEP] operator[&&] identifier[method] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[==] Other[1] operator[&&] identifier[method] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
identifier[candidates] operator[SEP] identifier[put] operator[SEP] identifier[method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[method] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[Method] operator[>] identifier[output] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[name] operator[:] identifier[names] operator[SEP] {
Keyword[if] operator[SEP] identifier[candidates] operator[SEP] identifier[containsKey] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
identifier[output] operator[SEP] identifier[add] operator[SEP] identifier[candidates] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[output] operator[SEP]
}
|
public com.google.api.ads.adwords.axis.v201809.rm.NumberKey getKey() {
return key;
}
|
class class_name[name] begin[{]
method[getKey, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.key]]
end[}]
END[}]
|
Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[adwords] operator[SEP] identifier[axis] operator[SEP] identifier[v201809] operator[SEP] identifier[rm] operator[SEP] identifier[NumberKey] identifier[getKey] operator[SEP] operator[SEP] {
Keyword[return] identifier[key] operator[SEP]
}
|
protected static int readInt(byte[] bytes, int offset, int length)
{
int result = 0;
for (int i = 0; i < length; ++i)
{
result <<= 8;
result += bytes[offset + i] & 0xFF;
}
return result;
}
|
class class_name[name] begin[{]
method[readInt, return_type[type[int]], modifier[static protected], parameter[bytes, offset, length]] begin[{]
local_variable[type[int], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=<<=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&)), 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=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.result]]
end[}]
END[}]
|
Keyword[protected] Keyword[static] Keyword[int] identifier[readInt] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] , Keyword[int] identifier[offset] , Keyword[int] identifier[length] operator[SEP] {
Keyword[int] identifier[result] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[result] operator[<<=] Other[8] operator[SEP] identifier[result] operator[+=] identifier[bytes] operator[SEP] identifier[offset] operator[+] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
private int setExceptionalCompletion(Throwable ex) {
int s = recordExceptionalCompletion(ex);
if ((s & DONE_MASK) == EXCEPTIONAL)
internalPropagateException(ex);
return s;
}
|
class class_name[name] begin[{]
method[setExceptionalCompletion, return_type[type[int]], modifier[private], parameter[ex]] begin[{]
local_variable[type[int], s]
if[binary_operation[binary_operation[member[.s], &, member[.DONE_MASK]], ==, member[.EXCEPTIONAL]]] begin[{]
call[.internalPropagateException, parameter[member[.ex]]]
else begin[{]
None
end[}]
return[member[.s]]
end[}]
END[}]
|
Keyword[private] Keyword[int] identifier[setExceptionalCompletion] operator[SEP] identifier[Throwable] identifier[ex] operator[SEP] {
Keyword[int] identifier[s] operator[=] identifier[recordExceptionalCompletion] operator[SEP] identifier[ex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[s] operator[&] identifier[DONE_MASK] operator[SEP] operator[==] identifier[EXCEPTIONAL] operator[SEP] identifier[internalPropagateException] operator[SEP] identifier[ex] operator[SEP] operator[SEP] Keyword[return] identifier[s] operator[SEP]
}
|
@Override
public final void addBatch(String s) throws SQLException {
batchSql.add(s);
stmt.addBatch(s);
}
|
class class_name[name] begin[{]
method[addBatch, return_type[void], modifier[final public], parameter[s]] begin[{]
call[batchSql.add, parameter[member[.s]]]
call[stmt.addBatch, parameter[member[.s]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[addBatch] operator[SEP] identifier[String] identifier[s] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[batchSql] operator[SEP] identifier[add] operator[SEP] identifier[s] operator[SEP] operator[SEP] identifier[stmt] operator[SEP] identifier[addBatch] operator[SEP] identifier[s] operator[SEP] operator[SEP]
}
|
private Collection<String> getCertServerNames(X509Certificate x509)
throws CertificateParsingException {
Collection<String> serverNames = new LinkedHashSet<>();
/* Add CN for the certificate */
String certCN = getCertCN(x509);
serverNames.add(certCN);
/* Add alternative names for each certificate */
try {
Collection<List<?>> altNames = x509.getSubjectAlternativeNames();
if (altNames != null) {
for (List<?> entry : altNames) {
if (entry.size() >= 2) {
Object entryType = entry.get(0);
if (entryType instanceof Integer &&
(Integer) entryType == 2) {
Object field = entry.get(1);
if (field instanceof String) {
serverNames.add(((String) field).toLowerCase());
}
}
}
}
}
} catch (CertificateParsingException cpe) {
LOGGER.warn("Certificate alternative names ignored for certificate " + (certCN != null ? " " + certCN : ""), cpe);
}
return serverNames;
}
|
class class_name[name] begin[{]
method[getCertServerNames, return_type[type[Collection]], modifier[private], parameter[x509]] begin[{]
local_variable[type[Collection], serverNames]
local_variable[type[String], certCN]
call[serverNames.add, parameter[member[.certCN]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSubjectAlternativeNames, postfix_operators=[], prefix_operators=[], qualifier=x509, selectors=[], type_arguments=None), name=altNames)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=List, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=altNames, 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=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), 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=entry, selectors=[], type_arguments=None), name=entryType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=entryType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=Cast(expression=MemberReference(member=entryType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), 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=1)], member=get, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=serverNames, selectors=[], type_arguments=None), label=None)]))]))]))]), control=EnhancedForControl(iterable=MemberReference(member=altNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=List, sub_type=None))), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Certificate alternative names ignored for certificate "), operandr=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=certCN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operandr=MemberReference(member=certCN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), operator=+), MemberReference(member=cpe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=cpe, types=['CertificateParsingException']))], finally_block=None, label=None, resources=None)
return[member[.serverNames]]
end[}]
END[}]
|
Keyword[private] identifier[Collection] operator[<] identifier[String] operator[>] identifier[getCertServerNames] operator[SEP] identifier[X509Certificate] identifier[x509] operator[SEP] Keyword[throws] identifier[CertificateParsingException] {
identifier[Collection] operator[<] identifier[String] operator[>] identifier[serverNames] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[certCN] operator[=] identifier[getCertCN] operator[SEP] identifier[x509] operator[SEP] operator[SEP] identifier[serverNames] operator[SEP] identifier[add] operator[SEP] identifier[certCN] operator[SEP] operator[SEP] Keyword[try] {
identifier[Collection] operator[<] identifier[List] operator[<] operator[?] operator[>] operator[>] identifier[altNames] operator[=] identifier[x509] operator[SEP] identifier[getSubjectAlternativeNames] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[altNames] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[List] operator[<] operator[?] operator[>] identifier[entry] operator[:] identifier[altNames] operator[SEP] {
Keyword[if] operator[SEP] identifier[entry] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>=] Other[2] operator[SEP] {
identifier[Object] identifier[entryType] operator[=] identifier[entry] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entryType] Keyword[instanceof] identifier[Integer] operator[&&] operator[SEP] identifier[Integer] operator[SEP] identifier[entryType] operator[==] Other[2] operator[SEP] {
identifier[Object] identifier[field] operator[=] identifier[entry] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[field] Keyword[instanceof] identifier[String] operator[SEP] {
identifier[serverNames] operator[SEP] identifier[add] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[field] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
}
Keyword[catch] operator[SEP] identifier[CertificateParsingException] identifier[cpe] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] operator[SEP] identifier[certCN] operator[!=] Other[null] operator[?] literal[String] operator[+] identifier[certCN] operator[:] literal[String] operator[SEP] , identifier[cpe] operator[SEP] operator[SEP]
}
Keyword[return] identifier[serverNames] operator[SEP]
}
|
public List<Flow> fetchFlowsWithConfig(String cluster, String username,
String batchDesc, String signature, int limit, String... configProps)
throws IOException {
LOG.info(String.format(
"Fetching last %d matching jobs for cluster=%s, user.name=%s, "
+ "batch.desc=%s, pig.logical.plan.signature=%s",
limit, cluster, username, batchDesc, signature));
String configParam = "";
if (configProps != null && configProps.length > 0) {
configParam = StringUtil.buildParam("includeConf", configProps);
}
String urlString = signature == null
? String.format("http://%s/api/v1/flow/%s/%s/%s?limit=%d&%s",
apiHostname, cluster, username, StringUtil.cleanseToken(batchDesc),
limit, configParam)
: String.format("http://%s/api/v1/flow/%s/%s/%s/%s?limit=%d&%s",
apiHostname, cluster, username, StringUtil.cleanseToken(batchDesc),
signature, limit, configParam);
return retrieveFlowsFromURL(urlString);
}
|
class class_name[name] begin[{]
method[fetchFlowsWithConfig, return_type[type[List]], modifier[public], parameter[cluster, username, batchDesc, signature, limit, configProps]] begin[{]
call[LOG.info, parameter[call[String.format, parameter[binary_operation[literal["Fetching last %d matching jobs for cluster=%s, user.name=%s, "], +, literal["batch.desc=%s, pig.logical.plan.signature=%s"]], member[.limit], member[.cluster], member[.username], member[.batchDesc], member[.signature]]]]]
local_variable[type[String], configParam]
if[binary_operation[binary_operation[member[.configProps], !=, literal[null]], &&, binary_operation[member[configProps.length], >, literal[0]]]] begin[{]
assign[member[.configParam], call[StringUtil.buildParam, parameter[literal["includeConf"], member[.configProps]]]]
else begin[{]
None
end[}]
local_variable[type[String], urlString]
return[call[.retrieveFlowsFromURL, parameter[member[.urlString]]]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[Flow] operator[>] identifier[fetchFlowsWithConfig] operator[SEP] identifier[String] identifier[cluster] , identifier[String] identifier[username] , identifier[String] identifier[batchDesc] , identifier[String] identifier[signature] , Keyword[int] identifier[limit] , identifier[String] operator[...] identifier[configProps] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] , identifier[limit] , identifier[cluster] , identifier[username] , identifier[batchDesc] , identifier[signature] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[configParam] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[configProps] operator[!=] Other[null] operator[&&] identifier[configProps] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[configParam] operator[=] identifier[StringUtil] operator[SEP] identifier[buildParam] operator[SEP] literal[String] , identifier[configProps] operator[SEP] operator[SEP]
}
identifier[String] identifier[urlString] operator[=] identifier[signature] operator[==] Other[null] operator[?] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[apiHostname] , identifier[cluster] , identifier[username] , identifier[StringUtil] operator[SEP] identifier[cleanseToken] operator[SEP] identifier[batchDesc] operator[SEP] , identifier[limit] , identifier[configParam] operator[SEP] operator[:] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[apiHostname] , identifier[cluster] , identifier[username] , identifier[StringUtil] operator[SEP] identifier[cleanseToken] operator[SEP] identifier[batchDesc] operator[SEP] , identifier[signature] , identifier[limit] , identifier[configParam] operator[SEP] operator[SEP] Keyword[return] identifier[retrieveFlowsFromURL] operator[SEP] identifier[urlString] operator[SEP] operator[SEP]
}
|
@Override
public void close() throws IOException {
try {
if (this.logicallyClosed.compareAndSet(false, true) && available) {
// 中断连接监视线程
if (this.threadWatch != null) {
this.threadWatch.interrupt();
this.threadWatch = null;
}
ThriftConnectionHandle<T> handle = null;
try {
handle = this.recreateConnectionHandle();
this.thriftConnectionPool.connectionStrategy.cleanupConnection(this, handle);
this.thriftConnectionPool.releaseConnection(handle);
} catch (ThriftConnectionPoolException e) {
possiblyBroken = true;
// 检查连接是否关闭了
if (!isClosed()) {
this.thriftConnectionPool.connectionStrategy.cleanupConnection(this, handle);
this.thriftConnectionPool.releaseConnection(this);
}
throw new IOException(e);
}
} else {
this.thriftConnectionPool.postDestroyConnection(this);
}
} catch (Exception e) {
possiblyBroken = true;
throw new IOException(e);
}
if (thriftConnection != null) {
thriftConnection.close();
}
}
|
class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=logicallyClosed, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=compareAndSet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=MemberReference(member=available, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=thriftConnectionPool, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=postDestroyConnection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=threadWatch, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), 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=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=threadWatch, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=interrupt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=threadWatch, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=handle)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ThriftConnectionHandle, sub_type=None)), TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=handle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=recreateConnectionHandle, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=thriftConnectionPool, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MemberReference(member=connectionStrategy, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=handle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cleanupConnection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=thriftConnectionPool, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=handle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=releaseConnection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=possiblyBroken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isClosed, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=thriftConnectionPool, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MemberReference(member=connectionStrategy, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=handle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cleanupConnection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=thriftConnectionPool, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=releaseConnection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)])), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ThriftConnectionPoolException']))], finally_block=None, label=None, resources=None)]))], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=possiblyBroken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=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)
if[binary_operation[member[.thriftConnection], !=, literal[null]]] begin[{]
call[thriftConnection.close, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[logicallyClosed] operator[SEP] identifier[compareAndSet] operator[SEP] literal[boolean] , literal[boolean] operator[SEP] operator[&&] identifier[available] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[threadWatch] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[threadWatch] operator[SEP] identifier[interrupt] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[threadWatch] operator[=] Other[null] operator[SEP]
}
identifier[ThriftConnectionHandle] operator[<] identifier[T] operator[>] identifier[handle] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[handle] operator[=] Keyword[this] operator[SEP] identifier[recreateConnectionHandle] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[thriftConnectionPool] operator[SEP] identifier[connectionStrategy] operator[SEP] identifier[cleanupConnection] operator[SEP] Keyword[this] , identifier[handle] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[thriftConnectionPool] operator[SEP] identifier[releaseConnection] operator[SEP] identifier[handle] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ThriftConnectionPoolException] identifier[e] operator[SEP] {
identifier[possiblyBroken] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isClosed] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[thriftConnectionPool] operator[SEP] identifier[connectionStrategy] operator[SEP] identifier[cleanupConnection] operator[SEP] Keyword[this] , identifier[handle] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[thriftConnectionPool] operator[SEP] identifier[releaseConnection] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[thriftConnectionPool] operator[SEP] identifier[postDestroyConnection] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[possiblyBroken] operator[=] literal[boolean] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[thriftConnection] operator[!=] Other[null] operator[SEP] {
identifier[thriftConnection] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private Path makeRelative(String initial, Path p) {
String scheme = this.uri.getScheme();
String authority = this.uri.getAuthority();
Path root = new Path(Path.SEPARATOR);
if (root.compareTo(p) == 0)
return new Path(scheme, authority, initial);
Path retPath = new Path(p.getName());
Path parent = p.getParent();
for (int i=0; i < p.depth()-1; i++) {
retPath = new Path(parent.getName(), retPath);
parent = parent.getParent();
}
return new Path(new Path(scheme, authority, initial),
retPath.toString());
}
|
class class_name[name] begin[{]
method[makeRelative, return_type[type[Path]], modifier[private], parameter[initial, p]] begin[{]
local_variable[type[String], scheme]
local_variable[type[String], authority]
local_variable[type[Path], root]
if[binary_operation[call[root.compareTo, parameter[member[.p]]], ==, literal[0]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=authority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=initial, 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=Path, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[Path], retPath]
local_variable[type[Path], parent]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=retPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[], type_arguments=None), MemberReference(member=retPath, 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=Path, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getParent, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=depth, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=authority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=initial, 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=Path, sub_type=None)), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=retPath, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Path, sub_type=None))]
end[}]
END[}]
|
Keyword[private] identifier[Path] identifier[makeRelative] operator[SEP] identifier[String] identifier[initial] , identifier[Path] identifier[p] operator[SEP] {
identifier[String] identifier[scheme] operator[=] Keyword[this] operator[SEP] identifier[uri] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[authority] operator[=] Keyword[this] operator[SEP] identifier[uri] operator[SEP] identifier[getAuthority] operator[SEP] operator[SEP] operator[SEP] identifier[Path] identifier[root] operator[=] Keyword[new] identifier[Path] operator[SEP] identifier[Path] operator[SEP] identifier[SEPARATOR] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[root] operator[SEP] identifier[compareTo] operator[SEP] identifier[p] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] Keyword[new] identifier[Path] operator[SEP] identifier[scheme] , identifier[authority] , identifier[initial] operator[SEP] operator[SEP] identifier[Path] identifier[retPath] operator[=] Keyword[new] identifier[Path] operator[SEP] identifier[p] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Path] identifier[parent] operator[=] identifier[p] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[p] operator[SEP] identifier[depth] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[retPath] operator[=] Keyword[new] identifier[Path] operator[SEP] identifier[parent] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[retPath] operator[SEP] operator[SEP] identifier[parent] operator[=] identifier[parent] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Path] operator[SEP] Keyword[new] identifier[Path] operator[SEP] identifier[scheme] , identifier[authority] , identifier[initial] operator[SEP] , identifier[retPath] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected void send() {
String msg = namespace + '|' + nodeID + '|' + port;
// Send broadcast packet
DatagramSocket udpSocket = null;
try {
byte[] bytes = msg.getBytes();
udpSocket = new DatagramSocket();
udpSocket.setBroadcast(true);
udpSocket.setReuseAddress(udpReuseAddr);
InetAddress address = InetAddress.getByName(udpAddress);
DatagramPacket packet = new DatagramPacket(bytes, bytes.length, address, udpPort);
udpSocket.send(packet);
if (debug) {
logger.info("Broadcast message submitted (namespace: " + namespace + ", node ID: " + nodeID + ", port: "
+ port + ").");
}
} catch (Exception cause) {
logger.error("Unable to send broadcast packet!", cause);
} finally {
try {
if (udpSocket != null) {
udpSocket.close();
}
udpSocket = null;
} catch (Exception ignored) {
}
}
}
|
class class_name[name] begin[{]
method[send, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[String], msg]
local_variable[type[DatagramSocket], udpSocket]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBytes, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), name=bytes)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=udpSocket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DatagramSocket, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setBroadcast, postfix_operators=[], prefix_operators=[], qualifier=udpSocket, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=udpReuseAddr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setReuseAddress, postfix_operators=[], prefix_operators=[], qualifier=udpSocket, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=udpAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getByName, postfix_operators=[], prefix_operators=[], qualifier=InetAddress, selectors=[], type_arguments=None), name=address)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InetAddress, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=bytes, selectors=[]), MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=udpPort, 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=DatagramPacket, sub_type=None)), name=packet)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DatagramPacket, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=packet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=send, postfix_operators=[], prefix_operators=[], qualifier=udpSocket, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=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="Broadcast message submitted (namespace: "), operandr=MemberReference(member=namespace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", node ID: "), operator=+), operandr=MemberReference(member=nodeID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", port: "), operator=+), operandr=MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")."), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to send broadcast packet!"), MemberReference(member=cause, 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=cause, types=['Exception']))], finally_block=[TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=udpSocket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=udpSocket, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=udpSocket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignored, types=['Exception']))], finally_block=None, label=None, resources=None)], label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[send] operator[SEP] operator[SEP] {
identifier[String] identifier[msg] operator[=] identifier[namespace] operator[+] literal[String] operator[+] identifier[nodeID] operator[+] literal[String] operator[+] identifier[port] operator[SEP] identifier[DatagramSocket] identifier[udpSocket] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[msg] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] identifier[udpSocket] operator[=] Keyword[new] identifier[DatagramSocket] operator[SEP] operator[SEP] operator[SEP] identifier[udpSocket] operator[SEP] identifier[setBroadcast] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[udpSocket] operator[SEP] identifier[setReuseAddress] operator[SEP] identifier[udpReuseAddr] operator[SEP] operator[SEP] identifier[InetAddress] identifier[address] operator[=] identifier[InetAddress] operator[SEP] identifier[getByName] operator[SEP] identifier[udpAddress] operator[SEP] operator[SEP] identifier[DatagramPacket] identifier[packet] operator[=] Keyword[new] identifier[DatagramPacket] operator[SEP] identifier[bytes] , identifier[bytes] operator[SEP] identifier[length] , identifier[address] , identifier[udpPort] operator[SEP] operator[SEP] identifier[udpSocket] operator[SEP] identifier[send] operator[SEP] identifier[packet] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[debug] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[namespace] operator[+] literal[String] operator[+] identifier[nodeID] operator[+] literal[String] operator[+] identifier[port] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[cause] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[cause] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[udpSocket] operator[!=] Other[null] operator[SEP] {
identifier[udpSocket] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[udpSocket] operator[=] Other[null] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ignored] operator[SEP] {
}
}
}
|
public static base_response enable(nitro_service client, String id) throws Exception {
Interface enableresource = new Interface();
enableresource.id = id;
return enableresource.perform_operation(client,"enable");
}
|
class class_name[name] begin[{]
method[enable, return_type[type[base_response]], modifier[public static], parameter[client, id]] begin[{]
local_variable[type[Interface], enableresource]
assign[member[enableresource.id], member[.id]]
return[call[enableresource.perform_operation, parameter[member[.client], literal["enable"]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[base_response] identifier[enable] operator[SEP] identifier[nitro_service] identifier[client] , identifier[String] identifier[id] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Interface] identifier[enableresource] operator[=] Keyword[new] identifier[Interface] operator[SEP] operator[SEP] operator[SEP] identifier[enableresource] operator[SEP] identifier[id] operator[=] identifier[id] operator[SEP] Keyword[return] identifier[enableresource] operator[SEP] identifier[perform_operation] operator[SEP] identifier[client] , literal[String] operator[SEP] operator[SEP]
}
|
@Override
public Iterable<ExpressionTemplateMatch> match(JCTree target, Context context) {
if (target instanceof JCExpression) {
JCExpression targetExpr = (JCExpression) target;
Optional<Unifier> unifier = unify(targetExpr, new Unifier(context)).first();
if (unifier.isPresent()) {
return ImmutableList.of(new ExpressionTemplateMatch(targetExpr, unifier.get()));
}
}
return ImmutableList.of();
}
|
class class_name[name] begin[{]
method[match, return_type[type[Iterable]], modifier[public], parameter[target, context]] begin[{]
if[binary_operation[member[.target], instanceof, type[JCExpression]]] begin[{]
local_variable[type[JCExpression], targetExpr]
local_variable[type[Optional], unifier]
if[call[unifier.isPresent, parameter[]]] begin[{]
return[call[ImmutableList.of, parameter[ClassCreator(arguments=[MemberReference(member=targetExpr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=unifier, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExpressionTemplateMatch, sub_type=None))]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[call[ImmutableList.of, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Iterable] operator[<] identifier[ExpressionTemplateMatch] operator[>] identifier[match] operator[SEP] identifier[JCTree] identifier[target] , identifier[Context] identifier[context] operator[SEP] {
Keyword[if] operator[SEP] identifier[target] Keyword[instanceof] identifier[JCExpression] operator[SEP] {
identifier[JCExpression] identifier[targetExpr] operator[=] operator[SEP] identifier[JCExpression] operator[SEP] identifier[target] operator[SEP] identifier[Optional] operator[<] identifier[Unifier] operator[>] identifier[unifier] operator[=] identifier[unify] operator[SEP] identifier[targetExpr] , Keyword[new] identifier[Unifier] operator[SEP] identifier[context] operator[SEP] operator[SEP] operator[SEP] identifier[first] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[unifier] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[ImmutableList] operator[SEP] identifier[of] operator[SEP] Keyword[new] identifier[ExpressionTemplateMatch] operator[SEP] identifier[targetExpr] , identifier[unifier] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[ImmutableList] operator[SEP] identifier[of] operator[SEP] operator[SEP] operator[SEP]
}
|
public RouteFilterRuleInner beginCreateOrUpdate(String resourceGroupName, String routeFilterName, String ruleName, RouteFilterRuleInner routeFilterRuleParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters).toBlocking().single().body();
}
|
class class_name[name] begin[{]
method[beginCreateOrUpdate, return_type[type[RouteFilterRuleInner]], modifier[public], parameter[resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters]] begin[{]
return[call[.beginCreateOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.routeFilterName], member[.ruleName], member[.routeFilterRuleParameters]]]]
end[}]
END[}]
|
Keyword[public] identifier[RouteFilterRuleInner] identifier[beginCreateOrUpdate] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[routeFilterName] , identifier[String] identifier[ruleName] , identifier[RouteFilterRuleInner] identifier[routeFilterRuleParameters] operator[SEP] {
Keyword[return] identifier[beginCreateOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[routeFilterName] , identifier[ruleName] , identifier[routeFilterRuleParameters] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String getEffectiveURI(WebContext ctx) {
String uri = ctx.getRequestedURI();
if (uri.startsWith("/s3")) {
uri = uri.substring(3);
}
if (uri.startsWith("/")) {
uri = uri.substring(1);
}
return uri;
}
|
class class_name[name] begin[{]
method[getEffectiveURI, return_type[type[String]], modifier[public static], parameter[ctx]] begin[{]
local_variable[type[String], uri]
if[call[uri.startsWith, parameter[literal["/s3"]]]] begin[{]
assign[member[.uri], call[uri.substring, parameter[literal[3]]]]
else begin[{]
None
end[}]
if[call[uri.startsWith, parameter[literal["/"]]]] begin[{]
assign[member[.uri], call[uri.substring, parameter[literal[1]]]]
else begin[{]
None
end[}]
return[member[.uri]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getEffectiveURI] operator[SEP] identifier[WebContext] identifier[ctx] operator[SEP] {
identifier[String] identifier[uri] operator[=] identifier[ctx] operator[SEP] identifier[getRequestedURI] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uri] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[uri] operator[=] identifier[uri] operator[SEP] identifier[substring] operator[SEP] Other[3] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[uri] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[uri] operator[=] identifier[uri] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[uri] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.