code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public void addExtends(String superType) {
if (!Strings.isEmpty(superType)
&& !Capacity.class.getName().equals(superType)) {
JvmParameterizedTypeReference superTypeRef = newTypeRef(this.sarlCapacity, superType);
JvmTypeReference baseTypeRef = findType(this.sarlCapacity, Capacity.class.getCanonicalName());
if (isSubTypeOf(this.sarlCapacity, superTypeRef, baseTypeRef)) {
this.sarlCapacity.getExtends().add(superTypeRef);
return;
}
}
} | class class_name[name] begin[{]
method[addExtends, return_type[void], modifier[public], parameter[superType]] begin[{]
if[binary_operation[call[Strings.isEmpty, parameter[member[.superType]]], &&, ClassReference(postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=superType, 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=Capacity, sub_type=None))]] begin[{]
local_variable[type[JvmParameterizedTypeReference], superTypeRef]
local_variable[type[JvmTypeReference], baseTypeRef]
if[call[.isSubTypeOf, parameter[THIS[member[None.sarlCapacity]], member[.superTypeRef], member[.baseTypeRef]]]] begin[{]
THIS[member[None.sarlCapacity]call[None.getExtends, parameter[]]call[None.add, parameter[member[.superTypeRef]]]]
return[None]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addExtends] operator[SEP] identifier[String] identifier[superType] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[Strings] operator[SEP] identifier[isEmpty] operator[SEP] identifier[superType] operator[SEP] operator[&&] operator[!] identifier[Capacity] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[superType] operator[SEP] operator[SEP] {
identifier[JvmParameterizedTypeReference] identifier[superTypeRef] operator[=] identifier[newTypeRef] operator[SEP] Keyword[this] operator[SEP] identifier[sarlCapacity] , identifier[superType] operator[SEP] operator[SEP] identifier[JvmTypeReference] identifier[baseTypeRef] operator[=] identifier[findType] operator[SEP] Keyword[this] operator[SEP] identifier[sarlCapacity] , identifier[Capacity] operator[SEP] Keyword[class] operator[SEP] identifier[getCanonicalName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isSubTypeOf] operator[SEP] Keyword[this] operator[SEP] identifier[sarlCapacity] , identifier[superTypeRef] , identifier[baseTypeRef] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[sarlCapacity] operator[SEP] identifier[getExtends] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[superTypeRef] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
}
}
|
@Override public void showTraces(List<Trace> traces, int removedTraces) {
if (lastScrollPosition == 0) {
lastScrollPosition = lv_traces.getFirstVisiblePosition();
}
adapter.clear();
adapter.addAll(traces);
adapter.notifyDataSetChanged();
updateScrollPosition(removedTraces);
} | class class_name[name] begin[{]
method[showTraces, return_type[void], modifier[public], parameter[traces, removedTraces]] begin[{]
if[binary_operation[member[.lastScrollPosition], ==, literal[0]]] begin[{]
assign[member[.lastScrollPosition], call[lv_traces.getFirstVisiblePosition, parameter[]]]
else begin[{]
None
end[}]
call[adapter.clear, parameter[]]
call[adapter.addAll, parameter[member[.traces]]]
call[adapter.notifyDataSetChanged, parameter[]]
call[.updateScrollPosition, parameter[member[.removedTraces]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[showTraces] operator[SEP] identifier[List] operator[<] identifier[Trace] operator[>] identifier[traces] , Keyword[int] identifier[removedTraces] operator[SEP] {
Keyword[if] operator[SEP] identifier[lastScrollPosition] operator[==] Other[0] operator[SEP] {
identifier[lastScrollPosition] operator[=] identifier[lv_traces] operator[SEP] identifier[getFirstVisiblePosition] operator[SEP] operator[SEP] operator[SEP]
}
identifier[adapter] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[adapter] operator[SEP] identifier[addAll] operator[SEP] identifier[traces] operator[SEP] operator[SEP] identifier[adapter] operator[SEP] identifier[notifyDataSetChanged] operator[SEP] operator[SEP] operator[SEP] identifier[updateScrollPosition] operator[SEP] identifier[removedTraces] operator[SEP] operator[SEP]
}
|
public static Locale toLocale(String localeStr) {
if ((localeStr == null) || (localeStr.trim().length() == 0) || ("_".equals(localeStr))) return Locale
.getDefault();
int index = localeStr.indexOf('_');
if (index < 0) return new Locale(localeStr);
String language = localeStr.substring(0, index);
if (index == localeStr.length()) return new Locale(language);
localeStr = localeStr.substring(index + 1);
index = localeStr.indexOf('_');
if (index < 0) return new Locale(language, localeStr);
String country = localeStr.substring(0, index);
if (index == localeStr.length()) return new Locale(language, country);
localeStr = localeStr.substring(index + 1);
return new Locale(language, country, localeStr);
} | class class_name[name] begin[{]
method[toLocale, return_type[type[Locale]], modifier[public static], parameter[localeStr]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.localeStr], ==, literal[null]], ||, binary_operation[call[localeStr.trim, parameter[]], ==, literal[0]]], ||, literal["_"]]] begin[{]
return[call[Locale.getDefault, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[int], index]
if[binary_operation[member[.index], <, literal[0]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=localeStr, 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=Locale, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], language]
if[binary_operation[member[.index], ==, call[localeStr.length, parameter[]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=language, 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=Locale, sub_type=None))]
else begin[{]
None
end[}]
assign[member[.localeStr], call[localeStr.substring, parameter[binary_operation[member[.index], +, literal[1]]]]]
assign[member[.index], call[localeStr.indexOf, parameter[literal['_']]]]
if[binary_operation[member[.index], <, literal[0]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=language, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=localeStr, 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=Locale, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], country]
if[binary_operation[member[.index], ==, call[localeStr.length, parameter[]]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=language, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=country, 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=Locale, sub_type=None))]
else begin[{]
None
end[}]
assign[member[.localeStr], call[localeStr.substring, parameter[binary_operation[member[.index], +, literal[1]]]]]
return[ClassCreator(arguments=[MemberReference(member=language, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=country, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=localeStr, 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=Locale, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Locale] identifier[toLocale] operator[SEP] identifier[String] identifier[localeStr] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[localeStr] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[localeStr] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] operator[||] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[localeStr] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Locale] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[localeStr] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[<] Other[0] operator[SEP] Keyword[return] Keyword[new] identifier[Locale] operator[SEP] identifier[localeStr] operator[SEP] operator[SEP] identifier[String] identifier[language] operator[=] identifier[localeStr] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[index] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[==] identifier[localeStr] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Locale] operator[SEP] identifier[language] operator[SEP] operator[SEP] identifier[localeStr] operator[=] identifier[localeStr] operator[SEP] identifier[substring] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[SEP] identifier[index] operator[=] identifier[localeStr] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[<] Other[0] operator[SEP] Keyword[return] Keyword[new] identifier[Locale] operator[SEP] identifier[language] , identifier[localeStr] operator[SEP] operator[SEP] identifier[String] identifier[country] operator[=] identifier[localeStr] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[index] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[==] identifier[localeStr] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Locale] operator[SEP] identifier[language] , identifier[country] operator[SEP] operator[SEP] identifier[localeStr] operator[=] identifier[localeStr] operator[SEP] identifier[substring] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Locale] operator[SEP] identifier[language] , identifier[country] , identifier[localeStr] operator[SEP] operator[SEP]
}
|
public final void setPropositionIds(String[] propIds) {
if (propIds == null) {
this.propIds = ArrayUtils.EMPTY_STRING_ARRAY;
} else {
this.propIds = propIds.clone();
ProtempaUtil.internAll(this.propIds);
}
} | class class_name[name] begin[{]
method[setPropositionIds, return_type[void], modifier[final public], parameter[propIds]] begin[{]
if[binary_operation[member[.propIds], ==, literal[null]]] begin[{]
assign[THIS[member[None.propIds]], member[ArrayUtils.EMPTY_STRING_ARRAY]]
else begin[{]
assign[THIS[member[None.propIds]], call[propIds.clone, parameter[]]]
call[ProtempaUtil.internAll, parameter[THIS[member[None.propIds]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[setPropositionIds] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[propIds] operator[SEP] {
Keyword[if] operator[SEP] identifier[propIds] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[propIds] operator[=] identifier[ArrayUtils] operator[SEP] identifier[EMPTY_STRING_ARRAY] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[propIds] operator[=] identifier[propIds] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[ProtempaUtil] operator[SEP] identifier[internAll] operator[SEP] Keyword[this] operator[SEP] identifier[propIds] operator[SEP] operator[SEP]
}
}
|
public static String matchOrigin(HttpServerExchange exchange, Collection<String> allowedOrigins) throws Exception {
HeaderMap headers = exchange.getRequestHeaders();
String[] origins = headers.get(Headers.ORIGIN).toArray();
if (allowedOrigins != null && !allowedOrigins.isEmpty()) {
for (String allowedOrigin : allowedOrigins) {
for (String origin : origins) {
if (allowedOrigin.equalsIgnoreCase(sanitizeDefaultPort(origin))) {
return allowedOrigin;
}
}
}
}
String allowedOrigin = defaultOrigin(exchange);
for (String origin : origins) {
if (allowedOrigin.equalsIgnoreCase(sanitizeDefaultPort(origin))) {
return allowedOrigin;
}
}
ROOT_LOGGER.debug("Request rejected due to HOST/ORIGIN mis-match.");
ResponseCodeHandler.HANDLE_403.handleRequest(exchange);
return null;
} | class class_name[name] begin[{]
method[matchOrigin, return_type[type[String]], modifier[public static], parameter[exchange, allowedOrigins]] begin[{]
local_variable[type[HeaderMap], headers]
local_variable[type[String], origins]
if[binary_operation[binary_operation[member[.allowedOrigins], !=, literal[null]], &&, call[allowedOrigins.isEmpty, parameter[]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=origin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sanitizeDefaultPort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=allowedOrigin, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=allowedOrigin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=origins, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=origin)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=allowedOrigins, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=allowedOrigin)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
local_variable[type[String], allowedOrigin]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=origin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sanitizeDefaultPort, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=allowedOrigin, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=allowedOrigin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=origins, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=origin)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[ROOT_LOGGER.debug, parameter[literal["Request rejected due to HOST/ORIGIN mis-match."]]]
call[ResponseCodeHandler.HANDLE_403.handleRequest, parameter[member[.exchange]]]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[matchOrigin] operator[SEP] identifier[HttpServerExchange] identifier[exchange] , identifier[Collection] operator[<] identifier[String] operator[>] identifier[allowedOrigins] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[HeaderMap] identifier[headers] operator[=] identifier[exchange] operator[SEP] identifier[getRequestHeaders] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[origins] operator[=] identifier[headers] operator[SEP] identifier[get] operator[SEP] identifier[Headers] operator[SEP] identifier[ORIGIN] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[allowedOrigins] operator[!=] Other[null] operator[&&] operator[!] identifier[allowedOrigins] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[allowedOrigin] operator[:] identifier[allowedOrigins] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[origin] operator[:] identifier[origins] operator[SEP] {
Keyword[if] operator[SEP] identifier[allowedOrigin] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[sanitizeDefaultPort] operator[SEP] identifier[origin] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[allowedOrigin] operator[SEP]
}
}
}
}
identifier[String] identifier[allowedOrigin] operator[=] identifier[defaultOrigin] operator[SEP] identifier[exchange] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[origin] operator[:] identifier[origins] operator[SEP] {
Keyword[if] operator[SEP] identifier[allowedOrigin] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[sanitizeDefaultPort] operator[SEP] identifier[origin] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[allowedOrigin] operator[SEP]
}
}
identifier[ROOT_LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ResponseCodeHandler] operator[SEP] identifier[HANDLE_403] operator[SEP] identifier[handleRequest] operator[SEP] identifier[exchange] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public void open() throws DBException
{
if (m_pDatabase == null)
{
PhysicalDatabaseParent pDBParent = null;
Environment env = (Environment)this.getDatabaseOwner().getEnvironment();
if (env != null)
pDBParent = (PhysicalDatabaseParent)env.getPDatabaseParent(mapDBParentProperties, true);
String databaseName = this.getDatabaseName(true);
if (databaseName.endsWith(BaseDatabase.SHARED_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.SHARED_SUFFIX.length());
else if (databaseName.endsWith(BaseDatabase.USER_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.USER_SUFFIX.length());
char strPDatabaseType = this.getPDatabaseType();
m_pDatabase = pDBParent.getPDatabase(databaseName, strPDatabaseType, false);
if (m_pDatabase == null)
m_pDatabase = this.makePDatabase(pDBParent, databaseName);
m_pDatabase.addPDatabaseOwner(this);
}
m_pDatabase.open();
super.open(); // Do any inherited
} | class class_name[name] begin[{]
method[open, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.m_pDatabase], ==, literal[null]]] begin[{]
local_variable[type[PhysicalDatabaseParent], pDBParent]
local_variable[type[Environment], env]
if[binary_operation[member[.env], !=, literal[null]]] begin[{]
assign[member[.pDBParent], Cast(expression=MethodInvocation(arguments=[MemberReference(member=mapDBParentProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=getPDatabaseParent, postfix_operators=[], prefix_operators=[], qualifier=env, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=PhysicalDatabaseParent, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], databaseName]
if[call[databaseName.endsWith, parameter[member[BaseDatabase.SHARED_SUFFIX]]]] begin[{]
assign[member[.databaseName], call[databaseName.substring, parameter[literal[0], binary_operation[call[databaseName.length, parameter[]], -, call[BaseDatabase.SHARED_SUFFIX.length, parameter[]]]]]]
else begin[{]
if[call[databaseName.endsWith, parameter[member[BaseDatabase.USER_SUFFIX]]]] begin[{]
assign[member[.databaseName], call[databaseName.substring, parameter[literal[0], binary_operation[call[databaseName.length, parameter[]], -, call[BaseDatabase.USER_SUFFIX.length, parameter[]]]]]]
else begin[{]
None
end[}]
end[}]
local_variable[type[char], strPDatabaseType]
assign[member[.m_pDatabase], call[pDBParent.getPDatabase, parameter[member[.databaseName], member[.strPDatabaseType], literal[false]]]]
if[binary_operation[member[.m_pDatabase], ==, literal[null]]] begin[{]
assign[member[.m_pDatabase], THIS[call[None.makePDatabase, parameter[member[.pDBParent], member[.databaseName]]]]]
else begin[{]
None
end[}]
call[m_pDatabase.addPDatabaseOwner, parameter[THIS[]]]
else begin[{]
None
end[}]
call[m_pDatabase.open, parameter[]]
SuperMethodInvocation(arguments=[], member=open, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[open] operator[SEP] operator[SEP] Keyword[throws] identifier[DBException] {
Keyword[if] operator[SEP] identifier[m_pDatabase] operator[==] Other[null] operator[SEP] {
identifier[PhysicalDatabaseParent] identifier[pDBParent] operator[=] Other[null] operator[SEP] identifier[Environment] identifier[env] operator[=] operator[SEP] identifier[Environment] operator[SEP] Keyword[this] operator[SEP] identifier[getDatabaseOwner] operator[SEP] operator[SEP] operator[SEP] identifier[getEnvironment] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[env] operator[!=] Other[null] operator[SEP] identifier[pDBParent] operator[=] operator[SEP] identifier[PhysicalDatabaseParent] operator[SEP] identifier[env] operator[SEP] identifier[getPDatabaseParent] operator[SEP] identifier[mapDBParentProperties] , literal[boolean] operator[SEP] operator[SEP] identifier[String] identifier[databaseName] operator[=] Keyword[this] operator[SEP] identifier[getDatabaseName] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[databaseName] operator[SEP] identifier[endsWith] operator[SEP] identifier[BaseDatabase] operator[SEP] identifier[SHARED_SUFFIX] operator[SEP] operator[SEP] identifier[databaseName] operator[=] identifier[databaseName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[databaseName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[BaseDatabase] operator[SEP] identifier[SHARED_SUFFIX] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[databaseName] operator[SEP] identifier[endsWith] operator[SEP] identifier[BaseDatabase] operator[SEP] identifier[USER_SUFFIX] operator[SEP] operator[SEP] identifier[databaseName] operator[=] identifier[databaseName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[databaseName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[BaseDatabase] operator[SEP] identifier[USER_SUFFIX] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[char] identifier[strPDatabaseType] operator[=] Keyword[this] operator[SEP] identifier[getPDatabaseType] operator[SEP] operator[SEP] operator[SEP] identifier[m_pDatabase] operator[=] identifier[pDBParent] operator[SEP] identifier[getPDatabase] operator[SEP] identifier[databaseName] , identifier[strPDatabaseType] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_pDatabase] operator[==] Other[null] operator[SEP] identifier[m_pDatabase] operator[=] Keyword[this] operator[SEP] identifier[makePDatabase] operator[SEP] identifier[pDBParent] , identifier[databaseName] operator[SEP] operator[SEP] identifier[m_pDatabase] operator[SEP] identifier[addPDatabaseOwner] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
identifier[m_pDatabase] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[open] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) throws SAXException {
try {
if (XHTML_NS.equals(namespaceURI)) {
if ("meta".equals(localName)
&& ((atts.getIndex("", "http-equiv") != -1) || (atts.getIndex(
"", "httpequiv") != -1))) {
return;
}
// start and element name
this.writer.write('<');
this.writer.write(localName);
// attributes
int length = atts.getLength();
boolean langPrinted = false;
for (int i = 0; i < length; i++) {
String ns = atts.getURI(i);
String name = null;
if ("".equals(ns)) {
name = atts.getLocalName(i);
} else if ("http://www.w3.org/XML/1998/namespace".equals(ns)
&& "lang".equals(atts.getLocalName(i))) {
name = "lang";
}
if (name != null && !(langPrinted && "lang".equals(name))) {
this.writer.write(' ');
this.writer.write(name);
if ("lang".equals(name)) {
langPrinted = true;
}
if (Arrays.binarySearch(booleanAttributes, name) < 0) {
// write value, escape certain characters
this.writer.write("=\"");
String value = atts.getValue(i);
for (int j = 0; j < value.length(); j++) {
char c = value.charAt(j);
switch (c) {
case '<':
this.writer.write("<");
break;
case '>':
this.writer.write(">");
break;
case '&':
this.writer.write("&");
break;
case '"':
this.writer.write(""");
break;
default:
this.writer.write(c);
}
}
this.writer.write('"');
}
}
}
// close
this.writer.write('>');
if (emitMeta && "head".equals(localName)) {
this.writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
this.writer.write(encoding);
this.writer.write("\">");
}
}
} catch (IOException ioe) {
throw (SAXException)new SAXException(ioe).initCause(ioe);
}
} | class class_name[name] begin[{]
method[startElement, return_type[void], modifier[public], parameter[namespaceURI, localName, qName, atts]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=namespaceURI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=XHTML_NS, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=localName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="meta"), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="http-equiv")], member=getIndex, postfix_operators=[], prefix_operators=[], qualifier=atts, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="httpequiv")], member=getIndex, postfix_operators=[], prefix_operators=[], qualifier=atts, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='<')], member=write, 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=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=localName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=atts, selectors=[], type_arguments=None), name=length)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=langPrinted)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getURI, postfix_operators=[], prefix_operators=[], qualifier=atts, selectors=[], type_arguments=None), name=ns)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=ns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value=""), else_statement=IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=ns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="http://www.w3.org/XML/1998/namespace"), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLocalName, postfix_operators=[], prefix_operators=[], qualifier=atts, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="lang"), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="lang")), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLocalName, postfix_operators=[], prefix_operators=[], qualifier=atts, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=langPrinted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="lang"), operator=&&), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')], member=write, 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=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="lang"), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=langPrinted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=booleanAttributes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=binarySearch, postfix_operators=[], prefix_operators=[], qualifier=Arrays, 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=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="=\"")], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=atts, selectors=[], type_arguments=None), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='<')], statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<")], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='>')], statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=">")], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='&')], statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="&")], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"')], statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""")], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)])], expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"')], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, 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=, 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), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='>')], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=emitMeta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=localName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="head"), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<meta http-equiv=\"Content-Type\" content=\"text/html; charset=")], member=write, 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=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, 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=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\">")], member=write, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]))]))], catches=[CatchClause(block=[ThrowStatement(expression=Cast(expression=ClassCreator(arguments=[MemberReference(member=ioe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=ioe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initCause, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=SAXException, sub_type=None)), type=ReferenceType(arguments=None, dimensions=[], name=SAXException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ioe, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[startElement] operator[SEP] identifier[String] identifier[namespaceURI] , identifier[String] identifier[localName] , identifier[String] identifier[qName] , identifier[Attributes] identifier[atts] operator[SEP] Keyword[throws] identifier[SAXException] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[XHTML_NS] operator[SEP] identifier[equals] operator[SEP] identifier[namespaceURI] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[localName] operator[SEP] operator[&&] operator[SEP] operator[SEP] identifier[atts] operator[SEP] identifier[getIndex] operator[SEP] literal[String] , literal[String] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] operator[||] operator[SEP] identifier[atts] operator[SEP] identifier[getIndex] operator[SEP] literal[String] , literal[String] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[localName] operator[SEP] operator[SEP] Keyword[int] identifier[length] operator[=] identifier[atts] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[langPrinted] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[ns] operator[=] identifier[atts] operator[SEP] identifier[getURI] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[String] identifier[name] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[ns] operator[SEP] operator[SEP] {
identifier[name] operator[=] identifier[atts] operator[SEP] identifier[getLocalName] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[ns] operator[SEP] operator[&&] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[atts] operator[SEP] identifier[getLocalName] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
identifier[name] operator[=] literal[String] operator[SEP]
}
Keyword[if] operator[SEP] identifier[name] operator[!=] Other[null] operator[&&] operator[!] operator[SEP] identifier[langPrinted] operator[&&] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
identifier[langPrinted] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Arrays] operator[SEP] identifier[binarySearch] operator[SEP] identifier[booleanAttributes] , identifier[name] operator[SEP] operator[<] Other[0] operator[SEP] {
Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] identifier[atts] operator[SEP] identifier[getValue] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[value] operator[SEP] identifier[charAt] operator[SEP] identifier[j] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[c] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
}
Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[emitMeta] operator[&&] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[localName] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ioe] operator[SEP] {
Keyword[throw] operator[SEP] identifier[SAXException] operator[SEP] Keyword[new] identifier[SAXException] operator[SEP] identifier[ioe] operator[SEP] operator[SEP] identifier[initCause] operator[SEP] identifier[ioe] operator[SEP] operator[SEP]
}
}
|
public void updateModule(String importFile) throws Exception {
CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(importFile);
String moduleName = module.getName();
String moduleVersion = module.getVersionStr();
m_shell.getOut().println("Updating module " + moduleName + " version " + moduleVersion);
if (OpenCms.getModuleManager().getModule(moduleName) != null) {
String oldVersion = OpenCms.getModuleManager().getModule(moduleName).getVersionStr();
m_shell.getOut().println("Previous version '" + oldVersion + "' detected");
if (!oldVersion.equals(moduleVersion)) {
// the import version does not equal the present module version, replace the module
OpenCms.getModuleManager().replaceModule(
m_cms,
importFile,
new CmsShellReport(m_cms.getRequestContext().getLocale()));
}
} else {
importModule(importFile);
}
} | class class_name[name] begin[{]
method[updateModule, return_type[void], modifier[public], parameter[importFile]] begin[{]
local_variable[type[CmsModule], module]
local_variable[type[String], moduleName]
local_variable[type[String], moduleVersion]
call[m_shell.getOut, parameter[]]
if[binary_operation[call[OpenCms.getModuleManager, parameter[]], !=, literal[null]]] begin[{]
local_variable[type[String], oldVersion]
call[m_shell.getOut, parameter[]]
if[call[oldVersion.equals, parameter[member[.moduleVersion]]]] begin[{]
call[OpenCms.getModuleManager, parameter[]]
else begin[{]
None
end[}]
else begin[{]
call[.importModule, parameter[member[.importFile]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[updateModule] operator[SEP] identifier[String] identifier[importFile] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[CmsModule] identifier[module] operator[=] identifier[CmsModuleImportExportHandler] operator[SEP] identifier[readModuleFromImport] operator[SEP] identifier[importFile] operator[SEP] operator[SEP] identifier[String] identifier[moduleName] operator[=] identifier[module] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[moduleVersion] operator[=] identifier[module] operator[SEP] identifier[getVersionStr] operator[SEP] operator[SEP] operator[SEP] identifier[m_shell] operator[SEP] identifier[getOut] operator[SEP] operator[SEP] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[moduleName] operator[+] literal[String] operator[+] identifier[moduleVersion] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getModuleManager] operator[SEP] operator[SEP] operator[SEP] identifier[getModule] operator[SEP] identifier[moduleName] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[oldVersion] operator[=] identifier[OpenCms] operator[SEP] identifier[getModuleManager] operator[SEP] operator[SEP] operator[SEP] identifier[getModule] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP] identifier[getVersionStr] operator[SEP] operator[SEP] operator[SEP] identifier[m_shell] operator[SEP] identifier[getOut] operator[SEP] operator[SEP] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[oldVersion] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[oldVersion] operator[SEP] identifier[equals] operator[SEP] identifier[moduleVersion] operator[SEP] operator[SEP] {
identifier[OpenCms] operator[SEP] identifier[getModuleManager] operator[SEP] operator[SEP] operator[SEP] identifier[replaceModule] operator[SEP] identifier[m_cms] , identifier[importFile] , Keyword[new] identifier[CmsShellReport] operator[SEP] identifier[m_cms] operator[SEP] identifier[getRequestContext] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[importModule] operator[SEP] identifier[importFile] operator[SEP] operator[SEP]
}
}
|
public <R> Request<T> setRequestData(R requestData, Converter<R, NetworkRequest>
converterToRequest)
throws IOException {
checkIfActive();
Utils.checkNotNull(requestData, "networkRequest cannot be null");
Utils.checkNotNull(converterToRequest, "converterToRequest cannot be null");
try {
this.networkRequest = converterToRequest.convert(requestData);
} catch (IOException e) {
throw e;
} catch (Exception e) {
//check if someone didnt wrap IOException
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
} else { //else wrap it in IOEx
throw new IOException(e);
}
}
return this;
} | class class_name[name] begin[{]
method[setRequestData, return_type[type[Request]], modifier[public], parameter[requestData, converterToRequest]] begin[{]
call[.checkIfActive, parameter[]]
call[Utils.checkNotNull, parameter[member[.requestData], literal["networkRequest cannot be null"]]]
call[Utils.checkNotNull, parameter[member[.converterToRequest], literal["converterToRequest cannot be null"]]]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=networkRequest, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MethodInvocation(arguments=[MemberReference(member=requestData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convert, postfix_operators=[], prefix_operators=[], qualifier=converterToRequest, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException'])), CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=IOException, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[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, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], 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)
return[THIS[]]
end[}]
END[}] | Keyword[public] operator[<] identifier[R] operator[>] identifier[Request] operator[<] identifier[T] operator[>] identifier[setRequestData] operator[SEP] identifier[R] identifier[requestData] , identifier[Converter] operator[<] identifier[R] , identifier[NetworkRequest] operator[>] identifier[converterToRequest] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[checkIfActive] operator[SEP] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[requestData] , literal[String] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[converterToRequest] , literal[String] operator[SEP] operator[SEP] Keyword[try] {
Keyword[this] operator[SEP] identifier[networkRequest] operator[=] identifier[converterToRequest] operator[SEP] identifier[convert] operator[SEP] identifier[requestData] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] Keyword[instanceof] identifier[IOException] operator[SEP] {
Keyword[throw] operator[SEP] identifier[IOException] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public List<ENTITY> page(List<Match> matches, List<Order> order, int curPage, int pageSize) {
if (curPage < 0 || pageSize < 0) {
return find(matches, order);
}
int offset = (curPage) * pageSize;
int limit = pageSize;
return find(matches, order, offset, limit);
} | class class_name[name] begin[{]
method[page, return_type[type[List]], modifier[public], parameter[matches, order, curPage, pageSize]] begin[{]
if[binary_operation[binary_operation[member[.curPage], <, literal[0]], ||, binary_operation[member[.pageSize], <, literal[0]]]] begin[{]
return[call[.find, parameter[member[.matches], member[.order]]]]
else begin[{]
None
end[}]
local_variable[type[int], offset]
local_variable[type[int], limit]
return[call[.find, parameter[member[.matches], member[.order], member[.offset], member[.limit]]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[ENTITY] operator[>] identifier[page] operator[SEP] identifier[List] operator[<] identifier[Match] operator[>] identifier[matches] , identifier[List] operator[<] identifier[Order] operator[>] identifier[order] , Keyword[int] identifier[curPage] , Keyword[int] identifier[pageSize] operator[SEP] {
Keyword[if] operator[SEP] identifier[curPage] operator[<] Other[0] operator[||] identifier[pageSize] operator[<] Other[0] operator[SEP] {
Keyword[return] identifier[find] operator[SEP] identifier[matches] , identifier[order] operator[SEP] operator[SEP]
}
Keyword[int] identifier[offset] operator[=] operator[SEP] identifier[curPage] operator[SEP] operator[*] identifier[pageSize] operator[SEP] Keyword[int] identifier[limit] operator[=] identifier[pageSize] operator[SEP] Keyword[return] identifier[find] operator[SEP] identifier[matches] , identifier[order] , identifier[offset] , identifier[limit] operator[SEP] operator[SEP]
}
|
public static String getShortRequestDump(String fromMethod, boolean includeHeaders, HttpServletRequest request) {
StringBuilder dump = new StringBuilder();
dump.append("Timestamp : ").append(ISO8601.getTimestamp()).append("\n");
dump.append("fromMethod : ").append(fromMethod).append("\n");
dump.append("Method : ").append(request.getMethod()).append('\n');
dump.append("Scheme : ").append(request.getScheme()).append('\n');
dump.append("URI : ").append(request.getRequestURI()).append('\n');
dump.append("Query-String : ").append(request.getQueryString()).append('\n');
dump.append("Auth-Type : ").append(request.getAuthType()).append('\n');
dump.append("Remote-Addr : ").append(request.getRemoteAddr()).append('\n');
dump.append("Scheme : ").append(request.getScheme()).append('\n');
dump.append("Content-Type : ").append(request.getContentType()).append('\n');
dump.append("Content-Length: ").append(request.getContentLength()).append('\n');
if (includeHeaders) {
dump.append("Headers :\n");
Enumeration<String> headers = request.getHeaderNames();
while (headers.hasMoreElements()) {
String header = headers.nextElement();
dump.append("\t").append(header).append(": ").append(request.getHeader(header)).append('\n');
}
}
return (dump.toString());
} | class class_name[name] begin[{]
method[getShortRequestDump, return_type[type[String]], modifier[public static], parameter[fromMethod, includeHeaders, request]] begin[{]
local_variable[type[StringBuilder], dump]
call[dump.append, parameter[literal["Timestamp : "]]]
call[dump.append, parameter[literal["fromMethod : "]]]
call[dump.append, parameter[literal["Method : "]]]
call[dump.append, parameter[literal["Scheme : "]]]
call[dump.append, parameter[literal["URI : "]]]
call[dump.append, parameter[literal["Query-String : "]]]
call[dump.append, parameter[literal["Auth-Type : "]]]
call[dump.append, parameter[literal["Remote-Addr : "]]]
call[dump.append, parameter[literal["Scheme : "]]]
call[dump.append, parameter[literal["Content-Type : "]]]
call[dump.append, parameter[literal["Content-Length: "]]]
if[member[.includeHeaders]] begin[{]
call[dump.append, parameter[literal["Headers :\n"]]]
local_variable[type[Enumeration], headers]
while[call[headers.hasMoreElements, parameter[]]] begin[{]
local_variable[type[String], header]
call[dump.append, parameter[literal["\t"]]]
end[}]
else begin[{]
None
end[}]
return[call[dump.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getShortRequestDump] operator[SEP] identifier[String] identifier[fromMethod] , Keyword[boolean] identifier[includeHeaders] , identifier[HttpServletRequest] identifier[request] operator[SEP] {
identifier[StringBuilder] identifier[dump] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[ISO8601] operator[SEP] identifier[getTimestamp] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[fromMethod] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getRequestURI] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getQueryString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getAuthType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getRemoteAddr] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getScheme] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getContentType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getContentLength] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[includeHeaders] operator[SEP] {
identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Enumeration] operator[<] identifier[String] operator[>] identifier[headers] operator[=] identifier[request] operator[SEP] identifier[getHeaderNames] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[headers] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[header] operator[=] identifier[headers] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] identifier[dump] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[header] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[request] operator[SEP] identifier[getHeader] operator[SEP] identifier[header] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] operator[SEP] identifier[dump] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setPlatforms(java.util.Collection<SigningPlatform> platforms) {
if (platforms == null) {
this.platforms = null;
return;
}
this.platforms = new java.util.ArrayList<SigningPlatform>(platforms);
} | class class_name[name] begin[{]
method[setPlatforms, return_type[void], modifier[public], parameter[platforms]] begin[{]
if[binary_operation[member[.platforms], ==, literal[null]]] begin[{]
assign[THIS[member[None.platforms]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.platforms]], ClassCreator(arguments=[MemberReference(member=platforms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=SigningPlatform, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setPlatforms] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[SigningPlatform] operator[>] identifier[platforms] operator[SEP] {
Keyword[if] operator[SEP] identifier[platforms] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[platforms] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[platforms] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[SigningPlatform] operator[>] operator[SEP] identifier[platforms] operator[SEP] operator[SEP]
}
|
protected static String cleanupUrl(final String url) {
if (url == null) {
return null;
}
val jsessionPosition = url.indexOf(";jsession");
if (jsessionPosition == -1) {
return url;
}
val questionMarkPosition = url.indexOf('?');
if (questionMarkPosition < jsessionPosition) {
return url.substring(0, url.indexOf(";jsession"));
}
return url.substring(0, jsessionPosition) + url.substring(questionMarkPosition);
} | class class_name[name] begin[{]
method[cleanupUrl, return_type[type[String]], modifier[static protected], parameter[url]] begin[{]
if[binary_operation[member[.url], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[val], jsessionPosition]
if[binary_operation[member[.jsessionPosition], ==, literal[1]]] begin[{]
return[member[.url]]
else begin[{]
None
end[}]
local_variable[type[val], questionMarkPosition]
if[binary_operation[member[.questionMarkPosition], <, member[.jsessionPosition]]] begin[{]
return[call[url.substring, parameter[literal[0], call[url.indexOf, parameter[literal[";jsession"]]]]]]
else begin[{]
None
end[}]
return[binary_operation[call[url.substring, parameter[literal[0], member[.jsessionPosition]]], +, call[url.substring, parameter[member[.questionMarkPosition]]]]]
end[}]
END[}] | Keyword[protected] Keyword[static] identifier[String] identifier[cleanupUrl] operator[SEP] Keyword[final] identifier[String] identifier[url] operator[SEP] {
Keyword[if] operator[SEP] identifier[url] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[val] identifier[jsessionPosition] operator[=] identifier[url] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsessionPosition] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[url] operator[SEP]
}
identifier[val] identifier[questionMarkPosition] operator[=] identifier[url] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[questionMarkPosition] operator[<] identifier[jsessionPosition] operator[SEP] {
Keyword[return] identifier[url] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[url] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[url] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[jsessionPosition] operator[SEP] operator[+] identifier[url] operator[SEP] identifier[substring] operator[SEP] identifier[questionMarkPosition] operator[SEP] operator[SEP]
}
|
@Override
public Iterator iterate()
{
return new ResultIterator((CouchDBClient) persistenceDelegeator.getClient(getEntityMetadata()),
getEntityMetadata(), persistenceDelegeator, onTranslation(getKunderaQuery().getFilterClauseQueue(),
getEntityMetadata()), getFetchSize() != null ? getFetchSize() : this.maxResult);
} | class class_name[name] begin[{]
method[iterate, return_type[type[Iterator]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEntityMetadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=getClient, postfix_operators=[], prefix_operators=[], qualifier=persistenceDelegeator, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=CouchDBClient, sub_type=None)), MethodInvocation(arguments=[], member=getEntityMetadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=persistenceDelegeator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKunderaQuery, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getFilterClauseQueue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getEntityMetadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=onTranslation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getFetchSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=maxResult, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), if_true=MethodInvocation(arguments=[], member=getFetchSize, 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=ResultIterator, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Iterator] identifier[iterate] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[ResultIterator] operator[SEP] operator[SEP] identifier[CouchDBClient] operator[SEP] identifier[persistenceDelegeator] operator[SEP] identifier[getClient] operator[SEP] identifier[getEntityMetadata] operator[SEP] operator[SEP] operator[SEP] , identifier[getEntityMetadata] operator[SEP] operator[SEP] , identifier[persistenceDelegeator] , identifier[onTranslation] operator[SEP] identifier[getKunderaQuery] operator[SEP] operator[SEP] operator[SEP] identifier[getFilterClauseQueue] operator[SEP] operator[SEP] , identifier[getEntityMetadata] operator[SEP] operator[SEP] operator[SEP] , identifier[getFetchSize] operator[SEP] operator[SEP] operator[!=] Other[null] operator[?] identifier[getFetchSize] operator[SEP] operator[SEP] operator[:] Keyword[this] operator[SEP] identifier[maxResult] operator[SEP] operator[SEP]
}
|
public static <K, V, R> Optional<R> getValueAsOptIfExist(Map<K, V> map,
K key, Function<V, R> returnBuilderFunction) {
return getOptional(map, key).map(returnBuilderFunction::apply);
} | class class_name[name] begin[{]
method[getValueAsOptIfExist, return_type[type[Optional]], modifier[public static], parameter[map, key, returnBuilderFunction]] begin[{]
return[call[.getOptional, parameter[member[.map], member[.key]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] , identifier[R] operator[>] identifier[Optional] operator[<] identifier[R] operator[>] identifier[getValueAsOptIfExist] operator[SEP] identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[map] , identifier[K] identifier[key] , identifier[Function] operator[<] identifier[V] , identifier[R] operator[>] identifier[returnBuilderFunction] operator[SEP] {
Keyword[return] identifier[getOptional] operator[SEP] identifier[map] , identifier[key] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[returnBuilderFunction] operator[::] identifier[apply] operator[SEP] operator[SEP]
}
|
public RawComponent addExperimentalComponent(String name) {
RawComponent raw = new RawComponent(name);
addComponent(raw);
return raw;
} | class class_name[name] begin[{]
method[addExperimentalComponent, return_type[type[RawComponent]], modifier[public], parameter[name]] begin[{]
local_variable[type[RawComponent], raw]
call[.addComponent, parameter[member[.raw]]]
return[member[.raw]]
end[}]
END[}] | Keyword[public] identifier[RawComponent] identifier[addExperimentalComponent] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[RawComponent] identifier[raw] operator[=] Keyword[new] identifier[RawComponent] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[addComponent] operator[SEP] identifier[raw] operator[SEP] operator[SEP] Keyword[return] identifier[raw] operator[SEP]
}
|
@Override
protected byte[] encodeType(Byte t) {
final ByteBuffer buffer = allocate(size);
// t is guaranteed non-null by superclass
buffer.put(t);
return buffer.array();
} | class class_name[name] begin[{]
method[encodeType, return_type[type[byte]], modifier[protected], parameter[t]] begin[{]
local_variable[type[ByteBuffer], buffer]
call[buffer.put, parameter[member[.t]]]
return[call[buffer.array, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[byte] operator[SEP] operator[SEP] identifier[encodeType] operator[SEP] identifier[Byte] identifier[t] operator[SEP] {
Keyword[final] identifier[ByteBuffer] identifier[buffer] operator[=] identifier[allocate] operator[SEP] identifier[size] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[put] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[return] identifier[buffer] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean waitForCancelResponse(SipTransaction siptrans, long timeout) {
initErrorInfo();
if (siptrans == null) {
returnCode = SipSession.INVALID_OPERATION;
errorMessage = (String) SipSession.statusCodeDescription.get(new Integer(returnCode))
+ " - no RE-INVITE transaction object given";
return false;
}
EventObject response_event = parent.waitResponse(siptrans, timeout);
if (response_event == null) {
setErrorMessage(parent.getErrorMessage());
setException(parent.getException());
setReturnCode(parent.getReturnCode());
return false;
}
if (response_event instanceof TimeoutEvent) {
setReturnCode(SipPhone.TIMEOUT_OCCURRED);
setErrorMessage("A Timeout Event was received");
return false;
}
Response resp = ((ResponseEvent) response_event).getResponse();
receivedResponses.add(new SipResponse((ResponseEvent) response_event));
LOG.info("CANCEL response received: {}", resp.toString());
setReturnCode(resp.getStatusCode());
return true;
} | class class_name[name] begin[{]
method[waitForCancelResponse, return_type[type[boolean]], modifier[public], parameter[siptrans, timeout]] begin[{]
call[.initErrorInfo, parameter[]]
if[binary_operation[member[.siptrans], ==, literal[null]]] begin[{]
assign[member[.returnCode], member[SipSession.INVALID_OPERATION]]
assign[member[.errorMessage], binary_operation[Cast(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=returnCode, 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=get, postfix_operators=[], prefix_operators=[], qualifier=SipSession.statusCodeDescription, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), +, literal[" - no RE-INVITE transaction object given"]]]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[EventObject], response_event]
if[binary_operation[member[.response_event], ==, literal[null]]] begin[{]
call[.setErrorMessage, parameter[call[parent.getErrorMessage, parameter[]]]]
call[.setException, parameter[call[parent.getException, parameter[]]]]
call[.setReturnCode, parameter[call[parent.getReturnCode, parameter[]]]]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.response_event], instanceof, type[TimeoutEvent]]] begin[{]
call[.setReturnCode, parameter[member[SipPhone.TIMEOUT_OCCURRED]]]
call[.setErrorMessage, parameter[literal["A Timeout Event was received"]]]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[Response], resp]
call[receivedResponses.add, parameter[ClassCreator(arguments=[Cast(expression=MemberReference(member=response_event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ResponseEvent, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SipResponse, sub_type=None))]]
call[LOG.info, parameter[literal["CANCEL response received: {}"], call[resp.toString, parameter[]]]]
call[.setReturnCode, parameter[call[resp.getStatusCode, parameter[]]]]
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[waitForCancelResponse] operator[SEP] identifier[SipTransaction] identifier[siptrans] , Keyword[long] identifier[timeout] operator[SEP] {
identifier[initErrorInfo] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[siptrans] operator[==] Other[null] operator[SEP] {
identifier[returnCode] operator[=] identifier[SipSession] operator[SEP] identifier[INVALID_OPERATION] operator[SEP] identifier[errorMessage] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[SipSession] operator[SEP] identifier[statusCodeDescription] operator[SEP] identifier[get] operator[SEP] Keyword[new] identifier[Integer] operator[SEP] identifier[returnCode] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
identifier[EventObject] identifier[response_event] operator[=] identifier[parent] operator[SEP] identifier[waitResponse] operator[SEP] identifier[siptrans] , identifier[timeout] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[response_event] operator[==] Other[null] operator[SEP] {
identifier[setErrorMessage] operator[SEP] identifier[parent] operator[SEP] identifier[getErrorMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setException] operator[SEP] identifier[parent] operator[SEP] identifier[getException] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setReturnCode] operator[SEP] identifier[parent] operator[SEP] identifier[getReturnCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[response_event] Keyword[instanceof] identifier[TimeoutEvent] operator[SEP] {
identifier[setReturnCode] operator[SEP] identifier[SipPhone] operator[SEP] identifier[TIMEOUT_OCCURRED] operator[SEP] operator[SEP] identifier[setErrorMessage] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
identifier[Response] identifier[resp] operator[=] operator[SEP] operator[SEP] identifier[ResponseEvent] operator[SEP] identifier[response_event] operator[SEP] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] identifier[receivedResponses] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[SipResponse] operator[SEP] operator[SEP] identifier[ResponseEvent] operator[SEP] identifier[response_event] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[resp] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setReturnCode] operator[SEP] identifier[resp] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public EClass getIfcRepresentationItem() {
if (ifcRepresentationItemEClass == null) {
ifcRepresentationItemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(568);
}
return ifcRepresentationItemEClass;
} | class class_name[name] begin[{]
method[getIfcRepresentationItem, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcRepresentationItemEClass], ==, literal[null]]] begin[{]
assign[member[.ifcRepresentationItemEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=568)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcRepresentationItemEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcRepresentationItem] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcRepresentationItemEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcRepresentationItemEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[568] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcRepresentationItemEClass] operator[SEP]
}
|
public void toStream(boolean skipNonOverrides, OutputStream out)
throws Exception {
PrintWriter writer = null;
try {
writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8"));
write(skipNonOverrides, true, writer);
} finally {
try {
writer.close();
} catch (Throwable th) {
}
try {
out.close();
} catch (Throwable th) {
}
}
} | class class_name[name] begin[{]
method[toStream, return_type[void], modifier[public], parameter[skipNonOverrides, out]] begin[{]
local_variable[type[PrintWriter], writer]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OutputStreamWriter, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrintWriter, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=skipNonOverrides, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=th, types=['Throwable']))], finally_block=None, label=None, resources=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=th, types=['Throwable']))], finally_block=None, label=None, resources=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[toStream] operator[SEP] Keyword[boolean] identifier[skipNonOverrides] , identifier[OutputStream] identifier[out] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[PrintWriter] identifier[writer] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[writer] operator[=] Keyword[new] identifier[PrintWriter] operator[SEP] Keyword[new] identifier[OutputStreamWriter] operator[SEP] identifier[out] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[write] operator[SEP] identifier[skipNonOverrides] , literal[boolean] , identifier[writer] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
identifier[writer] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[th] operator[SEP] {
}
Keyword[try] {
identifier[out] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[th] operator[SEP] {
}
}
}
|
public static Property select(
final String name, final String title, final String description,
final boolean required, final String defaultValue, final Collection<? extends Enum<?>> selectValues,
final Map<String, String> selectLabels,
final PropertyScope scope, final Map<String, Object> renderingOptions
)
{
//create string representation of the enum values
ArrayList<String> strings = new ArrayList<String>();
for (Enum<?> selectValue : selectValues) {
strings.add(selectValue.name());
}
return new SelectProperty(name, title, description, required, defaultValue, strings, selectLabels, scope,
renderingOptions, false
);
} | class class_name[name] begin[{]
method[select, return_type[type[Property]], modifier[public static], parameter[name, title, description, required, defaultValue, selectValues, selectLabels, scope, renderingOptions]] begin[{]
local_variable[type[ArrayList], strings]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=selectValue, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=strings, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=selectValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=selectValue)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Enum, sub_type=None))), label=None)
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=title, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=description, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=required, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=defaultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=strings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=selectLabels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=renderingOptions, 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=None, dimensions=None, name=SelectProperty, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Property] identifier[select] operator[SEP] Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[String] identifier[title] , Keyword[final] identifier[String] identifier[description] , Keyword[final] Keyword[boolean] identifier[required] , Keyword[final] identifier[String] identifier[defaultValue] , Keyword[final] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[Enum] operator[<] operator[?] operator[>] operator[>] identifier[selectValues] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[selectLabels] , Keyword[final] identifier[PropertyScope] identifier[scope] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[renderingOptions] operator[SEP] {
identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[strings] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Enum] operator[<] operator[?] operator[>] identifier[selectValue] operator[:] identifier[selectValues] operator[SEP] {
identifier[strings] operator[SEP] identifier[add] operator[SEP] identifier[selectValue] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[SelectProperty] operator[SEP] identifier[name] , identifier[title] , identifier[description] , identifier[required] , identifier[defaultValue] , identifier[strings] , identifier[selectLabels] , identifier[scope] , identifier[renderingOptions] , literal[boolean] operator[SEP] operator[SEP]
}
|
static boolean isJAXBElement(JType type) {
//noinspection RedundantIfStatement
if (type.fullName().startsWith(JAXBElement.class.getName())) {
return true;
}
return false;
} | class class_name[name] begin[{]
method[isJAXBElement, return_type[type[boolean]], modifier[static], parameter[type]] begin[{]
if[call[type.fullName, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[static] Keyword[boolean] identifier[isJAXBElement] operator[SEP] identifier[JType] identifier[type] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[fullName] operator[SEP] operator[SEP] operator[SEP] identifier[startsWith] operator[SEP] identifier[JAXBElement] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Deprecated
public static void error(String message, Throwable error) {
logger.error(message, error);
} | class class_name[name] begin[{]
method[error, return_type[void], modifier[public static], parameter[message, error]] begin[{]
call[logger.error, parameter[member[.message], member[.error]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] Keyword[void] identifier[error] operator[SEP] identifier[String] identifier[message] , identifier[Throwable] identifier[error] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[message] , identifier[error] operator[SEP] operator[SEP]
}
|
public void parseSignaturesStream(InputStream in, String name) throws IOException,ParseException {
logger.info("Reading API signatures: " + name);
final Set<String> missingClasses = new TreeSet<String>();
parseSignaturesStream(in, false, missingClasses);
reportMissingSignatureClasses(missingClasses);
} | class class_name[name] begin[{]
method[parseSignaturesStream, return_type[void], modifier[public], parameter[in, name]] begin[{]
call[logger.info, parameter[binary_operation[literal["Reading API signatures: "], +, member[.name]]]]
local_variable[type[Set], missingClasses]
call[.parseSignaturesStream, parameter[member[.in], literal[false], member[.missingClasses]]]
call[.reportMissingSignatureClasses, parameter[member[.missingClasses]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[parseSignaturesStream] operator[SEP] identifier[InputStream] identifier[in] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ParseException] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[missingClasses] operator[=] Keyword[new] identifier[TreeSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[parseSignaturesStream] operator[SEP] identifier[in] , literal[boolean] , identifier[missingClasses] operator[SEP] operator[SEP] identifier[reportMissingSignatureClasses] operator[SEP] identifier[missingClasses] operator[SEP] operator[SEP]
}
|
public void insert(Widget widget, String tabText, int beforeIndex) {
insert(widget, tabText, false, beforeIndex);
} | class class_name[name] begin[{]
method[insert, return_type[void], modifier[public], parameter[widget, tabText, beforeIndex]] begin[{]
call[.insert, parameter[member[.widget], member[.tabText], literal[false], member[.beforeIndex]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[insert] operator[SEP] identifier[Widget] identifier[widget] , identifier[String] identifier[tabText] , Keyword[int] identifier[beforeIndex] operator[SEP] {
identifier[insert] operator[SEP] identifier[widget] , identifier[tabText] , literal[boolean] , identifier[beforeIndex] operator[SEP] operator[SEP]
}
|
private boolean readln1(String strExpected, String strAlternative) {
String sX = scanner.next();
if (sX.equals(strExpected)) {
return true;
}
if (sX.equals(strAlternative)) {
return false;
}
throw new IllegalStateException("Expected: " + strAlternative + " but got: " + sX);
} | class class_name[name] begin[{]
method[readln1, return_type[type[boolean]], modifier[private], parameter[strExpected, strAlternative]] begin[{]
local_variable[type[String], sX]
if[call[sX.equals, parameter[member[.strExpected]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[call[sX.equals, parameter[member[.strAlternative]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Expected: "), operandr=MemberReference(member=strAlternative, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" but got: "), operator=+), operandr=MemberReference(member=sX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[readln1] operator[SEP] identifier[String] identifier[strExpected] , identifier[String] identifier[strAlternative] operator[SEP] {
identifier[String] identifier[sX] operator[=] identifier[scanner] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sX] operator[SEP] identifier[equals] operator[SEP] identifier[strExpected] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[sX] operator[SEP] identifier[equals] operator[SEP] identifier[strAlternative] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[strAlternative] operator[+] literal[String] operator[+] identifier[sX] operator[SEP] operator[SEP]
}
|
public static CommerceCurrency fetchByG_A_Last(long groupId,
boolean active, OrderByComparator<CommerceCurrency> orderByComparator) {
return getPersistence()
.fetchByG_A_Last(groupId, active, orderByComparator);
} | class class_name[name] begin[{]
method[fetchByG_A_Last, return_type[type[CommerceCurrency]], modifier[public static], parameter[groupId, active, orderByComparator]] begin[{]
return[call[.getPersistence, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CommerceCurrency] identifier[fetchByG_A_Last] operator[SEP] Keyword[long] identifier[groupId] , Keyword[boolean] identifier[active] , identifier[OrderByComparator] operator[<] identifier[CommerceCurrency] operator[>] identifier[orderByComparator] operator[SEP] {
Keyword[return] identifier[getPersistence] operator[SEP] operator[SEP] operator[SEP] identifier[fetchByG_A_Last] operator[SEP] identifier[groupId] , identifier[active] , identifier[orderByComparator] operator[SEP] operator[SEP]
}
|
public long readRawVarint64() throws IOException
{
// final byte[] buffer = this.buffer;
// int offset = this.offset;
int shift = 0;
long result = 0;
while (shift < 64)
{
final byte b = buffer.get();
result |= (long) (b & 0x7F) << shift;
if ((b & 0x80) == 0)
{
// this.offset = offset;
return result;
}
shift += 7;
}
throw ProtobufException.malformedVarint();
} | class class_name[name] begin[{]
method[readRawVarint64, return_type[type[long]], modifier[public], parameter[]] begin[{]
local_variable[type[int], shift]
local_variable[type[long], result]
while[binary_operation[member[.shift], <, literal[64]]] begin[{]
local_variable[type[byte], b]
assign[member[.result], binary_operation[Cast(expression=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x7F), operator=&), type=BasicType(dimensions=[], name=long)), <<, member[.shift]]]
if[binary_operation[binary_operation[member[.b], &, literal[0x80]], ==, literal[0]]] begin[{]
return[member[.result]]
else begin[{]
None
end[}]
assign[member[.shift], literal[7]]
end[}]
ThrowStatement(expression=MethodInvocation(arguments=[], member=malformedVarint, postfix_operators=[], prefix_operators=[], qualifier=ProtobufException, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[public] Keyword[long] identifier[readRawVarint64] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[shift] operator[=] Other[0] operator[SEP] Keyword[long] identifier[result] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[shift] operator[<] Other[64] operator[SEP] {
Keyword[final] Keyword[byte] identifier[b] operator[=] identifier[buffer] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[|=] operator[SEP] Keyword[long] operator[SEP] operator[SEP] identifier[b] operator[&] literal[Integer] operator[SEP] operator[<<] identifier[shift] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[b] operator[&] literal[Integer] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[result] operator[SEP]
}
identifier[shift] operator[+=] Other[7] operator[SEP]
}
Keyword[throw] identifier[ProtobufException] operator[SEP] identifier[malformedVarint] operator[SEP] operator[SEP] operator[SEP]
}
|
private void executeInClassScope(Callable<Void> call) {
try {
classContext.get().activate(deploymentClass);
call.call();
} catch (Exception e) {
throw new RuntimeException("Could not invoke operation", e); // NOPMD
} finally {
classContext.get().deactivate();
}
} | class class_name[name] begin[{]
method[executeInClassScope, return_type[void], modifier[private], parameter[call]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=classContext, selectors=[MethodInvocation(arguments=[MemberReference(member=deploymentClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=activate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=call, postfix_operators=[], prefix_operators=[], qualifier=call, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not invoke operation"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=classContext, selectors=[MethodInvocation(arguments=[], member=deactivate, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[executeInClassScope] operator[SEP] identifier[Callable] operator[<] identifier[Void] operator[>] identifier[call] operator[SEP] {
Keyword[try] {
identifier[classContext] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[activate] operator[SEP] identifier[deploymentClass] operator[SEP] operator[SEP] identifier[call] operator[SEP] identifier[call] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[classContext] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[deactivate] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public Map<String, Collection<String>> getRequireFeatureWithTolerates() {
// The feature may be an older feature which never had the tolerates information
// stored, in which case, look in the older requireFeature field and massage
// that info into the required format.
// Or there may just not be any required features at all.
Collection<RequireFeatureWithTolerates> rfwt = _asset.getWlpInformation().getRequireFeatureWithTolerates();
if (rfwt != null) {
Map<String, Collection<String>> rv = new HashMap<String, Collection<String>>();
for (RequireFeatureWithTolerates feature : rfwt) {
rv.put(feature.getFeature(), feature.getTolerates());
}
return rv;
}
// Newer field not present, check the older field
Collection<String> rf = _asset.getWlpInformation().getRequireFeature();
if (rf != null) {
Map<String, Collection<String>> rv = new HashMap<String, Collection<String>>();
for (String feature : rf) {
rv.put(feature, Collections.<String> emptyList());
}
return rv;
}
// No required features at all
return null;
} | class class_name[name] begin[{]
method[getRequireFeatureWithTolerates, return_type[type[Map]], modifier[public], parameter[]] begin[{]
local_variable[type[Collection], rfwt]
if[binary_operation[member[.rfwt], !=, literal[null]]] begin[{]
local_variable[type[Map], rv]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFeature, postfix_operators=[], prefix_operators=[], qualifier=feature, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTolerates, postfix_operators=[], prefix_operators=[], qualifier=feature, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=rv, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rfwt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=feature)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RequireFeatureWithTolerates, sub_type=None))), label=None)
return[member[.rv]]
else begin[{]
None
end[}]
local_variable[type[Collection], rf]
if[binary_operation[member[.rf], !=, literal[null]]] begin[{]
local_variable[type[Map], rv]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=feature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=Collections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))])], member=put, postfix_operators=[], prefix_operators=[], qualifier=rv, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=feature)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.rv]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Collection] operator[<] identifier[String] operator[>] operator[>] identifier[getRequireFeatureWithTolerates] operator[SEP] operator[SEP] {
identifier[Collection] operator[<] identifier[RequireFeatureWithTolerates] operator[>] identifier[rfwt] operator[=] identifier[_asset] operator[SEP] identifier[getWlpInformation] operator[SEP] operator[SEP] operator[SEP] identifier[getRequireFeatureWithTolerates] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rfwt] operator[!=] Other[null] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Collection] operator[<] identifier[String] operator[>] operator[>] identifier[rv] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Collection] operator[<] identifier[String] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[RequireFeatureWithTolerates] identifier[feature] operator[:] identifier[rfwt] operator[SEP] {
identifier[rv] operator[SEP] identifier[put] operator[SEP] identifier[feature] operator[SEP] identifier[getFeature] operator[SEP] operator[SEP] , identifier[feature] operator[SEP] identifier[getTolerates] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rv] operator[SEP]
}
identifier[Collection] operator[<] identifier[String] operator[>] identifier[rf] operator[=] identifier[_asset] operator[SEP] identifier[getWlpInformation] operator[SEP] operator[SEP] operator[SEP] identifier[getRequireFeature] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rf] operator[!=] Other[null] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Collection] operator[<] identifier[String] operator[>] operator[>] identifier[rv] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Collection] operator[<] identifier[String] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[feature] operator[:] identifier[rf] operator[SEP] {
identifier[rv] operator[SEP] identifier[put] operator[SEP] identifier[feature] , identifier[Collections] operator[SEP] operator[<] identifier[String] operator[>] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[rv] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public Formula importFormula(final Formula formula) {
if (this.importer == null) {
this.importer = new FormulaFactoryImporter(this);
}
final Formula imported = formula.transform(this.importer);
adjustCounters(imported);
return imported;
} | class class_name[name] begin[{]
method[importFormula, return_type[type[Formula]], modifier[public], parameter[formula]] begin[{]
if[binary_operation[THIS[member[None.importer]], ==, literal[null]]] begin[{]
assign[THIS[member[None.importer]], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FormulaFactoryImporter, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[Formula], imported]
call[.adjustCounters, parameter[member[.imported]]]
return[member[.imported]]
end[}]
END[}] | Keyword[public] identifier[Formula] identifier[importFormula] operator[SEP] Keyword[final] identifier[Formula] identifier[formula] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[importer] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[importer] operator[=] Keyword[new] identifier[FormulaFactoryImporter] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Formula] identifier[imported] operator[=] identifier[formula] operator[SEP] identifier[transform] operator[SEP] Keyword[this] operator[SEP] identifier[importer] operator[SEP] operator[SEP] identifier[adjustCounters] operator[SEP] identifier[imported] operator[SEP] operator[SEP] Keyword[return] identifier[imported] operator[SEP]
}
|
public static void drawStringCentered (
Graphics g, String str, int x, int y, int width, int height)
{
FontMetrics fm = g.getFontMetrics(g.getFont());
int xpos = x + ((width - fm.stringWidth(str)) / 2);
int ypos = y + ((height + fm.getAscent()) / 2);
g.drawString(str, xpos, ypos);
} | class class_name[name] begin[{]
method[drawStringCentered, return_type[void], modifier[public static], parameter[g, str, x, y, width, height]] begin[{]
local_variable[type[FontMetrics], fm]
local_variable[type[int], xpos]
local_variable[type[int], ypos]
call[g.drawString, parameter[member[.str], member[.xpos], member[.ypos]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[drawStringCentered] operator[SEP] identifier[Graphics] identifier[g] , identifier[String] identifier[str] , Keyword[int] identifier[x] , Keyword[int] identifier[y] , Keyword[int] identifier[width] , Keyword[int] identifier[height] operator[SEP] {
identifier[FontMetrics] identifier[fm] operator[=] identifier[g] operator[SEP] identifier[getFontMetrics] operator[SEP] identifier[g] operator[SEP] identifier[getFont] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[xpos] operator[=] identifier[x] operator[+] operator[SEP] operator[SEP] identifier[width] operator[-] identifier[fm] operator[SEP] identifier[stringWidth] operator[SEP] identifier[str] operator[SEP] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP] Keyword[int] identifier[ypos] operator[=] identifier[y] operator[+] operator[SEP] operator[SEP] identifier[height] operator[+] identifier[fm] operator[SEP] identifier[getAscent] operator[SEP] operator[SEP] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP] identifier[g] operator[SEP] identifier[drawString] operator[SEP] identifier[str] , identifier[xpos] , identifier[ypos] operator[SEP] operator[SEP]
}
|
public void marshall(APNSVoipChannelRequest aPNSVoipChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (aPNSVoipChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(aPNSVoipChannelRequest.getBundleId(), BUNDLEID_BINDING);
protocolMarshaller.marshall(aPNSVoipChannelRequest.getCertificate(), CERTIFICATE_BINDING);
protocolMarshaller.marshall(aPNSVoipChannelRequest.getDefaultAuthenticationMethod(), DEFAULTAUTHENTICATIONMETHOD_BINDING);
protocolMarshaller.marshall(aPNSVoipChannelRequest.getEnabled(), ENABLED_BINDING);
protocolMarshaller.marshall(aPNSVoipChannelRequest.getPrivateKey(), PRIVATEKEY_BINDING);
protocolMarshaller.marshall(aPNSVoipChannelRequest.getTeamId(), TEAMID_BINDING);
protocolMarshaller.marshall(aPNSVoipChannelRequest.getTokenKey(), TOKENKEY_BINDING);
protocolMarshaller.marshall(aPNSVoipChannelRequest.getTokenKeyId(), TOKENKEYID_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[aPNSVoipChannelRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.aPNSVoipChannelRequest], ==, 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=getBundleId, postfix_operators=[], prefix_operators=[], qualifier=aPNSVoipChannelRequest, selectors=[], type_arguments=None), MemberReference(member=BUNDLEID_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=getCertificate, postfix_operators=[], prefix_operators=[], qualifier=aPNSVoipChannelRequest, selectors=[], type_arguments=None), MemberReference(member=CERTIFICATE_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=getDefaultAuthenticationMethod, postfix_operators=[], prefix_operators=[], qualifier=aPNSVoipChannelRequest, selectors=[], type_arguments=None), MemberReference(member=DEFAULTAUTHENTICATIONMETHOD_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=getEnabled, postfix_operators=[], prefix_operators=[], qualifier=aPNSVoipChannelRequest, selectors=[], type_arguments=None), MemberReference(member=ENABLED_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=getPrivateKey, postfix_operators=[], prefix_operators=[], qualifier=aPNSVoipChannelRequest, selectors=[], type_arguments=None), MemberReference(member=PRIVATEKEY_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=getTeamId, postfix_operators=[], prefix_operators=[], qualifier=aPNSVoipChannelRequest, selectors=[], type_arguments=None), MemberReference(member=TEAMID_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=getTokenKey, postfix_operators=[], prefix_operators=[], qualifier=aPNSVoipChannelRequest, selectors=[], type_arguments=None), MemberReference(member=TOKENKEY_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=getTokenKeyId, postfix_operators=[], prefix_operators=[], qualifier=aPNSVoipChannelRequest, selectors=[], type_arguments=None), MemberReference(member=TOKENKEYID_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[APNSVoipChannelRequest] identifier[aPNSVoipChannelRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[aPNSVoipChannelRequest] 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[aPNSVoipChannelRequest] operator[SEP] identifier[getBundleId] operator[SEP] operator[SEP] , identifier[BUNDLEID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[aPNSVoipChannelRequest] operator[SEP] identifier[getCertificate] operator[SEP] operator[SEP] , identifier[CERTIFICATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[aPNSVoipChannelRequest] operator[SEP] identifier[getDefaultAuthenticationMethod] operator[SEP] operator[SEP] , identifier[DEFAULTAUTHENTICATIONMETHOD_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[aPNSVoipChannelRequest] operator[SEP] identifier[getEnabled] operator[SEP] operator[SEP] , identifier[ENABLED_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[aPNSVoipChannelRequest] operator[SEP] identifier[getPrivateKey] operator[SEP] operator[SEP] , identifier[PRIVATEKEY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[aPNSVoipChannelRequest] operator[SEP] identifier[getTeamId] operator[SEP] operator[SEP] , identifier[TEAMID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[aPNSVoipChannelRequest] operator[SEP] identifier[getTokenKey] operator[SEP] operator[SEP] , identifier[TOKENKEY_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[aPNSVoipChannelRequest] operator[SEP] identifier[getTokenKeyId] operator[SEP] operator[SEP] , identifier[TOKENKEYID_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 static Segment<PrimitiveParameter> nextSegmentAfterMatch(
PatternFinderUser def, Segment<PrimitiveParameter> seg,
Algorithm algorithm, int minPatternLength, int maxPatternLength) {
if (seg == null) {
return null;
}
int arg;
int x = seg.getFirstIndex();
int y = seg.getLastIndex();
Segment<PrimitiveParameter> nextSeg = null;
if ((arg = def.getMaxOverlapping()) > 0) {
int myCurrentColumn = y - (arg + 1);
if (myCurrentColumn - 1 > x) {
nextSeg = resetSegment(def, seg, myCurrentColumn, getYIndex(
def, myCurrentColumn, seg), algorithm,
minPatternLength, maxPatternLength);
} else {
nextSeg = resetSegment(def, seg, getXIndex(def, x, seg),
getYIndex(def, y + 1, seg), algorithm,
minPatternLength, maxPatternLength);
}
} else {
nextSeg = resetSegment(def, seg, getXIndex(def, x, seg), getYIndex(
def, y + 1, seg), algorithm, minPatternLength,
maxPatternLength);
}
return nextSeg;
} | class class_name[name] begin[{]
method[nextSegmentAfterMatch, return_type[type[Segment]], modifier[private static], parameter[def, seg, algorithm, minPatternLength, maxPatternLength]] begin[{]
if[binary_operation[member[.seg], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], arg]
local_variable[type[int], x]
local_variable[type[int], y]
local_variable[type[Segment], nextSeg]
if[binary_operation[assign[member[.arg], call[def.getMaxOverlapping, parameter[]]], >, literal[0]]] begin[{]
local_variable[type[int], myCurrentColumn]
if[binary_operation[binary_operation[member[.myCurrentColumn], -, literal[1]], >, member[.x]]] begin[{]
assign[member[.nextSeg], call[.resetSegment, parameter[member[.def], member[.seg], member[.myCurrentColumn], call[.getYIndex, parameter[member[.def], member[.myCurrentColumn], member[.seg]]], member[.algorithm], member[.minPatternLength], member[.maxPatternLength]]]]
else begin[{]
assign[member[.nextSeg], call[.resetSegment, parameter[member[.def], member[.seg], call[.getXIndex, parameter[member[.def], member[.x], member[.seg]]], call[.getYIndex, parameter[member[.def], binary_operation[member[.y], +, literal[1]], member[.seg]]], member[.algorithm], member[.minPatternLength], member[.maxPatternLength]]]]
end[}]
else begin[{]
assign[member[.nextSeg], call[.resetSegment, parameter[member[.def], member[.seg], call[.getXIndex, parameter[member[.def], member[.x], member[.seg]]], call[.getYIndex, parameter[member[.def], binary_operation[member[.y], +, literal[1]], member[.seg]]], member[.algorithm], member[.minPatternLength], member[.maxPatternLength]]]]
end[}]
return[member[.nextSeg]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Segment] operator[<] identifier[PrimitiveParameter] operator[>] identifier[nextSegmentAfterMatch] operator[SEP] identifier[PatternFinderUser] identifier[def] , identifier[Segment] operator[<] identifier[PrimitiveParameter] operator[>] identifier[seg] , identifier[Algorithm] identifier[algorithm] , Keyword[int] identifier[minPatternLength] , Keyword[int] identifier[maxPatternLength] operator[SEP] {
Keyword[if] operator[SEP] identifier[seg] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[int] identifier[arg] operator[SEP] Keyword[int] identifier[x] operator[=] identifier[seg] operator[SEP] identifier[getFirstIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[y] operator[=] identifier[seg] operator[SEP] identifier[getLastIndex] operator[SEP] operator[SEP] operator[SEP] identifier[Segment] operator[<] identifier[PrimitiveParameter] operator[>] identifier[nextSeg] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[arg] operator[=] identifier[def] operator[SEP] identifier[getMaxOverlapping] operator[SEP] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[int] identifier[myCurrentColumn] operator[=] identifier[y] operator[-] operator[SEP] identifier[arg] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[myCurrentColumn] operator[-] Other[1] operator[>] identifier[x] operator[SEP] {
identifier[nextSeg] operator[=] identifier[resetSegment] operator[SEP] identifier[def] , identifier[seg] , identifier[myCurrentColumn] , identifier[getYIndex] operator[SEP] identifier[def] , identifier[myCurrentColumn] , identifier[seg] operator[SEP] , identifier[algorithm] , identifier[minPatternLength] , identifier[maxPatternLength] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[nextSeg] operator[=] identifier[resetSegment] operator[SEP] identifier[def] , identifier[seg] , identifier[getXIndex] operator[SEP] identifier[def] , identifier[x] , identifier[seg] operator[SEP] , identifier[getYIndex] operator[SEP] identifier[def] , identifier[y] operator[+] Other[1] , identifier[seg] operator[SEP] , identifier[algorithm] , identifier[minPatternLength] , identifier[maxPatternLength] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[nextSeg] operator[=] identifier[resetSegment] operator[SEP] identifier[def] , identifier[seg] , identifier[getXIndex] operator[SEP] identifier[def] , identifier[x] , identifier[seg] operator[SEP] , identifier[getYIndex] operator[SEP] identifier[def] , identifier[y] operator[+] Other[1] , identifier[seg] operator[SEP] , identifier[algorithm] , identifier[minPatternLength] , identifier[maxPatternLength] operator[SEP] operator[SEP]
}
Keyword[return] identifier[nextSeg] operator[SEP]
}
|
public CollectionResult<double[]> run(Database database, Relation<O> rel) {
DistanceQuery<O> dq = rel.getDistanceQuery(getDistanceFunction());
int size = rel.size();
long pairs = (size * (long) size) >> 1;
final long ssize = sampling <= 1 ? (long) Math.ceil(sampling * pairs) : (long) sampling;
if(ssize > Integer.MAX_VALUE) {
throw new AbortException("Sampling size too large.");
}
final int qsize = quantile <= 0 ? 1 : (int) Math.ceil(quantile * ssize);
DoubleMaxHeap heap = new DoubleMaxHeap(qsize);
ArrayDBIDs ids = DBIDUtil.ensureArray(rel.getDBIDs());
DBIDArrayIter i1 = ids.iter(), i2 = ids.iter();
Random r = rand.getSingleThreadedRandom();
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Sampling", (int) ssize, LOG) : null;
for(long i = 0; i < ssize; i++) {
int x = r.nextInt(size - 1) + 1, y = r.nextInt(x);
double dist = dq.distance(i1.seek(x), i2.seek(y));
// Skip NaN, and/or zeros.
if(dist != dist || (nozeros && dist < Double.MIN_NORMAL)) {
continue;
}
heap.add(dist, qsize);
LOG.incrementProcessed(prog);
}
LOG.statistics(new DoubleStatistic(PREFIX + ".quantile", quantile));
LOG.statistics(new LongStatistic(PREFIX + ".samplesize", ssize));
LOG.statistics(new DoubleStatistic(PREFIX + ".distance", heap.peek()));
LOG.ensureCompleted(prog);
Collection<String> header = Arrays.asList(new String[] { "Distance" });
Collection<double[]> data = Arrays.asList(new double[][] { new double[] { heap.peek() } });
return new CollectionResult<double[]>("Distances sample", "distance-sample", data, header);
} | class class_name[name] begin[{]
method[run, return_type[type[CollectionResult]], modifier[public], parameter[database, rel]] begin[{]
local_variable[type[DistanceQuery], dq]
local_variable[type[int], size]
local_variable[type[long], pairs]
local_variable[type[long], ssize]
if[binary_operation[member[.ssize], >, member[Integer.MAX_VALUE]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Sampling size too large.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AbortException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], qsize]
local_variable[type[DoubleMaxHeap], heap]
local_variable[type[ArrayDBIDs], ids]
local_variable[type[DBIDArrayIter], i1]
local_variable[type[Random], r]
local_variable[type[FiniteProgress], prog]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), name=x), VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nextInt, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), name=y)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=seek, postfix_operators=[], prefix_operators=[], qualifier=i1, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=seek, postfix_operators=[], prefix_operators=[], qualifier=i2, selectors=[], type_arguments=None)], member=distance, postfix_operators=[], prefix_operators=[], qualifier=dq, selectors=[], type_arguments=None), name=dist)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=dist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=dist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=nozeros, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=dist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MIN_NORMAL, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[]), operator=<), operator=&&), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=qsize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=heap, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=prog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=incrementProcessed, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ssize, 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=long)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[LOG.statistics, parameter[ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=PREFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".quantile"), operator=+), MemberReference(member=quantile, 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=DoubleStatistic, sub_type=None))]]
call[LOG.statistics, parameter[ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=PREFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".samplesize"), operator=+), MemberReference(member=ssize, 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=LongStatistic, sub_type=None))]]
call[LOG.statistics, parameter[ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=PREFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".distance"), operator=+), MethodInvocation(arguments=[], member=peek, postfix_operators=[], prefix_operators=[], qualifier=heap, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DoubleStatistic, sub_type=None))]]
call[LOG.ensureCompleted, parameter[member[.prog]]]
local_variable[type[Collection], header]
local_variable[type[Collection], data]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Distances sample"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="distance-sample"), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=header, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=double))], dimensions=None, name=CollectionResult, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[CollectionResult] operator[<] Keyword[double] operator[SEP] operator[SEP] operator[>] identifier[run] operator[SEP] identifier[Database] identifier[database] , identifier[Relation] operator[<] identifier[O] operator[>] identifier[rel] operator[SEP] {
identifier[DistanceQuery] operator[<] identifier[O] operator[>] identifier[dq] operator[=] identifier[rel] operator[SEP] identifier[getDistanceQuery] operator[SEP] identifier[getDistanceFunction] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[size] operator[=] identifier[rel] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[pairs] operator[=] operator[SEP] identifier[size] operator[*] operator[SEP] Keyword[long] operator[SEP] identifier[size] operator[SEP] operator[>] operator[>] Other[1] operator[SEP] Keyword[final] Keyword[long] identifier[ssize] operator[=] identifier[sampling] operator[<=] Other[1] operator[?] operator[SEP] Keyword[long] operator[SEP] identifier[Math] operator[SEP] identifier[ceil] operator[SEP] identifier[sampling] operator[*] identifier[pairs] operator[SEP] operator[:] operator[SEP] Keyword[long] operator[SEP] identifier[sampling] operator[SEP] Keyword[if] operator[SEP] identifier[ssize] operator[>] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AbortException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[qsize] operator[=] identifier[quantile] operator[<=] Other[0] operator[?] Other[1] operator[:] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[ceil] operator[SEP] identifier[quantile] operator[*] identifier[ssize] operator[SEP] operator[SEP] identifier[DoubleMaxHeap] identifier[heap] operator[=] Keyword[new] identifier[DoubleMaxHeap] operator[SEP] identifier[qsize] operator[SEP] operator[SEP] identifier[ArrayDBIDs] identifier[ids] operator[=] identifier[DBIDUtil] operator[SEP] identifier[ensureArray] operator[SEP] identifier[rel] operator[SEP] identifier[getDBIDs] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[DBIDArrayIter] identifier[i1] operator[=] identifier[ids] operator[SEP] identifier[iter] operator[SEP] operator[SEP] , identifier[i2] operator[=] identifier[ids] operator[SEP] identifier[iter] operator[SEP] operator[SEP] operator[SEP] identifier[Random] identifier[r] operator[=] identifier[rand] operator[SEP] identifier[getSingleThreadedRandom] operator[SEP] operator[SEP] operator[SEP] identifier[FiniteProgress] identifier[prog] operator[=] identifier[LOG] operator[SEP] identifier[isVerbose] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[FiniteProgress] operator[SEP] literal[String] , operator[SEP] Keyword[int] operator[SEP] identifier[ssize] , identifier[LOG] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[long] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[ssize] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[x] operator[=] identifier[r] operator[SEP] identifier[nextInt] operator[SEP] identifier[size] operator[-] Other[1] operator[SEP] operator[+] Other[1] , identifier[y] operator[=] identifier[r] operator[SEP] identifier[nextInt] operator[SEP] identifier[x] operator[SEP] operator[SEP] Keyword[double] identifier[dist] operator[=] identifier[dq] operator[SEP] identifier[distance] operator[SEP] identifier[i1] operator[SEP] identifier[seek] operator[SEP] identifier[x] operator[SEP] , identifier[i2] operator[SEP] identifier[seek] operator[SEP] identifier[y] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dist] operator[!=] identifier[dist] operator[||] operator[SEP] identifier[nozeros] operator[&&] identifier[dist] operator[<] identifier[Double] operator[SEP] identifier[MIN_NORMAL] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[heap] operator[SEP] identifier[add] operator[SEP] identifier[dist] , identifier[qsize] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[incrementProcessed] operator[SEP] identifier[prog] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[statistics] operator[SEP] Keyword[new] identifier[DoubleStatistic] operator[SEP] identifier[PREFIX] operator[+] literal[String] , identifier[quantile] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[statistics] operator[SEP] Keyword[new] identifier[LongStatistic] operator[SEP] identifier[PREFIX] operator[+] literal[String] , identifier[ssize] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[statistics] operator[SEP] Keyword[new] identifier[DoubleStatistic] operator[SEP] identifier[PREFIX] operator[+] literal[String] , identifier[heap] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[ensureCompleted] operator[SEP] identifier[prog] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[header] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
literal[String]
} operator[SEP] operator[SEP] identifier[Collection] operator[<] Keyword[double] operator[SEP] operator[SEP] operator[>] identifier[data] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] Keyword[new] Keyword[double] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[new] Keyword[double] operator[SEP] operator[SEP] {
identifier[heap] operator[SEP] identifier[peek] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[CollectionResult] operator[<] Keyword[double] operator[SEP] operator[SEP] operator[>] operator[SEP] literal[String] , literal[String] , identifier[data] , identifier[header] operator[SEP] operator[SEP]
}
|
public final void setAll(IoSessionConfig config) {
if (config == null) {
throw new NullPointerException("config");
}
if (ENABLE_BUFFER_SIZE) {
System.out.println("AbstractIoSessionConfig.setAll()");
setReadBufferSize(config.getReadBufferSize());
setMinReadBufferSize(config.getMinReadBufferSize());
setMaxReadBufferSize(config.getMaxReadBufferSize());
}
setIdleTime(IdleStatus.BOTH_IDLE, config.getIdleTime(IdleStatus.BOTH_IDLE));
setIdleTime(IdleStatus.READER_IDLE, config.getIdleTime(IdleStatus.READER_IDLE));
setIdleTime(IdleStatus.WRITER_IDLE, config.getIdleTime(IdleStatus.WRITER_IDLE));
setWriteTimeout(config.getWriteTimeout());
setUseReadOperation(config.isUseReadOperation());
setThroughputCalculationInterval(config.getThroughputCalculationInterval());
doSetAll(config);
} | class class_name[name] begin[{]
method[setAll, return_type[void], modifier[final public], parameter[config]] begin[{]
if[binary_operation[member[.config], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="config")], 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[member[.ENABLE_BUFFER_SIZE]] begin[{]
call[System.out.println, parameter[literal["AbstractIoSessionConfig.setAll()"]]]
call[.setReadBufferSize, parameter[call[config.getReadBufferSize, parameter[]]]]
call[.setMinReadBufferSize, parameter[call[config.getMinReadBufferSize, parameter[]]]]
call[.setMaxReadBufferSize, parameter[call[config.getMaxReadBufferSize, parameter[]]]]
else begin[{]
None
end[}]
call[.setIdleTime, parameter[member[IdleStatus.BOTH_IDLE], call[config.getIdleTime, parameter[member[IdleStatus.BOTH_IDLE]]]]]
call[.setIdleTime, parameter[member[IdleStatus.READER_IDLE], call[config.getIdleTime, parameter[member[IdleStatus.READER_IDLE]]]]]
call[.setIdleTime, parameter[member[IdleStatus.WRITER_IDLE], call[config.getIdleTime, parameter[member[IdleStatus.WRITER_IDLE]]]]]
call[.setWriteTimeout, parameter[call[config.getWriteTimeout, parameter[]]]]
call[.setUseReadOperation, parameter[call[config.isUseReadOperation, parameter[]]]]
call[.setThroughputCalculationInterval, parameter[call[config.getThroughputCalculationInterval, parameter[]]]]
call[.doSetAll, parameter[member[.config]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[setAll] operator[SEP] identifier[IoSessionConfig] identifier[config] operator[SEP] {
Keyword[if] operator[SEP] identifier[config] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ENABLE_BUFFER_SIZE] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[setReadBufferSize] operator[SEP] identifier[config] operator[SEP] identifier[getReadBufferSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setMinReadBufferSize] operator[SEP] identifier[config] operator[SEP] identifier[getMinReadBufferSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setMaxReadBufferSize] operator[SEP] identifier[config] operator[SEP] identifier[getMaxReadBufferSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[setIdleTime] operator[SEP] identifier[IdleStatus] operator[SEP] identifier[BOTH_IDLE] , identifier[config] operator[SEP] identifier[getIdleTime] operator[SEP] identifier[IdleStatus] operator[SEP] identifier[BOTH_IDLE] operator[SEP] operator[SEP] operator[SEP] identifier[setIdleTime] operator[SEP] identifier[IdleStatus] operator[SEP] identifier[READER_IDLE] , identifier[config] operator[SEP] identifier[getIdleTime] operator[SEP] identifier[IdleStatus] operator[SEP] identifier[READER_IDLE] operator[SEP] operator[SEP] operator[SEP] identifier[setIdleTime] operator[SEP] identifier[IdleStatus] operator[SEP] identifier[WRITER_IDLE] , identifier[config] operator[SEP] identifier[getIdleTime] operator[SEP] identifier[IdleStatus] operator[SEP] identifier[WRITER_IDLE] operator[SEP] operator[SEP] operator[SEP] identifier[setWriteTimeout] operator[SEP] identifier[config] operator[SEP] identifier[getWriteTimeout] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setUseReadOperation] operator[SEP] identifier[config] operator[SEP] identifier[isUseReadOperation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setThroughputCalculationInterval] operator[SEP] identifier[config] operator[SEP] identifier[getThroughputCalculationInterval] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[doSetAll] operator[SEP] identifier[config] operator[SEP] operator[SEP]
}
|
public void addWithOverflow(PagedBitMap that, PagedBitMap overflow) {
LongArray ta = that.array;
LongArray of = overflow.array;
long n = 0;
while(true) {
n = ta.seekNext(n);
if (n < 0) {
break;
}
long o = array.get(n) & ta.get(n);
long v = array.get(n) | ta.get(n);
array.set(n, v);
if (o != 0) {
o |= of.get(n);
of.set(n, o);
}
++n;
}
} | class class_name[name] begin[{]
method[addWithOverflow, return_type[void], modifier[public], parameter[that, overflow]] begin[{]
local_variable[type[LongArray], ta]
local_variable[type[LongArray], of]
local_variable[type[long], n]
while[literal[true]] begin[{]
assign[member[.n], call[ta.seekNext, parameter[member[.n]]]]
if[binary_operation[member[.n], <, literal[0]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[long], o]
local_variable[type[long], v]
call[array.set, parameter[member[.n], member[.v]]]
if[binary_operation[member[.o], !=, literal[0]]] begin[{]
assign[member[.o], call[of.get, parameter[member[.n]]]]
call[of.set, parameter[member[.n], member[.o]]]
else begin[{]
None
end[}]
member[.n]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addWithOverflow] operator[SEP] identifier[PagedBitMap] identifier[that] , identifier[PagedBitMap] identifier[overflow] operator[SEP] {
identifier[LongArray] identifier[ta] operator[=] identifier[that] operator[SEP] identifier[array] operator[SEP] identifier[LongArray] identifier[of] operator[=] identifier[overflow] operator[SEP] identifier[array] operator[SEP] Keyword[long] identifier[n] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[n] operator[=] identifier[ta] operator[SEP] identifier[seekNext] operator[SEP] identifier[n] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[n] operator[<] Other[0] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[long] identifier[o] operator[=] identifier[array] operator[SEP] identifier[get] operator[SEP] identifier[n] operator[SEP] operator[&] identifier[ta] operator[SEP] identifier[get] operator[SEP] identifier[n] operator[SEP] operator[SEP] Keyword[long] identifier[v] operator[=] identifier[array] operator[SEP] identifier[get] operator[SEP] identifier[n] operator[SEP] operator[|] identifier[ta] operator[SEP] identifier[get] operator[SEP] identifier[n] operator[SEP] operator[SEP] identifier[array] operator[SEP] identifier[set] operator[SEP] identifier[n] , identifier[v] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] operator[!=] Other[0] operator[SEP] {
identifier[o] operator[|=] identifier[of] operator[SEP] identifier[get] operator[SEP] identifier[n] operator[SEP] operator[SEP] identifier[of] operator[SEP] identifier[set] operator[SEP] identifier[n] , identifier[o] operator[SEP] operator[SEP]
} operator[++] identifier[n] operator[SEP]
}
}
|
public FindingCriteria withCriterion(java.util.Map<String, Condition> criterion) {
setCriterion(criterion);
return this;
} | class class_name[name] begin[{]
method[withCriterion, return_type[type[FindingCriteria]], modifier[public], parameter[criterion]] begin[{]
call[.setCriterion, parameter[member[.criterion]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[FindingCriteria] identifier[withCriterion] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Condition] operator[>] identifier[criterion] operator[SEP] {
identifier[setCriterion] operator[SEP] identifier[criterion] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
private void streamContent(HttpServletResponse response, InputStream is) throws IOException {
OutputStream os = response.getOutputStream();
try {
byte buffer[] = new byte[DEFAULT_BUFFER_SIZE];
int bytes;
while ((bytes = is.read(buffer)) >= 0) {
os.write(buffer, 0, bytes);
}
} finally {
os.close();
}
} | class class_name[name] begin[{]
method[streamContent, return_type[void], modifier[private], parameter[response, is]] begin[{]
local_variable[type[OutputStream], os]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[None], initializer=ArrayCreator(dimensions=[MemberReference(member=DEFAULT_BUFFER_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte)), name=buffer)], modifiers=set(), type=BasicType(dimensions=[], name=byte)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=bytes)], modifiers=set(), type=BasicType(dimensions=[], name=int)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=bytes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[streamContent] operator[SEP] identifier[HttpServletResponse] identifier[response] , identifier[InputStream] identifier[is] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[OutputStream] identifier[os] operator[=] identifier[response] operator[SEP] identifier[getOutputStream] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[byte] identifier[buffer] operator[SEP] operator[SEP] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[DEFAULT_BUFFER_SIZE] operator[SEP] operator[SEP] Keyword[int] identifier[bytes] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] operator[>=] Other[0] operator[SEP] {
identifier[os] operator[SEP] identifier[write] operator[SEP] identifier[buffer] , Other[0] , identifier[bytes] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[os] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@CheckForNull
public File getCurrentFileName()
{
if (currentFileNameMockFile != null) {
return currentFileNameMockFile;
}
// the remainder of this method is a workaround for Checkstyle issue #1205
// https://github.com/checkstyle/checkstyle/issues/1205
final FileContents fileContents = check.getFileContents();
Method getFilename = null;
try {
getFilename = fileContents.getClass().getMethod("getFileName");
}
catch (NoSuchMethodException e) {
try {
getFilename = fileContents.getClass().getMethod("getFilename");
}
catch (NoSuchMethodException e1) {
throw new UnsupportedOperationException("FileContents.getFilename()", e1);
}
}
String filename = null;
if (getFilename != null) {
try {
filename = (String) getFilename.invoke(fileContents);
}
catch (IllegalAccessException | InvocationTargetException e) {
throw new UnsupportedOperationException("FileContents.getFilename()", e);
}
}
File result = filename != null ? new File(filename) : null;
return result;
} | class class_name[name] begin[{]
method[getCurrentFileName, return_type[type[File]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.currentFileNameMockFile], !=, literal[null]]] begin[{]
return[member[.currentFileNameMockFile]]
else begin[{]
None
end[}]
local_variable[type[FileContents], fileContents]
local_variable[type[Method], getFilename]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=getFilename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=fileContents, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getFileName")], member=getMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=getFilename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=fileContents, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="getFilename")], member=getMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="FileContents.getFilename()"), MemberReference(member=e1, 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=UnsupportedOperationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e1, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NoSuchMethodException']))], finally_block=None, label=None, resources=None)
local_variable[type[String], filename]
if[binary_operation[member[.getFilename], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=filename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=fileContents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=getFilename, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="FileContents.getFilename()"), 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=UnsupportedOperationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalAccessException', 'InvocationTargetException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
local_variable[type[File], result]
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[CheckForNull] Keyword[public] identifier[File] identifier[getCurrentFileName] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[currentFileNameMockFile] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[currentFileNameMockFile] operator[SEP]
}
Keyword[final] identifier[FileContents] identifier[fileContents] operator[=] identifier[check] operator[SEP] identifier[getFileContents] operator[SEP] operator[SEP] operator[SEP] identifier[Method] identifier[getFilename] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[getFilename] operator[=] identifier[fileContents] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
Keyword[try] {
identifier[getFilename] operator[=] identifier[fileContents] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] , identifier[e1] operator[SEP] operator[SEP]
}
}
identifier[String] identifier[filename] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[getFilename] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[filename] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[getFilename] operator[SEP] identifier[invoke] operator[SEP] identifier[fileContents] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] operator[|] identifier[InvocationTargetException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
identifier[File] identifier[result] operator[=] identifier[filename] operator[!=] Other[null] operator[?] Keyword[new] identifier[File] operator[SEP] identifier[filename] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public static Rational sDivide(Rational a, Rational b) {
long cPtr = VideoJNI.Rational_sDivide(Rational.getCPtr(a), a, Rational.getCPtr(b), b);
return (cPtr == 0) ? null : new Rational(cPtr, false);
} | class class_name[name] begin[{]
method[sDivide, return_type[type[Rational]], modifier[public static], parameter[a, b]] begin[{]
local_variable[type[long], cPtr]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=cPtr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=ClassCreator(arguments=[MemberReference(member=cPtr, 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=None, dimensions=None, name=Rational, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Rational] identifier[sDivide] operator[SEP] identifier[Rational] identifier[a] , identifier[Rational] identifier[b] operator[SEP] {
Keyword[long] identifier[cPtr] operator[=] identifier[VideoJNI] operator[SEP] identifier[Rational_sDivide] operator[SEP] identifier[Rational] operator[SEP] identifier[getCPtr] operator[SEP] identifier[a] operator[SEP] , identifier[a] , identifier[Rational] operator[SEP] identifier[getCPtr] operator[SEP] identifier[b] operator[SEP] , identifier[b] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[cPtr] operator[==] Other[0] operator[SEP] operator[?] Other[null] operator[:] Keyword[new] identifier[Rational] operator[SEP] identifier[cPtr] , literal[boolean] operator[SEP] operator[SEP]
}
|
public final <R> Call<R> map(Mapper<V, R> mapper) {
return new Mapping<>(mapper, this);
} | class class_name[name] begin[{]
method[map, return_type[type[Call]], modifier[final public], parameter[mapper]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=mapper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=Mapping, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[final] operator[<] identifier[R] operator[>] identifier[Call] operator[<] identifier[R] operator[>] identifier[map] operator[SEP] identifier[Mapper] operator[<] identifier[V] , identifier[R] operator[>] identifier[mapper] operator[SEP] {
Keyword[return] Keyword[new] identifier[Mapping] operator[<] operator[>] operator[SEP] identifier[mapper] , Keyword[this] operator[SEP] operator[SEP]
}
|
@Override
public void destroy() {
if (timerFilterThread != null) {
timerFilterThread.setStopped();
timerFilterThread = null;
}
Filter filter = null;
for (int i=0; i<filterFactory.getAllFilter().size(); i++) {
// ZAP: Removed unnecessary cast.
filter = filterFactory.getAllFilter().get(i);
try {
filter.destroy();
} catch (Exception e) {}
}
} | class class_name[name] begin[{]
method[destroy, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.timerFilterThread], !=, literal[null]]] begin[{]
call[timerFilterThread.setStopped, parameter[]]
assign[member[.timerFilterThread], literal[null]]
else begin[{]
None
end[}]
local_variable[type[Filter], filter]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getAllFilter, postfix_operators=[], prefix_operators=[], qualifier=filterFactory, selectors=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=destroy, postfix_operators=[], prefix_operators=[], qualifier=filter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getAllFilter, postfix_operators=[], prefix_operators=[], qualifier=filterFactory, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[destroy] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[timerFilterThread] operator[!=] Other[null] operator[SEP] {
identifier[timerFilterThread] operator[SEP] identifier[setStopped] operator[SEP] operator[SEP] operator[SEP] identifier[timerFilterThread] operator[=] Other[null] operator[SEP]
}
identifier[Filter] identifier[filter] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[filterFactory] operator[SEP] identifier[getAllFilter] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[filter] operator[=] identifier[filterFactory] operator[SEP] identifier[getAllFilter] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[try] {
identifier[filter] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
}
|
public void marshall(TapeRecoveryPointInfo tapeRecoveryPointInfo, ProtocolMarshaller protocolMarshaller) {
if (tapeRecoveryPointInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tapeRecoveryPointInfo.getTapeARN(), TAPEARN_BINDING);
protocolMarshaller.marshall(tapeRecoveryPointInfo.getTapeRecoveryPointTime(), TAPERECOVERYPOINTTIME_BINDING);
protocolMarshaller.marshall(tapeRecoveryPointInfo.getTapeSizeInBytes(), TAPESIZEINBYTES_BINDING);
protocolMarshaller.marshall(tapeRecoveryPointInfo.getTapeStatus(), TAPESTATUS_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[tapeRecoveryPointInfo, protocolMarshaller]] begin[{]
if[binary_operation[member[.tapeRecoveryPointInfo], ==, 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=getTapeARN, postfix_operators=[], prefix_operators=[], qualifier=tapeRecoveryPointInfo, selectors=[], type_arguments=None), MemberReference(member=TAPEARN_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=getTapeRecoveryPointTime, postfix_operators=[], prefix_operators=[], qualifier=tapeRecoveryPointInfo, selectors=[], type_arguments=None), MemberReference(member=TAPERECOVERYPOINTTIME_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=getTapeSizeInBytes, postfix_operators=[], prefix_operators=[], qualifier=tapeRecoveryPointInfo, selectors=[], type_arguments=None), MemberReference(member=TAPESIZEINBYTES_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=getTapeStatus, postfix_operators=[], prefix_operators=[], qualifier=tapeRecoveryPointInfo, selectors=[], type_arguments=None), MemberReference(member=TAPESTATUS_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[TapeRecoveryPointInfo] identifier[tapeRecoveryPointInfo] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[tapeRecoveryPointInfo] 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[tapeRecoveryPointInfo] operator[SEP] identifier[getTapeARN] operator[SEP] operator[SEP] , identifier[TAPEARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[tapeRecoveryPointInfo] operator[SEP] identifier[getTapeRecoveryPointTime] operator[SEP] operator[SEP] , identifier[TAPERECOVERYPOINTTIME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[tapeRecoveryPointInfo] operator[SEP] identifier[getTapeSizeInBytes] operator[SEP] operator[SEP] , identifier[TAPESIZEINBYTES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[tapeRecoveryPointInfo] operator[SEP] identifier[getTapeStatus] operator[SEP] operator[SEP] , identifier[TAPESTATUS_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void addOrAlterPartition(HiveTable table, HivePartition partition) throws IOException {
if (!addPartitionIfNotExists(table, partition)) {
alterPartition(table, partition);
}
} | class class_name[name] begin[{]
method[addOrAlterPartition, return_type[void], modifier[public], parameter[table, partition]] begin[{]
if[call[.addPartitionIfNotExists, parameter[member[.table], member[.partition]]]] begin[{]
call[.alterPartition, parameter[member[.table], member[.partition]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addOrAlterPartition] operator[SEP] identifier[HiveTable] identifier[table] , identifier[HivePartition] identifier[partition] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[addPartitionIfNotExists] operator[SEP] identifier[table] , identifier[partition] operator[SEP] operator[SEP] {
identifier[alterPartition] operator[SEP] identifier[table] , identifier[partition] operator[SEP] operator[SEP]
}
}
|
protected void initJpa() {
if (jpaPersistenceUnitName != null) {
jpaEntityManagerFactory = JpaHelper.createEntityManagerFactory(jpaPersistenceUnitName);
}
if (jpaEntityManagerFactory != null) {
sessionFactories.put(EntityManagerSession.class, new EntityManagerSessionFactory(jpaEntityManagerFactory, jpaHandleTransaction, jpaCloseEntityManager));
JPAVariableSerializer jpaType = (JPAVariableSerializer) variableSerializers.getSerializerByName(JPAVariableSerializer.NAME);
// Add JPA-type
if (jpaType == null) {
// We try adding the variable right after byte serializer, if available
int serializableIndex = variableSerializers.getSerializerIndexByName(ValueType.BYTES.getName());
if (serializableIndex > -1) {
variableSerializers.addSerializer(new JPAVariableSerializer(), serializableIndex);
} else {
variableSerializers.addSerializer(new JPAVariableSerializer());
}
}
}
} | class class_name[name] begin[{]
method[initJpa, return_type[void], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.jpaPersistenceUnitName], !=, literal[null]]] begin[{]
assign[member[.jpaEntityManagerFactory], call[JpaHelper.createEntityManagerFactory, parameter[member[.jpaPersistenceUnitName]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.jpaEntityManagerFactory], !=, literal[null]]] begin[{]
call[sessionFactories.put, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EntityManagerSession, sub_type=None)), ClassCreator(arguments=[MemberReference(member=jpaEntityManagerFactory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jpaHandleTransaction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jpaCloseEntityManager, 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=EntityManagerSessionFactory, sub_type=None))]]
local_variable[type[JPAVariableSerializer], jpaType]
if[binary_operation[member[.jpaType], ==, literal[null]]] begin[{]
local_variable[type[int], serializableIndex]
if[binary_operation[member[.serializableIndex], >, literal[1]]] begin[{]
call[variableSerializers.addSerializer, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JPAVariableSerializer, sub_type=None)), member[.serializableIndex]]]
else begin[{]
call[variableSerializers.addSerializer, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JPAVariableSerializer, sub_type=None))]]
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[initJpa] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[jpaPersistenceUnitName] operator[!=] Other[null] operator[SEP] {
identifier[jpaEntityManagerFactory] operator[=] identifier[JpaHelper] operator[SEP] identifier[createEntityManagerFactory] operator[SEP] identifier[jpaPersistenceUnitName] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[jpaEntityManagerFactory] operator[!=] Other[null] operator[SEP] {
identifier[sessionFactories] operator[SEP] identifier[put] operator[SEP] identifier[EntityManagerSession] operator[SEP] Keyword[class] , Keyword[new] identifier[EntityManagerSessionFactory] operator[SEP] identifier[jpaEntityManagerFactory] , identifier[jpaHandleTransaction] , identifier[jpaCloseEntityManager] operator[SEP] operator[SEP] operator[SEP] identifier[JPAVariableSerializer] identifier[jpaType] operator[=] operator[SEP] identifier[JPAVariableSerializer] operator[SEP] identifier[variableSerializers] operator[SEP] identifier[getSerializerByName] operator[SEP] identifier[JPAVariableSerializer] operator[SEP] identifier[NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jpaType] operator[==] Other[null] operator[SEP] {
Keyword[int] identifier[serializableIndex] operator[=] identifier[variableSerializers] operator[SEP] identifier[getSerializerIndexByName] operator[SEP] identifier[ValueType] operator[SEP] identifier[BYTES] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[serializableIndex] operator[>] operator[-] Other[1] operator[SEP] {
identifier[variableSerializers] operator[SEP] identifier[addSerializer] operator[SEP] Keyword[new] identifier[JPAVariableSerializer] operator[SEP] operator[SEP] , identifier[serializableIndex] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[variableSerializers] operator[SEP] identifier[addSerializer] operator[SEP] Keyword[new] identifier[JPAVariableSerializer] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public void marshall(ShareTarget shareTarget, ProtocolMarshaller protocolMarshaller) {
if (shareTarget == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(shareTarget.getId(), ID_BINDING);
protocolMarshaller.marshall(shareTarget.getType(), TYPE_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[shareTarget, protocolMarshaller]] begin[{]
if[binary_operation[member[.shareTarget], ==, 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=getId, postfix_operators=[], prefix_operators=[], qualifier=shareTarget, 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=getType, postfix_operators=[], prefix_operators=[], qualifier=shareTarget, selectors=[], type_arguments=None), MemberReference(member=TYPE_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[ShareTarget] identifier[shareTarget] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[shareTarget] 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[shareTarget] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[ID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[shareTarget] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[TYPE_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static void hessianPrewitt(GrayF32 inputDerivX , GrayF32 inputDerivY,
GrayF32 derivXX, GrayF32 derivYY, GrayF32 derivXY ,
ImageBorder_F32 border ) {
InputSanityCheck.reshapeOneIn(inputDerivX, inputDerivY, derivXX, derivYY, derivXY);
GradientPrewitt.process(inputDerivX,derivXX,derivXY,border);
if( border != null )
ConvolveImage.convolve(GradientPrewitt.kernelDerivY_F32,inputDerivY,derivYY,border);
else
ConvolveImageNoBorder.convolve(GradientPrewitt.kernelDerivY_F32,inputDerivY,derivYY);
} | class class_name[name] begin[{]
method[hessianPrewitt, return_type[void], modifier[public static], parameter[inputDerivX, inputDerivY, derivXX, derivYY, derivXY, border]] begin[{]
call[InputSanityCheck.reshapeOneIn, parameter[member[.inputDerivX], member[.inputDerivY], member[.derivXX], member[.derivYY], member[.derivXY]]]
call[GradientPrewitt.process, parameter[member[.inputDerivX], member[.derivXX], member[.derivXY], member[.border]]]
if[binary_operation[member[.border], !=, literal[null]]] begin[{]
call[ConvolveImage.convolve, parameter[member[GradientPrewitt.kernelDerivY_F32], member[.inputDerivY], member[.derivYY], member[.border]]]
else begin[{]
call[ConvolveImageNoBorder.convolve, parameter[member[GradientPrewitt.kernelDerivY_F32], member[.inputDerivY], member[.derivYY]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[hessianPrewitt] operator[SEP] identifier[GrayF32] identifier[inputDerivX] , identifier[GrayF32] identifier[inputDerivY] , identifier[GrayF32] identifier[derivXX] , identifier[GrayF32] identifier[derivYY] , identifier[GrayF32] identifier[derivXY] , identifier[ImageBorder_F32] identifier[border] operator[SEP] {
identifier[InputSanityCheck] operator[SEP] identifier[reshapeOneIn] operator[SEP] identifier[inputDerivX] , identifier[inputDerivY] , identifier[derivXX] , identifier[derivYY] , identifier[derivXY] operator[SEP] operator[SEP] identifier[GradientPrewitt] operator[SEP] identifier[process] operator[SEP] identifier[inputDerivX] , identifier[derivXX] , identifier[derivXY] , identifier[border] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[border] operator[!=] Other[null] operator[SEP] identifier[ConvolveImage] operator[SEP] identifier[convolve] operator[SEP] identifier[GradientPrewitt] operator[SEP] identifier[kernelDerivY_F32] , identifier[inputDerivY] , identifier[derivYY] , identifier[border] operator[SEP] operator[SEP] Keyword[else] identifier[ConvolveImageNoBorder] operator[SEP] identifier[convolve] operator[SEP] identifier[GradientPrewitt] operator[SEP] identifier[kernelDerivY_F32] , identifier[inputDerivY] , identifier[derivYY] operator[SEP] operator[SEP]
}
|
public void setModel(File model) {
this.dirty = true;
this.model = model;
this.modelConfig.setProperty(MODEL_FILE, model.getAbsolutePath());
} | class class_name[name] begin[{]
method[setModel, return_type[void], modifier[public], parameter[model]] begin[{]
assign[THIS[member[None.dirty]], literal[true]]
assign[THIS[member[None.model]], member[.model]]
THIS[member[None.modelConfig]call[None.setProperty, parameter[member[.MODEL_FILE], call[model.getAbsolutePath, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setModel] operator[SEP] identifier[File] identifier[model] operator[SEP] {
Keyword[this] operator[SEP] identifier[dirty] operator[=] literal[boolean] operator[SEP] Keyword[this] operator[SEP] identifier[model] operator[=] identifier[model] operator[SEP] Keyword[this] operator[SEP] identifier[modelConfig] operator[SEP] identifier[setProperty] operator[SEP] identifier[MODEL_FILE] , identifier[model] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static BundleAdjustment<SceneStructureProjective> bundleSparseProjective(@Nullable ConfigBundleAdjustment config ) {
if( config == null )
config = new ConfigBundleAdjustment();
UnconstrainedLeastSquaresSchur<DMatrixSparseCSC> minimizer;
if( config.configOptimizer instanceof ConfigTrustRegion )
minimizer = FactoryOptimizationSparse.doglegSchur((ConfigTrustRegion)config.configOptimizer);
else
minimizer = FactoryOptimizationSparse.levenbergMarquardtSchur((ConfigLevenbergMarquardt)config.configOptimizer);
return new BundleAdjustmentSchur_DSCC<>(minimizer,
new BundleAdjustmentProjectiveResidualFunction(),
new BundleAdjustmentProjectiveSchurJacobian_DSCC(),
new CodecSceneStructureProjective());
} | class class_name[name] begin[{]
method[bundleSparseProjective, return_type[type[BundleAdjustment]], modifier[public static], parameter[config]] begin[{]
if[binary_operation[member[.config], ==, literal[null]]] begin[{]
assign[member[.config], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConfigBundleAdjustment, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[UnconstrainedLeastSquaresSchur], minimizer]
if[binary_operation[member[config.configOptimizer], instanceof, type[ConfigTrustRegion]]] begin[{]
assign[member[.minimizer], call[FactoryOptimizationSparse.doglegSchur, parameter[Cast(expression=MemberReference(member=configOptimizer, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ConfigTrustRegion, sub_type=None))]]]
else begin[{]
assign[member[.minimizer], call[FactoryOptimizationSparse.levenbergMarquardtSchur, parameter[Cast(expression=MemberReference(member=configOptimizer, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ConfigLevenbergMarquardt, sub_type=None))]]]
end[}]
return[ClassCreator(arguments=[MemberReference(member=minimizer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BundleAdjustmentProjectiveResidualFunction, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BundleAdjustmentProjectiveSchurJacobian_DSCC, sub_type=None)), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CodecSceneStructureProjective, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=BundleAdjustmentSchur_DSCC, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[BundleAdjustment] operator[<] identifier[SceneStructureProjective] operator[>] identifier[bundleSparseProjective] operator[SEP] annotation[@] identifier[Nullable] identifier[ConfigBundleAdjustment] identifier[config] operator[SEP] {
Keyword[if] operator[SEP] identifier[config] operator[==] Other[null] operator[SEP] identifier[config] operator[=] Keyword[new] identifier[ConfigBundleAdjustment] operator[SEP] operator[SEP] operator[SEP] identifier[UnconstrainedLeastSquaresSchur] operator[<] identifier[DMatrixSparseCSC] operator[>] identifier[minimizer] operator[SEP] Keyword[if] operator[SEP] identifier[config] operator[SEP] identifier[configOptimizer] Keyword[instanceof] identifier[ConfigTrustRegion] operator[SEP] identifier[minimizer] operator[=] identifier[FactoryOptimizationSparse] operator[SEP] identifier[doglegSchur] operator[SEP] operator[SEP] identifier[ConfigTrustRegion] operator[SEP] identifier[config] operator[SEP] identifier[configOptimizer] operator[SEP] operator[SEP] Keyword[else] identifier[minimizer] operator[=] identifier[FactoryOptimizationSparse] operator[SEP] identifier[levenbergMarquardtSchur] operator[SEP] operator[SEP] identifier[ConfigLevenbergMarquardt] operator[SEP] identifier[config] operator[SEP] identifier[configOptimizer] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[BundleAdjustmentSchur_DSCC] operator[<] operator[>] operator[SEP] identifier[minimizer] , Keyword[new] identifier[BundleAdjustmentProjectiveResidualFunction] operator[SEP] operator[SEP] , Keyword[new] identifier[BundleAdjustmentProjectiveSchurJacobian_DSCC] operator[SEP] operator[SEP] , Keyword[new] identifier[CodecSceneStructureProjective] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Object writeAndRefresh(boolean bRefreshDataIfNoMods) throws DBException
{
if (!this.isModified())
{
if ((this.getEditMode() == DBConstants.EDIT_IN_PROGRESS)
|| (this.getEditMode() == DBConstants.EDIT_CURRENT))
{
boolean bLocked = (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS);
Object bookmark = this.getHandle(DBConstants.BOOKMARK_HANDLE);
if (bRefreshDataIfNoMods)
{
this.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
if (bLocked)
this.edit();
}
return bookmark;
}
else
return null;
}
Object bookmark = null;
if ((this.getEditMode() == DBConstants.EDIT_IN_PROGRESS)
|| (this.getEditMode() == DBConstants.EDIT_CURRENT))
{
if (this.getEditMode() == DBConstants.EDIT_CURRENT)
{ // HACK - It should have been locked already... especially if there were any changes
BaseBuffer buffer = null;
if (this.isModified())
{
buffer = new VectorBuffer(null, BaseBuffer.ALL_FIELDS | BaseBuffer.MODIFIED_ONLY);
buffer.fieldsToBuffer(this);
}
this.edit();
if (buffer != null)
{
boolean[] rgListeners = this.setEnableListeners(false);
Object[] rgFieldListeners = this.setEnableFieldListeners(false);
buffer.bufferToFields(this, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE);
buffer.free();
this.setEnableFieldListeners(rgFieldListeners);
this.setEnableListeners(rgListeners);
}
}
bookmark = this.getHandle(DBConstants.BOOKMARK_HANDLE);
int iOldOpenMode = this.getOpenMode();
this.setOpenMode(iOldOpenMode | DBConstants.OPEN_DONT_CHANGE_CURRENT_LOCK_TYPE); // Don't relinquish my lock
this.set();
this.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
this.setOpenMode(iOldOpenMode);
this.edit();
}
else if (this.getEditMode() == DBConstants.EDIT_ADD)
{
this.add();
bookmark = this.getLastModified(DBConstants.BOOKMARK_HANDLE);
this.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
this.edit();
}
return bookmark;
} | class class_name[name] begin[{]
method[writeAndRefresh, return_type[type[Object]], modifier[public], parameter[bRefreshDataIfNoMods]] begin[{]
if[THIS[call[None.isModified, parameter[]]]] begin[{]
if[binary_operation[binary_operation[THIS[call[None.getEditMode, parameter[]]], ==, member[DBConstants.EDIT_IN_PROGRESS]], ||, binary_operation[THIS[call[None.getEditMode, parameter[]]], ==, member[DBConstants.EDIT_CURRENT]]]] begin[{]
local_variable[type[boolean], bLocked]
local_variable[type[Object], bookmark]
if[member[.bRefreshDataIfNoMods]] begin[{]
THIS[call[None.setHandle, parameter[member[.bookmark], member[DBConstants.BOOKMARK_HANDLE]]]]
if[member[.bLocked]] begin[{]
THIS[call[None.edit, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.bookmark]]
else begin[{]
return[literal[null]]
end[}]
else begin[{]
None
end[}]
local_variable[type[Object], bookmark]
if[binary_operation[binary_operation[THIS[call[None.getEditMode, parameter[]]], ==, member[DBConstants.EDIT_IN_PROGRESS]], ||, binary_operation[THIS[call[None.getEditMode, parameter[]]], ==, member[DBConstants.EDIT_CURRENT]]]] begin[{]
if[binary_operation[THIS[call[None.getEditMode, parameter[]]], ==, member[DBConstants.EDIT_CURRENT]]] begin[{]
local_variable[type[BaseBuffer], buffer]
if[THIS[call[None.isModified, parameter[]]]] begin[{]
assign[member[.buffer], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), BinaryOperation(operandl=MemberReference(member=ALL_FIELDS, postfix_operators=[], prefix_operators=[], qualifier=BaseBuffer, selectors=[]), operandr=MemberReference(member=MODIFIED_ONLY, postfix_operators=[], prefix_operators=[], qualifier=BaseBuffer, selectors=[]), operator=|)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VectorBuffer, sub_type=None))]
call[buffer.fieldsToBuffer, parameter[THIS[]]]
else begin[{]
None
end[}]
THIS[call[None.edit, parameter[]]]
if[binary_operation[member[.buffer], !=, literal[null]]] begin[{]
local_variable[type[boolean], rgListeners]
local_variable[type[Object], rgFieldListeners]
call[buffer.bufferToFields, parameter[THIS[], member[DBConstants.DONT_DISPLAY], member[DBConstants.READ_MOVE]]]
call[buffer.free, parameter[]]
THIS[call[None.setEnableFieldListeners, parameter[member[.rgFieldListeners]]]]
THIS[call[None.setEnableListeners, parameter[member[.rgListeners]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.bookmark], THIS[call[None.getHandle, parameter[member[DBConstants.BOOKMARK_HANDLE]]]]]
local_variable[type[int], iOldOpenMode]
THIS[call[None.setOpenMode, parameter[binary_operation[member[.iOldOpenMode], |, member[DBConstants.OPEN_DONT_CHANGE_CURRENT_LOCK_TYPE]]]]]
THIS[call[None.set, parameter[]]]
THIS[call[None.setHandle, parameter[member[.bookmark], member[DBConstants.BOOKMARK_HANDLE]]]]
THIS[call[None.setOpenMode, parameter[member[.iOldOpenMode]]]]
THIS[call[None.edit, parameter[]]]
else begin[{]
if[binary_operation[THIS[call[None.getEditMode, parameter[]]], ==, member[DBConstants.EDIT_ADD]]] begin[{]
THIS[call[None.add, parameter[]]]
assign[member[.bookmark], THIS[call[None.getLastModified, parameter[member[DBConstants.BOOKMARK_HANDLE]]]]]
THIS[call[None.setHandle, parameter[member[.bookmark], member[DBConstants.BOOKMARK_HANDLE]]]]
THIS[call[None.edit, parameter[]]]
else begin[{]
None
end[}]
end[}]
return[member[.bookmark]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[writeAndRefresh] operator[SEP] Keyword[boolean] identifier[bRefreshDataIfNoMods] operator[SEP] Keyword[throws] identifier[DBException] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[isModified] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_IN_PROGRESS] operator[SEP] operator[||] operator[SEP] Keyword[this] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_CURRENT] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[bLocked] operator[=] operator[SEP] Keyword[this] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_IN_PROGRESS] operator[SEP] operator[SEP] identifier[Object] identifier[bookmark] operator[=] Keyword[this] operator[SEP] identifier[getHandle] operator[SEP] identifier[DBConstants] operator[SEP] identifier[BOOKMARK_HANDLE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bRefreshDataIfNoMods] operator[SEP] {
Keyword[this] operator[SEP] identifier[setHandle] operator[SEP] identifier[bookmark] , identifier[DBConstants] operator[SEP] identifier[BOOKMARK_HANDLE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bLocked] operator[SEP] Keyword[this] operator[SEP] identifier[edit] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[bookmark] operator[SEP]
}
Keyword[else] Keyword[return] Other[null] operator[SEP]
}
identifier[Object] identifier[bookmark] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_IN_PROGRESS] operator[SEP] operator[||] operator[SEP] Keyword[this] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_CURRENT] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_CURRENT] operator[SEP] {
identifier[BaseBuffer] identifier[buffer] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[isModified] operator[SEP] operator[SEP] operator[SEP] {
identifier[buffer] operator[=] Keyword[new] identifier[VectorBuffer] operator[SEP] Other[null] , identifier[BaseBuffer] operator[SEP] identifier[ALL_FIELDS] operator[|] identifier[BaseBuffer] operator[SEP] identifier[MODIFIED_ONLY] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[fieldsToBuffer] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[edit] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[buffer] operator[!=] Other[null] operator[SEP] {
Keyword[boolean] operator[SEP] operator[SEP] identifier[rgListeners] operator[=] Keyword[this] operator[SEP] identifier[setEnableListeners] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[rgFieldListeners] operator[=] Keyword[this] operator[SEP] identifier[setEnableFieldListeners] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[bufferToFields] operator[SEP] Keyword[this] , identifier[DBConstants] operator[SEP] identifier[DONT_DISPLAY] , identifier[DBConstants] operator[SEP] identifier[READ_MOVE] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setEnableFieldListeners] operator[SEP] identifier[rgFieldListeners] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setEnableListeners] operator[SEP] identifier[rgListeners] operator[SEP] operator[SEP]
}
}
identifier[bookmark] operator[=] Keyword[this] operator[SEP] identifier[getHandle] operator[SEP] identifier[DBConstants] operator[SEP] identifier[BOOKMARK_HANDLE] operator[SEP] operator[SEP] Keyword[int] identifier[iOldOpenMode] operator[=] Keyword[this] operator[SEP] identifier[getOpenMode] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setOpenMode] operator[SEP] identifier[iOldOpenMode] operator[|] identifier[DBConstants] operator[SEP] identifier[OPEN_DONT_CHANGE_CURRENT_LOCK_TYPE] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[set] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setHandle] operator[SEP] identifier[bookmark] , identifier[DBConstants] operator[SEP] identifier[BOOKMARK_HANDLE] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setOpenMode] operator[SEP] identifier[iOldOpenMode] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[edit] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getEditMode] operator[SEP] operator[SEP] operator[==] identifier[DBConstants] operator[SEP] identifier[EDIT_ADD] operator[SEP] {
Keyword[this] operator[SEP] identifier[add] operator[SEP] operator[SEP] operator[SEP] identifier[bookmark] operator[=] Keyword[this] operator[SEP] identifier[getLastModified] operator[SEP] identifier[DBConstants] operator[SEP] identifier[BOOKMARK_HANDLE] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[setHandle] operator[SEP] identifier[bookmark] , identifier[DBConstants] operator[SEP] identifier[BOOKMARK_HANDLE] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[edit] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[bookmark] operator[SEP]
}
|
public synchronized void onLowMemory() {
try {
this.mCachedTiles.clear();
} catch (Exception e) {
log.log(Level.SEVERE, "onLowMemory", e);
}
} | class class_name[name] begin[{]
method[onLowMemory, return_type[void], modifier[synchronized public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=mCachedTiles, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=clear, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="onLowMemory"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[onLowMemory] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[this] operator[SEP] identifier[mCachedTiles] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public List<Page> getPages(List<String> titleList) throws Exception {
String rvprop = "content|ids|timestamp";
List<Page> result = this.getPages(titleList, rvprop);
return result;
} | class class_name[name] begin[{]
method[getPages, return_type[type[List]], modifier[public], parameter[titleList]] begin[{]
local_variable[type[String], rvprop]
local_variable[type[List], result]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Page] operator[>] identifier[getPages] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[titleList] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[String] identifier[rvprop] operator[=] literal[String] operator[SEP] identifier[List] operator[<] identifier[Page] operator[>] identifier[result] operator[=] Keyword[this] operator[SEP] identifier[getPages] operator[SEP] identifier[titleList] , identifier[rvprop] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public boolean matchesIndexValue(int v) {
if (pattern.length() == 0) {
return true;
}
int c = UTF16.charAt(pattern, 0);
UnicodeMatcher m = data.lookupMatcher(c);
return (m == null) ? ((c & 0xFF) == v) : m.matchesIndexValue(v);
} | class class_name[name] begin[{]
method[matchesIndexValue, return_type[type[boolean]], modifier[public], parameter[v]] begin[{]
if[binary_operation[call[pattern.length, parameter[]], ==, literal[0]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[int], c]
local_variable[type[UnicodeMatcher], m]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=matchesIndexValue, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFF), operator=&), operandr=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[matchesIndexValue] operator[SEP] Keyword[int] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[pattern] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[int] identifier[c] operator[=] identifier[UTF16] operator[SEP] identifier[charAt] operator[SEP] identifier[pattern] , Other[0] operator[SEP] operator[SEP] identifier[UnicodeMatcher] identifier[m] operator[=] identifier[data] operator[SEP] identifier[lookupMatcher] operator[SEP] identifier[c] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[m] operator[==] Other[null] operator[SEP] operator[?] operator[SEP] operator[SEP] identifier[c] operator[&] literal[Integer] operator[SEP] operator[==] identifier[v] operator[SEP] operator[:] identifier[m] operator[SEP] identifier[matchesIndexValue] operator[SEP] identifier[v] operator[SEP] operator[SEP]
}
|
protected void loadRulesFromProperties(Properties p) {
for (String key : p.stringPropertyNames()) {
Matcher m = RE_TAG_ATTR_TYPE.matcher(key);
if (m.matches()) {
String tagName = m.group(1);
String testAttrName = m.group(2);
String testAttrValue = m.group(3);
String attrNameMatch = m.group(4);
String transformerName = p.getProperty(key);
StringTransformer transformer = transformers.get(transformerName);
if (transformer == null) {
LOGGER.warning("Unknown transformer name \"" +
transformerName + "\" for key \"" + key + "\"");
continue;
}
TransformAttr t;
if (testAttrName != null) {
t = new TransformAttrIfAttrValue(attrNameMatch,
transformer, testAttrName, testAttrValue);
} else {
t = new TransformAttr(attrNameMatch, transformer);
}
TransformAttr ta = rules.get(tagName);
TransformAttr pta = null;
while (true) {
if (ta == null) {
if (pta == null) {
rules.put(tagName, t);
} else {
pta.next = t;
}
break;
}
// TransformAttr for the same attrName are chained
// on "alt" link, sorted by specificity, descending.
if (ta.attrName.equals(t.attrName)) {
TransformAttr palt = null;
while (true) {
if (t.compareTo(ta) >= 0) {
t.alt = ta;
t.next = ta.next;
ta.next = null;
if (palt == null) {
if (pta == null) {
rules.put(tagName, t);
} else {
pta.next = t;
}
} else {
palt.next = t;
}
break;
}
palt = ta;
ta = ta.alt;
if (ta == null) {
palt.alt = t;
break;
}
}
break;
}
pta = ta;
ta = ta.next;
}
continue;
}
LOGGER.warning("unrecogized key syntax \"" + key + "\"");
}
} | class class_name[name] begin[{]
method[loadRulesFromProperties, return_type[void], modifier[protected], parameter[p]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=matcher, postfix_operators=[], prefix_operators=[], qualifier=RE_TAG_ATTR_TYPE, selectors=[], type_arguments=None), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Matcher, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=matches, postfix_operators=[], prefix_operators=[], qualifier=m, 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=1)], member=group, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=tagName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=group, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=testAttrName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], member=group, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=testAttrValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], member=group, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=attrNameMatch)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), name=transformerName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=transformerName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=transformers, selectors=[], type_arguments=None), name=transformer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringTransformer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=transformer, 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=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown transformer name \""), operandr=MemberReference(member=transformerName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\" for key \""), operator=+), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\""), operator=+)], member=warning, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TransformAttr, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=testAttrName, 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=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=attrNameMatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=transformer, 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=TransformAttr, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=attrNameMatch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=transformer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=testAttrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=testAttrValue, 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=TransformAttrIfAttrValue, sub_type=None))), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=rules, selectors=[], type_arguments=None), name=ta)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TransformAttr, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=pta)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TransformAttr, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pta, 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=next, postfix_operators=[], prefix_operators=[], qualifier=pta, selectors=[]), type==, value=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=rules, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=attrName, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=ta.attrName, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=palt)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TransformAttr, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=ta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareTo, postfix_operators=[], prefix_operators=[], qualifier=t, 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=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[]), type==, value=MemberReference(member=ta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[]), type==, value=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=ta, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=ta, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=palt, 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=next, postfix_operators=[], prefix_operators=[], qualifier=palt, selectors=[]), type==, value=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pta, 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=next, postfix_operators=[], prefix_operators=[], qualifier=pta, selectors=[]), type==, value=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tagName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=rules, selectors=[], type_arguments=None), label=None)]))])), BreakStatement(goto=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=palt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=alt, postfix_operators=[], prefix_operators=[], qualifier=ta, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ta, 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=alt, postfix_operators=[], prefix_operators=[], qualifier=palt, selectors=[]), type==, value=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]))]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None), BreakStatement(goto=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=ta, selectors=[])), label=None)]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None), ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unrecogized key syntax \""), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\""), operator=+)], member=warning, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=stringPropertyNames, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[loadRulesFromProperties] operator[SEP] identifier[Properties] identifier[p] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[p] operator[SEP] identifier[stringPropertyNames] operator[SEP] operator[SEP] operator[SEP] {
identifier[Matcher] identifier[m] operator[=] identifier[RE_TAG_ATTR_TYPE] operator[SEP] identifier[matcher] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[tagName] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[String] identifier[testAttrName] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] Other[2] operator[SEP] operator[SEP] identifier[String] identifier[testAttrValue] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] Other[3] operator[SEP] operator[SEP] identifier[String] identifier[attrNameMatch] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] Other[4] operator[SEP] operator[SEP] identifier[String] identifier[transformerName] operator[=] identifier[p] operator[SEP] identifier[getProperty] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[StringTransformer] identifier[transformer] operator[=] identifier[transformers] operator[SEP] identifier[get] operator[SEP] identifier[transformerName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[transformer] operator[==] Other[null] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[+] identifier[transformerName] operator[+] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[TransformAttr] identifier[t] operator[SEP] Keyword[if] operator[SEP] identifier[testAttrName] operator[!=] Other[null] operator[SEP] {
identifier[t] operator[=] Keyword[new] identifier[TransformAttrIfAttrValue] operator[SEP] identifier[attrNameMatch] , identifier[transformer] , identifier[testAttrName] , identifier[testAttrValue] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[t] operator[=] Keyword[new] identifier[TransformAttr] operator[SEP] identifier[attrNameMatch] , identifier[transformer] operator[SEP] operator[SEP]
}
identifier[TransformAttr] identifier[ta] operator[=] identifier[rules] operator[SEP] identifier[get] operator[SEP] identifier[tagName] operator[SEP] operator[SEP] identifier[TransformAttr] identifier[pta] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] identifier[ta] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[pta] operator[==] Other[null] operator[SEP] {
identifier[rules] operator[SEP] identifier[put] operator[SEP] identifier[tagName] , identifier[t] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[pta] operator[SEP] identifier[next] operator[=] identifier[t] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ta] operator[SEP] identifier[attrName] operator[SEP] identifier[equals] operator[SEP] identifier[t] operator[SEP] identifier[attrName] operator[SEP] operator[SEP] {
identifier[TransformAttr] identifier[palt] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[compareTo] operator[SEP] identifier[ta] operator[SEP] operator[>=] Other[0] operator[SEP] {
identifier[t] operator[SEP] identifier[alt] operator[=] identifier[ta] operator[SEP] identifier[t] operator[SEP] identifier[next] operator[=] identifier[ta] operator[SEP] identifier[next] operator[SEP] identifier[ta] operator[SEP] identifier[next] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[palt] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[pta] operator[==] Other[null] operator[SEP] {
identifier[rules] operator[SEP] identifier[put] operator[SEP] identifier[tagName] , identifier[t] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[pta] operator[SEP] identifier[next] operator[=] identifier[t] operator[SEP]
}
}
Keyword[else] {
identifier[palt] operator[SEP] identifier[next] operator[=] identifier[t] operator[SEP]
}
Keyword[break] operator[SEP]
}
identifier[palt] operator[=] identifier[ta] operator[SEP] identifier[ta] operator[=] identifier[ta] operator[SEP] identifier[alt] operator[SEP] Keyword[if] operator[SEP] identifier[ta] operator[==] Other[null] operator[SEP] {
identifier[palt] operator[SEP] identifier[alt] operator[=] identifier[t] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[break] operator[SEP]
}
identifier[pta] operator[=] identifier[ta] operator[SEP] identifier[ta] operator[=] identifier[ta] operator[SEP] identifier[next] operator[SEP]
}
Keyword[continue] operator[SEP]
}
identifier[LOGGER] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[+] identifier[key] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public EmbedBuilder updateFields(Predicate<EmbedField> predicate, Consumer<EditableEmbedField> updater) {
delegate.updateFields(predicate, updater);
return this;
} | class class_name[name] begin[{]
method[updateFields, return_type[type[EmbedBuilder]], modifier[public], parameter[predicate, updater]] begin[{]
call[delegate.updateFields, parameter[member[.predicate], member[.updater]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[EmbedBuilder] identifier[updateFields] operator[SEP] identifier[Predicate] operator[<] identifier[EmbedField] operator[>] identifier[predicate] , identifier[Consumer] operator[<] identifier[EditableEmbedField] operator[>] identifier[updater] operator[SEP] {
identifier[delegate] operator[SEP] identifier[updateFields] operator[SEP] identifier[predicate] , identifier[updater] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public final void ignorableWhitespace(char[] ch, int start, int length)
throws SAXException {
characters(ch, start, length);
} | class class_name[name] begin[{]
method[ignorableWhitespace, return_type[void], modifier[final public], parameter[ch, start, length]] begin[{]
call[.characters, parameter[member[.ch], member[.start], member[.length]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[ignorableWhitespace] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[ch] , Keyword[int] identifier[start] , Keyword[int] identifier[length] operator[SEP] Keyword[throws] identifier[SAXException] {
identifier[characters] operator[SEP] identifier[ch] , identifier[start] , identifier[length] operator[SEP] operator[SEP]
}
|
public static SDVariable softmax(SameDiff SD, SDVariable x, int dimension, int rank){
int[] permutation = ArrayUtil.range(0, rank);
permutation[0] = dimension;
permutation[dimension] = 0;
return SD.nn.softmax(x.permute(permutation)).permute(ArrayUtil.invertPermutation(permutation));
} | class class_name[name] begin[{]
method[softmax, return_type[type[SDVariable]], modifier[public static], parameter[SD, x, dimension, rank]] begin[{]
local_variable[type[int], permutation]
assign[member[.permutation], member[.dimension]]
assign[member[.permutation], literal[0]]
return[call[SD.nn.softmax, parameter[call[x.permute, parameter[member[.permutation]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SDVariable] identifier[softmax] operator[SEP] identifier[SameDiff] identifier[SD] , identifier[SDVariable] identifier[x] , Keyword[int] identifier[dimension] , Keyword[int] identifier[rank] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[permutation] operator[=] identifier[ArrayUtil] operator[SEP] identifier[range] operator[SEP] Other[0] , identifier[rank] operator[SEP] operator[SEP] identifier[permutation] operator[SEP] Other[0] operator[SEP] operator[=] identifier[dimension] operator[SEP] identifier[permutation] operator[SEP] identifier[dimension] operator[SEP] operator[=] Other[0] operator[SEP] Keyword[return] identifier[SD] operator[SEP] identifier[nn] operator[SEP] identifier[softmax] operator[SEP] identifier[x] operator[SEP] identifier[permute] operator[SEP] identifier[permutation] operator[SEP] operator[SEP] operator[SEP] identifier[permute] operator[SEP] identifier[ArrayUtil] operator[SEP] identifier[invertPermutation] operator[SEP] identifier[permutation] operator[SEP] operator[SEP] operator[SEP]
}
|
public long getRecordingPosition(final long recordingId)
{
lock.lock();
try
{
ensureOpen();
final long correlationId = aeron.nextCorrelationId();
if (!archiveProxy.getRecordingPosition(recordingId, correlationId, controlSessionId))
{
throw new ArchiveException("failed to send get recording position request");
}
return pollForResponse(correlationId);
}
finally
{
lock.unlock();
}
} | class class_name[name] begin[{]
method[getRecordingPosition, return_type[type[long]], modifier[public], parameter[recordingId]] begin[{]
call[lock.lock, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=ensureOpen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextCorrelationId, postfix_operators=[], prefix_operators=[], qualifier=aeron, selectors=[], type_arguments=None), name=correlationId)], modifiers={'final'}, type=BasicType(dimensions=[], name=long)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=recordingId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=correlationId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=controlSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRecordingPosition, postfix_operators=[], prefix_operators=['!'], qualifier=archiveProxy, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed to send get recording position request")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArchiveException, sub_type=None)), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=correlationId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pollForResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[long] identifier[getRecordingPosition] operator[SEP] Keyword[final] Keyword[long] identifier[recordingId] operator[SEP] {
identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[ensureOpen] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[long] identifier[correlationId] operator[=] identifier[aeron] operator[SEP] identifier[nextCorrelationId] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[archiveProxy] operator[SEP] identifier[getRecordingPosition] operator[SEP] identifier[recordingId] , identifier[correlationId] , identifier[controlSessionId] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ArchiveException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[pollForResponse] operator[SEP] identifier[correlationId] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Double getDouble(String key, Double defaultValue) throws SyntaxException
{
String value = getSimple(key);
if (value == null)
{
return defaultValue;
}
else
{
try
{
return Double.valueOf(value);
}
catch (NumberFormatException e)
{
throw new SyntaxException(String.format("Invalid double value %s for '%s'", value, key));
}
}
} | class class_name[name] begin[{]
method[getDouble, return_type[type[Double]], modifier[public], parameter[key, defaultValue]] begin[{]
local_variable[type[String], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
return[member[.defaultValue]]
else begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid double value %s for '%s'"), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SyntaxException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
END[}] | Keyword[public] identifier[Double] identifier[getDouble] operator[SEP] identifier[String] identifier[key] , identifier[Double] identifier[defaultValue] operator[SEP] Keyword[throws] identifier[SyntaxException] {
identifier[String] identifier[value] operator[=] identifier[getSimple] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[defaultValue] operator[SEP]
}
Keyword[else] {
Keyword[try] {
Keyword[return] identifier[Double] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SyntaxException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[value] , identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@Override
public void initPropertySources(ServletContext servletContext, PortletContext portletContext, PortletConfig portletConfig) {
PortletApplicationContextUtils.initPortletPropertySources(this.getPropertySources(), servletContext, portletContext, portletConfig);
} | class class_name[name] begin[{]
method[initPropertySources, return_type[void], modifier[public], parameter[servletContext, portletContext, portletConfig]] begin[{]
call[PortletApplicationContextUtils.initPortletPropertySources, parameter[THIS[call[None.getPropertySources, parameter[]]], member[.servletContext], member[.portletContext], member[.portletConfig]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[initPropertySources] operator[SEP] identifier[ServletContext] identifier[servletContext] , identifier[PortletContext] identifier[portletContext] , identifier[PortletConfig] identifier[portletConfig] operator[SEP] {
identifier[PortletApplicationContextUtils] operator[SEP] identifier[initPortletPropertySources] operator[SEP] Keyword[this] operator[SEP] identifier[getPropertySources] operator[SEP] operator[SEP] , identifier[servletContext] , identifier[portletContext] , identifier[portletConfig] operator[SEP] operator[SEP]
}
|
@Override
public void writeLong(long n) throws IOException {
byte[] intBytes = new byte[] { (byte) ((n >>> 56) ^ 0x80),
(byte) (n >>> 48), (byte) (n >>> 40), (byte) (n >>> 32),
(byte) (n >>> 24), (byte) (n >>> 16), (byte) (n >>> 8), (byte) n };
out.write(intBytes);
} | class class_name[name] begin[{]
method[writeLong, return_type[void], modifier[public], parameter[n]] begin[{]
local_variable[type[byte], intBytes]
call[out.write, parameter[member[.intBytes]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[writeLong] operator[SEP] Keyword[long] identifier[n] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[intBytes] operator[=] Keyword[new] Keyword[byte] operator[SEP] operator[SEP] {
operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[n] operator[>] operator[>] operator[>] Other[56] operator[SEP] operator[^] literal[Integer] operator[SEP] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[n] operator[>] operator[>] operator[>] Other[48] operator[SEP] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[n] operator[>] operator[>] operator[>] Other[40] operator[SEP] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[n] operator[>] operator[>] operator[>] Other[32] operator[SEP] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[n] operator[>] operator[>] operator[>] Other[24] operator[SEP] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[n] operator[>] operator[>] operator[>] Other[16] operator[SEP] , operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[n] operator[>] operator[>] operator[>] Other[8] operator[SEP] , operator[SEP] Keyword[byte] operator[SEP] identifier[n]
} operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[intBytes] operator[SEP] operator[SEP]
}
|
public String upload(InputStream content) throws RedmineException {
final URI uploadURI = getURIConfigurator().getUploadURI();
final HttpPost request = new HttpPost(uploadURI);
final AbstractHttpEntity entity = new InputStreamEntity(content, -1);
/* Content type required by a Redmine */
entity.setContentType("application/octet-stream");
request.setEntity(entity);
final String result = getCommunicator().sendRequest(request);
return parseResponse(result, "upload",
RedmineJSONParser.UPLOAD_TOKEN_PARSER);
} | class class_name[name] begin[{]
method[upload, return_type[type[String]], modifier[public], parameter[content]] begin[{]
local_variable[type[URI], uploadURI]
local_variable[type[HttpPost], request]
local_variable[type[AbstractHttpEntity], entity]
call[entity.setContentType, parameter[literal["application/octet-stream"]]]
call[request.setEntity, parameter[member[.entity]]]
local_variable[type[String], result]
return[call[.parseResponse, parameter[member[.result], literal["upload"], member[RedmineJSONParser.UPLOAD_TOKEN_PARSER]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[upload] operator[SEP] identifier[InputStream] identifier[content] operator[SEP] Keyword[throws] identifier[RedmineException] {
Keyword[final] identifier[URI] identifier[uploadURI] operator[=] identifier[getURIConfigurator] operator[SEP] operator[SEP] operator[SEP] identifier[getUploadURI] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[HttpPost] identifier[request] operator[=] Keyword[new] identifier[HttpPost] operator[SEP] identifier[uploadURI] operator[SEP] operator[SEP] Keyword[final] identifier[AbstractHttpEntity] identifier[entity] operator[=] Keyword[new] identifier[InputStreamEntity] operator[SEP] identifier[content] , operator[-] Other[1] operator[SEP] operator[SEP] identifier[entity] operator[SEP] identifier[setContentType] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setEntity] operator[SEP] identifier[entity] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[result] operator[=] identifier[getCommunicator] operator[SEP] operator[SEP] operator[SEP] identifier[sendRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[parseResponse] operator[SEP] identifier[result] , literal[String] , identifier[RedmineJSONParser] operator[SEP] identifier[UPLOAD_TOKEN_PARSER] operator[SEP] operator[SEP]
}
|
boolean removeEmptyNode(int lookup) {
// A VoltDB extension to diagnose ArrayOutOfBounds.
voltDBhistory[voltDBhistoryDepth++ % voltDBhistoryCapacity] = 1000000 + lookup;
// End of VoltDB extension
boolean found = false;
int lastLookup = -1;
for (int i = reclaimedNodePointer; i >= 0;
lastLookup = i, i = linkTable[i]) {
if (i == lookup) {
if (lastLookup == -1) {
reclaimedNodePointer = linkTable[lookup];
} else {
linkTable[lastLookup] = linkTable[lookup];
}
found = true;
break;
}
}
if (!found) {
return false;
}
for (int i = 0; i < newNodePointer; i++) {
if (linkTable[i] > lookup) {
linkTable[i]--;
}
}
System.arraycopy(linkTable, lookup + 1, linkTable, lookup,
newNodePointer - lookup - 1);
linkTable[newNodePointer - 1] = 0;
newNodePointer--;
for (int i = 0; i < hashTable.length; i++) {
if (hashTable[i] > lookup) {
hashTable[i]--;
}
}
return true;
} | class class_name[name] begin[{]
method[removeEmptyNode, return_type[type[boolean]], modifier[default], parameter[lookup]] begin[{]
assign[member[.voltDBhistory], binary_operation[literal[1000000], +, member[.lookup]]]
local_variable[type[boolean], found]
local_variable[type[int], lastLookup]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lookup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lastLookup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=linkTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=lastLookup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=linkTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=lookup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=reclaimedNodePointer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=linkTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=lookup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=found, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=reclaimedNodePointer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=lastLookup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=linkTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))]), label=None)
if[member[.found]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=linkTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=lookup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=linkTable, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=newNodePointer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[System.arraycopy, parameter[member[.linkTable], binary_operation[member[.lookup], +, literal[1]], member[.linkTable], member[.lookup], binary_operation[binary_operation[member[.newNodePointer], -, member[.lookup]], -, literal[1]]]]
assign[member[.linkTable], literal[0]]
member[.newNodePointer]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=hashTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=lookup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=hashTable, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=hashTable, 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[literal[true]]
end[}]
END[}] | Keyword[boolean] identifier[removeEmptyNode] operator[SEP] Keyword[int] identifier[lookup] operator[SEP] {
identifier[voltDBhistory] operator[SEP] identifier[voltDBhistoryDepth] operator[++] operator[%] identifier[voltDBhistoryCapacity] operator[SEP] operator[=] Other[1000000] operator[+] identifier[lookup] operator[SEP] Keyword[boolean] identifier[found] operator[=] literal[boolean] operator[SEP] Keyword[int] identifier[lastLookup] operator[=] operator[-] Other[1] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[reclaimedNodePointer] operator[SEP] identifier[i] operator[>=] Other[0] operator[SEP] identifier[lastLookup] operator[=] identifier[i] , identifier[i] operator[=] identifier[linkTable] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[==] identifier[lookup] operator[SEP] {
Keyword[if] operator[SEP] identifier[lastLookup] operator[==] operator[-] Other[1] operator[SEP] {
identifier[reclaimedNodePointer] operator[=] identifier[linkTable] operator[SEP] identifier[lookup] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[linkTable] operator[SEP] identifier[lastLookup] operator[SEP] operator[=] identifier[linkTable] operator[SEP] identifier[lookup] operator[SEP] operator[SEP]
}
identifier[found] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[found] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[newNodePointer] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[linkTable] operator[SEP] identifier[i] operator[SEP] operator[>] identifier[lookup] operator[SEP] {
identifier[linkTable] operator[SEP] identifier[i] operator[SEP] operator[--] operator[SEP]
}
}
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[linkTable] , identifier[lookup] operator[+] Other[1] , identifier[linkTable] , identifier[lookup] , identifier[newNodePointer] operator[-] identifier[lookup] operator[-] Other[1] operator[SEP] operator[SEP] identifier[linkTable] operator[SEP] identifier[newNodePointer] operator[-] Other[1] operator[SEP] operator[=] Other[0] operator[SEP] identifier[newNodePointer] operator[--] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[hashTable] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[hashTable] operator[SEP] identifier[i] operator[SEP] operator[>] identifier[lookup] operator[SEP] {
identifier[hashTable] operator[SEP] identifier[i] operator[SEP] operator[--] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void rollback() throws GitAPIException {
try (Git git = getGit()) {
git.reset().setMode(ResetCommand.ResetType.HARD).setRef(HEAD).call();
}
} | class class_name[name] begin[{]
method[rollback, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=reset, postfix_operators=[], prefix_operators=[], qualifier=git, selectors=[MethodInvocation(arguments=[MemberReference(member=HARD, postfix_operators=[], prefix_operators=[], qualifier=ResetCommand.ResetType, selectors=[])], member=setMode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=HEAD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRef, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=call, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=git, type=ReferenceType(arguments=None, dimensions=[], name=Git, sub_type=None), value=MethodInvocation(arguments=[], member=getGit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))])
end[}]
END[}] | Keyword[public] Keyword[void] identifier[rollback] operator[SEP] operator[SEP] Keyword[throws] identifier[GitAPIException] {
Keyword[try] operator[SEP] identifier[Git] identifier[git] operator[=] identifier[getGit] operator[SEP] operator[SEP] operator[SEP] {
identifier[git] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[setMode] operator[SEP] identifier[ResetCommand] operator[SEP] identifier[ResetType] operator[SEP] identifier[HARD] operator[SEP] operator[SEP] identifier[setRef] operator[SEP] identifier[HEAD] operator[SEP] operator[SEP] identifier[call] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public List<TopicRelationship> getTopicRelationships() {
ArrayList<TopicRelationship> relationships = new ArrayList<TopicRelationship>(topicRelationships);
for (final TargetRelationship relationship : topicTargetRelationships) {
relationships.add(new TopicRelationship(relationship.getPrimaryRelationship(), (SpecTopic) relationship.getSecondaryRelationship(),
relationship.getType()));
}
return relationships;
} | class class_name[name] begin[{]
method[getTopicRelationships, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[ArrayList], relationships]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getPrimaryRelationship, postfix_operators=[], prefix_operators=[], qualifier=relationship, selectors=[], type_arguments=None), Cast(expression=MethodInvocation(arguments=[], member=getSecondaryRelationship, postfix_operators=[], prefix_operators=[], qualifier=relationship, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SpecTopic, sub_type=None)), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=relationship, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TopicRelationship, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=relationships, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=topicTargetRelationships, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=relationship)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=TargetRelationship, sub_type=None))), label=None)
return[member[.relationships]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[TopicRelationship] operator[>] identifier[getTopicRelationships] operator[SEP] operator[SEP] {
identifier[ArrayList] operator[<] identifier[TopicRelationship] operator[>] identifier[relationships] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[TopicRelationship] operator[>] operator[SEP] identifier[topicRelationships] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[TargetRelationship] identifier[relationship] operator[:] identifier[topicTargetRelationships] operator[SEP] {
identifier[relationships] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[TopicRelationship] operator[SEP] identifier[relationship] operator[SEP] identifier[getPrimaryRelationship] operator[SEP] operator[SEP] , operator[SEP] identifier[SpecTopic] operator[SEP] identifier[relationship] operator[SEP] identifier[getSecondaryRelationship] operator[SEP] operator[SEP] , identifier[relationship] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[relationships] operator[SEP]
}
|
public Organization withAvailablePolicyTypes(PolicyTypeSummary... availablePolicyTypes) {
if (this.availablePolicyTypes == null) {
setAvailablePolicyTypes(new java.util.ArrayList<PolicyTypeSummary>(availablePolicyTypes.length));
}
for (PolicyTypeSummary ele : availablePolicyTypes) {
this.availablePolicyTypes.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withAvailablePolicyTypes, return_type[type[Organization]], modifier[public], parameter[availablePolicyTypes]] begin[{]
if[binary_operation[THIS[member[None.availablePolicyTypes]], ==, literal[null]]] begin[{]
call[.setAvailablePolicyTypes, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=availablePolicyTypes, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=PolicyTypeSummary, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=availablePolicyTypes, 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=availablePolicyTypes, 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=PolicyTypeSummary, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Organization] identifier[withAvailablePolicyTypes] operator[SEP] identifier[PolicyTypeSummary] operator[...] identifier[availablePolicyTypes] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[availablePolicyTypes] operator[==] Other[null] operator[SEP] {
identifier[setAvailablePolicyTypes] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[PolicyTypeSummary] operator[>] operator[SEP] identifier[availablePolicyTypes] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[PolicyTypeSummary] identifier[ele] operator[:] identifier[availablePolicyTypes] operator[SEP] {
Keyword[this] operator[SEP] identifier[availablePolicyTypes] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
private static void logResponse(StatusUpdate response) {
String text = response.getStatus();
String message = String.format(MESSAGE_RESPONSE, text);
System.out.println(message);
} | class class_name[name] begin[{]
method[logResponse, return_type[void], modifier[private static], parameter[response]] begin[{]
local_variable[type[String], text]
local_variable[type[String], message]
call[System.out.println, parameter[member[.message]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[logResponse] operator[SEP] identifier[StatusUpdate] identifier[response] operator[SEP] {
identifier[String] identifier[text] operator[=] identifier[response] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[message] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[MESSAGE_RESPONSE] , identifier[text] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
|
private static State convertDeprecatedConfigs(State state) {
if (state.contains(EXTRACT_LIMIT_RATE_LIMIT_KEY_DEP)) {
state.setProp(EXTRACT_LIMIT_RATE_LIMIT_KEY, state.getProp(EXTRACT_LIMIT_RATE_LIMIT_KEY_DEP));
state.removeProp(EXTRACT_LIMIT_RATE_LIMIT_KEY_DEP);
}
if (state.contains(EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY_DEP)) {
state.setProp(EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY, state.getProp(EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY_DEP));
state.removeProp(EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY_DEP);
}
if (state.contains(EXTRACT_LIMIT_TIME_LIMIT_KEY_DEP)) {
state.setProp(EXTRACT_LIMIT_TIME_LIMIT_KEY, state.getProp(EXTRACT_LIMIT_TIME_LIMIT_KEY_DEP));
state.removeProp(EXTRACT_LIMIT_TIME_LIMIT_KEY_DEP);
}
if (state.contains(EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY_DEP)) {
state.setProp(EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY, state.getProp(EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY_DEP));
state.removeProp(EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY_DEP);
}
return state;
} | class class_name[name] begin[{]
method[convertDeprecatedConfigs, return_type[type[State]], modifier[private static], parameter[state]] begin[{]
if[call[state.contains, parameter[member[.EXTRACT_LIMIT_RATE_LIMIT_KEY_DEP]]]] begin[{]
call[state.setProp, parameter[member[.EXTRACT_LIMIT_RATE_LIMIT_KEY], call[state.getProp, parameter[member[.EXTRACT_LIMIT_RATE_LIMIT_KEY_DEP]]]]]
call[state.removeProp, parameter[member[.EXTRACT_LIMIT_RATE_LIMIT_KEY_DEP]]]
else begin[{]
None
end[}]
if[call[state.contains, parameter[member[.EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY_DEP]]]] begin[{]
call[state.setProp, parameter[member[.EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY], call[state.getProp, parameter[member[.EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY_DEP]]]]]
call[state.removeProp, parameter[member[.EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY_DEP]]]
else begin[{]
None
end[}]
if[call[state.contains, parameter[member[.EXTRACT_LIMIT_TIME_LIMIT_KEY_DEP]]]] begin[{]
call[state.setProp, parameter[member[.EXTRACT_LIMIT_TIME_LIMIT_KEY], call[state.getProp, parameter[member[.EXTRACT_LIMIT_TIME_LIMIT_KEY_DEP]]]]]
call[state.removeProp, parameter[member[.EXTRACT_LIMIT_TIME_LIMIT_KEY_DEP]]]
else begin[{]
None
end[}]
if[call[state.contains, parameter[member[.EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY_DEP]]]] begin[{]
call[state.setProp, parameter[member[.EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY], call[state.getProp, parameter[member[.EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY_DEP]]]]]
call[state.removeProp, parameter[member[.EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY_DEP]]]
else begin[{]
None
end[}]
return[member[.state]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[State] identifier[convertDeprecatedConfigs] operator[SEP] identifier[State] identifier[state] operator[SEP] {
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[contains] operator[SEP] identifier[EXTRACT_LIMIT_RATE_LIMIT_KEY_DEP] operator[SEP] operator[SEP] {
identifier[state] operator[SEP] identifier[setProp] operator[SEP] identifier[EXTRACT_LIMIT_RATE_LIMIT_KEY] , identifier[state] operator[SEP] identifier[getProp] operator[SEP] identifier[EXTRACT_LIMIT_RATE_LIMIT_KEY_DEP] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[removeProp] operator[SEP] identifier[EXTRACT_LIMIT_RATE_LIMIT_KEY_DEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[contains] operator[SEP] identifier[EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY_DEP] operator[SEP] operator[SEP] {
identifier[state] operator[SEP] identifier[setProp] operator[SEP] identifier[EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY] , identifier[state] operator[SEP] identifier[getProp] operator[SEP] identifier[EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY_DEP] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[removeProp] operator[SEP] identifier[EXTRACT_LIMIT_RATE_LIMIT_TIMEUNIT_KEY_DEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[contains] operator[SEP] identifier[EXTRACT_LIMIT_TIME_LIMIT_KEY_DEP] operator[SEP] operator[SEP] {
identifier[state] operator[SEP] identifier[setProp] operator[SEP] identifier[EXTRACT_LIMIT_TIME_LIMIT_KEY] , identifier[state] operator[SEP] identifier[getProp] operator[SEP] identifier[EXTRACT_LIMIT_TIME_LIMIT_KEY_DEP] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[removeProp] operator[SEP] identifier[EXTRACT_LIMIT_TIME_LIMIT_KEY_DEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[contains] operator[SEP] identifier[EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY_DEP] operator[SEP] operator[SEP] {
identifier[state] operator[SEP] identifier[setProp] operator[SEP] identifier[EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY] , identifier[state] operator[SEP] identifier[getProp] operator[SEP] identifier[EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY_DEP] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[removeProp] operator[SEP] identifier[EXTRACT_LIMIT_TIME_LIMIT_TIMEUNIT_KEY_DEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[state] operator[SEP]
}
|
private void handleMultiInstanceReportResponse(SerialMessage serialMessage,
int offset) {
logger.trace("Process Multi-instance Report");
int commandClassCode = serialMessage.getMessagePayloadByte(offset);
int instances = serialMessage.getMessagePayloadByte(offset + 1);
if (instances == 0) {
setInstances(1);
} else
{
CommandClass commandClass = CommandClass.getCommandClass(commandClassCode);
if (commandClass == null) {
logger.error(String.format("Unsupported command class 0x%02x", commandClassCode));
return;
}
logger.debug(String.format("Node %d Requested Command Class = %s (0x%02x)", this.getNode().getNodeId(), commandClass.getLabel() , commandClassCode));
ZWaveCommandClass zwaveCommandClass = this.getNode().getCommandClass(commandClass);
if (zwaveCommandClass == null) {
logger.error(String.format("Unsupported command class %s (0x%02x)", commandClass.getLabel(), commandClassCode));
return;
}
zwaveCommandClass.setInstances(instances);
logger.debug(String.format("Node %d Instances = %d, number of instances set.", this.getNode().getNodeId(), instances));
}
for (ZWaveCommandClass zwaveCommandClass : this.getNode().getCommandClasses())
if (zwaveCommandClass.getInstances() == 0) // still waiting for an instance report of another command class.
return;
// advance node stage.
this.getNode().advanceNodeStage();
} | class class_name[name] begin[{]
method[handleMultiInstanceReportResponse, return_type[void], modifier[private], parameter[serialMessage, offset]] begin[{]
call[logger.trace, parameter[literal["Process Multi-instance Report"]]]
local_variable[type[int], commandClassCode]
local_variable[type[int], instances]
if[binary_operation[member[.instances], ==, literal[0]]] begin[{]
call[.setInstances, parameter[literal[1]]]
else begin[{]
local_variable[type[CommandClass], commandClass]
if[binary_operation[member[.commandClass], ==, literal[null]]] begin[{]
call[logger.error, parameter[call[String.format, parameter[literal["Unsupported command class 0x%02x"], member[.commandClassCode]]]]]
return[None]
else begin[{]
None
end[}]
call[logger.debug, parameter[call[String.format, parameter[literal["Node %d Requested Command Class = %s (0x%02x)"], THIS[call[None.getNode, parameter[]]call[None.getNodeId, parameter[]]], call[commandClass.getLabel, parameter[]], member[.commandClassCode]]]]]
local_variable[type[ZWaveCommandClass], zwaveCommandClass]
if[binary_operation[member[.zwaveCommandClass], ==, literal[null]]] begin[{]
call[logger.error, parameter[call[String.format, parameter[literal["Unsupported command class %s (0x%02x)"], call[commandClass.getLabel, parameter[]], member[.commandClassCode]]]]]
return[None]
else begin[{]
None
end[}]
call[zwaveCommandClass.setInstances, parameter[member[.instances]]]
call[logger.debug, parameter[call[String.format, parameter[literal["Node %d Instances = %d, number of instances set."], THIS[call[None.getNode, parameter[]]call[None.getNodeId, parameter[]]], member[.instances]]]]]
end[}]
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getInstances, postfix_operators=[], prefix_operators=[], qualifier=zwaveCommandClass, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getNode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getCommandClasses, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=zwaveCommandClass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ZWaveCommandClass, sub_type=None))), label=None)
THIS[call[None.getNode, parameter[]]call[None.advanceNodeStage, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[handleMultiInstanceReportResponse] operator[SEP] identifier[SerialMessage] identifier[serialMessage] , Keyword[int] identifier[offset] operator[SEP] {
identifier[logger] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[commandClassCode] operator[=] identifier[serialMessage] operator[SEP] identifier[getMessagePayloadByte] operator[SEP] identifier[offset] operator[SEP] operator[SEP] Keyword[int] identifier[instances] operator[=] identifier[serialMessage] operator[SEP] identifier[getMessagePayloadByte] operator[SEP] identifier[offset] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[instances] operator[==] Other[0] operator[SEP] {
identifier[setInstances] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[CommandClass] identifier[commandClass] operator[=] identifier[CommandClass] operator[SEP] identifier[getCommandClass] operator[SEP] identifier[commandClassCode] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[commandClass] operator[==] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[commandClassCode] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[logger] operator[SEP] identifier[debug] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[getNodeId] operator[SEP] operator[SEP] , identifier[commandClass] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP] , identifier[commandClassCode] operator[SEP] operator[SEP] operator[SEP] identifier[ZWaveCommandClass] identifier[zwaveCommandClass] operator[=] Keyword[this] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[getCommandClass] operator[SEP] identifier[commandClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[zwaveCommandClass] operator[==] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[commandClass] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP] , identifier[commandClassCode] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[zwaveCommandClass] operator[SEP] identifier[setInstances] operator[SEP] identifier[instances] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[getNodeId] operator[SEP] operator[SEP] , identifier[instances] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ZWaveCommandClass] identifier[zwaveCommandClass] operator[:] Keyword[this] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[getCommandClasses] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[zwaveCommandClass] operator[SEP] identifier[getInstances] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] operator[SEP] Keyword[this] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[advanceNodeStage] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public PutPlaybackConfigurationResult putPlaybackConfiguration(PutPlaybackConfigurationRequest request) {
request = beforeClientExecution(request);
return executePutPlaybackConfiguration(request);
} | class class_name[name] begin[{]
method[putPlaybackConfiguration, return_type[type[PutPlaybackConfigurationResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executePutPlaybackConfiguration, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[PutPlaybackConfigurationResult] identifier[putPlaybackConfiguration] operator[SEP] identifier[PutPlaybackConfigurationRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executePutPlaybackConfiguration] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private static <T extends Appendable> T _appendToPat(T buf, int c, boolean escapeUnprintable) {
try {
if (escapeUnprintable && Utility.isUnprintable(c)) {
// Use hex escape notation (<backslash>uxxxx or <backslash>Uxxxxxxxx) for anything
// unprintable
if (Utility.escapeUnprintable(buf, c)) {
return buf;
}
}
// Okay to let ':' pass through
switch (c) {
case '[': // SET_OPEN:
case ']': // SET_CLOSE:
case '-': // HYPHEN:
case '^': // COMPLEMENT:
case '&': // INTERSECTION:
case '\\': //BACKSLASH:
case '{':
case '}':
case '$':
case ':':
buf.append('\\');
break;
default:
// Escape whitespace
if (PatternProps.isWhiteSpace(c)) {
buf.append('\\');
}
break;
}
appendCodePoint(buf, c);
return buf;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
} | class class_name[name] begin[{]
method[_appendToPat, return_type[type[T]], modifier[private static], parameter[buf, c, escapeUnprintable]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=escapeUnprintable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isUnprintable, postfix_operators=[], prefix_operators=[], qualifier=Utility, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=escapeUnprintable, postfix_operators=[], prefix_operators=[], qualifier=Utility, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))])), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='['), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=']'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='-'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='^'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='&'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='{'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='}'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='$'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=':')], statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isWhiteSpace, postfix_operators=[], prefix_operators=[], qualifier=PatternProps, selectors=[], type_arguments=None), 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=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None)])), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=appendCodePoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ICUUncheckedIOException, 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[private] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Appendable] operator[>] identifier[T] identifier[_appendToPat] operator[SEP] identifier[T] identifier[buf] , Keyword[int] identifier[c] , Keyword[boolean] identifier[escapeUnprintable] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[escapeUnprintable] operator[&&] identifier[Utility] operator[SEP] identifier[isUnprintable] operator[SEP] identifier[c] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[Utility] operator[SEP] identifier[escapeUnprintable] operator[SEP] identifier[buf] , identifier[c] operator[SEP] operator[SEP] {
Keyword[return] identifier[buf] operator[SEP]
}
}
Keyword[switch] operator[SEP] identifier[c] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[if] operator[SEP] identifier[PatternProps] operator[SEP] identifier[isWhiteSpace] operator[SEP] identifier[c] operator[SEP] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP]
}
identifier[appendCodePoint] operator[SEP] identifier[buf] , identifier[c] operator[SEP] operator[SEP] Keyword[return] identifier[buf] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ICUUncheckedIOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public Vector3f set(int index, FloatBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | class class_name[name] begin[{]
method[set, return_type[type[Vector3f]], modifier[public], parameter[index, buffer]] begin[{]
call[MemUtil.INSTANCE.get, parameter[THIS[], member[.index], member[.buffer]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Vector3f] identifier[set] operator[SEP] Keyword[int] identifier[index] , identifier[FloatBuffer] identifier[buffer] operator[SEP] {
identifier[MemUtil] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[get] operator[SEP] Keyword[this] , identifier[index] , identifier[buffer] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public final Enumeration findResources(final String name)
throws IOException {
final CClassLoader loader = CClassLoader.getRootLoader();
final List URLList = new ArrayList();
try {
CClassLoader.loadResources(loader, URLList, name);
} finally {
try {
} catch (final Exception ignore) {
}
}
try {
final Enumeration eu = CClassLoader.getRootLoader().getParent()
.getResources(name);
while (eu.hasMoreElements()) {
URLList.add(eu.nextElement());
}
} catch (final Throwable ignore) {
}
final Iterator it = URLList.iterator();
return new Enumeration() {
Iterator internalIt = it;
public boolean hasMoreElements() {
return this.internalIt.hasNext();
} // end hasMoreElements()
public Object nextElement() {
return this.internalIt.next();
} // end nextElement()
} // end new
;
} | class class_name[name] begin[{]
method[findResources, return_type[type[Enumeration]], modifier[final public], parameter[name]] begin[{]
local_variable[type[CClassLoader], loader]
local_variable[type[List], URLList]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=loader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=URLList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadResources, postfix_operators=[], prefix_operators=[], qualifier=CClassLoader, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[TryStatement(block=[], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignore, types=['Exception']))], finally_block=None, label=None, resources=None)], label=None, resources=None)
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRootLoader, postfix_operators=[], prefix_operators=[], qualifier=CClassLoader, selectors=[MethodInvocation(arguments=[], member=getParent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResources, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=eu)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Enumeration, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=eu, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=URLList, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=eu, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignore, types=['Throwable']))], finally_block=None, label=None, resources=None)
local_variable[type[Iterator], it]
return[ClassCreator(arguments=[], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=it, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=internalIt)], documentation=None, modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Iterator, sub_type=None)), MethodDeclaration(annotations=[], body=[ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=internalIt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=hasNext, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=hasMoreElements, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=internalIt, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=next, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], documentation=None, modifiers={'public'}, name=nextElement, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Enumeration, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Enumeration] identifier[findResources] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[CClassLoader] identifier[loader] operator[=] identifier[CClassLoader] operator[SEP] identifier[getRootLoader] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] identifier[URLList] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[CClassLoader] operator[SEP] identifier[loadResources] operator[SEP] identifier[loader] , identifier[URLList] , identifier[name] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[ignore] operator[SEP] {
}
}
Keyword[try] {
Keyword[final] identifier[Enumeration] identifier[eu] operator[=] identifier[CClassLoader] operator[SEP] identifier[getRootLoader] operator[SEP] operator[SEP] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getResources] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[eu] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[URLList] operator[SEP] identifier[add] operator[SEP] identifier[eu] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Throwable] identifier[ignore] operator[SEP] {
}
Keyword[final] identifier[Iterator] identifier[it] operator[=] identifier[URLList] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Enumeration] operator[SEP] operator[SEP] {
identifier[Iterator] identifier[internalIt] operator[=] identifier[it] operator[SEP] Keyword[public] Keyword[boolean] identifier[hasMoreElements] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[internalIt] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[public] identifier[Object] identifier[nextElement] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[internalIt] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public List<PrivacyItem> setPrivacyList(String listName, List<PrivacyItem> listItem) {
// Add new list to the itemLists
this.getItemLists().put(listName, listItem);
return listItem;
} | class class_name[name] begin[{]
method[setPrivacyList, return_type[type[List]], modifier[public], parameter[listName, listItem]] begin[{]
THIS[call[None.getItemLists, parameter[]]call[None.put, parameter[member[.listName], member[.listItem]]]]
return[member[.listItem]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[PrivacyItem] operator[>] identifier[setPrivacyList] operator[SEP] identifier[String] identifier[listName] , identifier[List] operator[<] identifier[PrivacyItem] operator[>] identifier[listItem] operator[SEP] {
Keyword[this] operator[SEP] identifier[getItemLists] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[listName] , identifier[listItem] operator[SEP] operator[SEP] Keyword[return] identifier[listItem] operator[SEP]
}
|
private static String makeMessage(Throwable throwable) {
if(throwable instanceof AlgorithmException) {
return throwable.getMessage();
} else {
final String className = throwable.getClass().getName();
final String message = throwable.getMessage();
return className + ": " + message;
}
} | class class_name[name] begin[{]
method[makeMessage, return_type[type[String]], modifier[private static], parameter[throwable]] begin[{]
if[binary_operation[member[.throwable], instanceof, type[AlgorithmException]]] begin[{]
return[call[throwable.getMessage, parameter[]]]
else begin[{]
local_variable[type[String], className]
local_variable[type[String], message]
return[binary_operation[binary_operation[member[.className], +, literal[": "]], +, member[.message]]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[makeMessage] operator[SEP] identifier[Throwable] identifier[throwable] operator[SEP] {
Keyword[if] operator[SEP] identifier[throwable] Keyword[instanceof] identifier[AlgorithmException] operator[SEP] {
Keyword[return] identifier[throwable] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[final] identifier[String] identifier[className] operator[=] identifier[throwable] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[message] operator[=] identifier[throwable] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[className] operator[+] literal[String] operator[+] identifier[message] operator[SEP]
}
}
|
public void marshall(UntagCertificateAuthorityRequest untagCertificateAuthorityRequest, ProtocolMarshaller protocolMarshaller) {
if (untagCertificateAuthorityRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(untagCertificateAuthorityRequest.getCertificateAuthorityArn(), CERTIFICATEAUTHORITYARN_BINDING);
protocolMarshaller.marshall(untagCertificateAuthorityRequest.getTags(), TAGS_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[untagCertificateAuthorityRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.untagCertificateAuthorityRequest], ==, 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=getCertificateAuthorityArn, postfix_operators=[], prefix_operators=[], qualifier=untagCertificateAuthorityRequest, selectors=[], type_arguments=None), MemberReference(member=CERTIFICATEAUTHORITYARN_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=getTags, postfix_operators=[], prefix_operators=[], qualifier=untagCertificateAuthorityRequest, selectors=[], type_arguments=None), MemberReference(member=TAGS_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[UntagCertificateAuthorityRequest] identifier[untagCertificateAuthorityRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[untagCertificateAuthorityRequest] 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[untagCertificateAuthorityRequest] operator[SEP] identifier[getCertificateAuthorityArn] operator[SEP] operator[SEP] , identifier[CERTIFICATEAUTHORITYARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[untagCertificateAuthorityRequest] operator[SEP] identifier[getTags] operator[SEP] operator[SEP] , identifier[TAGS_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public String getBackupFilename()
{
Date now = new Date();
String strDate = Util.dateToString(now);
for (int i = 0; i < strDate.length(); i++)
{
char ch = strDate.charAt(i);
if (!Character.isLetterOrDigit(ch))
strDate = strDate.substring(0, i) + '_' + strDate.substring(i + 1, strDate.length());
}
return "backup" + strDate + ".zip";
} | class class_name[name] begin[{]
method[getBackupFilename, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[Date], now]
local_variable[type[String], strDate]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=strDate, selectors=[], type_arguments=None), name=ch)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isLetterOrDigit, postfix_operators=[], prefix_operators=['!'], qualifier=Character, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=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=strDate, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='_'), operator=+), operandr=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=+), MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=strDate, selectors=[], type_arguments=None)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=strDate, selectors=[], type_arguments=None), operator=+)), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=strDate, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[binary_operation[binary_operation[literal["backup"], +, member[.strDate]], +, literal[".zip"]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getBackupFilename] operator[SEP] operator[SEP] {
identifier[Date] identifier[now] operator[=] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strDate] operator[=] identifier[Util] operator[SEP] identifier[dateToString] operator[SEP] identifier[now] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[strDate] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[char] identifier[ch] operator[=] identifier[strDate] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Character] operator[SEP] identifier[isLetterOrDigit] operator[SEP] identifier[ch] operator[SEP] operator[SEP] identifier[strDate] operator[=] identifier[strDate] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[i] operator[SEP] operator[+] literal[String] operator[+] identifier[strDate] operator[SEP] identifier[substring] operator[SEP] identifier[i] operator[+] Other[1] , identifier[strDate] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[String] operator[+] identifier[strDate] operator[+] literal[String] operator[SEP]
}
|
private String replaceVariables(String inString) {
if (inString == null || inString == "")
return inString;
String outString = inString;
// Replace $ENVIRONMENT with the default environment
outString = stringReplace(outString, "{ENVIRONMENT}", defaultEnvironment);
// Go through the string and try to replace {...} escaped keys
String currentToken = "";
String replacedString = "";
boolean inToken = false;
for (int i = 0; i < outString.length(); i++) {
final char currentChar = outString.charAt(i);
if (!inToken && currentChar != '{') {
replacedString = replacedString + currentChar;
} else if (inToken && currentChar == '{') {
replacedString += "{" + currentToken;
currentToken = "";
} else if (inToken && currentChar != '}') {
currentToken = currentToken + currentChar;
} else if (inToken && currentChar == '}') {
// Try to find a replacement
inToken = false;
String replacement = null;
if (singletonInstance != null) {
replacement = PropertyManager.getProperty("", currentToken, null);
}
if (replacement != null) {
replacedString += replacement;
} else {
replacedString += "{" + currentToken + "}";
}
currentToken = "";
} else if (!inToken && currentChar == '{') {
inToken = true;
currentToken = "";
}
}
if (!currentToken.equals("")) {
replacedString += "{" + currentToken;
}
outString = replacedString;
// If in == out, then we've done as many replacements as we can, we're done
if (outString.equals(inString)) {
// Finally, check to see if the string should be clarified
if (inString.startsWith("[[[") && inString.endsWith("]]]")) {
// Clarify...
final String obfuscatedText = inString.substring(3, inString.length() - 3);
inString = ObfuscationManager.clarify(obfuscatedText);
}
return inString;
}
return replaceVariables(outString);
} | class class_name[name] begin[{]
method[replaceVariables, return_type[type[String]], modifier[private], parameter[inString]] begin[{]
if[binary_operation[binary_operation[member[.inString], ==, literal[null]], ||, binary_operation[member[.inString], ==, literal[""]]]] begin[{]
return[member[.inString]]
else begin[{]
None
end[}]
local_variable[type[String], outString]
assign[member[.outString], call[.stringReplace, parameter[member[.outString], literal["{ENVIRONMENT}"], member[.defaultEnvironment]]]]
local_variable[type[String], currentToken]
local_variable[type[String], replacedString]
local_variable[type[boolean], inToken]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=outString, selectors=[], type_arguments=None), name=currentChar)], modifiers={'final'}, type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=inToken, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=currentChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='{'), operator=!=), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=inToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=currentChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='{'), operator===), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=inToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=currentChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='}'), operator=!=), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=inToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=currentChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='}'), operator===), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=inToken, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=currentChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='{'), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=inToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=inToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=replacement)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=singletonInstance, 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=replacement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=currentToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=PropertyManager, selectors=[], type_arguments=None)), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=replacement, 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=replacedString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="{"), operandr=MemberReference(member=currentToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="}"), operator=+)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=replacedString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=replacement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=currentToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=currentChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=replacedString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="{"), operandr=MemberReference(member=currentToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=currentToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=replacedString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=replacedString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=currentChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=outString, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[call[currentToken.equals, parameter[literal[""]]]] begin[{]
assign[member[.replacedString], binary_operation[literal["{"], +, member[.currentToken]]]
else begin[{]
None
end[}]
assign[member[.outString], member[.replacedString]]
if[call[outString.equals, parameter[member[.inString]]]] begin[{]
if[binary_operation[call[inString.startsWith, parameter[literal["[[["]]], &&, call[inString.endsWith, parameter[literal["]]]"]]]]] begin[{]
local_variable[type[String], obfuscatedText]
assign[member[.inString], call[ObfuscationManager.clarify, parameter[member[.obfuscatedText]]]]
else begin[{]
None
end[}]
return[member[.inString]]
else begin[{]
None
end[}]
return[call[.replaceVariables, parameter[member[.outString]]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[replaceVariables] operator[SEP] identifier[String] identifier[inString] operator[SEP] {
Keyword[if] operator[SEP] identifier[inString] operator[==] Other[null] operator[||] identifier[inString] operator[==] literal[String] operator[SEP] Keyword[return] identifier[inString] operator[SEP] identifier[String] identifier[outString] operator[=] identifier[inString] operator[SEP] identifier[outString] operator[=] identifier[stringReplace] operator[SEP] identifier[outString] , literal[String] , identifier[defaultEnvironment] operator[SEP] operator[SEP] identifier[String] identifier[currentToken] operator[=] literal[String] operator[SEP] identifier[String] identifier[replacedString] operator[=] literal[String] operator[SEP] Keyword[boolean] identifier[inToken] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[outString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] Keyword[char] identifier[currentChar] operator[=] identifier[outString] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[inToken] operator[&&] identifier[currentChar] operator[!=] literal[String] operator[SEP] {
identifier[replacedString] operator[=] identifier[replacedString] operator[+] identifier[currentChar] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[inToken] operator[&&] identifier[currentChar] operator[==] literal[String] operator[SEP] {
identifier[replacedString] operator[+=] literal[String] operator[+] identifier[currentToken] operator[SEP] identifier[currentToken] operator[=] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[inToken] operator[&&] identifier[currentChar] operator[!=] literal[String] operator[SEP] {
identifier[currentToken] operator[=] identifier[currentToken] operator[+] identifier[currentChar] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[inToken] operator[&&] identifier[currentChar] operator[==] literal[String] operator[SEP] {
identifier[inToken] operator[=] literal[boolean] operator[SEP] identifier[String] identifier[replacement] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[singletonInstance] operator[!=] Other[null] operator[SEP] {
identifier[replacement] operator[=] identifier[PropertyManager] operator[SEP] identifier[getProperty] operator[SEP] literal[String] , identifier[currentToken] , Other[null] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[replacement] operator[!=] Other[null] operator[SEP] {
identifier[replacedString] operator[+=] identifier[replacement] operator[SEP]
}
Keyword[else] {
identifier[replacedString] operator[+=] literal[String] operator[+] identifier[currentToken] operator[+] literal[String] operator[SEP]
}
identifier[currentToken] operator[=] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[inToken] operator[&&] identifier[currentChar] operator[==] literal[String] operator[SEP] {
identifier[inToken] operator[=] literal[boolean] operator[SEP] identifier[currentToken] operator[=] literal[String] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[currentToken] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[replacedString] operator[+=] literal[String] operator[+] identifier[currentToken] operator[SEP]
}
identifier[outString] operator[=] identifier[replacedString] operator[SEP] Keyword[if] operator[SEP] identifier[outString] operator[SEP] identifier[equals] operator[SEP] identifier[inString] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[inString] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[inString] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[obfuscatedText] operator[=] identifier[inString] operator[SEP] identifier[substring] operator[SEP] Other[3] , identifier[inString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[3] operator[SEP] operator[SEP] identifier[inString] operator[=] identifier[ObfuscationManager] operator[SEP] identifier[clarify] operator[SEP] identifier[obfuscatedText] operator[SEP] operator[SEP]
}
Keyword[return] identifier[inString] operator[SEP]
}
Keyword[return] identifier[replaceVariables] operator[SEP] identifier[outString] operator[SEP] operator[SEP]
}
|
private static boolean isJarURL(final URL rootDirResource) {
final String protocol = rootDirResource.getProtocol();
/**
* Determine whether the given URL points to a resource in a jar file, that is, has protocol "jar", "zip",
* "wsjar" or "code-source".
* <p>
* "zip" and "wsjar" are used by BEA WebLogic Server and IBM WebSphere, respectively, but can be treated like
* jar files. The same applies to "code-source" URLs on Oracle OC4J, provided that the path contains a jar
* separator.
* *
*/
return "jar".equals(protocol) || "zip".equals(protocol) || "wsjar".equals(protocol)
|| ("code-source".equals(protocol) && rootDirResource.getPath().contains(JAR_URL_SEPARATOR));
} | class class_name[name] begin[{]
method[isJarURL, return_type[type[boolean]], modifier[private static], parameter[rootDirResource]] begin[{]
local_variable[type[String], protocol]
return[binary_operation[binary_operation[binary_operation[literal["jar"], ||, literal["zip"]], ||, literal["wsjar"]], ||, binary_operation[literal["code-source"], &&, call[rootDirResource.getPath, parameter[]]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[isJarURL] operator[SEP] Keyword[final] identifier[URL] identifier[rootDirResource] operator[SEP] {
Keyword[final] identifier[String] identifier[protocol] operator[=] identifier[rootDirResource] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[protocol] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[protocol] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[protocol] operator[SEP] operator[||] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[protocol] operator[SEP] operator[&&] identifier[rootDirResource] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[JAR_URL_SEPARATOR] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void recreateFullSubjects(SecurityService securityService, AtomicServiceReference<UnauthenticatedSubjectService> unauthenticatedSubjectServiceRef) {
callerSubject = recreateFullSubject(callerPrincipal, securityService, unauthenticatedSubjectServiceRef, callerSubjectCacheKey);
if (!subjectsAreEqual) {
invocationSubject = recreateFullSubject(invocationPrincipal, securityService, unauthenticatedSubjectServiceRef, invocationSubjectCacheKey);
} else {
invocationSubject = callerSubject;
}
} | class class_name[name] begin[{]
method[recreateFullSubjects, return_type[void], modifier[protected], parameter[securityService, unauthenticatedSubjectServiceRef]] begin[{]
assign[member[.callerSubject], call[.recreateFullSubject, parameter[member[.callerPrincipal], member[.securityService], member[.unauthenticatedSubjectServiceRef], member[.callerSubjectCacheKey]]]]
if[member[.subjectsAreEqual]] begin[{]
assign[member[.invocationSubject], call[.recreateFullSubject, parameter[member[.invocationPrincipal], member[.securityService], member[.unauthenticatedSubjectServiceRef], member[.invocationSubjectCacheKey]]]]
else begin[{]
assign[member[.invocationSubject], member[.callerSubject]]
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[recreateFullSubjects] operator[SEP] identifier[SecurityService] identifier[securityService] , identifier[AtomicServiceReference] operator[<] identifier[UnauthenticatedSubjectService] operator[>] identifier[unauthenticatedSubjectServiceRef] operator[SEP] {
identifier[callerSubject] operator[=] identifier[recreateFullSubject] operator[SEP] identifier[callerPrincipal] , identifier[securityService] , identifier[unauthenticatedSubjectServiceRef] , identifier[callerSubjectCacheKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[subjectsAreEqual] operator[SEP] {
identifier[invocationSubject] operator[=] identifier[recreateFullSubject] operator[SEP] identifier[invocationPrincipal] , identifier[securityService] , identifier[unauthenticatedSubjectServiceRef] , identifier[invocationSubjectCacheKey] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[invocationSubject] operator[=] identifier[callerSubject] operator[SEP]
}
}
|
public static Object create(Class type, Callback callback) {
Enhancer e = new Enhancer();
e.setSuperclass(type);
e.setCallback(callback);
return e.create();
} | class class_name[name] begin[{]
method[create, return_type[type[Object]], modifier[public static], parameter[type, callback]] begin[{]
local_variable[type[Enhancer], e]
call[e.setSuperclass, parameter[member[.type]]]
call[e.setCallback, parameter[member[.callback]]]
return[call[e.create, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Object] identifier[create] operator[SEP] identifier[Class] identifier[type] , identifier[Callback] identifier[callback] operator[SEP] {
identifier[Enhancer] identifier[e] operator[=] Keyword[new] identifier[Enhancer] operator[SEP] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[setSuperclass] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[setCallback] operator[SEP] identifier[callback] operator[SEP] operator[SEP] Keyword[return] identifier[e] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP]
}
|
private String toSimpleClassName(final String name) {
StringBuilder builder = new StringBuilder(name.length());
for (String token : SPLIT_PATTERN.split(name)) {
if (!token.isEmpty()) {
builder.append(Character.toUpperCase(token.charAt(0)));
builder.append(token.substring(1).toLowerCase(Locale.ROOT));
}
}
builder.append(service.getSimpleName());
return builder.toString();
} | class class_name[name] begin[{]
method[toSimpleClassName, return_type[type[String]], modifier[private], parameter[name]] begin[{]
local_variable[type[StringBuilder], builder]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=token, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=token, selectors=[], type_arguments=None)], member=toUpperCase, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=token, selectors=[MethodInvocation(arguments=[MemberReference(member=ROOT, postfix_operators=[], prefix_operators=[], qualifier=Locale, selectors=[])], member=toLowerCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=split, postfix_operators=[], prefix_operators=[], qualifier=SPLIT_PATTERN, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=token)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[builder.append, parameter[call[service.getSimpleName, parameter[]]]]
return[call[builder.toString, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[toSimpleClassName] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] {
identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[name] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[token] operator[:] identifier[SPLIT_PATTERN] operator[SEP] identifier[split] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[token] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[Character] operator[SEP] identifier[toUpperCase] operator[SEP] identifier[token] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[token] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[Locale] operator[SEP] identifier[ROOT] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[service] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public EntityModel<Order> process(EntityModel<Order> model) {
model.add( // <2>
new Link("/payments/{orderId}").withRel(LinkRelation.of("payments")) //
.expand(model.getContent().getOrderId()));
return model; // <3>
} | class class_name[name] begin[{]
method[process, return_type[type[EntityModel]], modifier[public], parameter[model]] begin[{]
call[model.add, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/payments/{orderId}")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="payments")], member=of, postfix_operators=[], prefix_operators=[], qualifier=LinkRelation, selectors=[], type_arguments=None)], member=withRel, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getContent, postfix_operators=[], prefix_operators=[], qualifier=model, selectors=[MethodInvocation(arguments=[], member=getOrderId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=expand, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Link, sub_type=None))]]
return[member[.model]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EntityModel] operator[<] identifier[Order] operator[>] identifier[process] operator[SEP] identifier[EntityModel] operator[<] identifier[Order] operator[>] identifier[model] operator[SEP] {
identifier[model] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Link] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[withRel] operator[SEP] identifier[LinkRelation] operator[SEP] identifier[of] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[expand] operator[SEP] identifier[model] operator[SEP] identifier[getContent] operator[SEP] operator[SEP] operator[SEP] identifier[getOrderId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[model] operator[SEP]
}
|
public java.util.List<String> getRemoveAllowedPrincipals() {
if (removeAllowedPrincipals == null) {
removeAllowedPrincipals = new com.amazonaws.internal.SdkInternalList<String>();
}
return removeAllowedPrincipals;
} | class class_name[name] begin[{]
method[getRemoveAllowedPrincipals, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.removeAllowedPrincipals], ==, literal[null]]] begin[{]
assign[member[.removeAllowedPrincipals], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.removeAllowedPrincipals]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[getRemoveAllowedPrincipals] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[removeAllowedPrincipals] operator[==] Other[null] operator[SEP] {
identifier[removeAllowedPrincipals] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[removeAllowedPrincipals] operator[SEP]
}
|
public final Tuple4<T8, T9, T10, T11> skip7() {
return new Tuple4<>(v8, v9, v10, v11);
} | class class_name[name] begin[{]
method[skip7, return_type[type[Tuple4]], modifier[final public], parameter[]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=v8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=v9, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=v10, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=v11, 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=Tuple4, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[Tuple4] operator[<] identifier[T8] , identifier[T9] , identifier[T10] , identifier[T11] operator[>] identifier[skip7] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[Tuple4] operator[<] operator[>] operator[SEP] identifier[v8] , identifier[v9] , identifier[v10] , identifier[v11] operator[SEP] operator[SEP]
}
|
public static boolean toBoolean(final String str, final String trueString, final String falseString) {
if (str == trueString) {
return true;
} else if (str == falseString) {
return false;
} else if (str != null) {
if (str.equals(trueString)) {
return true;
} else if (str.equals(falseString)) {
return false;
}
}
// no match
throw new IllegalArgumentException("The String did not match either specified value");
} | class class_name[name] begin[{]
method[toBoolean, return_type[type[boolean]], modifier[public static], parameter[str, trueString, falseString]] begin[{]
if[binary_operation[member[.str], ==, member[.trueString]]] begin[{]
return[literal[true]]
else begin[{]
if[binary_operation[member[.str], ==, member[.falseString]]] begin[{]
return[literal[false]]
else begin[{]
if[binary_operation[member[.str], !=, literal[null]]] begin[{]
if[call[str.equals, parameter[member[.trueString]]]] begin[{]
return[literal[true]]
else begin[{]
if[call[str.equals, parameter[member[.falseString]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The String did not match either specified value")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[toBoolean] operator[SEP] Keyword[final] identifier[String] identifier[str] , Keyword[final] identifier[String] identifier[trueString] , Keyword[final] identifier[String] identifier[falseString] operator[SEP] {
Keyword[if] operator[SEP] identifier[str] operator[==] identifier[trueString] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[str] operator[==] identifier[falseString] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[str] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[str] operator[SEP] identifier[equals] operator[SEP] identifier[trueString] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[str] operator[SEP] identifier[equals] operator[SEP] identifier[falseString] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
void expectSuperType(Node n, ObjectType superObject, ObjectType subObject) {
FunctionType subCtor = subObject.getConstructor();
ObjectType implicitProto = subObject.getImplicitPrototype();
ObjectType declaredSuper =
implicitProto == null ? null : implicitProto.getImplicitPrototype();
if (declaredSuper != null && declaredSuper.isTemplatizedType()) {
declaredSuper =
declaredSuper.toMaybeTemplatizedType().getReferencedType();
}
if (declaredSuper != null
&& !(superObject instanceof UnknownType)
&& !declaredSuper.isEquivalentTo(superObject)) {
if (declaredSuper.isEquivalentTo(getNativeType(OBJECT_TYPE))) {
registerMismatch(
superObject,
declaredSuper,
report(JSError.make(n, MISSING_EXTENDS_TAG_WARNING, subObject.toString())));
} else {
mismatch(n, "mismatch in declaration of superclass type", superObject, declaredSuper);
}
// Correct the super type.
if (!subCtor.hasCachedValues()) {
subCtor.setPrototypeBasedOn(superObject);
}
}
} | class class_name[name] begin[{]
method[expectSuperType, return_type[void], modifier[default], parameter[n, superObject, subObject]] begin[{]
local_variable[type[FunctionType], subCtor]
local_variable[type[ObjectType], implicitProto]
local_variable[type[ObjectType], declaredSuper]
if[binary_operation[binary_operation[member[.declaredSuper], !=, literal[null]], &&, call[declaredSuper.isTemplatizedType, parameter[]]]] begin[{]
assign[member[.declaredSuper], call[declaredSuper.toMaybeTemplatizedType, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.declaredSuper], !=, literal[null]], &&, binary_operation[member[.superObject], instanceof, type[UnknownType]]], &&, call[declaredSuper.isEquivalentTo, parameter[member[.superObject]]]]] begin[{]
if[call[declaredSuper.isEquivalentTo, parameter[call[.getNativeType, parameter[member[.OBJECT_TYPE]]]]]] begin[{]
call[.registerMismatch, parameter[member[.superObject], member[.declaredSuper], call[.report, parameter[call[JSError.make, parameter[member[.n], member[.MISSING_EXTENDS_TAG_WARNING], call[subObject.toString, parameter[]]]]]]]]
else begin[{]
call[.mismatch, parameter[member[.n], literal["mismatch in declaration of superclass type"], member[.superObject], member[.declaredSuper]]]
end[}]
if[call[subCtor.hasCachedValues, parameter[]]] begin[{]
call[subCtor.setPrototypeBasedOn, parameter[member[.superObject]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[expectSuperType] operator[SEP] identifier[Node] identifier[n] , identifier[ObjectType] identifier[superObject] , identifier[ObjectType] identifier[subObject] operator[SEP] {
identifier[FunctionType] identifier[subCtor] operator[=] identifier[subObject] operator[SEP] identifier[getConstructor] operator[SEP] operator[SEP] operator[SEP] identifier[ObjectType] identifier[implicitProto] operator[=] identifier[subObject] operator[SEP] identifier[getImplicitPrototype] operator[SEP] operator[SEP] operator[SEP] identifier[ObjectType] identifier[declaredSuper] operator[=] identifier[implicitProto] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[implicitProto] operator[SEP] identifier[getImplicitPrototype] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[declaredSuper] operator[!=] Other[null] operator[&&] identifier[declaredSuper] operator[SEP] identifier[isTemplatizedType] operator[SEP] operator[SEP] operator[SEP] {
identifier[declaredSuper] operator[=] identifier[declaredSuper] operator[SEP] identifier[toMaybeTemplatizedType] operator[SEP] operator[SEP] operator[SEP] identifier[getReferencedType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[declaredSuper] operator[!=] Other[null] operator[&&] operator[!] operator[SEP] identifier[superObject] Keyword[instanceof] identifier[UnknownType] operator[SEP] operator[&&] operator[!] identifier[declaredSuper] operator[SEP] identifier[isEquivalentTo] operator[SEP] identifier[superObject] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[declaredSuper] operator[SEP] identifier[isEquivalentTo] operator[SEP] identifier[getNativeType] operator[SEP] identifier[OBJECT_TYPE] operator[SEP] operator[SEP] operator[SEP] {
identifier[registerMismatch] operator[SEP] identifier[superObject] , identifier[declaredSuper] , identifier[report] operator[SEP] identifier[JSError] operator[SEP] identifier[make] operator[SEP] identifier[n] , identifier[MISSING_EXTENDS_TAG_WARNING] , identifier[subObject] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[mismatch] operator[SEP] identifier[n] , literal[String] , identifier[superObject] , identifier[declaredSuper] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[subCtor] operator[SEP] identifier[hasCachedValues] operator[SEP] operator[SEP] operator[SEP] {
identifier[subCtor] operator[SEP] identifier[setPrototypeBasedOn] operator[SEP] identifier[superObject] operator[SEP] operator[SEP]
}
}
}
|
private List<Object> findUsingLucene(EntityMetadata m, Client client, Object[] primaryKeys)
{
String idField = m.getIdAttribute().getName();
String equals = "=";
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
EntityType entityType = metaModel.entity(m.getEntityClazz());
String columnName = ((AbstractAttribute) entityType.getAttribute(idField)).getJPAColumnName();
List<Object> result = new ArrayList<Object>();
Queue queue = getKunderaQuery().getFilterClauseQueue();
KunderaQuery kunderaQuery = getKunderaQuery();
for (Object primaryKey : primaryKeys)
{
FilterClause filterClause = kunderaQuery.new FilterClause(columnName, equals, primaryKey, idField);
kunderaQuery.setFilter(kunderaQuery.getEntityAlias() + "." + columnName + " = " + primaryKey);
queue.clear();
queue.add(filterClause);
List<Object> object = findUsingLucene(m, client);
if (object != null && !object.isEmpty())
result.add(object.get(0));
}
return result;
} | class class_name[name] begin[{]
method[findUsingLucene, return_type[type[List]], modifier[private], parameter[m, client, primaryKeys]] begin[{]
local_variable[type[String], idField]
local_variable[type[String], equals]
local_variable[type[MetamodelImpl], metaModel]
local_variable[type[EntityType], entityType]
local_variable[type[String], columnName]
local_variable[type[List], result]
local_variable[type[Queue], queue]
local_variable[type[KunderaQuery], kunderaQuery]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=InnerClassCreator(arguments=[MemberReference(member=columnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=equals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=primaryKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=idField, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=kunderaQuery, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FilterClause, sub_type=None)), name=filterClause)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FilterClause, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getEntityAlias, postfix_operators=[], prefix_operators=[], qualifier=kunderaQuery, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=columnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" = "), operator=+), operandr=MemberReference(member=primaryKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=setFilter, postfix_operators=[], prefix_operators=[], qualifier=kunderaQuery, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=queue, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=filterClause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=queue, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=client, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findUsingLucene, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=object)], 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)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=object, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=object, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=primaryKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=primaryKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[Object] operator[>] identifier[findUsingLucene] operator[SEP] identifier[EntityMetadata] identifier[m] , identifier[Client] identifier[client] , identifier[Object] operator[SEP] operator[SEP] identifier[primaryKeys] operator[SEP] {
identifier[String] identifier[idField] operator[=] identifier[m] operator[SEP] identifier[getIdAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[equals] operator[=] literal[String] operator[SEP] identifier[MetamodelImpl] identifier[metaModel] operator[=] operator[SEP] identifier[MetamodelImpl] operator[SEP] identifier[kunderaMetadata] operator[SEP] identifier[getApplicationMetadata] operator[SEP] operator[SEP] operator[SEP] identifier[getMetamodel] operator[SEP] identifier[m] operator[SEP] identifier[getPersistenceUnit] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[EntityType] identifier[entityType] operator[=] identifier[metaModel] operator[SEP] identifier[entity] operator[SEP] identifier[m] operator[SEP] identifier[getEntityClazz] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[columnName] operator[=] operator[SEP] operator[SEP] identifier[AbstractAttribute] operator[SEP] identifier[entityType] operator[SEP] identifier[getAttribute] operator[SEP] identifier[idField] operator[SEP] operator[SEP] operator[SEP] identifier[getJPAColumnName] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Queue] identifier[queue] operator[=] identifier[getKunderaQuery] operator[SEP] operator[SEP] operator[SEP] identifier[getFilterClauseQueue] operator[SEP] operator[SEP] operator[SEP] identifier[KunderaQuery] identifier[kunderaQuery] operator[=] identifier[getKunderaQuery] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[primaryKey] operator[:] identifier[primaryKeys] operator[SEP] {
identifier[FilterClause] identifier[filterClause] operator[=] identifier[kunderaQuery] operator[SEP] Keyword[new] identifier[FilterClause] operator[SEP] identifier[columnName] , identifier[equals] , identifier[primaryKey] , identifier[idField] operator[SEP] operator[SEP] identifier[kunderaQuery] operator[SEP] identifier[setFilter] operator[SEP] identifier[kunderaQuery] operator[SEP] identifier[getEntityAlias] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[columnName] operator[+] literal[String] operator[+] identifier[primaryKey] operator[SEP] operator[SEP] identifier[queue] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[queue] operator[SEP] identifier[add] operator[SEP] identifier[filterClause] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] identifier[object] operator[=] identifier[findUsingLucene] operator[SEP] identifier[m] , identifier[client] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[object] operator[!=] Other[null] operator[&&] operator[!] identifier[object] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[object] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static int getFineDirection (double theta)
{
theta = ((theta + Math.PI) * 8) / Math.PI;
return ANGLE_MAP[(int)Math.round(theta) % FINE_DIRECTION_COUNT];
} | class class_name[name] begin[{]
method[getFineDirection, return_type[type[int]], modifier[public static], parameter[theta]] begin[{]
assign[member[.theta], binary_operation[binary_operation[binary_operation[member[.theta], +, member[Math.PI]], *, literal[8]], /, member[Math.PI]]]
return[member[.ANGLE_MAP]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[getFineDirection] operator[SEP] Keyword[double] identifier[theta] operator[SEP] {
identifier[theta] operator[=] operator[SEP] operator[SEP] identifier[theta] operator[+] identifier[Math] operator[SEP] identifier[PI] operator[SEP] operator[*] Other[8] operator[SEP] operator[/] identifier[Math] operator[SEP] identifier[PI] operator[SEP] Keyword[return] identifier[ANGLE_MAP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[theta] operator[SEP] operator[%] identifier[FINE_DIRECTION_COUNT] operator[SEP] operator[SEP]
}
|
@Nullable
public static String getTableName(Path rootPath, Path path) {
path = qualified(rootPath, path);
if (rootPath.equals(path)) {
// Path is root, no table
return null;
}
Path tablePath;
Path parent = path.getParent();
if (Objects.equals(parent, rootPath)) {
// The path itself represents a table (e.g.; emodb://ci.us/mytable)
tablePath = path;
} else if (parent != null && Objects.equals(parent.getParent(), rootPath)) {
// The path is a split (e.g.; emodb://ci.us/mytable/split-id)
tablePath = parent;
} else {
throw new IllegalArgumentException(
format("Path does not represent a table, split, or root (path=%s, root=%s)", path, rootPath));
}
return decode(tablePath.getName());
} | class class_name[name] begin[{]
method[getTableName, return_type[type[String]], modifier[public static], parameter[rootPath, path]] begin[{]
assign[member[.path], call[.qualified, parameter[member[.rootPath], member[.path]]]]
if[call[rootPath.equals, parameter[member[.path]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Path], tablePath]
local_variable[type[Path], parent]
if[call[Objects.equals, parameter[member[.parent], member[.rootPath]]]] begin[{]
assign[member[.tablePath], member[.path]]
else begin[{]
if[binary_operation[binary_operation[member[.parent], !=, literal[null]], &&, call[Objects.equals, parameter[call[parent.getParent, parameter[]], member[.rootPath]]]]] begin[{]
assign[member[.tablePath], member[.parent]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Path does not represent a table, split, or root (path=%s, root=%s)"), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rootPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, 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=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
return[call[.decode, parameter[call[tablePath.getName, parameter[]]]]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[String] identifier[getTableName] operator[SEP] identifier[Path] identifier[rootPath] , identifier[Path] identifier[path] operator[SEP] {
identifier[path] operator[=] identifier[qualified] operator[SEP] identifier[rootPath] , identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rootPath] operator[SEP] identifier[equals] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Path] identifier[tablePath] operator[SEP] identifier[Path] identifier[parent] operator[=] identifier[path] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[parent] , identifier[rootPath] operator[SEP] operator[SEP] {
identifier[tablePath] operator[=] identifier[path] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[parent] operator[!=] Other[null] operator[&&] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[parent] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] , identifier[rootPath] operator[SEP] operator[SEP] {
identifier[tablePath] operator[=] identifier[parent] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[path] , identifier[rootPath] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[decode] operator[SEP] identifier[tablePath] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public List<T> getAllEndpoints() {
ArrayList<T> list = new ArrayList<>(endpoints.length);
for (int i = 0; i < endpoints.length; i++) {
list.add((T) endpoints[i]);
}
return list;
} | class class_name[name] begin[{]
method[getAllEndpoints, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[ArrayList], list]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=endpoints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, 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=endpoints, 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[.list]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[T] operator[>] identifier[getAllEndpoints] operator[SEP] operator[SEP] {
identifier[ArrayList] operator[<] identifier[T] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[endpoints] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[endpoints] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[list] operator[SEP] identifier[add] operator[SEP] operator[SEP] identifier[T] operator[SEP] identifier[endpoints] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
public static Writer
createWriter(Configuration conf, FSDataOutputStream out,
Class keyClass, Class valClass, CompressionType compressionType,
CompressionCodec codec)
throws IOException {
Writer writer = createWriter(conf, out, keyClass, valClass, compressionType,
codec, new Metadata());
return writer;
} | class class_name[name] begin[{]
method[createWriter, return_type[type[Writer]], modifier[public static], parameter[conf, out, keyClass, valClass, compressionType, codec]] begin[{]
local_variable[type[Writer], writer]
return[member[.writer]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Writer] identifier[createWriter] operator[SEP] identifier[Configuration] identifier[conf] , identifier[FSDataOutputStream] identifier[out] , identifier[Class] identifier[keyClass] , identifier[Class] identifier[valClass] , identifier[CompressionType] identifier[compressionType] , identifier[CompressionCodec] identifier[codec] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Writer] identifier[writer] operator[=] identifier[createWriter] operator[SEP] identifier[conf] , identifier[out] , identifier[keyClass] , identifier[valClass] , identifier[compressionType] , identifier[codec] , Keyword[new] identifier[Metadata] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[writer] operator[SEP]
}
|
public void setNamespace(String prefix, String uri) {
this.prefix2namespace.put(prefix, uri);
this.namespace2prefix.put(uri, prefix);
} | class class_name[name] begin[{]
method[setNamespace, return_type[void], modifier[public], parameter[prefix, uri]] begin[{]
THIS[member[None.prefix2namespace]call[None.put, parameter[member[.prefix], member[.uri]]]]
THIS[member[None.namespace2prefix]call[None.put, parameter[member[.uri], member[.prefix]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setNamespace] operator[SEP] identifier[String] identifier[prefix] , identifier[String] identifier[uri] operator[SEP] {
Keyword[this] operator[SEP] identifier[prefix2namespace] operator[SEP] identifier[put] operator[SEP] identifier[prefix] , identifier[uri] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[namespace2prefix] operator[SEP] identifier[put] operator[SEP] identifier[uri] , identifier[prefix] operator[SEP] operator[SEP]
}
|
public MaterializeBuilder withFullscreen(boolean fullscreen) {
this.mFullscreen = fullscreen;
if (fullscreen) {
withTranslucentNavigationBarProgrammatically(true);
withTintedStatusBar(false);
withTintedNavigationBar(false);
}
return this;
} | class class_name[name] begin[{]
method[withFullscreen, return_type[type[MaterializeBuilder]], modifier[public], parameter[fullscreen]] begin[{]
assign[THIS[member[None.mFullscreen]], member[.fullscreen]]
if[member[.fullscreen]] begin[{]
call[.withTranslucentNavigationBarProgrammatically, parameter[literal[true]]]
call[.withTintedStatusBar, parameter[literal[false]]]
call[.withTintedNavigationBar, parameter[literal[false]]]
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[MaterializeBuilder] identifier[withFullscreen] operator[SEP] Keyword[boolean] identifier[fullscreen] operator[SEP] {
Keyword[this] operator[SEP] identifier[mFullscreen] operator[=] identifier[fullscreen] operator[SEP] Keyword[if] operator[SEP] identifier[fullscreen] operator[SEP] {
identifier[withTranslucentNavigationBarProgrammatically] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[withTintedStatusBar] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[withTintedNavigationBar] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
protected void transmitPartialTask(final Task<Diff> result)
throws TimeoutException
{
this.diffedSize += result.byteSize();
this.processingTimeDiff += System.currentTimeMillis() - startTime;
super.transmitPartialTask(result);
startTime = System.currentTimeMillis();
} | class class_name[name] begin[{]
method[transmitPartialTask, return_type[void], modifier[protected], parameter[result]] begin[{]
assign[THIS[member[None.diffedSize]], call[result.byteSize, parameter[]]]
assign[THIS[member[None.processingTimeDiff]], binary_operation[call[System.currentTimeMillis, parameter[]], -, member[.startTime]]]
SuperMethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=transmitPartialTask, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
assign[member[.startTime], call[System.currentTimeMillis, parameter[]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[transmitPartialTask] operator[SEP] Keyword[final] identifier[Task] operator[<] identifier[Diff] operator[>] identifier[result] operator[SEP] Keyword[throws] identifier[TimeoutException] {
Keyword[this] operator[SEP] identifier[diffedSize] operator[+=] identifier[result] operator[SEP] identifier[byteSize] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[processingTimeDiff] operator[+=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[startTime] operator[SEP] Keyword[super] operator[SEP] identifier[transmitPartialTask] operator[SEP] identifier[result] operator[SEP] operator[SEP] identifier[startTime] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP]
}
|
private ServiceReference checkService(ServiceReference serviceReference, String interfaceClassName)
{
if (serviceReference != null)
{
Object service = bundleContext.getService(serviceReference);
if (service != null)
{
try {
if (interfaceClassName != null)
if (!service.getClass().isAssignableFrom(Class.forName(interfaceClassName)))
serviceReference = null;
} catch (ClassNotFoundException e) {
// Ignore this error
}
}
}
return serviceReference;
} | class class_name[name] begin[{]
method[checkService, return_type[type[ServiceReference]], modifier[private], parameter[serviceReference, interfaceClassName]] begin[{]
if[binary_operation[member[.serviceReference], !=, literal[null]]] begin[{]
local_variable[type[Object], service]
if[binary_operation[member[.service], !=, literal[null]]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=interfaceClassName, 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=IfStatement(condition=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=['!'], qualifier=service, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=interfaceClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=serviceReference, 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=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.serviceReference]]
end[}]
END[}] | Keyword[private] identifier[ServiceReference] identifier[checkService] operator[SEP] identifier[ServiceReference] identifier[serviceReference] , identifier[String] identifier[interfaceClassName] operator[SEP] {
Keyword[if] operator[SEP] identifier[serviceReference] operator[!=] Other[null] operator[SEP] {
identifier[Object] identifier[service] operator[=] identifier[bundleContext] operator[SEP] identifier[getService] operator[SEP] identifier[serviceReference] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[service] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[interfaceClassName] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[service] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[interfaceClassName] operator[SEP] operator[SEP] operator[SEP] identifier[serviceReference] operator[=] Other[null] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
}
}
}
Keyword[return] identifier[serviceReference] operator[SEP]
}
|
public Edge edgeFromJson(final JsonNode json, final Vertex out, final Vertex in) throws IOException {
final Map<String, Object> props = OGraphSONUtility.readProperties(json, true, this.hasEmbeddedTypes);
final Object edgeId = getTypedValueFromJsonNode(json.get(GraphSONTokens._ID));
final JsonNode nodeLabel = json.get(GraphSONTokens._LABEL);
// assigned an empty string edge label in cases where one does not exist. this gets around the requirement
// that blueprints graphs have a non-null label while ensuring that GraphSON can stay flexible in parsing
// partial bits from the JSON. Not sure if there is any gotchas developing out of this.
final String label = nodeLabel == null ? EMPTY_STRING : nodeLabel.textValue();
final Edge e = factory.createEdge(edgeId, out, in, label);
for (Map.Entry<String, Object> entry : props.entrySet()) {
// if (this.edgePropertyKeys == null || this.edgePropertyKeys.contains(entry.getKey())) {
if (includeKey(entry.getKey(), edgePropertyKeys, this.edgePropertiesRule)) {
e.setProperty(entry.getKey(), entry.getValue());
}
}
return e;
} | class class_name[name] begin[{]
method[edgeFromJson, return_type[type[Edge]], modifier[public], parameter[json, out, in]] begin[{]
local_variable[type[Map], props]
local_variable[type[Object], edgeId]
local_variable[type[JsonNode], nodeLabel]
local_variable[type[String], label]
local_variable[type[Edge], e]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MemberReference(member=edgePropertyKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=edgePropertiesRule, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=includeKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=props, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.e]]
end[}]
END[}] | Keyword[public] identifier[Edge] identifier[edgeFromJson] operator[SEP] Keyword[final] identifier[JsonNode] identifier[json] , Keyword[final] identifier[Vertex] identifier[out] , Keyword[final] identifier[Vertex] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[props] operator[=] identifier[OGraphSONUtility] operator[SEP] identifier[readProperties] operator[SEP] identifier[json] , literal[boolean] , Keyword[this] operator[SEP] identifier[hasEmbeddedTypes] operator[SEP] operator[SEP] Keyword[final] identifier[Object] identifier[edgeId] operator[=] identifier[getTypedValueFromJsonNode] operator[SEP] identifier[json] operator[SEP] identifier[get] operator[SEP] identifier[GraphSONTokens] operator[SEP] identifier[_ID] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[JsonNode] identifier[nodeLabel] operator[=] identifier[json] operator[SEP] identifier[get] operator[SEP] identifier[GraphSONTokens] operator[SEP] identifier[_LABEL] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[label] operator[=] identifier[nodeLabel] operator[==] Other[null] operator[?] identifier[EMPTY_STRING] operator[:] identifier[nodeLabel] operator[SEP] identifier[textValue] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Edge] identifier[e] operator[=] identifier[factory] operator[SEP] identifier[createEdge] operator[SEP] identifier[edgeId] , identifier[out] , identifier[in] , identifier[label] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[entry] operator[:] identifier[props] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[includeKey] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[edgePropertyKeys] , Keyword[this] operator[SEP] identifier[edgePropertiesRule] operator[SEP] operator[SEP] {
identifier[e] operator[SEP] identifier[setProperty] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[e] operator[SEP]
}
|
public static DefaultMutableTreeNode findNode(
TreeModel treeModel, Object userObject)
{
return findNode(treeModel, treeModel.getRoot(), userObject);
} | class class_name[name] begin[{]
method[findNode, return_type[type[DefaultMutableTreeNode]], modifier[public static], parameter[treeModel, userObject]] begin[{]
return[call[.findNode, parameter[member[.treeModel], call[treeModel.getRoot, parameter[]], member[.userObject]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DefaultMutableTreeNode] identifier[findNode] operator[SEP] identifier[TreeModel] identifier[treeModel] , identifier[Object] identifier[userObject] operator[SEP] {
Keyword[return] identifier[findNode] operator[SEP] identifier[treeModel] , identifier[treeModel] operator[SEP] identifier[getRoot] operator[SEP] operator[SEP] , identifier[userObject] operator[SEP] operator[SEP]
}
|
private String nextQuotedValue(char quote)
{
// Like nextNonWhitespace, this uses locals 'p' and 'l' to save inner-loop field access.
StringBuilder builder = new StringBuilder();
int p = pos;
/* the index of the first character not yet appended to the builder. */
int start = p;
while (p < limit) {
int c = in.charAt(p++);
if (c == quote) {
pos = p;
builder.append(in.substring(start, p - 1));
return builder.toString();
} else if (c == '\\') {
pos = p;
builder.append(in.substring(start, p - 1));
builder.append(readEscapeCharacter());
p = pos;
start = p;
} else if (c == '\n') {
lineNumber++;
lineStart = p;
}
}
throw syntaxError("Unterminated string");
} | class class_name[name] begin[{]
method[nextQuotedValue, return_type[type[String]], modifier[private], parameter[quote]] begin[{]
local_variable[type[StringBuilder], builder]
local_variable[type[int], p]
local_variable[type[int], start]
while[binary_operation[member[.p], <, member[.limit]]] begin[{]
local_variable[type[int], c]
if[binary_operation[member[.c], ==, member[.quote]]] begin[{]
assign[member[.pos], member[.p]]
call[builder.append, parameter[call[in.substring, parameter[member[.start], binary_operation[member[.p], -, literal[1]]]]]]
return[call[builder.toString, parameter[]]]
else begin[{]
if[binary_operation[member[.c], ==, literal['\\']]] begin[{]
assign[member[.pos], member[.p]]
call[builder.append, parameter[call[in.substring, parameter[member[.start], binary_operation[member[.p], -, literal[1]]]]]]
call[builder.append, parameter[call[.readEscapeCharacter, parameter[]]]]
assign[member[.p], member[.pos]]
assign[member[.start], member[.p]]
else begin[{]
if[binary_operation[member[.c], ==, literal['\n']]] begin[{]
member[.lineNumber]
assign[member[.lineStart], member[.p]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
ThrowStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unterminated string")], member=syntaxError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[private] identifier[String] identifier[nextQuotedValue] operator[SEP] Keyword[char] identifier[quote] operator[SEP] {
identifier[StringBuilder] identifier[builder] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[p] operator[=] identifier[pos] operator[SEP] Keyword[int] identifier[start] operator[=] identifier[p] operator[SEP] Keyword[while] operator[SEP] identifier[p] operator[<] identifier[limit] operator[SEP] {
Keyword[int] identifier[c] operator[=] identifier[in] operator[SEP] identifier[charAt] operator[SEP] identifier[p] operator[++] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] identifier[quote] operator[SEP] {
identifier[pos] operator[=] identifier[p] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[in] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[p] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[pos] operator[=] identifier[p] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[in] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[p] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[append] operator[SEP] identifier[readEscapeCharacter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[p] operator[=] identifier[pos] operator[SEP] identifier[start] operator[=] identifier[p] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[lineNumber] operator[++] operator[SEP] identifier[lineStart] operator[=] identifier[p] operator[SEP]
}
}
Keyword[throw] identifier[syntaxError] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.