code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
public DirectoryStream<Path> newDirectoryStream(
JimfsPath dir,
DirectoryStream.Filter<? super Path> filter,
Set<? super LinkOption> options,
JimfsPath basePathForStream)
throws IOException {
Directory file = (Directory) lookUpWithLock(dir, options).requireDirectory(dir).file();
FileSystemView view = new FileSystemView(store, file, basePathForStream);
JimfsSecureDirectoryStream stream = new JimfsSecureDirectoryStream(view, filter, state());
return store.supportsFeature(Feature.SECURE_DIRECTORY_STREAM)
? stream
: new DowngradedDirectoryStream(stream);
} | class class_name[name] begin[{]
method[newDirectoryStream, return_type[type[DirectoryStream]], modifier[public], parameter[dir, filter, options, basePathForStream]] begin[{]
local_variable[type[Directory], file]
local_variable[type[FileSystemView], view]
local_variable[type[JimfsSecureDirectoryStream], stream]
return[TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=SECURE_DIRECTORY_STREAM, postfix_operators=[], prefix_operators=[], qualifier=Feature, selectors=[])], member=supportsFeature, postfix_operators=[], prefix_operators=[], qualifier=store, selectors=[], type_arguments=None), if_false=ClassCreator(arguments=[MemberReference(member=stream, 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=DowngradedDirectoryStream, sub_type=None)), if_true=MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
END[}] | Keyword[public] identifier[DirectoryStream] operator[<] identifier[Path] operator[>] identifier[newDirectoryStream] operator[SEP] identifier[JimfsPath] identifier[dir] , identifier[DirectoryStream] operator[SEP] identifier[Filter] operator[<] operator[?] Keyword[super] identifier[Path] operator[>] identifier[filter] , identifier[Set] operator[<] operator[?] Keyword[super] identifier[LinkOption] operator[>] identifier[options] , identifier[JimfsPath] identifier[basePathForStream] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Directory] identifier[file] operator[=] operator[SEP] identifier[Directory] operator[SEP] identifier[lookUpWithLock] operator[SEP] identifier[dir] , identifier[options] operator[SEP] operator[SEP] identifier[requireDirectory] operator[SEP] identifier[dir] operator[SEP] operator[SEP] identifier[file] operator[SEP] operator[SEP] operator[SEP] identifier[FileSystemView] identifier[view] operator[=] Keyword[new] identifier[FileSystemView] operator[SEP] identifier[store] , identifier[file] , identifier[basePathForStream] operator[SEP] operator[SEP] identifier[JimfsSecureDirectoryStream] identifier[stream] operator[=] Keyword[new] identifier[JimfsSecureDirectoryStream] operator[SEP] identifier[view] , identifier[filter] , identifier[state] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[store] operator[SEP] identifier[supportsFeature] operator[SEP] identifier[Feature] operator[SEP] identifier[SECURE_DIRECTORY_STREAM] operator[SEP] operator[?] identifier[stream] operator[:] Keyword[new] identifier[DowngradedDirectoryStream] operator[SEP] identifier[stream] operator[SEP] operator[SEP]
}
|
public boolean shouldYieldFocus(JComponent input) {
boolean isValidInput = verify(input);
if (isValidInput) {
input.setBackground(background);
} else {
input.setBackground(warningBackground);
}
return isValidInput;
} | class class_name[name] begin[{]
method[shouldYieldFocus, return_type[type[boolean]], modifier[public], parameter[input]] begin[{]
local_variable[type[boolean], isValidInput]
if[member[.isValidInput]] begin[{]
call[input.setBackground, parameter[member[.background]]]
else begin[{]
call[input.setBackground, parameter[member[.warningBackground]]]
end[}]
return[member[.isValidInput]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[shouldYieldFocus] operator[SEP] identifier[JComponent] identifier[input] operator[SEP] {
Keyword[boolean] identifier[isValidInput] operator[=] identifier[verify] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isValidInput] operator[SEP] {
identifier[input] operator[SEP] identifier[setBackground] operator[SEP] identifier[background] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[input] operator[SEP] identifier[setBackground] operator[SEP] identifier[warningBackground] operator[SEP] operator[SEP]
}
Keyword[return] identifier[isValidInput] operator[SEP]
}
|
private JarFile getJarFile(String jarFileUrl) throws IOException {
if (jarFileUrl.startsWith("file:")) {
try {
final URI uri = new URI(jarFileUrl.replaceAll(" ", "\\%20"));
final String jarFileName = uri.getSchemeSpecificPart();
logger.info("Creating new JarFile based on URI-scheme filename: {}", jarFileName);
return new JarFile(jarFileName);
} catch (URISyntaxException ex) {
// Fallback for URLs that are not valid URIs (should hardly ever
// happen).
final String jarFileName = jarFileUrl.substring("file:".length());
logger.info("Creating new JarFile based on alternative filename: {}", jarFileName);
return new JarFile(jarFileName);
}
} else {
logger.info("Creating new JarFile based on URI (with '!/'): {}", jarFileUrl);
return new JarFile(jarFileUrl);
}
} | class class_name[name] begin[{]
method[getJarFile, return_type[type[JarFile]], modifier[private], parameter[jarFileUrl]] begin[{]
if[call[jarFileUrl.startsWith, parameter[literal["file:"]]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\%20")], member=replaceAll, postfix_operators=[], prefix_operators=[], qualifier=jarFileUrl, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URI, sub_type=None)), name=uri)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=URI, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSchemeSpecificPart, postfix_operators=[], prefix_operators=[], qualifier=uri, selectors=[], type_arguments=None), name=jarFileName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Creating new JarFile based on URI-scheme filename: {}"), MemberReference(member=jarFileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=jarFileName, 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=JarFile, sub_type=None)), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="file:")], member=substring, postfix_operators=[], prefix_operators=[], qualifier=jarFileUrl, selectors=[], type_arguments=None), name=jarFileName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Creating new JarFile based on alternative filename: {}"), MemberReference(member=jarFileName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=jarFileName, 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=JarFile, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
else begin[{]
call[logger.info, parameter[literal["Creating new JarFile based on URI (with '!/'): {}"], member[.jarFileUrl]]]
return[ClassCreator(arguments=[MemberReference(member=jarFileUrl, 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=JarFile, sub_type=None))]
end[}]
end[}]
END[}] | Keyword[private] identifier[JarFile] identifier[getJarFile] operator[SEP] identifier[String] identifier[jarFileUrl] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[jarFileUrl] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[final] identifier[URI] identifier[uri] operator[=] Keyword[new] identifier[URI] operator[SEP] identifier[jarFileUrl] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[jarFileName] operator[=] identifier[uri] operator[SEP] identifier[getSchemeSpecificPart] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[jarFileName] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[JarFile] operator[SEP] identifier[jarFileName] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[ex] operator[SEP] {
Keyword[final] identifier[String] identifier[jarFileName] operator[=] identifier[jarFileUrl] operator[SEP] identifier[substring] operator[SEP] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[jarFileName] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[JarFile] operator[SEP] identifier[jarFileName] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[jarFileUrl] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[JarFile] operator[SEP] identifier[jarFileUrl] operator[SEP] operator[SEP]
}
}
|
private List<Group> populateList(final int numStdDev, final int limit) {
final List<Group> list = new ArrayList<>();
for (int i = 0; i < mapArrSize; i++) {
if (hashArr[i] != 0) {
final String priKey = priKeyArr[i];
final int count = counterArr[i];
final double est = sketch.getEstimate(count);
final double ub = sketch.getUpperBound(numStdDev, count);
final double lb = sketch.getLowerBound(numStdDev, count);
final double thresh = (double) count / sketch.getRetainedEntries();
final double rse = (sketch.getUpperBound(1, count) / est) - 1.0;
final Group gp = group.copy();
gp.init(priKey, count, est, ub, lb, thresh, rse);
list.add(gp);
}
}
list.sort(null); //Comparable implemented in Group
final int totLen = list.size();
final List<Group> returnList;
if ((limit > 0) && (limit < totLen)) {
returnList = list.subList(0, limit);
} else {
returnList = list;
}
return returnList;
} | class class_name[name] begin[{]
method[populateList, return_type[type[List]], modifier[private], parameter[numStdDev, limit]] begin[{]
local_variable[type[List], list]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=hashArr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=priKeyArr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=priKey)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=counterArr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=count)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEstimate, postfix_operators=[], prefix_operators=[], qualifier=sketch, selectors=[], type_arguments=None), name=est)], modifiers={'final'}, type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=numStdDev, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getUpperBound, postfix_operators=[], prefix_operators=[], qualifier=sketch, selectors=[], type_arguments=None), name=ub)], modifiers={'final'}, type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=numStdDev, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLowerBound, postfix_operators=[], prefix_operators=[], qualifier=sketch, selectors=[], type_arguments=None), name=lb)], modifiers={'final'}, type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Cast(expression=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=double)), operandr=MethodInvocation(arguments=[], member=getRetainedEntries, postfix_operators=[], prefix_operators=[], qualifier=sketch, selectors=[], type_arguments=None), operator=/), name=thresh)], modifiers={'final'}, type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getUpperBound, postfix_operators=[], prefix_operators=[], qualifier=sketch, selectors=[], type_arguments=None), operandr=MemberReference(member=est, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1.0), operator=-), name=rse)], modifiers={'final'}, type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=copy, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[], type_arguments=None), name=gp)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=priKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=est, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ub, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=thresh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=gp, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=mapArrSize, 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[list.sort, parameter[literal[null]]]
local_variable[type[int], totLen]
local_variable[type[List], returnList]
if[binary_operation[binary_operation[member[.limit], >, literal[0]], &&, binary_operation[member[.limit], <, member[.totLen]]]] begin[{]
assign[member[.returnList], call[list.subList, parameter[literal[0], member[.limit]]]]
else begin[{]
assign[member[.returnList], member[.list]]
end[}]
return[member[.returnList]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[Group] operator[>] identifier[populateList] operator[SEP] Keyword[final] Keyword[int] identifier[numStdDev] , Keyword[final] Keyword[int] identifier[limit] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[Group] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[mapArrSize] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[hashArr] operator[SEP] identifier[i] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[final] identifier[String] identifier[priKey] operator[=] identifier[priKeyArr] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[count] operator[=] identifier[counterArr] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[est] operator[=] identifier[sketch] operator[SEP] identifier[getEstimate] operator[SEP] identifier[count] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[ub] operator[=] identifier[sketch] operator[SEP] identifier[getUpperBound] operator[SEP] identifier[numStdDev] , identifier[count] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[lb] operator[=] identifier[sketch] operator[SEP] identifier[getLowerBound] operator[SEP] identifier[numStdDev] , identifier[count] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[thresh] operator[=] operator[SEP] Keyword[double] operator[SEP] identifier[count] operator[/] identifier[sketch] operator[SEP] identifier[getRetainedEntries] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[rse] operator[=] operator[SEP] identifier[sketch] operator[SEP] identifier[getUpperBound] operator[SEP] Other[1] , identifier[count] operator[SEP] operator[/] identifier[est] operator[SEP] operator[-] literal[Float] operator[SEP] Keyword[final] identifier[Group] identifier[gp] operator[=] identifier[group] operator[SEP] identifier[copy] operator[SEP] operator[SEP] operator[SEP] identifier[gp] operator[SEP] identifier[init] operator[SEP] identifier[priKey] , identifier[count] , identifier[est] , identifier[ub] , identifier[lb] , identifier[thresh] , identifier[rse] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[gp] operator[SEP] operator[SEP]
}
}
identifier[list] operator[SEP] identifier[sort] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[totLen] operator[=] identifier[list] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Group] operator[>] identifier[returnList] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[limit] operator[>] Other[0] operator[SEP] operator[&&] operator[SEP] identifier[limit] operator[<] identifier[totLen] operator[SEP] operator[SEP] {
identifier[returnList] operator[=] identifier[list] operator[SEP] identifier[subList] operator[SEP] Other[0] , identifier[limit] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[returnList] operator[=] identifier[list] operator[SEP]
}
Keyword[return] identifier[returnList] operator[SEP]
}
|
public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
return character;
}
} else {
int c2 = get(at + 2);
character = ((c & 0x7F) << 14) | ((c1 & 0x7F) << 7) | c2;
if ((c2 & 0x80) == 0 && character > 0x3FFF && character <= 0x10FFFF
&& (character < 0xD800 || character > 0xDFFF)) {
return character;
}
}
throw new JSONException("Bad character at " + at);
} | class class_name[name] begin[{]
method[characterAt, return_type[type[int]], modifier[public], parameter[at]] begin[{]
local_variable[type[int], c]
if[binary_operation[binary_operation[member[.c], &, literal[0x80]], ==, literal[0]]] begin[{]
return[member[.c]]
else begin[{]
None
end[}]
local_variable[type[int], character]
local_variable[type[int], c1]
if[binary_operation[binary_operation[member[.c1], &, literal[0x80]], ==, literal[0]]] begin[{]
assign[member[.character], binary_operation[binary_operation[binary_operation[member[.c], &, literal[0x7F]], <<, literal[7]], |, member[.c1]]]
if[binary_operation[member[.character], >, literal[0x7F]]] begin[{]
return[member[.character]]
else begin[{]
None
end[}]
else begin[{]
local_variable[type[int], c2]
assign[member[.character], binary_operation[binary_operation[binary_operation[binary_operation[member[.c], &, literal[0x7F]], <<, literal[14]], |, binary_operation[binary_operation[member[.c1], &, literal[0x7F]], <<, literal[7]]], |, member[.c2]]]
if[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.c2], &, literal[0x80]], ==, literal[0]], &&, binary_operation[member[.character], >, literal[0x3FFF]]], &&, binary_operation[member[.character], <=, literal[0x10FFFF]]], &&, binary_operation[binary_operation[member[.character], <, literal[0xD800]], ||, binary_operation[member[.character], >, literal[0xDFFF]]]]] begin[{]
return[member[.character]]
else begin[{]
None
end[}]
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Bad character at "), operandr=MemberReference(member=at, 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=JSONException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] Keyword[int] identifier[characterAt] operator[SEP] Keyword[int] identifier[at] operator[SEP] Keyword[throws] identifier[JSONException] {
Keyword[int] identifier[c] operator[=] identifier[get] operator[SEP] identifier[at] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[c] operator[&] literal[Integer] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[c] operator[SEP]
}
Keyword[int] identifier[character] operator[SEP] Keyword[int] identifier[c1] operator[=] identifier[get] operator[SEP] identifier[at] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[c1] operator[&] literal[Integer] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[character] operator[=] operator[SEP] operator[SEP] identifier[c] operator[&] literal[Integer] operator[SEP] operator[<<] Other[7] operator[SEP] operator[|] identifier[c1] operator[SEP] Keyword[if] operator[SEP] identifier[character] operator[>] literal[Integer] operator[SEP] {
Keyword[return] identifier[character] operator[SEP]
}
}
Keyword[else] {
Keyword[int] identifier[c2] operator[=] identifier[get] operator[SEP] identifier[at] operator[+] Other[2] operator[SEP] operator[SEP] identifier[character] operator[=] operator[SEP] operator[SEP] identifier[c] operator[&] literal[Integer] operator[SEP] operator[<<] Other[14] operator[SEP] operator[|] operator[SEP] operator[SEP] identifier[c1] operator[&] literal[Integer] operator[SEP] operator[<<] Other[7] operator[SEP] operator[|] identifier[c2] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[c2] operator[&] literal[Integer] operator[SEP] operator[==] Other[0] operator[&&] identifier[character] operator[>] literal[Integer] operator[&&] identifier[character] operator[<=] literal[Integer] operator[&&] operator[SEP] identifier[character] operator[<] literal[Integer] operator[||] identifier[character] operator[>] literal[Integer] operator[SEP] operator[SEP] {
Keyword[return] identifier[character] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[JSONException] operator[SEP] literal[String] operator[+] identifier[at] operator[SEP] operator[SEP]
}
|
public static <D extends Comparable> NumberExpression<Integer> datediff(DatePart unit,
DateExpression<D> start, DateExpression<D> end) {
return Expressions.numberOperation(Integer.class, DATE_DIFF_OPS.get(unit), start, end);
} | class class_name[name] begin[{]
method[datediff, return_type[type[NumberExpression]], modifier[public static], parameter[unit, start, end]] begin[{]
return[call[Expressions.numberOperation, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None)), call[DATE_DIFF_OPS.get, parameter[member[.unit]]], member[.start], member[.end]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[D] Keyword[extends] identifier[Comparable] operator[>] identifier[NumberExpression] operator[<] identifier[Integer] operator[>] identifier[datediff] operator[SEP] identifier[DatePart] identifier[unit] , identifier[DateExpression] operator[<] identifier[D] operator[>] identifier[start] , identifier[DateExpression] operator[<] identifier[D] operator[>] identifier[end] operator[SEP] {
Keyword[return] identifier[Expressions] operator[SEP] identifier[numberOperation] operator[SEP] identifier[Integer] operator[SEP] Keyword[class] , identifier[DATE_DIFF_OPS] operator[SEP] identifier[get] operator[SEP] identifier[unit] operator[SEP] , identifier[start] , identifier[end] operator[SEP] operator[SEP]
}
|
@Override
public StorePath uploadImageAndCrtThumbImage(InputStream inputStream,
long fileSize,
String fileExtName,
Set<MetaData> metaDataSet) {
FastImageFile fastImageFile;
if (null == metaDataSet) {
fastImageFile = new FastImageFile.Builder()
.withFile(inputStream, fileSize, fileExtName)
.withThumbImage()
.build();
} else {
fastImageFile = new FastImageFile.Builder()
.withFile(inputStream, fileSize, fileExtName)
.withMetaData(metaDataSet)
.withThumbImage()
.build();
}
return uploadImage(fastImageFile);
} | class class_name[name] begin[{]
method[uploadImageAndCrtThumbImage, return_type[type[StorePath]], modifier[public], parameter[inputStream, fileSize, fileExtName, metaDataSet]] begin[{]
local_variable[type[FastImageFile], fastImageFile]
if[binary_operation[literal[null], ==, member[.metaDataSet]]] begin[{]
assign[member[.fastImageFile], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fileSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fileExtName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withFile, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=withThumbImage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=FastImageFile, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None)))]
else begin[{]
assign[member[.fastImageFile], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fileSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fileExtName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withFile, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=metaDataSet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withMetaData, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=withThumbImage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=FastImageFile, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None)))]
end[}]
return[call[.uploadImage, parameter[member[.fastImageFile]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[StorePath] identifier[uploadImageAndCrtThumbImage] operator[SEP] identifier[InputStream] identifier[inputStream] , Keyword[long] identifier[fileSize] , identifier[String] identifier[fileExtName] , identifier[Set] operator[<] identifier[MetaData] operator[>] identifier[metaDataSet] operator[SEP] {
identifier[FastImageFile] identifier[fastImageFile] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[metaDataSet] operator[SEP] {
identifier[fastImageFile] operator[=] Keyword[new] identifier[FastImageFile] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[withFile] operator[SEP] identifier[inputStream] , identifier[fileSize] , identifier[fileExtName] operator[SEP] operator[SEP] identifier[withThumbImage] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[fastImageFile] operator[=] Keyword[new] identifier[FastImageFile] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[withFile] operator[SEP] identifier[inputStream] , identifier[fileSize] , identifier[fileExtName] operator[SEP] operator[SEP] identifier[withMetaData] operator[SEP] identifier[metaDataSet] operator[SEP] operator[SEP] identifier[withThumbImage] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[uploadImage] operator[SEP] identifier[fastImageFile] operator[SEP] operator[SEP]
}
|
protected Vec4 computeSurfacePoint(OrbitView view, Angle heading, Angle pitch)
{
Globe globe = wwd.getModel().getGlobe();
// Compute transform to be applied to north pointing Y so that it would point in the view direction
// Move coordinate system to view center point
Matrix transform = globe.computeSurfaceOrientationAtPosition(view.getCenterPosition());
// Rotate so that the north pointing axes Y will point in the look at direction
transform = transform.multiply(Matrix.fromRotationZ(heading.multiply(-1)));
transform = transform.multiply(Matrix.fromRotationX(Angle.NEG90.add(pitch)));
// Compute forward vector
Vec4 forward = Vec4.UNIT_Y.transformBy4(transform);
// Return intersection with terrain
Intersection[] intersections = wwd.getSceneController().getTerrain().intersect(
new Line(view.getEyePoint(), forward));
return (intersections != null && intersections.length != 0) ? intersections[0].getIntersectionPoint() : null;
} | class class_name[name] begin[{]
method[computeSurfacePoint, return_type[type[Vec4]], modifier[protected], parameter[view, heading, pitch]] begin[{]
local_variable[type[Globe], globe]
local_variable[type[Matrix], transform]
assign[member[.transform], call[transform.multiply, parameter[call[Matrix.fromRotationZ, parameter[call[heading.multiply, parameter[literal[1]]]]]]]]
assign[member[.transform], call[transform.multiply, parameter[call[Matrix.fromRotationX, parameter[call[Angle.NEG90.add, parameter[member[.pitch]]]]]]]]
local_variable[type[Vec4], forward]
local_variable[type[Intersection], intersections]
return[TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=intersections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=intersections, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), operator=&&), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MemberReference(member=intersections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[], member=getIntersectionPoint, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]))]
end[}]
END[}] | Keyword[protected] identifier[Vec4] identifier[computeSurfacePoint] operator[SEP] identifier[OrbitView] identifier[view] , identifier[Angle] identifier[heading] , identifier[Angle] identifier[pitch] operator[SEP] {
identifier[Globe] identifier[globe] operator[=] identifier[wwd] operator[SEP] identifier[getModel] operator[SEP] operator[SEP] operator[SEP] identifier[getGlobe] operator[SEP] operator[SEP] operator[SEP] identifier[Matrix] identifier[transform] operator[=] identifier[globe] operator[SEP] identifier[computeSurfaceOrientationAtPosition] operator[SEP] identifier[view] operator[SEP] identifier[getCenterPosition] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[transform] operator[=] identifier[transform] operator[SEP] identifier[multiply] operator[SEP] identifier[Matrix] operator[SEP] identifier[fromRotationZ] operator[SEP] identifier[heading] operator[SEP] identifier[multiply] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[transform] operator[=] identifier[transform] operator[SEP] identifier[multiply] operator[SEP] identifier[Matrix] operator[SEP] identifier[fromRotationX] operator[SEP] identifier[Angle] operator[SEP] identifier[NEG90] operator[SEP] identifier[add] operator[SEP] identifier[pitch] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Vec4] identifier[forward] operator[=] identifier[Vec4] operator[SEP] identifier[UNIT_Y] operator[SEP] identifier[transformBy4] operator[SEP] identifier[transform] operator[SEP] operator[SEP] identifier[Intersection] operator[SEP] operator[SEP] identifier[intersections] operator[=] identifier[wwd] operator[SEP] identifier[getSceneController] operator[SEP] operator[SEP] operator[SEP] identifier[getTerrain] operator[SEP] operator[SEP] operator[SEP] identifier[intersect] operator[SEP] Keyword[new] identifier[Line] operator[SEP] identifier[view] operator[SEP] identifier[getEyePoint] operator[SEP] operator[SEP] , identifier[forward] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[intersections] operator[!=] Other[null] operator[&&] identifier[intersections] operator[SEP] identifier[length] operator[!=] Other[0] operator[SEP] operator[?] identifier[intersections] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getIntersectionPoint] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
private void handleWebSocketReplyMessage(final String webSocketText) {
final List<Message<Object>> messages = QBit.factory().createProtocolParser().parse("", webSocketText);
//noinspection Convert2streamapi
for (Message<Object> message : messages) {
if (message instanceof Response) {
@SuppressWarnings("unchecked") final Response<Object> response = ((Response) message);
final String[] split = StringScanner.split(response.returnAddress(), (char) PROTOCOL_ARG_SEPARATOR);
final HandlerKey key = split.length == 2 ? new HandlerKey(split[1], response.id()) : new HandlerKey(split[0], response.id());
final Callback<Object> handler = handlers.get(key);
if (handler != null) {
handleAsyncCallback(response, handler);
handlers.remove(key);
} // else there was no handler, it was a one way method.
}
}
} | class class_name[name] begin[{]
method[handleWebSocketReplyMessage, return_type[void], modifier[private], parameter[webSocketText]] begin[{]
local_variable[type[List], messages]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Response, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unchecked"), name=SuppressWarnings)], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Response, sub_type=None)), name=response)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Response, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=returnAddress, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), Cast(expression=MemberReference(member=PROTOCOL_ARG_SEPARATOR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))], member=split, postfix_operators=[], prefix_operators=[], qualifier=StringScanner, selectors=[], type_arguments=None), name=split)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=split, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator===), if_false=ClassCreator(arguments=[MemberReference(member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MethodInvocation(arguments=[], member=id, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HandlerKey, sub_type=None)), if_true=ClassCreator(arguments=[MemberReference(member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), MethodInvocation(arguments=[], member=id, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HandlerKey, sub_type=None))), name=key)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=HandlerKey, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=handlers, selectors=[], type_arguments=None), name=handler)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Callback, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=handler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleAsyncCallback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=handlers, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MemberReference(member=messages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=message)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Message, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[handleWebSocketReplyMessage] operator[SEP] Keyword[final] identifier[String] identifier[webSocketText] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[Message] operator[<] identifier[Object] operator[>] operator[>] identifier[messages] operator[=] identifier[QBit] operator[SEP] identifier[factory] operator[SEP] operator[SEP] operator[SEP] identifier[createProtocolParser] operator[SEP] operator[SEP] operator[SEP] identifier[parse] operator[SEP] literal[String] , identifier[webSocketText] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Message] operator[<] identifier[Object] operator[>] identifier[message] operator[:] identifier[messages] operator[SEP] {
Keyword[if] operator[SEP] identifier[message] Keyword[instanceof] identifier[Response] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[final] identifier[Response] operator[<] identifier[Object] operator[>] identifier[response] operator[=] operator[SEP] operator[SEP] identifier[Response] operator[SEP] identifier[message] operator[SEP] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[split] operator[=] identifier[StringScanner] operator[SEP] identifier[split] operator[SEP] identifier[response] operator[SEP] identifier[returnAddress] operator[SEP] operator[SEP] , operator[SEP] Keyword[char] operator[SEP] identifier[PROTOCOL_ARG_SEPARATOR] operator[SEP] operator[SEP] Keyword[final] identifier[HandlerKey] identifier[key] operator[=] identifier[split] operator[SEP] identifier[length] operator[==] Other[2] operator[?] Keyword[new] identifier[HandlerKey] operator[SEP] identifier[split] operator[SEP] Other[1] operator[SEP] , identifier[response] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] operator[:] Keyword[new] identifier[HandlerKey] operator[SEP] identifier[split] operator[SEP] Other[0] operator[SEP] , identifier[response] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Callback] operator[<] identifier[Object] operator[>] identifier[handler] operator[=] identifier[handlers] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[handler] operator[!=] Other[null] operator[SEP] {
identifier[handleAsyncCallback] operator[SEP] identifier[response] , identifier[handler] operator[SEP] operator[SEP] identifier[handlers] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
}
}
}
|
private void putId() {
// note: name and info may be null
super.put("Provider.id name", String.valueOf(name));
super.put("Provider.id version", String.valueOf(version));
super.put("Provider.id info", String.valueOf(info));
super.put("Provider.id className", this.getClass().getName());
} | class class_name[name] begin[{]
method[putId, return_type[void], modifier[private], parameter[]] begin[{]
SuperMethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Provider.id name"), MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SuperMethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Provider.id version"), MethodInvocation(arguments=[MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SuperMethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Provider.id info"), MethodInvocation(arguments=[MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SuperMethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Provider.id className"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=put, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[putId] operator[SEP] operator[SEP] {
Keyword[super] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[version] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[info] operator[SEP] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[put] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static final boolean isNull(final String value, final boolean trim, final boolean empty)
{
// For backwards compatibility
if (disableIsNull)
return false;
// No value?
if (value == null)
return true;
// Trim the text when requested
String trimmed = trim ? value.trim() : value;
// Is the empty string null?
if (empty && trimmed.length() == 0)
return true;
// Just check it.
return NULL.equalsIgnoreCase(trimmed);
} | class class_name[name] begin[{]
method[isNull, return_type[type[boolean]], modifier[final public static], parameter[value, trim, empty]] begin[{]
if[member[.disableIsNull]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[String], trimmed]
if[binary_operation[member[.empty], &&, binary_operation[call[trimmed.length, parameter[]], ==, literal[0]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[call[NULL.equalsIgnoreCase, parameter[member[.trimmed]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] Keyword[boolean] identifier[isNull] operator[SEP] Keyword[final] identifier[String] identifier[value] , Keyword[final] Keyword[boolean] identifier[trim] , Keyword[final] Keyword[boolean] identifier[empty] operator[SEP] {
Keyword[if] operator[SEP] identifier[disableIsNull] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[String] identifier[trimmed] operator[=] identifier[trim] operator[?] identifier[value] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[:] identifier[value] operator[SEP] Keyword[if] operator[SEP] identifier[empty] operator[&&] identifier[trimmed] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] identifier[NULL] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[trimmed] operator[SEP] operator[SEP]
}
|
@Override
public java.util.Iterator<com.google.api.ads.adwords.axis.v201809.cm.AdGroupFeed> iterator() {
if (entries == null) {
return java.util.Collections.<com.google.api.ads.adwords.axis.v201809.cm.AdGroupFeed>emptyIterator();
}
return java.util.Arrays.<com.google.api.ads.adwords.axis.v201809.cm.AdGroupFeed>asList(entries).iterator();
} | class class_name[name] begin[{]
method[iterator, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.entries], ==, literal[null]]] begin[{]
return[call[java.util.Collections, parameter[]]]
else begin[{]
None
end[}]
return[call[java.util.Arrays, parameter[member[.entries]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Iterator] operator[<] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[adwords] operator[SEP] identifier[axis] operator[SEP] identifier[v201809] operator[SEP] identifier[cm] operator[SEP] identifier[AdGroupFeed] operator[>] identifier[iterator] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[entries] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collections] operator[SEP] operator[<] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[adwords] operator[SEP] identifier[axis] operator[SEP] identifier[v201809] operator[SEP] identifier[cm] operator[SEP] identifier[AdGroupFeed] operator[>] identifier[emptyIterator] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Arrays] operator[SEP] operator[<] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[adwords] operator[SEP] identifier[axis] operator[SEP] identifier[v201809] operator[SEP] identifier[cm] operator[SEP] identifier[AdGroupFeed] operator[>] identifier[asList] operator[SEP] identifier[entries] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public <T> T onlyOne(Class<T> serviceClass) {
Collection<T> all = all(serviceClass);
if (all.size() == 1) {
return all.iterator().next();
}
if (all.size() > 1) {
throw new IllegalStateException(
"Multiple service implementations found for " + serviceClass + ": " + toClassString(all));
}
return null;
} | class class_name[name] begin[{]
method[onlyOne, return_type[type[T]], modifier[public], parameter[serviceClass]] begin[{]
local_variable[type[Collection], all]
if[binary_operation[call[all.size, parameter[]], ==, literal[1]]] begin[{]
return[call[all.iterator, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[call[all.size, parameter[]], >, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Multiple service implementations found for "), operandr=MemberReference(member=serviceClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=all, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toClassString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[onlyOne] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[serviceClass] operator[SEP] {
identifier[Collection] operator[<] identifier[T] operator[>] identifier[all] operator[=] identifier[all] operator[SEP] identifier[serviceClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[all] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[all] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[all] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[serviceClass] operator[+] literal[String] operator[+] identifier[toClassString] operator[SEP] identifier[all] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public EList<String> getElectronicMailAddresses() {
return (EList<String>) eGet(Ifc4Package.Literals.IFC_TELECOM_ADDRESS__ELECTRONIC_MAIL_ADDRESSES, true);
} | class class_name[name] begin[{]
method[getElectronicMailAddresses, return_type[type[EList]], modifier[public], parameter[]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=IFC_TELECOM_ADDRESS__ELECTRONIC_MAIL_ADDRESSES, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package.Literals, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=eGet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=EList, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[EList] operator[<] identifier[String] operator[>] identifier[getElectronicMailAddresses] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[EList] operator[<] identifier[String] operator[>] operator[SEP] identifier[eGet] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[Literals] operator[SEP] identifier[IFC_TELECOM_ADDRESS__ELECTRONIC_MAIL_ADDRESSES] , literal[boolean] operator[SEP] operator[SEP]
}
|
public FeatureInfoWithActions getFeatureInfoWidgetWithActions(MapPresenter mapPresenter) {
FeatureInfoWithActions widgetWithActions = new FeatureInfoWithActions();
widgetWithActions.addHasFeature(new ZoomToObjectAction(mapPresenter));
return widgetWithActions;
} | class class_name[name] begin[{]
method[getFeatureInfoWidgetWithActions, return_type[type[FeatureInfoWithActions]], modifier[public], parameter[mapPresenter]] begin[{]
local_variable[type[FeatureInfoWithActions], widgetWithActions]
call[widgetWithActions.addHasFeature, parameter[ClassCreator(arguments=[MemberReference(member=mapPresenter, 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=ZoomToObjectAction, sub_type=None))]]
return[member[.widgetWithActions]]
end[}]
END[}] | Keyword[public] identifier[FeatureInfoWithActions] identifier[getFeatureInfoWidgetWithActions] operator[SEP] identifier[MapPresenter] identifier[mapPresenter] operator[SEP] {
identifier[FeatureInfoWithActions] identifier[widgetWithActions] operator[=] Keyword[new] identifier[FeatureInfoWithActions] operator[SEP] operator[SEP] operator[SEP] identifier[widgetWithActions] operator[SEP] identifier[addHasFeature] operator[SEP] Keyword[new] identifier[ZoomToObjectAction] operator[SEP] identifier[mapPresenter] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[widgetWithActions] operator[SEP]
}
|
@Pure
public static String getUserHomeDirectoryName() {
final String userHome = System.getProperty("user.home"); //$NON-NLS-1$
if ((userHome == null || userHome.isEmpty()) && (OperatingSystem.ANDROID.isCurrentOS())) {
return join(File.listRoots()[0], Android.HOME_DIRECTORY).toString();
}
return userHome;
} | class class_name[name] begin[{]
method[getUserHomeDirectoryName, return_type[type[String]], modifier[public static], parameter[]] begin[{]
local_variable[type[String], userHome]
if[binary_operation[binary_operation[binary_operation[member[.userHome], ==, literal[null]], ||, call[userHome.isEmpty, parameter[]]], &&, call[OperatingSystem.ANDROID.isCurrentOS, parameter[]]]] begin[{]
return[call[.join, parameter[call[File.listRoots, parameter[]], member[Android.HOME_DIRECTORY]]]]
else begin[{]
None
end[}]
return[member[.userHome]]
end[}]
END[}] | annotation[@] identifier[Pure] Keyword[public] Keyword[static] identifier[String] identifier[getUserHomeDirectoryName] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[userHome] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[userHome] operator[==] Other[null] operator[||] identifier[userHome] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[OperatingSystem] operator[SEP] identifier[ANDROID] operator[SEP] identifier[isCurrentOS] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[join] operator[SEP] identifier[File] operator[SEP] identifier[listRoots] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] , identifier[Android] operator[SEP] identifier[HOME_DIRECTORY] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[userHome] operator[SEP]
}
|
public static boolean hasFilter(Filter filter) {
Jenkins j = Jenkins.getInstanceOrNull();
PluginServletFilter container = null;
if(j != null) {
container = getInstance(j.servletContext);
}
if (j == null || container == null) {
return LEGACY.contains(filter);
} else {
return container.list.contains(filter);
}
} | class class_name[name] begin[{]
method[hasFilter, return_type[type[boolean]], modifier[public static], parameter[filter]] begin[{]
local_variable[type[Jenkins], j]
local_variable[type[PluginServletFilter], container]
if[binary_operation[member[.j], !=, literal[null]]] begin[{]
assign[member[.container], call[.getInstance, parameter[member[j.servletContext]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.j], ==, literal[null]], ||, binary_operation[member[.container], ==, literal[null]]]] begin[{]
return[call[LEGACY.contains, parameter[member[.filter]]]]
else begin[{]
return[call[container.list.contains, parameter[member[.filter]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[hasFilter] operator[SEP] identifier[Filter] identifier[filter] operator[SEP] {
identifier[Jenkins] identifier[j] operator[=] identifier[Jenkins] operator[SEP] identifier[getInstanceOrNull] operator[SEP] operator[SEP] operator[SEP] identifier[PluginServletFilter] identifier[container] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[j] operator[!=] Other[null] operator[SEP] {
identifier[container] operator[=] identifier[getInstance] operator[SEP] identifier[j] operator[SEP] identifier[servletContext] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[j] operator[==] Other[null] operator[||] identifier[container] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[LEGACY] operator[SEP] identifier[contains] operator[SEP] identifier[filter] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[container] operator[SEP] identifier[list] operator[SEP] identifier[contains] operator[SEP] identifier[filter] operator[SEP] operator[SEP]
}
}
|
public int getLength()
{
int length = 0;
Iterator<V> it = this.values().iterator();
while (it.hasNext())
{
length += ((ID3v2Frame) it.next()).getFrameLength();
}
return length;
} | class class_name[name] begin[{]
method[getLength, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[int], length]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
assign[member[.length], Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=ID3v2Frame, sub_type=None))]
end[}]
return[member[.length]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getLength] operator[SEP] operator[SEP] {
Keyword[int] identifier[length] operator[=] Other[0] operator[SEP] identifier[Iterator] operator[<] identifier[V] operator[>] identifier[it] operator[=] Keyword[this] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[length] operator[+=] operator[SEP] operator[SEP] identifier[ID3v2Frame] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getFrameLength] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[length] operator[SEP]
}
|
public PhotoList<Photo> getPhotos(String photosetId, int perPage, int page) throws FlickrException {
return getPhotos(photosetId, Extras.MIN_EXTRAS, Flickr.PRIVACY_LEVEL_NO_FILTER, perPage, page);
} | class class_name[name] begin[{]
method[getPhotos, return_type[type[PhotoList]], modifier[public], parameter[photosetId, perPage, page]] begin[{]
return[call[.getPhotos, parameter[member[.photosetId], member[Extras.MIN_EXTRAS], member[Flickr.PRIVACY_LEVEL_NO_FILTER], member[.perPage], member[.page]]]]
end[}]
END[}] | Keyword[public] identifier[PhotoList] operator[<] identifier[Photo] operator[>] identifier[getPhotos] operator[SEP] identifier[String] identifier[photosetId] , Keyword[int] identifier[perPage] , Keyword[int] identifier[page] operator[SEP] Keyword[throws] identifier[FlickrException] {
Keyword[return] identifier[getPhotos] operator[SEP] identifier[photosetId] , identifier[Extras] operator[SEP] identifier[MIN_EXTRAS] , identifier[Flickr] operator[SEP] identifier[PRIVACY_LEVEL_NO_FILTER] , identifier[perPage] , identifier[page] operator[SEP] operator[SEP]
}
|
@UiHandler("m_includeExpiredCheckBox")
protected void onIncludeExpiredChange(ValueChangeEvent<Boolean> event) {
Boolean value = event.getValue();
m_tabHandler.setIncludeExpired(value.booleanValue(), true);
} | class class_name[name] begin[{]
method[onIncludeExpiredChange, return_type[void], modifier[protected], parameter[event]] begin[{]
local_variable[type[Boolean], value]
call[m_tabHandler.setIncludeExpired, parameter[call[value.booleanValue, parameter[]], literal[true]]]
end[}]
END[}] | annotation[@] identifier[UiHandler] operator[SEP] literal[String] operator[SEP] Keyword[protected] Keyword[void] identifier[onIncludeExpiredChange] operator[SEP] identifier[ValueChangeEvent] operator[<] identifier[Boolean] operator[>] identifier[event] operator[SEP] {
identifier[Boolean] identifier[value] operator[=] identifier[event] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[m_tabHandler] operator[SEP] identifier[setIncludeExpired] operator[SEP] identifier[value] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
|
public static boolean isJavaAtLeast(double version) {
String javaVersion = System.getProperty("java.version");
if (javaVersion == null) {
return false;
}
// if the retrieved version is one three digits, remove the last one.
Matcher matcher = JAVA_VERSION.matcher(javaVersion);
if (matcher.matches()) {
javaVersion = matcher.group(1);
}
try {
double v = Double.parseDouble(javaVersion);
return v >= version;
} catch (NumberFormatException e) { //NOSONAR if it's not a number, just return false
return false;
}
} | class class_name[name] begin[{]
method[isJavaAtLeast, return_type[type[boolean]], modifier[public static], parameter[version]] begin[{]
local_variable[type[String], javaVersion]
if[binary_operation[member[.javaVersion], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[Matcher], matcher]
if[call[matcher.matches, parameter[]]] begin[{]
assign[member[.javaVersion], call[matcher.group, parameter[literal[1]]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=javaVersion, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseDouble, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None), name=v)], modifiers=set(), type=BasicType(dimensions=[], name=double)), ReturnStatement(expression=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isJavaAtLeast] operator[SEP] Keyword[double] identifier[version] operator[SEP] {
identifier[String] identifier[javaVersion] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[javaVersion] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Matcher] identifier[matcher] operator[=] identifier[JAVA_VERSION] operator[SEP] identifier[matcher] operator[SEP] identifier[javaVersion] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[matcher] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[javaVersion] operator[=] identifier[matcher] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[double] identifier[v] operator[=] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[javaVersion] operator[SEP] operator[SEP] Keyword[return] identifier[v] operator[>=] identifier[version] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public static <R> Stream<R> zip(final short[] a, final short[] b, final short[] c, final ShortTriFunction<R> zipFunction) {
return zip(ShortIteratorEx.of(a), ShortIteratorEx.of(b), ShortIteratorEx.of(c), zipFunction);
} | class class_name[name] begin[{]
method[zip, return_type[type[Stream]], modifier[public static], parameter[a, b, c, zipFunction]] begin[{]
return[call[.zip, parameter[call[ShortIteratorEx.of, parameter[member[.a]]], call[ShortIteratorEx.of, parameter[member[.b]]], call[ShortIteratorEx.of, parameter[member[.c]]], member[.zipFunction]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[R] operator[>] identifier[Stream] operator[<] identifier[R] operator[>] identifier[zip] operator[SEP] Keyword[final] Keyword[short] operator[SEP] operator[SEP] identifier[a] , Keyword[final] Keyword[short] operator[SEP] operator[SEP] identifier[b] , Keyword[final] Keyword[short] operator[SEP] operator[SEP] identifier[c] , Keyword[final] identifier[ShortTriFunction] operator[<] identifier[R] operator[>] identifier[zipFunction] operator[SEP] {
Keyword[return] identifier[zip] operator[SEP] identifier[ShortIteratorEx] operator[SEP] identifier[of] operator[SEP] identifier[a] operator[SEP] , identifier[ShortIteratorEx] operator[SEP] identifier[of] operator[SEP] identifier[b] operator[SEP] , identifier[ShortIteratorEx] operator[SEP] identifier[of] operator[SEP] identifier[c] operator[SEP] , identifier[zipFunction] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static <T extends StatefulConnection<?, ?>> GenericObjectPool<T> createGenericObjectPool(
Supplier<T> connectionSupplier, GenericObjectPoolConfig<T> config, boolean wrapConnections) {
LettuceAssert.notNull(connectionSupplier, "Connection supplier must not be null");
LettuceAssert.notNull(config, "GenericObjectPoolConfig must not be null");
AtomicReference<Origin<T>> poolRef = new AtomicReference<>();
GenericObjectPool<T> pool = new GenericObjectPool<T>(new RedisPooledObjectFactory<T>(connectionSupplier), config) {
@Override
public T borrowObject() throws Exception {
return wrapConnections ? ConnectionWrapping.wrapConnection(super.borrowObject(), poolRef.get()) : super
.borrowObject();
}
@Override
public void returnObject(T obj) {
if (wrapConnections && obj instanceof HasTargetConnection) {
super.returnObject((T) ((HasTargetConnection) obj).getTargetConnection());
return;
}
super.returnObject(obj);
}
};
poolRef.set(new ObjectPoolWrapper<>(pool));
return pool;
} | class class_name[name] begin[{]
method[createGenericObjectPool, return_type[type[GenericObjectPool]], modifier[public static], parameter[connectionSupplier, config, wrapConnections]] begin[{]
call[LettuceAssert.notNull, parameter[member[.connectionSupplier], literal["Connection supplier must not be null"]]]
call[LettuceAssert.notNull, parameter[member[.config], literal["GenericObjectPoolConfig must not be null"]]]
local_variable[type[AtomicReference], poolRef]
local_variable[type[GenericObjectPool], pool]
call[poolRef.set, parameter[ClassCreator(arguments=[MemberReference(member=pool, 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=ObjectPoolWrapper, sub_type=None))]]
return[member[.pool]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[StatefulConnection] operator[<] operator[?] , operator[?] operator[>] operator[>] identifier[GenericObjectPool] operator[<] identifier[T] operator[>] identifier[createGenericObjectPool] operator[SEP] identifier[Supplier] operator[<] identifier[T] operator[>] identifier[connectionSupplier] , identifier[GenericObjectPoolConfig] operator[<] identifier[T] operator[>] identifier[config] , Keyword[boolean] identifier[wrapConnections] operator[SEP] {
identifier[LettuceAssert] operator[SEP] identifier[notNull] operator[SEP] identifier[connectionSupplier] , literal[String] operator[SEP] operator[SEP] identifier[LettuceAssert] operator[SEP] identifier[notNull] operator[SEP] identifier[config] , literal[String] operator[SEP] operator[SEP] identifier[AtomicReference] operator[<] identifier[Origin] operator[<] identifier[T] operator[>] operator[>] identifier[poolRef] operator[=] Keyword[new] identifier[AtomicReference] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[GenericObjectPool] operator[<] identifier[T] operator[>] identifier[pool] operator[=] Keyword[new] identifier[GenericObjectPool] operator[<] identifier[T] operator[>] operator[SEP] Keyword[new] identifier[RedisPooledObjectFactory] operator[<] identifier[T] operator[>] operator[SEP] identifier[connectionSupplier] operator[SEP] , identifier[config] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[T] identifier[borrowObject] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[return] identifier[wrapConnections] operator[?] identifier[ConnectionWrapping] operator[SEP] identifier[wrapConnection] operator[SEP] Keyword[super] operator[SEP] identifier[borrowObject] operator[SEP] operator[SEP] , identifier[poolRef] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[:] Keyword[super] operator[SEP] identifier[borrowObject] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[returnObject] operator[SEP] identifier[T] identifier[obj] operator[SEP] {
Keyword[if] operator[SEP] identifier[wrapConnections] operator[&&] identifier[obj] Keyword[instanceof] identifier[HasTargetConnection] operator[SEP] {
Keyword[super] operator[SEP] identifier[returnObject] operator[SEP] operator[SEP] identifier[T] operator[SEP] operator[SEP] operator[SEP] identifier[HasTargetConnection] operator[SEP] identifier[obj] operator[SEP] operator[SEP] identifier[getTargetConnection] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[returnObject] operator[SEP] identifier[obj] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[poolRef] operator[SEP] identifier[set] operator[SEP] Keyword[new] identifier[ObjectPoolWrapper] operator[<] operator[>] operator[SEP] identifier[pool] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[pool] operator[SEP]
}
|
private void parseDocument() throws Exception {
try { // added by MHK
boolean sawDTD = parseProlog();
require('<');
parseElement(!sawDTD);
} catch (EOFException ee) { // added by MHK
fatal("premature end of file", "[EOF]", null);
}
try {
parseMisc(); // skip all white, PIs, and comments
char c = readCh(); // if this doesn't throw an exception...
fatal("unexpected characters after document end", c, null);
} catch (EOFException e) {
if (characterHandler != null) {
characterHandler.end();
}
if (normalizationChecker != null) {
normalizationChecker.end();
}
return;
}
} | class class_name[name] begin[{]
method[parseDocument, return_type[void], modifier[private], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=parseProlog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=sawDTD)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='<')], member=require, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sawDTD, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[])], member=parseElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="premature end of file"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[EOF]"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=fatal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ee, types=['EOFException']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=parseMisc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readCh, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unexpected characters after document end"), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=fatal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=characterHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=end, postfix_operators=[], prefix_operators=[], qualifier=characterHandler, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=normalizationChecker, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=end, postfix_operators=[], prefix_operators=[], qualifier=normalizationChecker, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['EOFException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[parseDocument] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[try] {
Keyword[boolean] identifier[sawDTD] operator[=] identifier[parseProlog] operator[SEP] operator[SEP] operator[SEP] identifier[require] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[parseElement] operator[SEP] operator[!] identifier[sawDTD] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[EOFException] identifier[ee] operator[SEP] {
identifier[fatal] operator[SEP] literal[String] , literal[String] , Other[null] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[parseMisc] operator[SEP] operator[SEP] operator[SEP] Keyword[char] identifier[c] operator[=] identifier[readCh] operator[SEP] operator[SEP] operator[SEP] identifier[fatal] operator[SEP] literal[String] , identifier[c] , Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[EOFException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[characterHandler] operator[!=] Other[null] operator[SEP] {
identifier[characterHandler] operator[SEP] identifier[end] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[normalizationChecker] operator[!=] Other[null] operator[SEP] {
identifier[normalizationChecker] operator[SEP] identifier[end] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
}
|
private Response<SearchResult> searchForServiceById(final Long id) throws LdapException {
val filter = LdapUtils.newLdaptiveSearchFilter(this.searchFilter,
LdapUtils.LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME, CollectionUtils.wrap(id.toString()));
return LdapUtils.executeSearchOperation(this.connectionFactory, this.baseDn, filter);
} | class class_name[name] begin[{]
method[searchForServiceById, return_type[type[Response]], modifier[private], parameter[id]] begin[{]
local_variable[type[val], filter]
return[call[LdapUtils.executeSearchOperation, parameter[THIS[member[None.connectionFactory]], THIS[member[None.baseDn]], member[.filter]]]]
end[}]
END[}] | Keyword[private] identifier[Response] operator[<] identifier[SearchResult] operator[>] identifier[searchForServiceById] operator[SEP] Keyword[final] identifier[Long] identifier[id] operator[SEP] Keyword[throws] identifier[LdapException] {
identifier[val] identifier[filter] operator[=] identifier[LdapUtils] operator[SEP] identifier[newLdaptiveSearchFilter] operator[SEP] Keyword[this] operator[SEP] identifier[searchFilter] , identifier[LdapUtils] operator[SEP] identifier[LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME] , identifier[CollectionUtils] operator[SEP] identifier[wrap] operator[SEP] identifier[id] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[LdapUtils] operator[SEP] identifier[executeSearchOperation] operator[SEP] Keyword[this] operator[SEP] identifier[connectionFactory] , Keyword[this] operator[SEP] identifier[baseDn] , identifier[filter] operator[SEP] operator[SEP]
}
|
public boolean isSupported(Jid jid) throws SmackException, XMPPException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).supportsFeature(jid,
DeliveryReceipt.NAMESPACE);
} | class class_name[name] begin[{]
method[isSupported, return_type[type[boolean]], modifier[public], parameter[jid]] begin[{]
return[call[ServiceDiscoveryManager.getInstanceFor, parameter[call[.connection, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isSupported] operator[SEP] identifier[Jid] identifier[jid] operator[SEP] Keyword[throws] identifier[SmackException] , identifier[XMPPException] , identifier[InterruptedException] {
Keyword[return] identifier[ServiceDiscoveryManager] operator[SEP] identifier[getInstanceFor] operator[SEP] identifier[connection] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[supportsFeature] operator[SEP] identifier[jid] , identifier[DeliveryReceipt] operator[SEP] identifier[NAMESPACE] operator[SEP] operator[SEP]
}
|
static long calcInterval(int segments, int start, int limit) {
long range = limit - start;
if (range < 0) {
return 0;
}
int partSegment = (range % segments) == 0 ? 0
: 1;
return (range / segments) + partSegment;
} | class class_name[name] begin[{]
method[calcInterval, return_type[type[long]], modifier[static], parameter[segments, start, limit]] begin[{]
local_variable[type[long], range]
if[binary_operation[member[.range], <, literal[0]]] begin[{]
return[literal[0]]
else begin[{]
None
end[}]
local_variable[type[int], partSegment]
return[binary_operation[binary_operation[member[.range], /, member[.segments]], +, member[.partSegment]]]
end[}]
END[}] | Keyword[static] Keyword[long] identifier[calcInterval] operator[SEP] Keyword[int] identifier[segments] , Keyword[int] identifier[start] , Keyword[int] identifier[limit] operator[SEP] {
Keyword[long] identifier[range] operator[=] identifier[limit] operator[-] identifier[start] operator[SEP] Keyword[if] operator[SEP] identifier[range] operator[<] Other[0] operator[SEP] {
Keyword[return] Other[0] operator[SEP]
}
Keyword[int] identifier[partSegment] operator[=] operator[SEP] identifier[range] operator[%] identifier[segments] operator[SEP] operator[==] Other[0] operator[?] Other[0] operator[:] Other[1] operator[SEP] Keyword[return] operator[SEP] identifier[range] operator[/] identifier[segments] operator[SEP] operator[+] identifier[partSegment] operator[SEP]
}
|
private void loadBodyRows(final SheetConfiguration sheetConfig, final Map<String, CellRangeAddress> cellRangeMap,
final List<String> skippedRegionCells) {
int top = sheetConfig.getBodyCellRange().getTopRow();
int bottom = CellUtility.getBodyBottomFromConfig(sheetConfig);
int left = sheetConfig.getBodyCellRange().getLeftCol();
int right = sheetConfig.getBodyCellRange().getRightCol();
String sheetName = sheetConfig.getSheetName();
Sheet sheet1 = parent.getWb().getSheet(sheetName);
parent.getBodyRows().clear();
clearCache();
for (int i = top; i <= bottom; i++) {
parent.getBodyRows()
.add(assembleFacesBodyRow(i, sheet1, left, right, sheetConfig, cellRangeMap, skippedRegionCells));
}
sheetConfig.setBodyPopulated(true);
parent.getCurrent().setCurrentTopRow(top);
parent.getCurrent().setCurrentLeftColumn(left);
} | class class_name[name] begin[{]
method[loadBodyRows, return_type[void], modifier[private], parameter[sheetConfig, cellRangeMap, skippedRegionCells]] begin[{]
local_variable[type[int], top]
local_variable[type[int], bottom]
local_variable[type[int], left]
local_variable[type[int], right]
local_variable[type[String], sheetName]
local_variable[type[Sheet], sheet1]
call[parent.getBodyRows, parameter[]]
call[.clearCache, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getBodyRows, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sheet1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=right, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sheetConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cellRangeMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=skippedRegionCells, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=assembleFacesBodyRow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bottom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[sheetConfig.setBodyPopulated, parameter[literal[true]]]
call[parent.getCurrent, parameter[]]
call[parent.getCurrent, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[loadBodyRows] operator[SEP] Keyword[final] identifier[SheetConfiguration] identifier[sheetConfig] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[CellRangeAddress] operator[>] identifier[cellRangeMap] , Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[skippedRegionCells] operator[SEP] {
Keyword[int] identifier[top] operator[=] identifier[sheetConfig] operator[SEP] identifier[getBodyCellRange] operator[SEP] operator[SEP] operator[SEP] identifier[getTopRow] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[bottom] operator[=] identifier[CellUtility] operator[SEP] identifier[getBodyBottomFromConfig] operator[SEP] identifier[sheetConfig] operator[SEP] operator[SEP] Keyword[int] identifier[left] operator[=] identifier[sheetConfig] operator[SEP] identifier[getBodyCellRange] operator[SEP] operator[SEP] operator[SEP] identifier[getLeftCol] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[right] operator[=] identifier[sheetConfig] operator[SEP] identifier[getBodyCellRange] operator[SEP] operator[SEP] operator[SEP] identifier[getRightCol] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[sheetName] operator[=] identifier[sheetConfig] operator[SEP] identifier[getSheetName] operator[SEP] operator[SEP] operator[SEP] identifier[Sheet] identifier[sheet1] operator[=] identifier[parent] operator[SEP] identifier[getWb] operator[SEP] operator[SEP] operator[SEP] identifier[getSheet] operator[SEP] identifier[sheetName] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[getBodyRows] operator[SEP] operator[SEP] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[clearCache] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[top] operator[SEP] identifier[i] operator[<=] identifier[bottom] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[parent] operator[SEP] identifier[getBodyRows] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[assembleFacesBodyRow] operator[SEP] identifier[i] , identifier[sheet1] , identifier[left] , identifier[right] , identifier[sheetConfig] , identifier[cellRangeMap] , identifier[skippedRegionCells] operator[SEP] operator[SEP] operator[SEP]
}
identifier[sheetConfig] operator[SEP] identifier[setBodyPopulated] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] identifier[setCurrentTopRow] operator[SEP] identifier[top] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] identifier[setCurrentLeftColumn] operator[SEP] identifier[left] operator[SEP] operator[SEP]
}
|
@Deprecated
public static List<String> qualityList(Enumeration<String> e) {
if (e == null || !e.hasMoreElements())
return Collections.emptyList();
QuotedQualityCSV values = new QuotedQualityCSV();
while (e.hasMoreElements())
values.addValue(e.nextElement());
return values.getValues();
} | class class_name[name] begin[{]
method[qualityList, return_type[type[List]], modifier[public static], parameter[e]] begin[{]
if[binary_operation[binary_operation[member[.e], ==, literal[null]], ||, call[e.hasMoreElements, parameter[]]]] begin[{]
return[call[Collections.emptyList, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[QuotedQualityCSV], values]
while[call[e.hasMoreElements, parameter[]]] begin[{]
call[values.addValue, parameter[call[e.nextElement, parameter[]]]]
end[}]
return[call[values.getValues, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[qualityList] operator[SEP] identifier[Enumeration] operator[<] identifier[String] operator[>] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[==] Other[null] operator[||] operator[!] identifier[e] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP] identifier[QuotedQualityCSV] identifier[values] operator[=] Keyword[new] identifier[QuotedQualityCSV] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[e] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[addValue] operator[SEP] identifier[e] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[values] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP]
}
|
private static String blankToNull(String value) {
if (value != null) {
value = value.trim();
if (value.equals("")) {
value = null;
}
}
return value;
} | class class_name[name] begin[{]
method[blankToNull, return_type[type[String]], modifier[private static], parameter[value]] begin[{]
if[binary_operation[member[.value], !=, literal[null]]] begin[{]
assign[member[.value], call[value.trim, parameter[]]]
if[call[value.equals, parameter[literal[""]]]] begin[{]
assign[member[.value], literal[null]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[blankToNull] operator[SEP] identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[value] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[value] operator[=] Other[null] operator[SEP]
}
}
Keyword[return] identifier[value] operator[SEP]
}
|
@Override
public void audit(final LoggingEvent e) {
try {
logger.info(MarkerFactory.getMarker(AUDIT), serialize(e));
} catch (Exception ex) {
throw new RuntimeException("unable to serialize event", ex);
}
} | class class_name[name] begin[{]
method[audit, return_type[void], modifier[public], parameter[e]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=AUDIT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMarker, postfix_operators=[], prefix_operators=[], qualifier=MarkerFactory, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serialize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unable to serialize event"), MemberReference(member=ex, 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=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[audit] operator[SEP] Keyword[final] identifier[LoggingEvent] identifier[e] operator[SEP] {
Keyword[try] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] identifier[MarkerFactory] operator[SEP] identifier[getMarker] operator[SEP] identifier[AUDIT] operator[SEP] , identifier[serialize] operator[SEP] identifier[e] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
|
public static InterfaceMeta get(final Class<?> type) {
InterfaceMeta interfaceMeta = INTERFACE_MAP.get(type);
if (interfaceMeta == null) {
final Interface waylandInterface = type.getAnnotation(Interface.class);
if (waylandInterface == null) {
interfaceMeta = NO_INTERFACE;
}
else {
interfaceMeta = create(waylandInterface.name(),
waylandInterface.version(),
waylandInterface.methods(),
waylandInterface.events());
}
INTERFACE_MAP.put(type,
interfaceMeta);
}
return interfaceMeta;
} | class class_name[name] begin[{]
method[get, return_type[type[InterfaceMeta]], modifier[public static], parameter[type]] begin[{]
local_variable[type[InterfaceMeta], interfaceMeta]
if[binary_operation[member[.interfaceMeta], ==, literal[null]]] begin[{]
local_variable[type[Interface], waylandInterface]
if[binary_operation[member[.waylandInterface], ==, literal[null]]] begin[{]
assign[member[.interfaceMeta], member[.NO_INTERFACE]]
else begin[{]
assign[member[.interfaceMeta], call[.create, parameter[call[waylandInterface.name, parameter[]], call[waylandInterface.version, parameter[]], call[waylandInterface.methods, parameter[]], call[waylandInterface.events, parameter[]]]]]
end[}]
call[INTERFACE_MAP.put, parameter[member[.type], member[.interfaceMeta]]]
else begin[{]
None
end[}]
return[member[.interfaceMeta]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[InterfaceMeta] identifier[get] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[SEP] {
identifier[InterfaceMeta] identifier[interfaceMeta] operator[=] identifier[INTERFACE_MAP] operator[SEP] identifier[get] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[interfaceMeta] operator[==] Other[null] operator[SEP] {
Keyword[final] identifier[Interface] identifier[waylandInterface] operator[=] identifier[type] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[Interface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[waylandInterface] operator[==] Other[null] operator[SEP] {
identifier[interfaceMeta] operator[=] identifier[NO_INTERFACE] operator[SEP]
}
Keyword[else] {
identifier[interfaceMeta] operator[=] identifier[create] operator[SEP] identifier[waylandInterface] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[waylandInterface] operator[SEP] identifier[version] operator[SEP] operator[SEP] , identifier[waylandInterface] operator[SEP] identifier[methods] operator[SEP] operator[SEP] , identifier[waylandInterface] operator[SEP] identifier[events] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[INTERFACE_MAP] operator[SEP] identifier[put] operator[SEP] identifier[type] , identifier[interfaceMeta] operator[SEP] operator[SEP]
}
Keyword[return] identifier[interfaceMeta] operator[SEP]
}
|
public static Response patch(String path, Object... pathParams) {
return given().patch(path, pathParams);
} | class class_name[name] begin[{]
method[patch, return_type[type[Response]], modifier[public static], parameter[path, pathParams]] begin[{]
return[call[.given, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Response] identifier[patch] operator[SEP] identifier[String] identifier[path] , identifier[Object] operator[...] identifier[pathParams] operator[SEP] {
Keyword[return] identifier[given] operator[SEP] operator[SEP] operator[SEP] identifier[patch] operator[SEP] identifier[path] , identifier[pathParams] operator[SEP] operator[SEP]
}
|
public CalendarWeek minus(Years<Weekcycle> years) {
if (years.isEmpty()) {
return this;
}
int y = MathUtils.safeSubtract(this.year, years.getAmount());
int effectiveWeek = this.week;
if ((this.week == 53) && (maximumOfWeek(y) < 53)) {
effectiveWeek = 52;
}
return CalendarWeek.of(y, effectiveWeek);
} | class class_name[name] begin[{]
method[minus, return_type[type[CalendarWeek]], modifier[public], parameter[years]] begin[{]
if[call[years.isEmpty, parameter[]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
local_variable[type[int], y]
local_variable[type[int], effectiveWeek]
if[binary_operation[binary_operation[THIS[member[None.week]], ==, literal[53]], &&, binary_operation[call[.maximumOfWeek, parameter[member[.y]]], <, literal[53]]]] begin[{]
assign[member[.effectiveWeek], literal[52]]
else begin[{]
None
end[}]
return[call[CalendarWeek.of, parameter[member[.y], member[.effectiveWeek]]]]
end[}]
END[}] | Keyword[public] identifier[CalendarWeek] identifier[minus] operator[SEP] identifier[Years] operator[<] identifier[Weekcycle] operator[>] identifier[years] operator[SEP] {
Keyword[if] operator[SEP] identifier[years] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[int] identifier[y] operator[=] identifier[MathUtils] operator[SEP] identifier[safeSubtract] operator[SEP] Keyword[this] operator[SEP] identifier[year] , identifier[years] operator[SEP] identifier[getAmount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[effectiveWeek] operator[=] Keyword[this] operator[SEP] identifier[week] operator[SEP] Keyword[if] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[week] operator[==] Other[53] operator[SEP] operator[&&] operator[SEP] identifier[maximumOfWeek] operator[SEP] identifier[y] operator[SEP] operator[<] Other[53] operator[SEP] operator[SEP] {
identifier[effectiveWeek] operator[=] Other[52] operator[SEP]
}
Keyword[return] identifier[CalendarWeek] operator[SEP] identifier[of] operator[SEP] identifier[y] , identifier[effectiveWeek] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("PMD.NPathComplexity")
private static boolean isConfigured(AuditType auditType, JSONArray jsonArray) {
if (auditType.equals(AuditType.CODE_REVIEW)) {
return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_REPO_CONFIGURED.name()) ? true : false);
}
if (auditType.equals(AuditType.CODE_QUALITY)) {
return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_CODEQUALITY_CONFIGURED.name()) ? true : false);
}
if (auditType.equals(AuditType.STATIC_SECURITY_ANALYSIS)) {
return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_STATIC_SECURITY_ANALYSIS_CONFIGURED.name()) ? true : false);
}
if (auditType.equals(AuditType.LIBRARY_POLICY)) {
return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_LIBRARY_POLICY_ANALYSIS_CONFIGURED.name()) ? true : false);
}
if (auditType.equals(AuditType.TEST_RESULT)) {
return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_TEST_CONFIGURED.name()) ? true : false);
}
if (auditType.equals(AuditType.PERF_TEST)) {
return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_PERFORMANCE_TEST_CONFIGURED.name()) ? true : false);
}
if (auditType.equals(AuditType.BUILD_REVIEW)) {
return (jsonArray.toJSONString().contains(DashboardAuditStatus.DASHBOARD_BUILD_CONFIGURED.name()) ? true : false);
}
return false;
} | class class_name[name] begin[{]
method[isConfigured, return_type[type[boolean]], modifier[private static], parameter[auditType, jsonArray]] begin[{]
if[call[auditType.equals, parameter[member[AuditType.CODE_REVIEW]]]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=toJSONString, postfix_operators=[], prefix_operators=[], qualifier=jsonArray, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=DashboardAuditStatus.DASHBOARD_REPO_CONFIGURED, selectors=[], type_arguments=None)], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true))]
else begin[{]
None
end[}]
if[call[auditType.equals, parameter[member[AuditType.CODE_QUALITY]]]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=toJSONString, postfix_operators=[], prefix_operators=[], qualifier=jsonArray, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=DashboardAuditStatus.DASHBOARD_CODEQUALITY_CONFIGURED, selectors=[], type_arguments=None)], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true))]
else begin[{]
None
end[}]
if[call[auditType.equals, parameter[member[AuditType.STATIC_SECURITY_ANALYSIS]]]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=toJSONString, postfix_operators=[], prefix_operators=[], qualifier=jsonArray, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=DashboardAuditStatus.DASHBOARD_STATIC_SECURITY_ANALYSIS_CONFIGURED, selectors=[], type_arguments=None)], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true))]
else begin[{]
None
end[}]
if[call[auditType.equals, parameter[member[AuditType.LIBRARY_POLICY]]]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=toJSONString, postfix_operators=[], prefix_operators=[], qualifier=jsonArray, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=DashboardAuditStatus.DASHBOARD_LIBRARY_POLICY_ANALYSIS_CONFIGURED, selectors=[], type_arguments=None)], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true))]
else begin[{]
None
end[}]
if[call[auditType.equals, parameter[member[AuditType.TEST_RESULT]]]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=toJSONString, postfix_operators=[], prefix_operators=[], qualifier=jsonArray, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=DashboardAuditStatus.DASHBOARD_TEST_CONFIGURED, selectors=[], type_arguments=None)], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true))]
else begin[{]
None
end[}]
if[call[auditType.equals, parameter[member[AuditType.PERF_TEST]]]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=toJSONString, postfix_operators=[], prefix_operators=[], qualifier=jsonArray, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=DashboardAuditStatus.DASHBOARD_PERFORMANCE_TEST_CONFIGURED, selectors=[], type_arguments=None)], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true))]
else begin[{]
None
end[}]
if[call[auditType.equals, parameter[member[AuditType.BUILD_REVIEW]]]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=toJSONString, postfix_operators=[], prefix_operators=[], qualifier=jsonArray, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=DashboardAuditStatus.DASHBOARD_BUILD_CONFIGURED, selectors=[], type_arguments=None)], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true))]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] Keyword[static] Keyword[boolean] identifier[isConfigured] operator[SEP] identifier[AuditType] identifier[auditType] , identifier[JSONArray] identifier[jsonArray] operator[SEP] {
Keyword[if] operator[SEP] identifier[auditType] operator[SEP] identifier[equals] operator[SEP] identifier[AuditType] operator[SEP] identifier[CODE_REVIEW] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[jsonArray] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[DashboardAuditStatus] operator[SEP] identifier[DASHBOARD_REPO_CONFIGURED] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[?] literal[boolean] operator[:] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[auditType] operator[SEP] identifier[equals] operator[SEP] identifier[AuditType] operator[SEP] identifier[CODE_QUALITY] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[jsonArray] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[DashboardAuditStatus] operator[SEP] identifier[DASHBOARD_CODEQUALITY_CONFIGURED] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[?] literal[boolean] operator[:] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[auditType] operator[SEP] identifier[equals] operator[SEP] identifier[AuditType] operator[SEP] identifier[STATIC_SECURITY_ANALYSIS] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[jsonArray] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[DashboardAuditStatus] operator[SEP] identifier[DASHBOARD_STATIC_SECURITY_ANALYSIS_CONFIGURED] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[?] literal[boolean] operator[:] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[auditType] operator[SEP] identifier[equals] operator[SEP] identifier[AuditType] operator[SEP] identifier[LIBRARY_POLICY] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[jsonArray] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[DashboardAuditStatus] operator[SEP] identifier[DASHBOARD_LIBRARY_POLICY_ANALYSIS_CONFIGURED] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[?] literal[boolean] operator[:] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[auditType] operator[SEP] identifier[equals] operator[SEP] identifier[AuditType] operator[SEP] identifier[TEST_RESULT] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[jsonArray] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[DashboardAuditStatus] operator[SEP] identifier[DASHBOARD_TEST_CONFIGURED] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[?] literal[boolean] operator[:] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[auditType] operator[SEP] identifier[equals] operator[SEP] identifier[AuditType] operator[SEP] identifier[PERF_TEST] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[jsonArray] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[DashboardAuditStatus] operator[SEP] identifier[DASHBOARD_PERFORMANCE_TEST_CONFIGURED] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[?] literal[boolean] operator[:] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[auditType] operator[SEP] identifier[equals] operator[SEP] identifier[AuditType] operator[SEP] identifier[BUILD_REVIEW] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[jsonArray] operator[SEP] identifier[toJSONString] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[DashboardAuditStatus] operator[SEP] identifier[DASHBOARD_BUILD_CONFIGURED] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[?] literal[boolean] operator[:] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public SDVariable pad(SDVariable input, SDVariable padding, double constant){
return pad(null, input, padding, Pad.Mode.CONSTANT, constant);
} | class class_name[name] begin[{]
method[pad, return_type[type[SDVariable]], modifier[public], parameter[input, padding, constant]] begin[{]
return[call[.pad, parameter[literal[null], member[.input], member[.padding], member[Pad.Mode.CONSTANT], member[.constant]]]]
end[}]
END[}] | Keyword[public] identifier[SDVariable] identifier[pad] operator[SEP] identifier[SDVariable] identifier[input] , identifier[SDVariable] identifier[padding] , Keyword[double] identifier[constant] operator[SEP] {
Keyword[return] identifier[pad] operator[SEP] Other[null] , identifier[input] , identifier[padding] , identifier[Pad] operator[SEP] identifier[Mode] operator[SEP] identifier[CONSTANT] , identifier[constant] operator[SEP] operator[SEP]
}
|
@NonNull
public static Disposable fromSubscription(@NonNull Subscription subscription) {
ObjectHelper.requireNonNull(subscription, "subscription is null");
return new SubscriptionDisposable(subscription);
} | class class_name[name] begin[{]
method[fromSubscription, return_type[type[Disposable]], modifier[public static], parameter[subscription]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.subscription], literal["subscription is null"]]]
return[ClassCreator(arguments=[MemberReference(member=subscription, 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=SubscriptionDisposable, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[NonNull] Keyword[public] Keyword[static] identifier[Disposable] identifier[fromSubscription] operator[SEP] annotation[@] identifier[NonNull] identifier[Subscription] identifier[subscription] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[subscription] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[SubscriptionDisposable] operator[SEP] identifier[subscription] operator[SEP] operator[SEP]
}
|
public <T extends Serializable, Method extends BotApiMethod<T>, Callback extends SentCallback<T>> void executeAsync(Method method, Callback callback) throws TelegramApiException {
if (method == null) {
throw new TelegramApiException("Parameter method can not be null");
}
if (callback == null) {
throw new TelegramApiException("Parameter callback can not be null");
}
sendApiMethodAsync(method, callback);
} | class class_name[name] begin[{]
method[executeAsync, return_type[void], modifier[public], parameter[method, callback]] begin[{]
if[binary_operation[member[.method], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter method can not be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TelegramApiException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.callback], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter callback can not be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TelegramApiException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.sendApiMethodAsync, parameter[member[.method], member[.callback]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[Serializable] , identifier[Method] Keyword[extends] identifier[BotApiMethod] operator[<] identifier[T] operator[>] , identifier[Callback] Keyword[extends] identifier[SentCallback] operator[<] identifier[T] operator[>] operator[>] Keyword[void] identifier[executeAsync] operator[SEP] identifier[Method] identifier[method] , identifier[Callback] identifier[callback] operator[SEP] Keyword[throws] identifier[TelegramApiException] {
Keyword[if] operator[SEP] identifier[method] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TelegramApiException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[callback] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TelegramApiException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[sendApiMethodAsync] operator[SEP] identifier[method] , identifier[callback] operator[SEP] operator[SEP]
}
|
public Collection<ProcessDefinition> getProcessesByDeploymentId(String deploymentId, QueryContext queryContext) {
deploymentId = getLatestDeploymentId(requireNonNull(deploymentId, DEPLOYMENT_ID_MUST_NOT_BE_NULL));
List<ProcessDefinition> outputCollection = new ArrayList<ProcessDefinition>();
CollectionUtils.select(availableProcesses, new ByDeploymentIdPredicate(deploymentId, identityProvider.getRoles()), outputCollection);
applySorting(outputCollection, queryContext);
return applyPaginition(outputCollection, queryContext);
} | class class_name[name] begin[{]
method[getProcessesByDeploymentId, return_type[type[Collection]], modifier[public], parameter[deploymentId, queryContext]] begin[{]
assign[member[.deploymentId], call[.getLatestDeploymentId, parameter[call[.requireNonNull, parameter[member[.deploymentId], member[.DEPLOYMENT_ID_MUST_NOT_BE_NULL]]]]]]
local_variable[type[List], outputCollection]
call[CollectionUtils.select, parameter[member[.availableProcesses], ClassCreator(arguments=[MemberReference(member=deploymentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getRoles, postfix_operators=[], prefix_operators=[], qualifier=identityProvider, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByDeploymentIdPredicate, sub_type=None)), member[.outputCollection]]]
call[.applySorting, parameter[member[.outputCollection], member[.queryContext]]]
return[call[.applyPaginition, parameter[member[.outputCollection], member[.queryContext]]]]
end[}]
END[}] | Keyword[public] identifier[Collection] operator[<] identifier[ProcessDefinition] operator[>] identifier[getProcessesByDeploymentId] operator[SEP] identifier[String] identifier[deploymentId] , identifier[QueryContext] identifier[queryContext] operator[SEP] {
identifier[deploymentId] operator[=] identifier[getLatestDeploymentId] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[deploymentId] , identifier[DEPLOYMENT_ID_MUST_NOT_BE_NULL] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[ProcessDefinition] operator[>] identifier[outputCollection] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[ProcessDefinition] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[CollectionUtils] operator[SEP] identifier[select] operator[SEP] identifier[availableProcesses] , Keyword[new] identifier[ByDeploymentIdPredicate] operator[SEP] identifier[deploymentId] , identifier[identityProvider] operator[SEP] identifier[getRoles] operator[SEP] operator[SEP] operator[SEP] , identifier[outputCollection] operator[SEP] operator[SEP] identifier[applySorting] operator[SEP] identifier[outputCollection] , identifier[queryContext] operator[SEP] operator[SEP] Keyword[return] identifier[applyPaginition] operator[SEP] identifier[outputCollection] , identifier[queryContext] operator[SEP] operator[SEP]
}
|
protected MessageFormat createMessageFormat(String msg, Locale locale) {
return new MessageFormat((msg != null ? msg : ""), locale);
} | class class_name[name] begin[{]
method[createMessageFormat, return_type[type[MessageFormat]], modifier[protected], parameter[msg, locale]] begin[{]
return[ClassCreator(arguments=[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), if_true=MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=locale, 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=MessageFormat, sub_type=None))]
end[}]
END[}] | Keyword[protected] identifier[MessageFormat] identifier[createMessageFormat] operator[SEP] identifier[String] identifier[msg] , identifier[Locale] identifier[locale] operator[SEP] {
Keyword[return] Keyword[new] identifier[MessageFormat] operator[SEP] operator[SEP] identifier[msg] operator[!=] Other[null] operator[?] identifier[msg] operator[:] literal[String] operator[SEP] , identifier[locale] operator[SEP] operator[SEP]
}
|
public static void waitForStandalone(final Process process, final ModelControllerClient client, final long startupTimeout)
throws InterruptedException, RuntimeException, TimeoutException {
Assert.checkNotNullParam("client", client);
long timeout = startupTimeout * 1000;
final long sleep = 100L;
while (timeout > 0) {
long before = System.currentTimeMillis();
if (isStandaloneRunning(client))
break;
timeout -= (System.currentTimeMillis() - before);
if (process != null && !process.isAlive()) {
throw new RuntimeException(String.format("The process has unexpectedly exited with code %d", process.exitValue()));
}
TimeUnit.MILLISECONDS.sleep(sleep);
timeout -= sleep;
}
if (timeout <= 0) {
if (process != null) {
process.destroy();
}
throw new TimeoutException(String.format("The server did not start within %s seconds.", startupTimeout));
}
} | class class_name[name] begin[{]
method[waitForStandalone, return_type[void], modifier[public static], parameter[process, client, startupTimeout]] begin[{]
call[Assert.checkNotNullParam, parameter[literal["client"], member[.client]]]
local_variable[type[long], timeout]
local_variable[type[long], sleep]
while[binary_operation[member[.timeout], >, literal[0]]] begin[{]
local_variable[type[long], before]
if[call[.isStandaloneRunning, parameter[member[.client]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.timeout], binary_operation[call[System.currentTimeMillis, parameter[]], -, member[.before]]]
if[binary_operation[binary_operation[member[.process], !=, literal[null]], &&, call[process.isAlive, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The process has unexpectedly exited with code %d"), MethodInvocation(arguments=[], member=exitValue, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None)], 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=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[TimeUnit.MILLISECONDS.sleep, parameter[member[.sleep]]]
assign[member[.timeout], member[.sleep]]
end[}]
if[binary_operation[member[.timeout], <=, literal[0]]] begin[{]
if[binary_operation[member[.process], !=, literal[null]]] begin[{]
call[process.destroy, parameter[]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The server did not start within %s seconds."), MemberReference(member=startupTimeout, 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=TimeoutException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[waitForStandalone] operator[SEP] Keyword[final] identifier[Process] identifier[process] , Keyword[final] identifier[ModelControllerClient] identifier[client] , Keyword[final] Keyword[long] identifier[startupTimeout] operator[SEP] Keyword[throws] identifier[InterruptedException] , identifier[RuntimeException] , identifier[TimeoutException] {
identifier[Assert] operator[SEP] identifier[checkNotNullParam] operator[SEP] literal[String] , identifier[client] operator[SEP] operator[SEP] Keyword[long] identifier[timeout] operator[=] identifier[startupTimeout] operator[*] Other[1000] operator[SEP] Keyword[final] Keyword[long] identifier[sleep] operator[=] Other[100L] operator[SEP] Keyword[while] operator[SEP] identifier[timeout] operator[>] Other[0] operator[SEP] {
Keyword[long] identifier[before] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isStandaloneRunning] operator[SEP] identifier[client] operator[SEP] operator[SEP] Keyword[break] operator[SEP] identifier[timeout] operator[-=] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[before] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[process] operator[!=] Other[null] operator[&&] operator[!] identifier[process] operator[SEP] identifier[isAlive] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[process] operator[SEP] identifier[exitValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] identifier[sleep] operator[SEP] identifier[sleep] operator[SEP] operator[SEP] identifier[timeout] operator[-=] identifier[sleep] operator[SEP]
}
Keyword[if] operator[SEP] identifier[timeout] operator[<=] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[process] operator[!=] Other[null] operator[SEP] {
identifier[process] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[TimeoutException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[startupTimeout] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public void index(Class entityClazz, EntityMetadata metadata, Map<String, Object> values, Object parentId,
Class parentClazz)
{
ObjectMapper mapper = new ObjectMapper();
try
{
values.put("entity_class", metadata.getEntityClazz().getCanonicalName().toLowerCase());
if (parentId != null)
{
values.put(PARENT_ID_FIELD, parentId);
}
if (entityClazz != null)
{
values.put(PARENT_ID_CLASS, parentClazz.getCanonicalName().toLowerCase());
}
String json = mapper.writeValueAsString(values);
String idColumnName = ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName();
Object id = PropertyAccessorHelper.fromSourceToTargetClass(String.class,
((AbstractAttribute) metadata.getIdAttribute()).getBindableJavaType(), values.get(idColumnName));
ListenableActionFuture<IndexResponse> listenableActionFuture = client
.prepareIndex(metadata.getSchema().toLowerCase(), entityClazz.getSimpleName(), id.toString())
.setSource(json).execute();
IndexResponse response = listenableActionFuture.actionGet();
}
catch (JsonGenerationException e)
{
log.error("Error while creating json document", e);
throw new KunderaException(e);
}
catch (JsonMappingException e)
{
log.error("Error while creating json document", e);
throw new KunderaException(e);
}
catch (IOException e)
{
log.error("Error while creating json document", e);
throw new KunderaException(e);
}
catch (Exception e)
{
log.error("Error while creating indexes on document", e);
throw new KunderaException(e);
}
} | class class_name[name] begin[{]
method[index, return_type[void], modifier[public], parameter[entityClazz, metadata, values, parentId, parentClazz]] begin[{]
local_variable[type[ObjectMapper], mapper]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="entity_class"), MethodInvocation(arguments=[], member=getEntityClazz, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[MethodInvocation(arguments=[], member=getCanonicalName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toLowerCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=parentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PARENT_ID_FIELD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=parentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=entityClazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PARENT_ID_CLASS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getCanonicalName, postfix_operators=[], prefix_operators=[], qualifier=parentClazz, selectors=[MethodInvocation(arguments=[], member=toLowerCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeValueAsString, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), name=json)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getIdAttribute, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=AbstractAttribute, sub_type=None)), name=idColumnName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), Cast(expression=MethodInvocation(arguments=[], member=getIdAttribute, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=AbstractAttribute, sub_type=None)), MethodInvocation(arguments=[MemberReference(member=idColumnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None)], member=fromSourceToTargetClass, postfix_operators=[], prefix_operators=[], qualifier=PropertyAccessorHelper, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSchema, postfix_operators=[], prefix_operators=[], qualifier=metadata, selectors=[MethodInvocation(arguments=[], member=toLowerCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=[], prefix_operators=[], qualifier=entityClazz, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=id, selectors=[], type_arguments=None)], member=prepareIndex, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[MethodInvocation(arguments=[MemberReference(member=json, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=execute, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=listenableActionFuture)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=IndexResponse, sub_type=None))], dimensions=[], name=ListenableActionFuture, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=actionGet, postfix_operators=[], prefix_operators=[], qualifier=listenableActionFuture, selectors=[], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IndexResponse, sub_type=None))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while creating json document"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KunderaException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JsonGenerationException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while creating json document"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KunderaException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JsonMappingException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while creating json document"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KunderaException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error while creating indexes on document"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KunderaException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[index] operator[SEP] identifier[Class] identifier[entityClazz] , identifier[EntityMetadata] identifier[metadata] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[values] , identifier[Object] identifier[parentId] , identifier[Class] identifier[parentClazz] operator[SEP] {
identifier[ObjectMapper] identifier[mapper] operator[=] Keyword[new] identifier[ObjectMapper] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[values] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[metadata] operator[SEP] identifier[getEntityClazz] operator[SEP] operator[SEP] operator[SEP] identifier[getCanonicalName] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parentId] operator[!=] Other[null] operator[SEP] {
identifier[values] operator[SEP] identifier[put] operator[SEP] identifier[PARENT_ID_FIELD] , identifier[parentId] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[entityClazz] operator[!=] Other[null] operator[SEP] {
identifier[values] operator[SEP] identifier[put] operator[SEP] identifier[PARENT_ID_CLASS] , identifier[parentClazz] operator[SEP] identifier[getCanonicalName] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[json] operator[=] identifier[mapper] operator[SEP] identifier[writeValueAsString] operator[SEP] identifier[values] operator[SEP] operator[SEP] identifier[String] identifier[idColumnName] operator[=] operator[SEP] operator[SEP] identifier[AbstractAttribute] operator[SEP] identifier[metadata] operator[SEP] identifier[getIdAttribute] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getJPAColumnName] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[id] operator[=] identifier[PropertyAccessorHelper] operator[SEP] identifier[fromSourceToTargetClass] operator[SEP] identifier[String] operator[SEP] Keyword[class] , operator[SEP] operator[SEP] identifier[AbstractAttribute] operator[SEP] identifier[metadata] operator[SEP] identifier[getIdAttribute] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getBindableJavaType] operator[SEP] operator[SEP] , identifier[values] operator[SEP] identifier[get] operator[SEP] identifier[idColumnName] operator[SEP] operator[SEP] operator[SEP] identifier[ListenableActionFuture] operator[<] identifier[IndexResponse] operator[>] identifier[listenableActionFuture] operator[=] identifier[client] operator[SEP] identifier[prepareIndex] operator[SEP] identifier[metadata] operator[SEP] identifier[getSchema] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] , identifier[entityClazz] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] , identifier[id] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setSource] operator[SEP] identifier[json] operator[SEP] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] identifier[IndexResponse] identifier[response] operator[=] identifier[listenableActionFuture] operator[SEP] identifier[actionGet] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JsonGenerationException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[KunderaException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JsonMappingException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[KunderaException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[KunderaException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[KunderaException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static String render(String templateContent, Map<String, Object> paramMap) {
StringWriter writer = new StringWriter();
try {
Configuration cfg = new Configuration(Configuration.VERSION_2_3_22);
cfg.setTemplateLoader(new StringTemplateLoader(templateContent));
cfg.setDefaultEncoding("UTF-8");
Template template = cfg.getTemplate("");
template.process(paramMap, writer);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
} catch (TemplateException e) {
e.printStackTrace();
log.error(e.getMessage());
}
return writer.toString();
} | class class_name[name] begin[{]
method[render, return_type[type[String]], modifier[public static], parameter[templateContent, paramMap]] begin[{]
local_variable[type[StringWriter], writer]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=VERSION_2_3_22, postfix_operators=[], prefix_operators=[], qualifier=Configuration, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Configuration, sub_type=None)), name=cfg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Configuration, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=templateContent, 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=StringTemplateLoader, sub_type=None))], member=setTemplateLoader, postfix_operators=[], prefix_operators=[], qualifier=cfg, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=setDefaultEncoding, postfix_operators=[], prefix_operators=[], qualifier=cfg, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=getTemplate, postfix_operators=[], prefix_operators=[], qualifier=cfg, selectors=[], type_arguments=None), name=template)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Template, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=paramMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=process, postfix_operators=[], prefix_operators=[], qualifier=template, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TemplateException']))], finally_block=None, label=None, resources=None)
return[call[writer.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[render] operator[SEP] identifier[String] identifier[templateContent] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[paramMap] operator[SEP] {
identifier[StringWriter] identifier[writer] operator[=] Keyword[new] identifier[StringWriter] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Configuration] identifier[cfg] operator[=] Keyword[new] identifier[Configuration] operator[SEP] identifier[Configuration] operator[SEP] identifier[VERSION_2_3_22] operator[SEP] operator[SEP] identifier[cfg] operator[SEP] identifier[setTemplateLoader] operator[SEP] Keyword[new] identifier[StringTemplateLoader] operator[SEP] identifier[templateContent] operator[SEP] operator[SEP] operator[SEP] identifier[cfg] operator[SEP] identifier[setDefaultEncoding] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Template] identifier[template] operator[=] identifier[cfg] operator[SEP] identifier[getTemplate] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[template] operator[SEP] identifier[process] operator[SEP] identifier[paramMap] , identifier[writer] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TemplateException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[writer] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public Pager<Group> getGroups(int itemsPerPage) throws GitLabApiException {
return (new Pager<Group>(this, Group.class, itemsPerPage, null, "groups"));
} | class class_name[name] begin[{]
method[getGroups, return_type[type[Pager]], modifier[public], parameter[itemsPerPage]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Group, sub_type=None)), MemberReference(member=itemsPerPage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="groups")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None))], dimensions=None, name=Pager, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Pager] operator[<] identifier[Group] operator[>] identifier[getGroups] operator[SEP] Keyword[int] identifier[itemsPerPage] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[return] operator[SEP] Keyword[new] identifier[Pager] operator[<] identifier[Group] operator[>] operator[SEP] Keyword[this] , identifier[Group] operator[SEP] Keyword[class] , identifier[itemsPerPage] , Other[null] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
private static void analyzeClassFile(org.jacoco.previous.core.analysis.Analyzer analyzer, File classFile) {
try (InputStream inputStream = new FileInputStream(classFile)) {
analyzer.analyzeClass(inputStream, classFile.getPath());
} catch (IOException e) {
// (Godin): in fact JaCoCo includes name into exception
JaCoCoExtensions.logger().warn("Exception during analysis of file " + classFile.getAbsolutePath(), e);
}
} | class class_name[name] begin[{]
method[analyzeClassFile, return_type[void], modifier[private static], parameter[analyzer, classFile]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=classFile, selectors=[], type_arguments=None)], member=analyzeClass, postfix_operators=[], prefix_operators=[], qualifier=analyzer, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=logger, postfix_operators=[], prefix_operators=[], qualifier=JaCoCoExtensions, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception during analysis of file "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=classFile, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=inputStream, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=classFile, 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=FileInputStream, sub_type=None)))])
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[analyzeClassFile] operator[SEP] identifier[org] operator[SEP] identifier[jacoco] operator[SEP] identifier[previous] operator[SEP] identifier[core] operator[SEP] identifier[analysis] operator[SEP] identifier[Analyzer] identifier[analyzer] , identifier[File] identifier[classFile] operator[SEP] {
Keyword[try] operator[SEP] identifier[InputStream] identifier[inputStream] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[classFile] operator[SEP] operator[SEP] {
identifier[analyzer] operator[SEP] identifier[analyzeClass] operator[SEP] identifier[inputStream] , identifier[classFile] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[JaCoCoExtensions] operator[SEP] identifier[logger] operator[SEP] operator[SEP] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[classFile] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public <T extends IGeneratorParameter<S>, S> S getDefault(Class<T> param) {
if (renderingParameters.containsKey(param.getName())) return getParameter(param).getDefault();
// OK, this parameter is not registered, but that's fine, as we are
// only to return the default value anyway...
try {
return param.newInstance().getDefault();
} catch (InstantiationException exception) {
throw new IllegalArgumentException("Could not instantiate a default " + param.getClass().getName(),
exception);
} catch (IllegalAccessException exception) {
throw new IllegalArgumentException("Could not instantiate a default " + param.getClass().getName(),
exception);
}
} | class class_name[name] begin[{]
method[getDefault, return_type[type[S]], modifier[public], parameter[param]] begin[{]
if[call[renderingParameters.containsKey, parameter[call[param.getName, parameter[]]]]] begin[{]
return[call[.getParameter, parameter[member[.param]]]]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[MethodInvocation(arguments=[], member=getDefault, 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=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not instantiate a default "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['InstantiationException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not instantiate a default "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), MemberReference(member=exception, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=exception, types=['IllegalAccessException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] operator[<] identifier[T] Keyword[extends] identifier[IGeneratorParameter] operator[<] identifier[S] operator[>] , identifier[S] operator[>] identifier[S] identifier[getDefault] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[param] operator[SEP] {
Keyword[if] operator[SEP] identifier[renderingParameters] operator[SEP] identifier[containsKey] operator[SEP] identifier[param] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getParameter] operator[SEP] identifier[param] operator[SEP] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[param] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InstantiationException] identifier[exception] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[param] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[exception] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] identifier[exception] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[param] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[exception] operator[SEP] operator[SEP]
}
}
|
private void updateUnderFileSystemInputStream(long offset) throws IOException {
if ((mUnderFileSystemInputStream != null) && offset != mInStreamPos) {
mUfsInstreamManager.release(mUnderFileSystemInputStream);
mUnderFileSystemInputStream = null;
mInStreamPos = -1;
}
if (mUnderFileSystemInputStream == null && offset < mBlockMeta.getBlockSize()) {
UnderFileSystem ufs = mUfsResource.get();
mUnderFileSystemInputStream = mUfsInstreamManager.acquire(ufs,
mBlockMeta.getUnderFileSystemPath(), IdUtils.fileIdFromBlockId(mBlockMeta.getBlockId()),
OpenOptions.defaults().setOffset(mBlockMeta.getOffset() + offset));
mInStreamPos = offset;
}
} | class class_name[name] begin[{]
method[updateUnderFileSystemInputStream, return_type[void], modifier[private], parameter[offset]] begin[{]
if[binary_operation[binary_operation[member[.mUnderFileSystemInputStream], !=, literal[null]], &&, binary_operation[member[.offset], !=, member[.mInStreamPos]]]] begin[{]
call[mUfsInstreamManager.release, parameter[member[.mUnderFileSystemInputStream]]]
assign[member[.mUnderFileSystemInputStream], literal[null]]
assign[member[.mInStreamPos], literal[1]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.mUnderFileSystemInputStream], ==, literal[null]], &&, binary_operation[member[.offset], <, call[mBlockMeta.getBlockSize, parameter[]]]]] begin[{]
local_variable[type[UnderFileSystem], ufs]
assign[member[.mUnderFileSystemInputStream], call[mUfsInstreamManager.acquire, parameter[member[.ufs], call[mBlockMeta.getUnderFileSystemPath, parameter[]], call[IdUtils.fileIdFromBlockId, parameter[call[mBlockMeta.getBlockId, parameter[]]]], call[OpenOptions.defaults, parameter[]]]]]
assign[member[.mInStreamPos], member[.offset]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[updateUnderFileSystemInputStream] operator[SEP] Keyword[long] identifier[offset] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[SEP] identifier[mUnderFileSystemInputStream] operator[!=] Other[null] operator[SEP] operator[&&] identifier[offset] operator[!=] identifier[mInStreamPos] operator[SEP] {
identifier[mUfsInstreamManager] operator[SEP] identifier[release] operator[SEP] identifier[mUnderFileSystemInputStream] operator[SEP] operator[SEP] identifier[mUnderFileSystemInputStream] operator[=] Other[null] operator[SEP] identifier[mInStreamPos] operator[=] operator[-] Other[1] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mUnderFileSystemInputStream] operator[==] Other[null] operator[&&] identifier[offset] operator[<] identifier[mBlockMeta] operator[SEP] identifier[getBlockSize] operator[SEP] operator[SEP] operator[SEP] {
identifier[UnderFileSystem] identifier[ufs] operator[=] identifier[mUfsResource] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[mUnderFileSystemInputStream] operator[=] identifier[mUfsInstreamManager] operator[SEP] identifier[acquire] operator[SEP] identifier[ufs] , identifier[mBlockMeta] operator[SEP] identifier[getUnderFileSystemPath] operator[SEP] operator[SEP] , identifier[IdUtils] operator[SEP] identifier[fileIdFromBlockId] operator[SEP] identifier[mBlockMeta] operator[SEP] identifier[getBlockId] operator[SEP] operator[SEP] operator[SEP] , identifier[OpenOptions] operator[SEP] identifier[defaults] operator[SEP] operator[SEP] operator[SEP] identifier[setOffset] operator[SEP] identifier[mBlockMeta] operator[SEP] identifier[getOffset] operator[SEP] operator[SEP] operator[+] identifier[offset] operator[SEP] operator[SEP] operator[SEP] identifier[mInStreamPos] operator[=] identifier[offset] operator[SEP]
}
}
|
public com.google.api.ads.adwords.axis.v201809.cm.Image getLandscapeLogoImage() {
return landscapeLogoImage;
} | class class_name[name] begin[{]
method[getLandscapeLogoImage, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.landscapeLogoImage]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[adwords] operator[SEP] identifier[axis] operator[SEP] identifier[v201809] operator[SEP] identifier[cm] operator[SEP] identifier[Image] identifier[getLandscapeLogoImage] operator[SEP] operator[SEP] {
Keyword[return] identifier[landscapeLogoImage] operator[SEP]
}
|
public void marshall(DeleteDirectoryRequest deleteDirectoryRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDirectoryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDirectoryRequest.getDirectoryArn(), DIRECTORYARN_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[deleteDirectoryRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deleteDirectoryRequest], ==, 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=getDirectoryArn, postfix_operators=[], prefix_operators=[], qualifier=deleteDirectoryRequest, selectors=[], type_arguments=None), MemberReference(member=DIRECTORYARN_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[DeleteDirectoryRequest] identifier[deleteDirectoryRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deleteDirectoryRequest] 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[deleteDirectoryRequest] operator[SEP] identifier[getDirectoryArn] operator[SEP] operator[SEP] , identifier[DIRECTORYARN_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 CmsXmlContent getContentDocument(CmsFile file, boolean fromCache) throws CmsXmlException {
CmsXmlContent content = null;
if (fromCache) {
content = getSessionCache().getCacheXmlContent(file.getStructureId());
}
if (content == null) {
content = CmsXmlContentFactory.unmarshal(getCmsObject(), file);
getSessionCache().setCacheXmlContent(file.getStructureId(), content);
}
return content;
} | class class_name[name] begin[{]
method[getContentDocument, return_type[type[CmsXmlContent]], modifier[private], parameter[file, fromCache]] begin[{]
local_variable[type[CmsXmlContent], content]
if[member[.fromCache]] begin[{]
assign[member[.content], call[.getSessionCache, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[member[.content], ==, literal[null]]] begin[{]
assign[member[.content], call[CmsXmlContentFactory.unmarshal, parameter[call[.getCmsObject, parameter[]], member[.file]]]]
call[.getSessionCache, parameter[]]
else begin[{]
None
end[}]
return[member[.content]]
end[}]
END[}] | Keyword[private] identifier[CmsXmlContent] identifier[getContentDocument] operator[SEP] identifier[CmsFile] identifier[file] , Keyword[boolean] identifier[fromCache] operator[SEP] Keyword[throws] identifier[CmsXmlException] {
identifier[CmsXmlContent] identifier[content] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[fromCache] operator[SEP] {
identifier[content] operator[=] identifier[getSessionCache] operator[SEP] operator[SEP] operator[SEP] identifier[getCacheXmlContent] operator[SEP] identifier[file] operator[SEP] identifier[getStructureId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[content] operator[==] Other[null] operator[SEP] {
identifier[content] operator[=] identifier[CmsXmlContentFactory] operator[SEP] identifier[unmarshal] operator[SEP] identifier[getCmsObject] operator[SEP] operator[SEP] , identifier[file] operator[SEP] operator[SEP] identifier[getSessionCache] operator[SEP] operator[SEP] operator[SEP] identifier[setCacheXmlContent] operator[SEP] identifier[file] operator[SEP] identifier[getStructureId] operator[SEP] operator[SEP] , identifier[content] operator[SEP] operator[SEP]
}
Keyword[return] identifier[content] operator[SEP]
}
|
public OvhOrder cdn_webstorage_serviceName_traffic_POST(String serviceName, OvhOrderTrafficEnum bandwidth) throws IOException {
String qPath = "/order/cdn/webstorage/{serviceName}/traffic";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "bandwidth", bandwidth);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | class class_name[name] begin[{]
method[cdn_webstorage_serviceName_traffic_POST, return_type[type[OvhOrder]], modifier[public], parameter[serviceName, bandwidth]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[HashMap], o]
call[.addBody, parameter[member[.o], literal["bandwidth"], member[.bandwidth]]]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhOrder, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[OvhOrder] identifier[cdn_webstorage_serviceName_traffic_POST] operator[SEP] identifier[String] identifier[serviceName] , identifier[OvhOrderTrafficEnum] identifier[bandwidth] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[serviceName] operator[SEP] operator[SEP] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[o] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[bandwidth] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[o] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhOrder] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
private static List<String> parseExecParameters(String paramText)
{
final String SafeParamStringValuePattern = "#(SQL_PARSER_SAFE_PARAMSTRING)";
// Find all quoted strings.
// Mask out strings that contain whitespace or commas
// that must not be confused with parameter separators.
// "Safe" strings that don't contain these characters don't need to be masked
// but they DO need to be found and explicitly skipped so that their closing
// quotes don't trigger a false positive for the START of an unsafe string.
// Skipping is accomplished by resetting paramText to an offset substring
// after copying the skipped (or substituted) text to a string builder.
ArrayList<String> originalString = new ArrayList<>();
Matcher stringMatcher = SingleQuotedString.matcher(paramText);
StringBuilder safeText = new StringBuilder();
while (stringMatcher.find()) {
// Save anything before the found string.
safeText.append(paramText.substring(0, stringMatcher.start()));
String asMatched = stringMatcher.group();
if (SingleQuotedStringContainingParameterSeparators.matcher(asMatched).matches()) {
// The matched string is unsafe, provide cover for it in safeText.
originalString.add(asMatched);
safeText.append(SafeParamStringValuePattern);
} else {
// The matched string is safe. Add it to safeText.
safeText.append(asMatched);
}
paramText = paramText.substring(stringMatcher.end());
stringMatcher = SingleQuotedString.matcher(paramText);
}
// Save anything after the last found string.
safeText.append(paramText);
ArrayList<String> params = new ArrayList<>();
int subCount = 0;
int neededSubs = originalString.size();
// Split the params at the separators
String[] split = safeText.toString().split("[\\s,]+");
for (String fragment : split) {
if (fragment.isEmpty()) {
continue; // ignore effects of leading or trailing separators
}
// Replace each substitution in order exactly once.
if (subCount < neededSubs) {
// Substituted strings will normally take up an entire parameter,
// but some cases like parameters containing escaped single quotes
// may require multiple serial substitutions.
while (fragment.indexOf(SafeParamStringValuePattern) > -1) {
fragment = fragment.replace(SafeParamStringValuePattern,
originalString.get(subCount));
++subCount;
}
}
params.add(fragment);
}
assert(subCount == neededSubs);
return params;
} | class class_name[name] begin[{]
method[parseExecParameters, return_type[type[List]], modifier[private static], parameter[paramText]] begin[{]
local_variable[type[String], SafeParamStringValuePattern]
local_variable[type[ArrayList], originalString]
local_variable[type[Matcher], stringMatcher]
local_variable[type[StringBuilder], safeText]
while[call[stringMatcher.find, parameter[]]] begin[{]
call[safeText.append, parameter[call[paramText.substring, parameter[literal[0], call[stringMatcher.start, parameter[]]]]]]
local_variable[type[String], asMatched]
if[call[SingleQuotedStringContainingParameterSeparators.matcher, parameter[member[.asMatched]]]] begin[{]
call[originalString.add, parameter[member[.asMatched]]]
call[safeText.append, parameter[member[.SafeParamStringValuePattern]]]
else begin[{]
call[safeText.append, parameter[member[.asMatched]]]
end[}]
assign[member[.paramText], call[paramText.substring, parameter[call[stringMatcher.end, parameter[]]]]]
assign[member[.stringMatcher], call[SingleQuotedString.matcher, parameter[member[.paramText]]]]
end[}]
call[safeText.append, parameter[member[.paramText]]]
local_variable[type[ArrayList], params]
local_variable[type[int], subCount]
local_variable[type[int], neededSubs]
local_variable[type[String], split]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=fragment, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=subCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=neededSubs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fragment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=SafeParamStringValuePattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=subCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=originalString, selectors=[], type_arguments=None)], member=replace, postfix_operators=[], prefix_operators=[], qualifier=fragment, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=subCount, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[]), label=None)]), condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=SafeParamStringValuePattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=fragment, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=>), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fragment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fragment)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=subCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=neededSubs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), label=None, value=None)
return[member[.params]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[parseExecParameters] operator[SEP] identifier[String] identifier[paramText] operator[SEP] {
Keyword[final] identifier[String] identifier[SafeParamStringValuePattern] operator[=] literal[String] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[originalString] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Matcher] identifier[stringMatcher] operator[=] identifier[SingleQuotedString] operator[SEP] identifier[matcher] operator[SEP] identifier[paramText] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[safeText] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[stringMatcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
identifier[safeText] operator[SEP] identifier[append] operator[SEP] identifier[paramText] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[stringMatcher] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[asMatched] operator[=] identifier[stringMatcher] operator[SEP] identifier[group] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[SingleQuotedStringContainingParameterSeparators] operator[SEP] identifier[matcher] operator[SEP] identifier[asMatched] operator[SEP] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[originalString] operator[SEP] identifier[add] operator[SEP] identifier[asMatched] operator[SEP] operator[SEP] identifier[safeText] operator[SEP] identifier[append] operator[SEP] identifier[SafeParamStringValuePattern] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[safeText] operator[SEP] identifier[append] operator[SEP] identifier[asMatched] operator[SEP] operator[SEP]
}
identifier[paramText] operator[=] identifier[paramText] operator[SEP] identifier[substring] operator[SEP] identifier[stringMatcher] operator[SEP] identifier[end] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[stringMatcher] operator[=] identifier[SingleQuotedString] operator[SEP] identifier[matcher] operator[SEP] identifier[paramText] operator[SEP] operator[SEP]
}
identifier[safeText] operator[SEP] identifier[append] operator[SEP] identifier[paramText] operator[SEP] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[params] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[subCount] operator[=] Other[0] operator[SEP] Keyword[int] identifier[neededSubs] operator[=] identifier[originalString] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[split] operator[=] identifier[safeText] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[fragment] operator[:] identifier[split] operator[SEP] {
Keyword[if] operator[SEP] identifier[fragment] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[subCount] operator[<] identifier[neededSubs] operator[SEP] {
Keyword[while] operator[SEP] identifier[fragment] operator[SEP] identifier[indexOf] operator[SEP] identifier[SafeParamStringValuePattern] operator[SEP] operator[>] operator[-] Other[1] operator[SEP] {
identifier[fragment] operator[=] identifier[fragment] operator[SEP] identifier[replace] operator[SEP] identifier[SafeParamStringValuePattern] , identifier[originalString] operator[SEP] identifier[get] operator[SEP] identifier[subCount] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[subCount] operator[SEP]
}
}
identifier[params] operator[SEP] identifier[add] operator[SEP] identifier[fragment] operator[SEP] operator[SEP]
}
Keyword[assert] operator[SEP] identifier[subCount] operator[==] identifier[neededSubs] operator[SEP] operator[SEP] Keyword[return] identifier[params] operator[SEP]
}
|
void shutdown() throws InterruptedException {
m_shouldStop = true;
if (m_thread != null) {
m_selector.wakeup();
m_thread.join();
}
} | class class_name[name] begin[{]
method[shutdown, return_type[void], modifier[default], parameter[]] begin[{]
assign[member[.m_shouldStop], literal[true]]
if[binary_operation[member[.m_thread], !=, literal[null]]] begin[{]
call[m_selector.wakeup, parameter[]]
call[m_thread.join, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[shutdown] operator[SEP] operator[SEP] Keyword[throws] identifier[InterruptedException] {
identifier[m_shouldStop] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[m_thread] operator[!=] Other[null] operator[SEP] {
identifier[m_selector] operator[SEP] identifier[wakeup] operator[SEP] operator[SEP] operator[SEP] identifier[m_thread] operator[SEP] identifier[join] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public OvhTrafficExtract billingAccount_line_serviceName_trafficExtracts_id_GET(String billingAccount, String serviceName, Long id) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/trafficExtracts/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhTrafficExtract.class);
} | class class_name[name] begin[{]
method[billingAccount_line_serviceName_trafficExtracts_id_GET, return_type[type[OvhTrafficExtract]], modifier[public], parameter[billingAccount, serviceName, id]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhTrafficExtract, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[OvhTrafficExtract] identifier[billingAccount_line_serviceName_trafficExtracts_id_GET] operator[SEP] identifier[String] identifier[billingAccount] , identifier[String] identifier[serviceName] , identifier[Long] identifier[id] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[billingAccount] , identifier[serviceName] , identifier[id] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhTrafficExtract] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public float similarity(K what, K with)
{
Vector vectorWhat = storage.get(what);
if (vectorWhat == null)
{
return -1f;
}
Vector vectorWith = storage.get(with);
if (vectorWith == null)
{
return -1f;
}
return vectorWhat.cosineForUnitVector(vectorWith);
} | class class_name[name] begin[{]
method[similarity, return_type[type[float]], modifier[public], parameter[what, with]] begin[{]
local_variable[type[Vector], vectorWhat]
if[binary_operation[member[.vectorWhat], ==, literal[null]]] begin[{]
return[literal[1f]]
else begin[{]
None
end[}]
local_variable[type[Vector], vectorWith]
if[binary_operation[member[.vectorWith], ==, literal[null]]] begin[{]
return[literal[1f]]
else begin[{]
None
end[}]
return[call[vectorWhat.cosineForUnitVector, parameter[member[.vectorWith]]]]
end[}]
END[}] | Keyword[public] Keyword[float] identifier[similarity] operator[SEP] identifier[K] identifier[what] , identifier[K] identifier[with] operator[SEP] {
identifier[Vector] identifier[vectorWhat] operator[=] identifier[storage] operator[SEP] identifier[get] operator[SEP] identifier[what] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vectorWhat] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[-] literal[Float] operator[SEP]
}
identifier[Vector] identifier[vectorWith] operator[=] identifier[storage] operator[SEP] identifier[get] operator[SEP] identifier[with] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vectorWith] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[-] literal[Float] operator[SEP]
}
Keyword[return] identifier[vectorWhat] operator[SEP] identifier[cosineForUnitVector] operator[SEP] identifier[vectorWith] operator[SEP] operator[SEP]
}
|
public static String getParamInfo(Parameterizable p) {
StringBuilder sb = new StringBuilder(p.getParameters().size() * 20);
for (Parameter e : p.getParameters().values()) {
if (e.getValue() != null && !e.getValue().equals(e.getDefault())) {
sb.append(e.toString()).append("\n");
}
}
return sb.toString();
} | class class_name[name] begin[{]
method[getParamInfo, return_type[type[String]], modifier[public static], parameter[p]] begin[{]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=['!'], qualifier=e, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getParameters, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Parameter, sub_type=None))), label=None)
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getParamInfo] operator[SEP] identifier[Parameterizable] identifier[p] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[p] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[*] Other[20] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Parameter] identifier[e] operator[:] identifier[p] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[e] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[e] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static ModuleId fromString(String moduleId) throws IllegalArgumentException {
if (moduleId == null) {
throw new IllegalArgumentException("Module Id String is null");
}
if (moduleId.length() == 0) {
throw new IllegalArgumentException("Empty Module Id String");
}
final int c1 = moduleId.lastIndexOf(MODULE_VERSION_SEPARATOR);
final String name;
final String version;
if (c1 != -1) {
name = moduleId.substring(0, c1);
version = moduleId.substring(c1 + 1);
} else {
name = moduleId;
version = DEFAULT_VERSION;
}
return new ModuleId(name, version);
} | class class_name[name] begin[{]
method[fromString, return_type[type[ModuleId]], modifier[public static], parameter[moduleId]] begin[{]
if[binary_operation[member[.moduleId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Module Id String is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[call[moduleId.length, parameter[]], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Empty Module Id String")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], c1]
local_variable[type[String], name]
local_variable[type[String], version]
if[binary_operation[member[.c1], !=, literal[1]]] begin[{]
assign[member[.name], call[moduleId.substring, parameter[literal[0], member[.c1]]]]
assign[member[.version], call[moduleId.substring, parameter[binary_operation[member[.c1], +, literal[1]]]]]
else begin[{]
assign[member[.name], member[.moduleId]]
assign[member[.version], member[.DEFAULT_VERSION]]
end[}]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=version, 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=ModuleId, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ModuleId] identifier[fromString] operator[SEP] identifier[String] identifier[moduleId] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
Keyword[if] operator[SEP] identifier[moduleId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[moduleId] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[int] identifier[c1] operator[=] identifier[moduleId] operator[SEP] identifier[lastIndexOf] operator[SEP] identifier[MODULE_VERSION_SEPARATOR] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] Keyword[final] identifier[String] identifier[version] operator[SEP] Keyword[if] operator[SEP] identifier[c1] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[name] operator[=] identifier[moduleId] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[c1] operator[SEP] operator[SEP] identifier[version] operator[=] identifier[moduleId] operator[SEP] identifier[substring] operator[SEP] identifier[c1] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[name] operator[=] identifier[moduleId] operator[SEP] identifier[version] operator[=] identifier[DEFAULT_VERSION] operator[SEP]
}
Keyword[return] Keyword[new] identifier[ModuleId] operator[SEP] identifier[name] , identifier[version] operator[SEP] operator[SEP]
}
|
void validate(TableKelp table)
{
if (! table.isValidate()) {
return;
}
Row row = table.row();
for (BlockLeaf block : _blocks) {
block.validateBlock(row);
}
} | class class_name[name] begin[{]
method[validate, return_type[void], modifier[default], parameter[table]] begin[{]
if[call[table.isValidate, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[Row], row]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=row, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=validateBlock, postfix_operators=[], prefix_operators=[], qualifier=block, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=_blocks, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=block)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BlockLeaf, sub_type=None))), label=None)
end[}]
END[}] | Keyword[void] identifier[validate] operator[SEP] identifier[TableKelp] identifier[table] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[table] operator[SEP] identifier[isValidate] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[Row] identifier[row] operator[=] identifier[table] operator[SEP] identifier[row] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[BlockLeaf] identifier[block] operator[:] identifier[_blocks] operator[SEP] {
identifier[block] operator[SEP] identifier[validateBlock] operator[SEP] identifier[row] operator[SEP] operator[SEP]
}
}
|
protected void copySelectionToClipboard(final MBasicTable table) {
if (table.getSelectionModel().isSelectionEmpty()) {
return;
}
final Toolkit toolkit = table.getToolkit();
final Clipboard clipboard = toolkit.getSystemClipboard();
final ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(2048);
try {
writeHtml(table, byteArrayOut, true);
final String charset = System.getProperty("file.encoding");
final StringSelection contents = new StringSelection(byteArrayOut.toString(charset));
clipboard.setContents(contents, contents);
} catch (final IOException e) {
MSwingUtilities.showException(e);
}
} | class class_name[name] begin[{]
method[copySelectionToClipboard, return_type[void], modifier[protected], parameter[table]] begin[{]
if[call[table.getSelectionModel, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[Toolkit], toolkit]
local_variable[type[Clipboard], clipboard]
local_variable[type[ByteArrayOutputStream], byteArrayOut]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=byteArrayOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=writeHtml, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="file.encoding")], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), name=charset)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=byteArrayOut, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringSelection, sub_type=None)), name=contents)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=StringSelection, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=contents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContents, postfix_operators=[], prefix_operators=[], qualifier=clipboard, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=showException, postfix_operators=[], prefix_operators=[], qualifier=MSwingUtilities, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[copySelectionToClipboard] operator[SEP] Keyword[final] identifier[MBasicTable] identifier[table] operator[SEP] {
Keyword[if] operator[SEP] identifier[table] operator[SEP] identifier[getSelectionModel] operator[SEP] operator[SEP] operator[SEP] identifier[isSelectionEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[final] identifier[Toolkit] identifier[toolkit] operator[=] identifier[table] operator[SEP] identifier[getToolkit] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Clipboard] identifier[clipboard] operator[=] identifier[toolkit] operator[SEP] identifier[getSystemClipboard] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ByteArrayOutputStream] identifier[byteArrayOut] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] Other[2048] operator[SEP] operator[SEP] Keyword[try] {
identifier[writeHtml] operator[SEP] identifier[table] , identifier[byteArrayOut] , literal[boolean] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[charset] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[StringSelection] identifier[contents] operator[=] Keyword[new] identifier[StringSelection] operator[SEP] identifier[byteArrayOut] operator[SEP] identifier[toString] operator[SEP] identifier[charset] operator[SEP] operator[SEP] operator[SEP] identifier[clipboard] operator[SEP] identifier[setContents] operator[SEP] identifier[contents] , identifier[contents] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[e] operator[SEP] {
identifier[MSwingUtilities] operator[SEP] identifier[showException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
private void checkClockDrift(long intervalMillis) {
long now = Clock.currentTimeMillis();
// compensate for any abrupt jumps forward in the system clock
if (lastHeartbeat != 0L) {
long clockJump = now - lastHeartbeat - intervalMillis;
long absoluteClockJump = Math.abs(clockJump);
if (absoluteClockJump > CLOCK_JUMP_THRESHOLD) {
logger.info(format("System clock apparently jumped from %s to %s since last heartbeat (%+d ms)",
timeToString(lastHeartbeat), timeToString(now), clockJump));
// We only set cluster clock, if clock jumps more than threshold.
// If the last cluster-time diff we've seen is significantly different than what we read now,
// that means, it's already adjusted by master heartbeat. Then don't update the cluster time again.
long currentClusterTimeDiff = clusterClock.getClusterTimeDiff();
if (Math.abs(lastClusterTimeDiff - currentClusterTimeDiff) < CLOCK_JUMP_THRESHOLD) {
// adjust cluster clock due to clock drift
clusterClock.setClusterTimeDiff(currentClusterTimeDiff - clockJump);
}
}
if (absoluteClockJump >= maxNoHeartbeatMillis / 2) {
logger.warning(format("Resetting heartbeat timestamps because of huge system clock jump!"
+ " Clock-Jump: %d ms, Heartbeat-Timeout: %d ms", clockJump, maxNoHeartbeatMillis));
resetHeartbeats();
}
}
lastClusterTimeDiff = clusterClock.getClusterTimeDiff();
lastHeartbeat = now;
} | class class_name[name] begin[{]
method[checkClockDrift, return_type[void], modifier[private], parameter[intervalMillis]] begin[{]
local_variable[type[long], now]
if[binary_operation[member[.lastHeartbeat], !=, literal[0L]]] begin[{]
local_variable[type[long], clockJump]
local_variable[type[long], absoluteClockJump]
if[binary_operation[member[.absoluteClockJump], >, member[.CLOCK_JUMP_THRESHOLD]]] begin[{]
call[logger.info, parameter[call[.format, parameter[literal["System clock apparently jumped from %s to %s since last heartbeat (%+d ms)"], call[.timeToString, parameter[member[.lastHeartbeat]]], call[.timeToString, parameter[member[.now]]], member[.clockJump]]]]]
local_variable[type[long], currentClusterTimeDiff]
if[binary_operation[call[Math.abs, parameter[binary_operation[member[.lastClusterTimeDiff], -, member[.currentClusterTimeDiff]]]], <, member[.CLOCK_JUMP_THRESHOLD]]] begin[{]
call[clusterClock.setClusterTimeDiff, parameter[binary_operation[member[.currentClusterTimeDiff], -, member[.clockJump]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.absoluteClockJump], >=, binary_operation[member[.maxNoHeartbeatMillis], /, literal[2]]]] begin[{]
call[logger.warning, parameter[call[.format, parameter[binary_operation[literal["Resetting heartbeat timestamps because of huge system clock jump!"], +, literal[" Clock-Jump: %d ms, Heartbeat-Timeout: %d ms"]], member[.clockJump], member[.maxNoHeartbeatMillis]]]]]
call[.resetHeartbeats, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.lastClusterTimeDiff], call[clusterClock.getClusterTimeDiff, parameter[]]]
assign[member[.lastHeartbeat], member[.now]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[checkClockDrift] operator[SEP] Keyword[long] identifier[intervalMillis] operator[SEP] {
Keyword[long] identifier[now] operator[=] identifier[Clock] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastHeartbeat] operator[!=] Other[0L] operator[SEP] {
Keyword[long] identifier[clockJump] operator[=] identifier[now] operator[-] identifier[lastHeartbeat] operator[-] identifier[intervalMillis] operator[SEP] Keyword[long] identifier[absoluteClockJump] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[clockJump] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[absoluteClockJump] operator[>] identifier[CLOCK_JUMP_THRESHOLD] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[timeToString] operator[SEP] identifier[lastHeartbeat] operator[SEP] , identifier[timeToString] operator[SEP] identifier[now] operator[SEP] , identifier[clockJump] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[currentClusterTimeDiff] operator[=] identifier[clusterClock] operator[SEP] identifier[getClusterTimeDiff] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[lastClusterTimeDiff] operator[-] identifier[currentClusterTimeDiff] operator[SEP] operator[<] identifier[CLOCK_JUMP_THRESHOLD] operator[SEP] {
identifier[clusterClock] operator[SEP] identifier[setClusterTimeDiff] operator[SEP] identifier[currentClusterTimeDiff] operator[-] identifier[clockJump] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[absoluteClockJump] operator[>=] identifier[maxNoHeartbeatMillis] operator[/] Other[2] operator[SEP] {
identifier[logger] operator[SEP] identifier[warning] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] , identifier[clockJump] , identifier[maxNoHeartbeatMillis] operator[SEP] operator[SEP] operator[SEP] identifier[resetHeartbeats] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[lastClusterTimeDiff] operator[=] identifier[clusterClock] operator[SEP] identifier[getClusterTimeDiff] operator[SEP] operator[SEP] operator[SEP] identifier[lastHeartbeat] operator[=] identifier[now] operator[SEP]
}
|
@Pure
public static Element getElementFromPath(Node document, boolean caseSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getElementFromPath(document, caseSensitive, 0, path);
} | class class_name[name] begin[{]
method[getElementFromPath, return_type[type[Element]], modifier[public static], parameter[document, caseSensitive, path]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=document, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=notNullParameter, postfix_operators=[], prefix_operators=[], qualifier=AssertMessages, selectors=[], type_arguments=None))
return[call[.getElementFromPath, parameter[member[.document], member[.caseSensitive], literal[0], member[.path]]]]
end[}]
END[}] | annotation[@] identifier[Pure] Keyword[public] Keyword[static] identifier[Element] identifier[getElementFromPath] operator[SEP] identifier[Node] identifier[document] , Keyword[boolean] identifier[caseSensitive] , identifier[String] operator[...] identifier[path] operator[SEP] {
Keyword[assert] identifier[document] operator[!=] Other[null] operator[:] identifier[AssertMessages] operator[SEP] identifier[notNullParameter] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[getElementFromPath] operator[SEP] identifier[document] , identifier[caseSensitive] , Other[0] , identifier[path] operator[SEP] operator[SEP]
}
|
@Override
public UserTrades getTradeHistory(final TradeHistoryParams params) throws IOException {
if (params instanceof RippleTradeHistoryCount) {
final RippleTradeHistoryCount rippleParams = (RippleTradeHistoryCount) params;
rippleParams.resetApiCallCount();
rippleParams.resetTradeCount();
}
final String account;
if (params instanceof RippleTradeHistoryAccount) {
final RippleTradeHistoryAccount rippleAccount = (RippleTradeHistoryAccount) params;
if (rippleAccount.getAccount() != null) {
account = rippleAccount.getAccount();
} else {
account = exchange.getExchangeSpecification().getApiKey();
}
} else {
account = defaultTradeHistoryParams.getAccount();
}
final List<IRippleTradeTransaction> trades = getTradesForAccount(params, account);
return RippleAdapters.adaptTrades(
trades,
params,
(RippleAccountService) exchange.getAccountService(),
ripple.getRoundingScale());
} | class class_name[name] begin[{]
method[getTradeHistory, return_type[type[UserTrades]], modifier[public], parameter[params]] begin[{]
if[binary_operation[member[.params], instanceof, type[RippleTradeHistoryCount]]] begin[{]
local_variable[type[RippleTradeHistoryCount], rippleParams]
call[rippleParams.resetApiCallCount, parameter[]]
call[rippleParams.resetTradeCount, parameter[]]
else begin[{]
None
end[}]
local_variable[type[String], account]
if[binary_operation[member[.params], instanceof, type[RippleTradeHistoryAccount]]] begin[{]
local_variable[type[RippleTradeHistoryAccount], rippleAccount]
if[binary_operation[call[rippleAccount.getAccount, parameter[]], !=, literal[null]]] begin[{]
assign[member[.account], call[rippleAccount.getAccount, parameter[]]]
else begin[{]
assign[member[.account], call[exchange.getExchangeSpecification, parameter[]]]
end[}]
else begin[{]
assign[member[.account], call[defaultTradeHistoryParams.getAccount, parameter[]]]
end[}]
local_variable[type[List], trades]
return[call[RippleAdapters.adaptTrades, parameter[member[.trades], member[.params], Cast(expression=MethodInvocation(arguments=[], member=getAccountService, postfix_operators=[], prefix_operators=[], qualifier=exchange, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=RippleAccountService, sub_type=None)), call[ripple.getRoundingScale, parameter[]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[UserTrades] identifier[getTradeHistory] operator[SEP] Keyword[final] identifier[TradeHistoryParams] identifier[params] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[params] Keyword[instanceof] identifier[RippleTradeHistoryCount] operator[SEP] {
Keyword[final] identifier[RippleTradeHistoryCount] identifier[rippleParams] operator[=] operator[SEP] identifier[RippleTradeHistoryCount] operator[SEP] identifier[params] operator[SEP] identifier[rippleParams] operator[SEP] identifier[resetApiCallCount] operator[SEP] operator[SEP] operator[SEP] identifier[rippleParams] operator[SEP] identifier[resetTradeCount] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[account] operator[SEP] Keyword[if] operator[SEP] identifier[params] Keyword[instanceof] identifier[RippleTradeHistoryAccount] operator[SEP] {
Keyword[final] identifier[RippleTradeHistoryAccount] identifier[rippleAccount] operator[=] operator[SEP] identifier[RippleTradeHistoryAccount] operator[SEP] identifier[params] operator[SEP] Keyword[if] operator[SEP] identifier[rippleAccount] operator[SEP] identifier[getAccount] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[account] operator[=] identifier[rippleAccount] operator[SEP] identifier[getAccount] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[account] operator[=] identifier[exchange] operator[SEP] identifier[getExchangeSpecification] operator[SEP] operator[SEP] operator[SEP] identifier[getApiKey] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[account] operator[=] identifier[defaultTradeHistoryParams] operator[SEP] identifier[getAccount] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[IRippleTradeTransaction] operator[>] identifier[trades] operator[=] identifier[getTradesForAccount] operator[SEP] identifier[params] , identifier[account] operator[SEP] operator[SEP] Keyword[return] identifier[RippleAdapters] operator[SEP] identifier[adaptTrades] operator[SEP] identifier[trades] , identifier[params] , operator[SEP] identifier[RippleAccountService] operator[SEP] identifier[exchange] operator[SEP] identifier[getAccountService] operator[SEP] operator[SEP] , identifier[ripple] operator[SEP] identifier[getRoundingScale] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public InternationalFixedDate date(int prolepticYear, int month, int dayOfMonth) {
return InternationalFixedDate.of(prolepticYear, month, dayOfMonth);
} | class class_name[name] begin[{]
method[date, return_type[type[InternationalFixedDate]], modifier[public], parameter[prolepticYear, month, dayOfMonth]] begin[{]
return[call[InternationalFixedDate.of, parameter[member[.prolepticYear], member[.month], member[.dayOfMonth]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[InternationalFixedDate] identifier[date] operator[SEP] Keyword[int] identifier[prolepticYear] , Keyword[int] identifier[month] , Keyword[int] identifier[dayOfMonth] operator[SEP] {
Keyword[return] identifier[InternationalFixedDate] operator[SEP] identifier[of] operator[SEP] identifier[prolepticYear] , identifier[month] , identifier[dayOfMonth] operator[SEP] operator[SEP]
}
|
public static File zip(String srcPath, String zipPath) throws UtilException {
return zip(srcPath, zipPath, false);
} | class class_name[name] begin[{]
method[zip, return_type[type[File]], modifier[public static], parameter[srcPath, zipPath]] begin[{]
return[call[.zip, parameter[member[.srcPath], member[.zipPath], literal[false]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[File] identifier[zip] operator[SEP] identifier[String] identifier[srcPath] , identifier[String] identifier[zipPath] operator[SEP] Keyword[throws] identifier[UtilException] {
Keyword[return] identifier[zip] operator[SEP] identifier[srcPath] , identifier[zipPath] , literal[boolean] operator[SEP] operator[SEP]
}
|
public void setAmbientLight(int i, Color color, boolean enableColor, Vector3D v) {
float ambient[] = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
float position[] = { (float)v.getX(), (float)v.getY(), (float)v.getZ(), 1.0f };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, position, 0);
if(enableColor)
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_AMBIENT, ambient, 0);
} | class class_name[name] begin[{]
method[setAmbientLight, return_type[void], modifier[public], parameter[i, color, enableColor, v]] begin[{]
local_variable[type[float], ambient]
local_variable[type[float], position]
call[gl.glEnable, parameter[member[GL2.GL_LIGHTING]]]
call[gl.glEnable, parameter[binary_operation[member[GL2.GL_LIGHT0], +, member[.i]]]]
call[gl.glLightfv, parameter[binary_operation[member[GL2.GL_LIGHT0], +, member[.i]], member[GL2.GL_POSITION], member[.position], literal[0]]]
if[member[.enableColor]] begin[{]
call[gl.glLightfv, parameter[binary_operation[member[GL2.GL_LIGHT0], +, member[.i]], member[GL2.GL_AMBIENT], member[.ambient], literal[0]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setAmbientLight] operator[SEP] Keyword[int] identifier[i] , identifier[Color] identifier[color] , Keyword[boolean] identifier[enableColor] , identifier[Vector3D] identifier[v] operator[SEP] {
Keyword[float] identifier[ambient] operator[SEP] operator[SEP] operator[=] {
operator[SEP] Keyword[float] operator[SEP] identifier[color] operator[SEP] identifier[getRed] operator[SEP] operator[SEP] , operator[SEP] Keyword[float] operator[SEP] identifier[color] operator[SEP] identifier[getGreen] operator[SEP] operator[SEP] , operator[SEP] Keyword[float] operator[SEP] identifier[color] operator[SEP] identifier[getBlue] operator[SEP] operator[SEP] , operator[SEP] Keyword[float] operator[SEP] identifier[color] operator[SEP] identifier[getAlpha] operator[SEP] operator[SEP]
} operator[SEP] Keyword[float] identifier[position] operator[SEP] operator[SEP] operator[=] {
operator[SEP] Keyword[float] operator[SEP] identifier[v] operator[SEP] identifier[getX] operator[SEP] operator[SEP] , operator[SEP] Keyword[float] operator[SEP] identifier[v] operator[SEP] identifier[getY] operator[SEP] operator[SEP] , operator[SEP] Keyword[float] operator[SEP] identifier[v] operator[SEP] identifier[getZ] operator[SEP] operator[SEP] , literal[Float]
} operator[SEP] identifier[gl] operator[SEP] identifier[glEnable] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_LIGHTING] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glEnable] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_LIGHT0] operator[+] identifier[i] operator[SEP] operator[SEP] identifier[gl] operator[SEP] identifier[glLightfv] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_LIGHT0] operator[+] identifier[i] , identifier[GL2] operator[SEP] identifier[GL_POSITION] , identifier[position] , Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[enableColor] operator[SEP] identifier[gl] operator[SEP] identifier[glLightfv] operator[SEP] identifier[GL2] operator[SEP] identifier[GL_LIGHT0] operator[+] identifier[i] , identifier[GL2] operator[SEP] identifier[GL_AMBIENT] , identifier[ambient] , Other[0] operator[SEP] operator[SEP]
}
|
@Override
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.linsert(key, JedisConverters.toListPosition(where), pivot, value)));
return null;
}
return client.linsert(key, JedisConverters.toListPosition(where), pivot, value);
} catch (Exception ex) {
throw convertException(ex);
}
} | class class_name[name] begin[{]
method[lInsert, return_type[type[Long]], modifier[public], parameter[key, where, pivot, value]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isPipelined, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=where, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toListPosition, postfix_operators=[], prefix_operators=[], qualifier=JedisConverters, selectors=[], type_arguments=None), MemberReference(member=pivot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=linsert, postfix_operators=[], prefix_operators=[], qualifier=pipeline, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JedisResult, sub_type=None))], member=pipeline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=where, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toListPosition, postfix_operators=[], prefix_operators=[], qualifier=JedisConverters, selectors=[], type_arguments=None), MemberReference(member=pivot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=linsert, postfix_operators=[], prefix_operators=[], qualifier=client, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convertException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Long] identifier[lInsert] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[key] , identifier[Position] identifier[where] , Keyword[byte] operator[SEP] operator[SEP] identifier[pivot] , Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[isPipelined] operator[SEP] operator[SEP] operator[SEP] {
identifier[pipeline] operator[SEP] Keyword[new] identifier[JedisResult] operator[SEP] identifier[pipeline] operator[SEP] identifier[linsert] operator[SEP] identifier[key] , identifier[JedisConverters] operator[SEP] identifier[toListPosition] operator[SEP] identifier[where] operator[SEP] , identifier[pivot] , identifier[value] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[client] operator[SEP] identifier[linsert] operator[SEP] identifier[key] , identifier[JedisConverters] operator[SEP] identifier[toListPosition] operator[SEP] identifier[where] operator[SEP] , identifier[pivot] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] identifier[convertException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
|
public double getPercentileAtOrBelowValue(final long value) {
if (getTotalCount() == 0) {
return 100.0;
}
final int targetIndex = Math.min(countsArrayIndex(value), (countsArrayLength - 1));
long totalToCurrentIndex = 0;
for (int i = 0; i <= targetIndex; i++) {
totalToCurrentIndex += getCountAtIndex(i);
}
return (100.0 * totalToCurrentIndex) / getTotalCount();
} | class class_name[name] begin[{]
method[getPercentileAtOrBelowValue, return_type[type[double]], modifier[public], parameter[value]] begin[{]
if[binary_operation[call[.getTotalCount, parameter[]], ==, literal[0]]] begin[{]
return[literal[100.0]]
else begin[{]
None
end[}]
local_variable[type[int], targetIndex]
local_variable[type[long], totalToCurrentIndex]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=totalToCurrentIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCountAtIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=targetIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[binary_operation[binary_operation[literal[100.0], *, member[.totalToCurrentIndex]], /, call[.getTotalCount, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[getPercentileAtOrBelowValue] operator[SEP] Keyword[final] Keyword[long] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[getTotalCount] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[Float] operator[SEP]
}
Keyword[final] Keyword[int] identifier[targetIndex] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[countsArrayIndex] operator[SEP] identifier[value] operator[SEP] , operator[SEP] identifier[countsArrayLength] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[totalToCurrentIndex] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<=] identifier[targetIndex] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[totalToCurrentIndex] operator[+=] identifier[getCountAtIndex] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] literal[Float] operator[*] identifier[totalToCurrentIndex] operator[SEP] operator[/] identifier[getTotalCount] operator[SEP] operator[SEP] operator[SEP]
}
|
public BufferedImage acquireImage(ScanListener listener) throws IOException, SaneException {
Preconditions.checkState(isOpen(), "device is not open");
if (listener == null) {
listener = new ScanListenerAdapter();
}
return session.acquireImage(this, listener);
} | class class_name[name] begin[{]
method[acquireImage, return_type[type[BufferedImage]], modifier[public], parameter[listener]] begin[{]
call[Preconditions.checkState, parameter[call[.isOpen, parameter[]], literal["device is not open"]]]
if[binary_operation[member[.listener], ==, literal[null]]] begin[{]
assign[member[.listener], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ScanListenerAdapter, sub_type=None))]
else begin[{]
None
end[}]
return[call[session.acquireImage, parameter[THIS[], member[.listener]]]]
end[}]
END[}] | Keyword[public] identifier[BufferedImage] identifier[acquireImage] operator[SEP] identifier[ScanListener] identifier[listener] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SaneException] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[isOpen] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listener] operator[==] Other[null] operator[SEP] {
identifier[listener] operator[=] Keyword[new] identifier[ScanListenerAdapter] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[session] operator[SEP] identifier[acquireImage] operator[SEP] Keyword[this] , identifier[listener] operator[SEP] operator[SEP]
}
|
public void add(FutureReadResultEntry entry) {
synchronized (this.reads) {
Exceptions.checkNotClosed(this.closed, this);
this.reads.add(entry);
}
} | class class_name[name] begin[{]
method[add, return_type[void], modifier[public], parameter[entry]] begin[{]
SYNCHRONIZED[THIS[member[None.reads]]] BEGIN[{]
call[Exceptions.checkNotClosed, parameter[THIS[member[None.closed]], THIS[]]]
THIS[member[None.reads]call[None.add, parameter[member[.entry]]]]
END[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[add] operator[SEP] identifier[FutureReadResultEntry] identifier[entry] operator[SEP] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] identifier[reads] operator[SEP] {
identifier[Exceptions] operator[SEP] identifier[checkNotClosed] operator[SEP] Keyword[this] operator[SEP] identifier[closed] , Keyword[this] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[reads] operator[SEP] identifier[add] operator[SEP] identifier[entry] operator[SEP] operator[SEP]
}
}
|
@Override
protected boolean mutatesTo(Object o1, Object o2)
{
if (this.propertyNames.length > 0)
{
if (BeansUtils.declaredEquals(o1.getClass()))
{
return o1.equals(o2);
}
}
return super.mutatesTo(o1, o2);
} | class class_name[name] begin[{]
method[mutatesTo, return_type[type[boolean]], modifier[protected], parameter[o1, o2]] begin[{]
if[binary_operation[THIS[member[None.propertyNames]member[None.length]], >, literal[0]]] begin[{]
if[call[BeansUtils.declaredEquals, parameter[call[o1.getClass, parameter[]]]]] begin[{]
return[call[o1.equals, parameter[member[.o2]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[SuperMethodInvocation(arguments=[MemberReference(member=o1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=o2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mutatesTo, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[boolean] identifier[mutatesTo] operator[SEP] identifier[Object] identifier[o1] , identifier[Object] identifier[o2] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[propertyNames] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[BeansUtils] operator[SEP] identifier[declaredEquals] operator[SEP] identifier[o1] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[o1] operator[SEP] identifier[equals] operator[SEP] identifier[o2] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[super] operator[SEP] identifier[mutatesTo] operator[SEP] identifier[o1] , identifier[o2] operator[SEP] operator[SEP]
}
|
public static int poolid(int agentid) {
int poolid = agentid / poolsize;
if (poolid + 1 > npools) {
poolid = npools - 1;
}
return poolid;
} | class class_name[name] begin[{]
method[poolid, return_type[type[int]], modifier[public static], parameter[agentid]] begin[{]
local_variable[type[int], poolid]
if[binary_operation[binary_operation[member[.poolid], +, literal[1]], >, member[.npools]]] begin[{]
assign[member[.poolid], binary_operation[member[.npools], -, literal[1]]]
else begin[{]
None
end[}]
return[member[.poolid]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[poolid] operator[SEP] Keyword[int] identifier[agentid] operator[SEP] {
Keyword[int] identifier[poolid] operator[=] identifier[agentid] operator[/] identifier[poolsize] operator[SEP] Keyword[if] operator[SEP] identifier[poolid] operator[+] Other[1] operator[>] identifier[npools] operator[SEP] {
identifier[poolid] operator[=] identifier[npools] operator[-] Other[1] operator[SEP]
}
Keyword[return] identifier[poolid] operator[SEP]
}
|
void initialize(AbstractCompiler compiler) throws Exception {
checkState(
!Strings.isNullOrEmpty(templateJs),
"The template JS must be loaded before the scanner is used. "
+ "Make sure that the template file is not empty.");
Node scriptRoot = new JsAst(SourceFile.fromCode(
"template", templateJs)).getAstRoot(compiler);
// The before-templates are kept in a LinkedHashMap, to ensure that they are later iterated
// over in the order in which they appear in the template JS file.
LinkedHashMap<String, Node> beforeTemplates = new LinkedHashMap<>();
Map<String, SortedMap<Integer, Node>> afterTemplates = new HashMap<>();
Set<String> hasChoices = new HashSet<>();
for (Node templateNode : scriptRoot.children()) {
if (templateNode.isFunction()) {
String fnName = templateNode.getFirstChild().getQualifiedName();
if (fnName.startsWith("before_")) {
String templateName = fnName.substring("before_".length());
Preconditions.checkState(
!beforeTemplates.containsKey(templateName),
"Found existing template with the same name: %s", beforeTemplates.get(templateName));
checkState(
templateNode.getLastChild().hasChildren(),
"Before templates are not allowed to be empty!");
beforeTemplates.put(templateName, templateNode);
} else if (fnName.startsWith("after_option_")) {
Matcher m = AFTER_CHOICE_PATTERN.matcher(fnName);
checkState(m.matches(), "Template name %s must match pattern after_option_\\d*_", fnName);
int optionNumber = Integer.parseInt(m.group(1));
String templateName = m.group(2);
if (!afterTemplates.containsKey(templateName)) {
afterTemplates.put(templateName, new TreeMap<>());
hasChoices.add(templateName);
}
checkState(
hasChoices.contains(templateName),
"Template %s can only be mixed with other after_option_ templates");
checkState(
!afterTemplates.get(templateName).containsKey(optionNumber),
"Found duplicate template for %s, assign unique indexes for options",
fnName);
afterTemplates.get(templateName).put(optionNumber, templateNode);
} else if (fnName.startsWith("after_")) {
String templateName = fnName.substring("after_".length());
Preconditions.checkState(
!afterTemplates.containsKey(templateName),
"Found existing template with the same name: %s", afterTemplates.get(templateName));
afterTemplates.put(templateName, ImmutableSortedMap.of(0, templateNode));
} else if (fnName.startsWith("do_not_change_")) {
String templateName = fnName.substring("do_not_change_".length());
Preconditions.checkState(
!beforeTemplates.containsKey(templateName),
"Found existing template with the same name: %s",
beforeTemplates.get(templateName));
Preconditions.checkState(
!afterTemplates.containsKey(templateName),
"Found existing template with the same name: %s",
afterTemplates.get(templateName));
beforeTemplates.put(templateName, templateNode);
afterTemplates.put(templateName, ImmutableSortedMap.of(0, templateNode));
}
}
}
checkState(
!beforeTemplates.isEmpty(),
"Did not find any RefasterJs templates! Make sure that there are 2 functions defined "
+ "with the same name, one with a \"before_\" prefix and one with a \"after_\" prefix");
// TODO(bangert): Get ImmutableLinkedMap into Guava?
this.templates = new LinkedHashMap<>();
for (String templateName : beforeTemplates.keySet()) {
Preconditions.checkState(
afterTemplates.containsKey(templateName) && !afterTemplates.get(templateName).isEmpty(),
"Found before template without at least one corresponding after "
+ " template. Make sure there is an after_%s or after_option_1_%s function defined.",
templateName,
templateName);
ImmutableList.Builder<RefasterJsTemplate> builder = ImmutableList.builder();
for (Node afterTemplateOption : afterTemplates.get(templateName).values()) {
builder.add(
new RefasterJsTemplate(
compiler.getTypeRegistry(),
typeMatchingStrategy,
beforeTemplates.get(templateName),
afterTemplateOption));
}
ImmutableList<RefasterJsTemplate> afterOptions = builder.build();
this.templates.put(afterOptions.get(0).matcher, afterOptions);
}
} | class class_name[name] begin[{]
method[initialize, return_type[void], modifier[default], parameter[compiler]] begin[{]
call[.checkState, parameter[call[Strings.isNullOrEmpty, parameter[member[.templateJs]]], binary_operation[literal["The template JS must be loaded before the scanner is used. "], +, literal["Make sure that the template file is not empty."]]]]
local_variable[type[Node], scriptRoot]
local_variable[type[LinkedHashMap], beforeTemplates]
local_variable[type[Map], afterTemplates]
local_variable[type[Set], hasChoices]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isFunction, postfix_operators=[], prefix_operators=[], qualifier=templateNode, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getFirstChild, postfix_operators=[], prefix_operators=[], qualifier=templateNode, selectors=[MethodInvocation(arguments=[], member=getQualifiedName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=fnName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="before_")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=fnName, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="after_option_")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=fnName, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="after_")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=fnName, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="do_not_change_")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=fnName, 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=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="do_not_change_")], member=substring, postfix_operators=[], prefix_operators=[], qualifier=fnName, selectors=[], type_arguments=None), name=templateName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=beforeTemplates, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Found existing template with the same name: %s"), MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=beforeTemplates, selectors=[], type_arguments=None)], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=afterTemplates, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Found existing template with the same name: %s"), MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=afterTemplates, selectors=[], type_arguments=None)], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=templateNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=beforeTemplates, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=templateNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=ImmutableSortedMap, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=afterTemplates, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="after_")], member=substring, postfix_operators=[], prefix_operators=[], qualifier=fnName, selectors=[], type_arguments=None), name=templateName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=afterTemplates, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Found existing template with the same name: %s"), MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=afterTemplates, selectors=[], type_arguments=None)], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=templateNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=ImmutableSortedMap, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=afterTemplates, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=matcher, postfix_operators=[], prefix_operators=[], qualifier=AFTER_CHOICE_PATTERN, selectors=[], type_arguments=None), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Matcher, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=matches, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Template name %s must match pattern after_option_\\d*_"), MemberReference(member=fnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=group, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None)], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=optionNumber)], modifiers=set(), type=BasicType(dimensions=[], name=int)), 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=templateName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=afterTemplates, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=TreeMap, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=afterTemplates, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=hasChoices, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=hasChoices, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Template %s can only be mixed with other after_option_ templates")], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=['!'], qualifier=afterTemplates, selectors=[MethodInvocation(arguments=[MemberReference(member=optionNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Found duplicate template for %s, assign unique indexes for options"), MemberReference(member=fnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=afterTemplates, selectors=[MethodInvocation(arguments=[MemberReference(member=optionNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=templateNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="before_")], member=substring, postfix_operators=[], prefix_operators=[], qualifier=fnName, selectors=[], type_arguments=None), name=templateName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=beforeTemplates, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Found existing template with the same name: %s"), MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=beforeTemplates, selectors=[], type_arguments=None)], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLastChild, postfix_operators=[], prefix_operators=[], qualifier=templateNode, selectors=[MethodInvocation(arguments=[], member=hasChildren, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Before templates are not allowed to be empty!")], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=templateNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=beforeTemplates, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=children, postfix_operators=[], prefix_operators=[], qualifier=scriptRoot, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=templateNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
call[.checkState, parameter[call[beforeTemplates.isEmpty, parameter[]], binary_operation[literal["Did not find any RefasterJs templates! Make sure that there are 2 functions defined "], +, literal["with the same name, one with a \"before_\" prefix and one with a \"after_\" prefix"]]]]
assign[THIS[member[None.templates]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedHashMap, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=afterTemplates, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=['!'], qualifier=afterTemplates, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Found before template without at least one corresponding after "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" template. Make sure there is an after_%s or after_option_1_%s function defined."), operator=+), MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=builder, postfix_operators=[], prefix_operators=[], qualifier=ImmutableList, selectors=[], type_arguments=None), name=builder)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ImmutableList, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RefasterJsTemplate, sub_type=None))], dimensions=None, name=Builder, sub_type=None))), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getTypeRegistry, postfix_operators=[], prefix_operators=[], qualifier=compiler, selectors=[], type_arguments=None), MemberReference(member=typeMatchingStrategy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=beforeTemplates, selectors=[], type_arguments=None), MemberReference(member=afterTemplateOption, 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=RefasterJsTemplate, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=templateName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=afterTemplates, selectors=[MethodInvocation(arguments=[], member=values, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=afterTemplateOption)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), name=afterOptions)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RefasterJsTemplate, sub_type=None))], dimensions=[], name=ImmutableList, sub_type=None)), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=templates, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=afterOptions, selectors=[MemberReference(member=matcher, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), MemberReference(member=afterOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=beforeTemplates, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=templateName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[void] identifier[initialize] operator[SEP] identifier[AbstractCompiler] identifier[compiler] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[checkState] operator[SEP] operator[!] identifier[Strings] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[templateJs] operator[SEP] , literal[String] operator[+] literal[String] operator[SEP] operator[SEP] identifier[Node] identifier[scriptRoot] operator[=] Keyword[new] identifier[JsAst] operator[SEP] identifier[SourceFile] operator[SEP] identifier[fromCode] operator[SEP] literal[String] , identifier[templateJs] operator[SEP] operator[SEP] operator[SEP] identifier[getAstRoot] operator[SEP] identifier[compiler] operator[SEP] operator[SEP] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[Node] operator[>] identifier[beforeTemplates] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[SortedMap] operator[<] identifier[Integer] , identifier[Node] operator[>] operator[>] identifier[afterTemplates] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[hasChoices] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[templateNode] operator[:] identifier[scriptRoot] operator[SEP] identifier[children] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[templateNode] operator[SEP] identifier[isFunction] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[fnName] operator[=] identifier[templateNode] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[SEP] identifier[getQualifiedName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fnName] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[templateName] operator[=] identifier[fnName] operator[SEP] identifier[substring] operator[SEP] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] operator[!] identifier[beforeTemplates] operator[SEP] identifier[containsKey] operator[SEP] identifier[templateName] operator[SEP] , literal[String] , identifier[beforeTemplates] operator[SEP] identifier[get] operator[SEP] identifier[templateName] operator[SEP] operator[SEP] operator[SEP] identifier[checkState] operator[SEP] identifier[templateNode] operator[SEP] identifier[getLastChild] operator[SEP] operator[SEP] operator[SEP] identifier[hasChildren] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[beforeTemplates] operator[SEP] identifier[put] operator[SEP] identifier[templateName] , identifier[templateNode] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[fnName] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[Matcher] identifier[m] operator[=] identifier[AFTER_CHOICE_PATTERN] operator[SEP] identifier[matcher] operator[SEP] identifier[fnName] operator[SEP] operator[SEP] identifier[checkState] operator[SEP] identifier[m] operator[SEP] identifier[matches] operator[SEP] operator[SEP] , literal[String] , identifier[fnName] operator[SEP] operator[SEP] Keyword[int] identifier[optionNumber] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[m] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[templateName] operator[=] identifier[m] operator[SEP] identifier[group] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[afterTemplates] operator[SEP] identifier[containsKey] operator[SEP] identifier[templateName] operator[SEP] operator[SEP] {
identifier[afterTemplates] operator[SEP] identifier[put] operator[SEP] identifier[templateName] , Keyword[new] identifier[TreeMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[hasChoices] operator[SEP] identifier[add] operator[SEP] identifier[templateName] operator[SEP] operator[SEP]
}
identifier[checkState] operator[SEP] identifier[hasChoices] operator[SEP] identifier[contains] operator[SEP] identifier[templateName] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[checkState] operator[SEP] operator[!] identifier[afterTemplates] operator[SEP] identifier[get] operator[SEP] identifier[templateName] operator[SEP] operator[SEP] identifier[containsKey] operator[SEP] identifier[optionNumber] operator[SEP] , literal[String] , identifier[fnName] operator[SEP] operator[SEP] identifier[afterTemplates] operator[SEP] identifier[get] operator[SEP] identifier[templateName] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[optionNumber] , identifier[templateNode] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[fnName] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[templateName] operator[=] identifier[fnName] operator[SEP] identifier[substring] operator[SEP] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] operator[!] identifier[afterTemplates] operator[SEP] identifier[containsKey] operator[SEP] identifier[templateName] operator[SEP] , literal[String] , identifier[afterTemplates] operator[SEP] identifier[get] operator[SEP] identifier[templateName] operator[SEP] operator[SEP] operator[SEP] identifier[afterTemplates] operator[SEP] identifier[put] operator[SEP] identifier[templateName] , identifier[ImmutableSortedMap] operator[SEP] identifier[of] operator[SEP] Other[0] , identifier[templateNode] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[fnName] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[templateName] operator[=] identifier[fnName] operator[SEP] identifier[substring] operator[SEP] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] operator[!] identifier[beforeTemplates] operator[SEP] identifier[containsKey] operator[SEP] identifier[templateName] operator[SEP] , literal[String] , identifier[beforeTemplates] operator[SEP] identifier[get] operator[SEP] identifier[templateName] operator[SEP] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] operator[!] identifier[afterTemplates] operator[SEP] identifier[containsKey] operator[SEP] identifier[templateName] operator[SEP] , literal[String] , identifier[afterTemplates] operator[SEP] identifier[get] operator[SEP] identifier[templateName] operator[SEP] operator[SEP] operator[SEP] identifier[beforeTemplates] operator[SEP] identifier[put] operator[SEP] identifier[templateName] , identifier[templateNode] operator[SEP] operator[SEP] identifier[afterTemplates] operator[SEP] identifier[put] operator[SEP] identifier[templateName] , identifier[ImmutableSortedMap] operator[SEP] identifier[of] operator[SEP] Other[0] , identifier[templateNode] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[checkState] operator[SEP] operator[!] identifier[beforeTemplates] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] , literal[String] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[templates] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[templateName] operator[:] identifier[beforeTemplates] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[afterTemplates] operator[SEP] identifier[containsKey] operator[SEP] identifier[templateName] operator[SEP] operator[&&] operator[!] identifier[afterTemplates] operator[SEP] identifier[get] operator[SEP] identifier[templateName] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] , literal[String] operator[+] literal[String] , identifier[templateName] , identifier[templateName] operator[SEP] operator[SEP] identifier[ImmutableList] operator[SEP] identifier[Builder] operator[<] identifier[RefasterJsTemplate] operator[>] identifier[builder] operator[=] identifier[ImmutableList] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[afterTemplateOption] operator[:] identifier[afterTemplates] operator[SEP] identifier[get] operator[SEP] identifier[templateName] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[builder] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[RefasterJsTemplate] operator[SEP] identifier[compiler] operator[SEP] identifier[getTypeRegistry] operator[SEP] operator[SEP] , identifier[typeMatchingStrategy] , identifier[beforeTemplates] operator[SEP] identifier[get] operator[SEP] identifier[templateName] operator[SEP] , identifier[afterTemplateOption] operator[SEP] operator[SEP] operator[SEP]
}
identifier[ImmutableList] operator[<] identifier[RefasterJsTemplate] operator[>] identifier[afterOptions] operator[=] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[templates] operator[SEP] identifier[put] operator[SEP] identifier[afterOptions] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[matcher] , identifier[afterOptions] operator[SEP] operator[SEP]
}
}
|
private static String generateAliasRoot(String description) {
String result = truncate(unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH)
// Important to use Locale.ENGLISH. See HHH-8579. #toLowerCase() uses the default Locale. Certain DBs
// do not like non-ascii characters in aliases, etc., so ensure consistency/portability here.
.toLowerCase(Locale.ENGLISH)
.replace('/', '_') // entityNames may now include slashes for the representations
.replace('$', '_'); //classname may be an inner class
result = cleanAlias(result);
if (Character.isDigit(result.charAt(result.length() - 1))) {
return result + "x"; //ick!
} else {
return result;
}
} | class class_name[name] begin[{]
method[generateAliasRoot, return_type[type[String]], modifier[private static], parameter[description]] begin[{]
local_variable[type[String], result]
assign[member[.result], call[.cleanAlias, parameter[member[.result]]]]
if[call[Character.isDigit, parameter[call[result.charAt, parameter[binary_operation[call[result.length, parameter[]], -, literal[1]]]]]]] begin[{]
return[binary_operation[member[.result], +, literal["x"]]]
else begin[{]
return[member[.result]]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[generateAliasRoot] operator[SEP] identifier[String] identifier[description] operator[SEP] {
identifier[String] identifier[result] operator[=] identifier[truncate] operator[SEP] identifier[unqualifyEntityName] operator[SEP] identifier[description] operator[SEP] , identifier[ALIAS_TRUNCATE_LENGTH] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[Locale] operator[SEP] identifier[ENGLISH] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[cleanAlias] operator[SEP] identifier[result] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Character] operator[SEP] identifier[isDigit] operator[SEP] identifier[result] operator[SEP] identifier[charAt] operator[SEP] identifier[result] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[result] operator[+] literal[String] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[result] operator[SEP]
}
}
|
public Observable<Page<CloudJobSchedule>> listAsync(final JobScheduleListOptions jobScheduleListOptions) {
return listWithServiceResponseAsync(jobScheduleListOptions)
.map(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Page<CloudJobSchedule>>() {
@Override
public Page<CloudJobSchedule> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listAsync, return_type[type[Observable]], modifier[public], parameter[jobScheduleListOptions]] begin[{]
return[call[.listWithServiceResponseAsync, parameter[member[.jobScheduleListOptions]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[CloudJobSchedule] operator[>] operator[>] identifier[listAsync] operator[SEP] Keyword[final] identifier[JobScheduleListOptions] identifier[jobScheduleListOptions] operator[SEP] {
Keyword[return] identifier[listWithServiceResponseAsync] operator[SEP] identifier[jobScheduleListOptions] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponseWithHeaders] operator[<] identifier[Page] operator[<] identifier[CloudJobSchedule] operator[>] , identifier[JobScheduleListHeaders] operator[>] , identifier[Page] operator[<] identifier[CloudJobSchedule] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[CloudJobSchedule] operator[>] identifier[call] operator[SEP] identifier[ServiceResponseWithHeaders] operator[<] identifier[Page] operator[<] identifier[CloudJobSchedule] operator[>] , identifier[JobScheduleListHeaders] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public PullResult pullFromRepository(Git git, String remote, String remoteBranch) {
try {
return git.pull()
.setRemote(remote)
.setRemoteBranchName(remoteBranch)
.call();
} catch (GitAPIException e) {
throw new IllegalStateException(e);
}
} | class class_name[name] begin[{]
method[pullFromRepository, return_type[type[PullResult]], modifier[public], parameter[git, remote, remoteBranch]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[], member=pull, postfix_operators=[], prefix_operators=[], qualifier=git, selectors=[MethodInvocation(arguments=[MemberReference(member=remote, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRemote, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=remoteBranch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setRemoteBranchName, 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=[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=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['GitAPIException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[PullResult] identifier[pullFromRepository] operator[SEP] identifier[Git] identifier[git] , identifier[String] identifier[remote] , identifier[String] identifier[remoteBranch] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[git] operator[SEP] identifier[pull] operator[SEP] operator[SEP] operator[SEP] identifier[setRemote] operator[SEP] identifier[remote] operator[SEP] operator[SEP] identifier[setRemoteBranchName] operator[SEP] identifier[remoteBranch] operator[SEP] operator[SEP] identifier[call] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[GitAPIException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
protected List<HalResource<?>> resolveCachedLinks(String[] linkedIds, Cache cache, List<String> notCachedLinkedIds) {
ArrayList<HalResource<?>> resolvedResources = new ArrayList<HalResource<?>>();
for (String linkedId : linkedIds) {
HalResource<?> resource = (HalResource<?>) cache.get(linkedId);
if (resource != null) {
resolvedResources.add(resource);
}
else {
notCachedLinkedIds.add(linkedId);
}
}
return resolvedResources;
} | class class_name[name] begin[{]
method[resolveCachedLinks, return_type[type[List]], modifier[protected], parameter[linkedIds, cache, notCachedLinkedIds]] begin[{]
local_variable[type[ArrayList], resolvedResources]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=linkedId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=cache, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=HalResource, sub_type=None)), name=resource)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=HalResource, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=resource, 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=MethodInvocation(arguments=[MemberReference(member=linkedId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=notCachedLinkedIds, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=resolvedResources, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=linkedIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=linkedId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.resolvedResources]]
end[}]
END[}] | Keyword[protected] identifier[List] operator[<] identifier[HalResource] operator[<] operator[?] operator[>] operator[>] identifier[resolveCachedLinks] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[linkedIds] , identifier[Cache] identifier[cache] , identifier[List] operator[<] identifier[String] operator[>] identifier[notCachedLinkedIds] operator[SEP] {
identifier[ArrayList] operator[<] identifier[HalResource] operator[<] operator[?] operator[>] operator[>] identifier[resolvedResources] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[HalResource] operator[<] operator[?] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[linkedId] operator[:] identifier[linkedIds] operator[SEP] {
identifier[HalResource] operator[<] operator[?] operator[>] identifier[resource] operator[=] operator[SEP] identifier[HalResource] operator[<] operator[?] operator[>] operator[SEP] identifier[cache] operator[SEP] identifier[get] operator[SEP] identifier[linkedId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resource] operator[!=] Other[null] operator[SEP] {
identifier[resolvedResources] operator[SEP] identifier[add] operator[SEP] identifier[resource] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[notCachedLinkedIds] operator[SEP] identifier[add] operator[SEP] identifier[linkedId] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[resolvedResources] operator[SEP]
}
|
@SuppressWarnings("unchecked")
private KeyEntitySchemaParser<?, ?> getSchemaParser(
String schemaParserClassName) {
if (schemaParsers.contains(schemaParserClassName)) {
return schemaParsers.get(schemaParserClassName);
} else {
try {
Class<KeyEntitySchemaParser<?, ?>> schemaParserClass = (Class<KeyEntitySchemaParser<?, ?>>) Class
.forName(schemaParserClassName);
KeyEntitySchemaParser<?, ?> schemaParser = schemaParserClass
.getConstructor().newInstance();
schemaParsers.putIfAbsent(schemaParserClassName, schemaParser);
return schemaParser;
} catch (Exception e) {
throw new DatasetException(
"Could not instantiate schema parser class: "
+ schemaParserClassName, e);
}
}
} | class class_name[name] begin[{]
method[getSchemaParser, return_type[type[KeyEntitySchemaParser]], modifier[private], parameter[schemaParserClassName]] begin[{]
if[call[schemaParsers.contains, parameter[member[.schemaParserClassName]]]] begin[{]
return[call[schemaParsers.get, parameter[member[.schemaParserClassName]]]]
else begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=schemaParserClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=KeyEntitySchemaParser, sub_type=None))], dimensions=[], name=Class, sub_type=None)), name=schemaParserClass)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=KeyEntitySchemaParser, sub_type=None))], dimensions=[], name=Class, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getConstructor, postfix_operators=[], prefix_operators=[], qualifier=schemaParserClass, selectors=[MethodInvocation(arguments=[], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=schemaParser)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=KeyEntitySchemaParser, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=schemaParserClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=schemaParser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putIfAbsent, postfix_operators=[], prefix_operators=[], qualifier=schemaParsers, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=schemaParser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not instantiate schema parser class: "), operandr=MemberReference(member=schemaParserClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DatasetException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] identifier[KeyEntitySchemaParser] operator[<] operator[?] , operator[?] operator[>] identifier[getSchemaParser] operator[SEP] identifier[String] identifier[schemaParserClassName] operator[SEP] {
Keyword[if] operator[SEP] identifier[schemaParsers] operator[SEP] identifier[contains] operator[SEP] identifier[schemaParserClassName] operator[SEP] operator[SEP] {
Keyword[return] identifier[schemaParsers] operator[SEP] identifier[get] operator[SEP] identifier[schemaParserClassName] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[try] {
identifier[Class] operator[<] identifier[KeyEntitySchemaParser] operator[<] operator[?] , operator[?] operator[>] operator[>] identifier[schemaParserClass] operator[=] operator[SEP] identifier[Class] operator[<] identifier[KeyEntitySchemaParser] operator[<] operator[?] , operator[?] operator[>] operator[>] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[schemaParserClassName] operator[SEP] operator[SEP] identifier[KeyEntitySchemaParser] operator[<] operator[?] , operator[?] operator[>] identifier[schemaParser] operator[=] identifier[schemaParserClass] operator[SEP] identifier[getConstructor] operator[SEP] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[schemaParsers] operator[SEP] identifier[putIfAbsent] operator[SEP] identifier[schemaParserClassName] , identifier[schemaParser] operator[SEP] operator[SEP] Keyword[return] identifier[schemaParser] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DatasetException] operator[SEP] literal[String] operator[+] identifier[schemaParserClassName] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public static void register(IRegisterable<?> registerable)
{
ResourceLocation name = registerable.getName();
if (name == null)
throw new IllegalArgumentException("No name specified for registration for " + registerable.getClass().getName());
if (!(registerable instanceof Block || registerable instanceof Item))
throw new IllegalArgumentException("Cannot register " + registerable.getClass().getName() + " (" + name
+ ") because it's neither a block or an item.");
if (registerable instanceof Block)
{
Block block = (Block) registerable;
ForgeRegistries.BLOCKS.register(block);
Item item = registerable.getItem(block);
if (item != null)
ForgeRegistries.ITEMS.register(item);
//register the mapper for the block and the model for the item
if (MalisisCore.isClient())
{
ModelLoader.setCustomStateMapper(block, b -> ImmutableMap.of());
if (item != null)
EmptyModelLoader.register(item);
}
ClientNotificationManager.discover(block);
}
else if (registerable instanceof Item)
{
Item item = (Item) registerable;
ForgeRegistries.ITEMS.register(item);
if (MalisisCore.isClient())
EmptyModelLoader.register(item);
}
} | class class_name[name] begin[{]
method[register, return_type[void], modifier[public static], parameter[registerable]] begin[{]
local_variable[type[ResourceLocation], name]
if[binary_operation[member[.name], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No name specified for registration for "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=registerable, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.registerable], instanceof, type[Block]], ||, binary_operation[member[.registerable], instanceof, type[Item]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot register "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=registerable, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ("), operator=+), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") because it's neither a block or an item."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.registerable], instanceof, type[Block]]] begin[{]
local_variable[type[Block], block]
call[ForgeRegistries.BLOCKS.register, parameter[member[.block]]]
local_variable[type[Item], item]
if[binary_operation[member[.item], !=, literal[null]]] begin[{]
call[ForgeRegistries.ITEMS.register, parameter[member[.item]]]
else begin[{]
None
end[}]
if[call[MalisisCore.isClient, parameter[]]] begin[{]
call[ModelLoader.setCustomStateMapper, parameter[member[.block], LambdaExpression(body=MethodInvocation(arguments=[], member=of, postfix_operators=[], prefix_operators=[], qualifier=ImmutableMap, selectors=[], type_arguments=None), parameters=[MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
if[binary_operation[member[.item], !=, literal[null]]] begin[{]
call[EmptyModelLoader.register, parameter[member[.item]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
call[ClientNotificationManager.discover, parameter[member[.block]]]
else begin[{]
if[binary_operation[member[.registerable], instanceof, type[Item]]] begin[{]
local_variable[type[Item], item]
call[ForgeRegistries.ITEMS.register, parameter[member[.item]]]
if[call[MalisisCore.isClient, parameter[]]] begin[{]
call[EmptyModelLoader.register, parameter[member[.item]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[register] operator[SEP] identifier[IRegisterable] operator[<] operator[?] operator[>] identifier[registerable] operator[SEP] {
identifier[ResourceLocation] identifier[name] operator[=] identifier[registerable] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[registerable] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[registerable] Keyword[instanceof] identifier[Block] operator[||] identifier[registerable] Keyword[instanceof] identifier[Item] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[registerable] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[name] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[registerable] Keyword[instanceof] identifier[Block] operator[SEP] {
identifier[Block] identifier[block] operator[=] operator[SEP] identifier[Block] operator[SEP] identifier[registerable] operator[SEP] identifier[ForgeRegistries] operator[SEP] identifier[BLOCKS] operator[SEP] identifier[register] operator[SEP] identifier[block] operator[SEP] operator[SEP] identifier[Item] identifier[item] operator[=] identifier[registerable] operator[SEP] identifier[getItem] operator[SEP] identifier[block] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[item] operator[!=] Other[null] operator[SEP] identifier[ForgeRegistries] operator[SEP] identifier[ITEMS] operator[SEP] identifier[register] operator[SEP] identifier[item] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[MalisisCore] operator[SEP] identifier[isClient] operator[SEP] operator[SEP] operator[SEP] {
identifier[ModelLoader] operator[SEP] identifier[setCustomStateMapper] operator[SEP] identifier[block] , identifier[b] operator[->] identifier[ImmutableMap] operator[SEP] identifier[of] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[item] operator[!=] Other[null] operator[SEP] identifier[EmptyModelLoader] operator[SEP] identifier[register] operator[SEP] identifier[item] operator[SEP] operator[SEP]
}
identifier[ClientNotificationManager] operator[SEP] identifier[discover] operator[SEP] identifier[block] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[registerable] Keyword[instanceof] identifier[Item] operator[SEP] {
identifier[Item] identifier[item] operator[=] operator[SEP] identifier[Item] operator[SEP] identifier[registerable] operator[SEP] identifier[ForgeRegistries] operator[SEP] identifier[ITEMS] operator[SEP] identifier[register] operator[SEP] identifier[item] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[MalisisCore] operator[SEP] identifier[isClient] operator[SEP] operator[SEP] operator[SEP] identifier[EmptyModelLoader] operator[SEP] identifier[register] operator[SEP] identifier[item] operator[SEP] operator[SEP]
}
}
|
public static int getAtomCount(IMolecularFormula formula) {
int count = 0;
for (IIsotope isotope : formula.isotopes()) {
count += formula.getIsotopeCount(isotope);
}
return count;
} | class class_name[name] begin[{]
method[getAtomCount, return_type[type[int]], modifier[public static], parameter[formula]] begin[{]
local_variable[type[int], count]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=isotope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIsotopeCount, postfix_operators=[], prefix_operators=[], qualifier=formula, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=isotopes, postfix_operators=[], prefix_operators=[], qualifier=formula, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=isotope)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IIsotope, sub_type=None))), label=None)
return[member[.count]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[getAtomCount] operator[SEP] identifier[IMolecularFormula] identifier[formula] operator[SEP] {
Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[IIsotope] identifier[isotope] operator[:] identifier[formula] operator[SEP] identifier[isotopes] operator[SEP] operator[SEP] operator[SEP] {
identifier[count] operator[+=] identifier[formula] operator[SEP] identifier[getIsotopeCount] operator[SEP] identifier[isotope] operator[SEP] operator[SEP]
}
Keyword[return] identifier[count] operator[SEP]
}
|
public static void setClassConf(Class<? extends Message> protoClass, Configuration conf) {
Protobufs.setClassConf(conf, RCFileProtobufInputFormat.class, protoClass);
} | class class_name[name] begin[{]
method[setClassConf, return_type[void], modifier[public static], parameter[protoClass, conf]] begin[{]
call[Protobufs.setClassConf, parameter[member[.conf], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RCFileProtobufInputFormat, sub_type=None)), member[.protoClass]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setClassConf] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Message] operator[>] identifier[protoClass] , identifier[Configuration] identifier[conf] operator[SEP] {
identifier[Protobufs] operator[SEP] identifier[setClassConf] operator[SEP] identifier[conf] , identifier[RCFileProtobufInputFormat] operator[SEP] Keyword[class] , identifier[protoClass] operator[SEP] operator[SEP]
}
|
@GwtIncompatible("incompatible method")
public static boolean isAssignable(final Class<?>[] classArray, final Class<?>... toClassArray) {
return isAssignable(classArray, toClassArray, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5));
} | class class_name[name] begin[{]
method[isAssignable, return_type[type[boolean]], modifier[public static], parameter[classArray, toClassArray]] begin[{]
return[call[.isAssignable, parameter[member[.classArray], member[.toClassArray], call[SystemUtils.isJavaVersionAtLeast, parameter[member[JavaVersion.JAVA_1_5]]]]]]
end[}]
END[}] | annotation[@] identifier[GwtIncompatible] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] Keyword[boolean] identifier[isAssignable] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[classArray] , Keyword[final] identifier[Class] operator[<] operator[?] operator[>] operator[...] identifier[toClassArray] operator[SEP] {
Keyword[return] identifier[isAssignable] operator[SEP] identifier[classArray] , identifier[toClassArray] , identifier[SystemUtils] operator[SEP] identifier[isJavaVersionAtLeast] operator[SEP] identifier[JavaVersion] operator[SEP] identifier[JAVA_1_5] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public T addPackage(Package pack) throws IllegalArgumentException {
Validate.notNull(pack, "Pack must be specified");
return addPackage(pack.getName());
} | class class_name[name] begin[{]
method[addPackage, return_type[type[T]], modifier[public], parameter[pack]] begin[{]
call[Validate.notNull, parameter[member[.pack], literal["Pack must be specified"]]]
return[call[.addPackage, parameter[call[pack.getName, parameter[]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[T] identifier[addPackage] operator[SEP] identifier[Package] identifier[pack] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[pack] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[addPackage] operator[SEP] identifier[pack] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public Object convert(String value) {
Object converted = null;
if (value != null) { //if the value is null then we always return null
try {
if (this.ctor != null) {
converted = this.ctor.newInstance(value);
} else if (this.valueOfMethod != null) {
converted = this.valueOfMethod.invoke(null, value);
} else if (this.parseMethod != null) {
converted = this.parseMethod.invoke(null, value);
}
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof IllegalArgumentException) {
throw (IllegalArgumentException) cause;
} else {
throw new ConversionException(cause);
}
} catch (IllegalAccessException | InstantiationException e) {
throw new ConversionException(e);
}
}
return converted;
} | class class_name[name] begin[{]
method[convert, return_type[type[Object]], modifier[public], parameter[value]] begin[{]
local_variable[type[Object], converted]
if[binary_operation[member[.value], !=, literal[null]]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ctor, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=valueOfMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=IfStatement(condition=BinaryOperation(operandl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=parseMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=converted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=parseMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=converted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=valueOfMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=invoke, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=converted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=ctor, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)]))], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), name=cause)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=IllegalArgumentException, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=cause, 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=ConversionException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=Cast(expression=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IllegalArgumentException, sub_type=None)), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvocationTargetException'])), 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=ConversionException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalAccessException', 'InstantiationException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.converted]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[convert] operator[SEP] identifier[String] identifier[value] operator[SEP] {
identifier[Object] identifier[converted] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[ctor] operator[!=] Other[null] operator[SEP] {
identifier[converted] operator[=] Keyword[this] operator[SEP] identifier[ctor] operator[SEP] identifier[newInstance] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[valueOfMethod] operator[!=] Other[null] operator[SEP] {
identifier[converted] operator[=] Keyword[this] operator[SEP] identifier[valueOfMethod] operator[SEP] identifier[invoke] operator[SEP] Other[null] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[parseMethod] operator[!=] Other[null] operator[SEP] {
identifier[converted] operator[=] Keyword[this] operator[SEP] identifier[parseMethod] operator[SEP] identifier[invoke] operator[SEP] Other[null] , identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InvocationTargetException] identifier[e] operator[SEP] {
identifier[Throwable] identifier[cause] operator[=] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cause] Keyword[instanceof] identifier[IllegalArgumentException] operator[SEP] {
Keyword[throw] operator[SEP] identifier[IllegalArgumentException] operator[SEP] identifier[cause] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[ConversionException] operator[SEP] identifier[cause] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IllegalAccessException] operator[|] identifier[InstantiationException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ConversionException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[converted] operator[SEP]
}
|
private static int parseJavaVersion() {
String[] parts = JAVA_SPECIFICATION_VERSION.split("\\.");
int nbParts = parts.length;
int majorIndex = nbParts > 1 ? 1 : 0;
return Integer.parseInt(parts[majorIndex]);
} | class class_name[name] begin[{]
method[parseJavaVersion, return_type[type[int]], modifier[private static], parameter[]] begin[{]
local_variable[type[String], parts]
local_variable[type[int], nbParts]
local_variable[type[int], majorIndex]
return[call[Integer.parseInt, parameter[member[.parts]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[int] identifier[parseJavaVersion] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[parts] operator[=] identifier[JAVA_SPECIFICATION_VERSION] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[nbParts] operator[=] identifier[parts] operator[SEP] identifier[length] operator[SEP] Keyword[int] identifier[majorIndex] operator[=] identifier[nbParts] operator[>] Other[1] operator[?] Other[1] operator[:] Other[0] operator[SEP] Keyword[return] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[parts] operator[SEP] identifier[majorIndex] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void createCacheFileAsync(final String fileNamePrefix, final InputStream is,
final CreateCompletionCallback callback) {
_aggregator.getExecutors().getFileCreateExecutor().submit(new Runnable() {
public void run() {
File file = null;
try {
file = File.createTempFile(fileNamePrefix, ".cache", _directory); //$NON-NLS-1$
OutputStream os = new FileOutputStream(file);
CopyUtil.copy(is, os);
if (callback != null) {
callback.completed(file.getName(), null);
}
} catch (IOException e) {
if (log.isLoggable(Level.WARNING))
log.log(Level.WARNING, MessageFormat.format(
Messages.CacheManagerImpl_4, new Object[]{file.getPath()}), e);
if (callback != null) {
callback.completed(file.getName(), e);
}
}
}
});
} | class class_name[name] begin[{]
method[createCacheFileAsync, return_type[void], modifier[public], parameter[fileNamePrefix, is, callback]] begin[{]
call[_aggregator.getExecutors, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[createCacheFileAsync] operator[SEP] Keyword[final] identifier[String] identifier[fileNamePrefix] , Keyword[final] identifier[InputStream] identifier[is] , Keyword[final] identifier[CreateCompletionCallback] identifier[callback] operator[SEP] {
identifier[_aggregator] operator[SEP] identifier[getExecutors] operator[SEP] operator[SEP] operator[SEP] identifier[getFileCreateExecutor] operator[SEP] operator[SEP] operator[SEP] identifier[submit] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[File] identifier[file] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[file] operator[=] identifier[File] operator[SEP] identifier[createTempFile] operator[SEP] identifier[fileNamePrefix] , literal[String] , identifier[_directory] operator[SEP] operator[SEP] identifier[OutputStream] identifier[os] operator[=] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[CopyUtil] operator[SEP] identifier[copy] operator[SEP] identifier[is] , identifier[os] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[callback] operator[!=] Other[null] operator[SEP] {
identifier[callback] operator[SEP] identifier[completed] operator[SEP] identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] , identifier[MessageFormat] operator[SEP] identifier[format] operator[SEP] identifier[Messages] operator[SEP] identifier[CacheManagerImpl_4] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[file] operator[SEP] identifier[getPath] operator[SEP] operator[SEP]
} operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[callback] operator[!=] Other[null] operator[SEP] {
identifier[callback] operator[SEP] identifier[completed] operator[SEP] identifier[file] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
} operator[SEP] operator[SEP]
}
|
public void init(ModeledAuthenticatedUser currentUser,
ModeledPermissions<? extends EntityModel> entity,
Set<String> effectiveGroups) {
super.init(currentUser);
this.entity = entity;
this.effectiveGroups = effectiveGroups;
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[currentUser, entity, effectiveGroups]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=currentUser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
assign[THIS[member[None.entity]], member[.entity]]
assign[THIS[member[None.effectiveGroups]], member[.effectiveGroups]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[init] operator[SEP] identifier[ModeledAuthenticatedUser] identifier[currentUser] , identifier[ModeledPermissions] operator[<] operator[?] Keyword[extends] identifier[EntityModel] operator[>] identifier[entity] , identifier[Set] operator[<] identifier[String] operator[>] identifier[effectiveGroups] operator[SEP] {
Keyword[super] operator[SEP] identifier[init] operator[SEP] identifier[currentUser] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[entity] operator[=] identifier[entity] operator[SEP] Keyword[this] operator[SEP] identifier[effectiveGroups] operator[=] identifier[effectiveGroups] operator[SEP]
}
|
private void checkInterface(Node n, FunctionType functionType) {
// Interface must extend only interfaces
for (ObjectType extInterface : functionType.getExtendedInterfaces()) {
if (extInterface.getConstructor() != null && !extInterface.getConstructor().isInterface()) {
compiler.report(
JSError.make(n, CONFLICTING_EXTENDED_TYPE, "interface", getBestFunctionName(n)));
}
}
// Check whether the extended interfaces have any conflicts
if (functionType.getExtendedInterfacesCount() > 1) {
// Only check when extending more than one interfaces
HashMap<String, ObjectType> properties = new HashMap<>();
LinkedHashMap<String, ObjectType> currentProperties = new LinkedHashMap<>();
for (ObjectType interfaceType : functionType.getExtendedInterfaces()) {
currentProperties.clear();
checkInterfaceConflictProperties(
n, getBestFunctionName(n), properties, currentProperties, interfaceType);
properties.putAll(currentProperties);
}
}
List<FunctionType> loopPath = functionType.checkExtendsLoop();
if (loopPath != null) {
String strPath = "";
for (int i = 0; i < loopPath.size() - 1; i++) {
strPath += loopPath.get(i).getDisplayName() + " -> ";
}
strPath += Iterables.getLast(loopPath).getDisplayName();
compiler.report(
JSError.make(n, INTERFACE_EXTENDS_LOOP, loopPath.get(0).getDisplayName(), strPath));
}
} | class class_name[name] begin[{]
method[checkInterface, return_type[void], modifier[private], parameter[n, functionType]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getConstructor, postfix_operators=[], prefix_operators=[], qualifier=extInterface, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=getConstructor, postfix_operators=[], prefix_operators=['!'], qualifier=extInterface, selectors=[MethodInvocation(arguments=[], member=isInterface, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CONFLICTING_EXTENDED_TYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="interface"), MethodInvocation(arguments=[MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBestFunctionName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=make, postfix_operators=[], prefix_operators=[], qualifier=JSError, selectors=[], type_arguments=None)], member=report, postfix_operators=[], prefix_operators=[], qualifier=compiler, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getExtendedInterfaces, postfix_operators=[], prefix_operators=[], qualifier=functionType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=extInterface)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ObjectType, sub_type=None))), label=None)
if[binary_operation[call[functionType.getExtendedInterfacesCount, parameter[]], >, literal[1]]] begin[{]
local_variable[type[HashMap], properties]
local_variable[type[LinkedHashMap], currentProperties]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=currentProperties, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBestFunctionName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=interfaceType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkInterfaceConflictProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentProperties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putAll, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getExtendedInterfaces, postfix_operators=[], prefix_operators=[], qualifier=functionType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=interfaceType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ObjectType, sub_type=None))), label=None)
else begin[{]
None
end[}]
local_variable[type[List], loopPath]
if[binary_operation[member[.loopPath], !=, literal[null]]] begin[{]
local_variable[type[String], strPath]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=strPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=loopPath, selectors=[MethodInvocation(arguments=[], member=getDisplayName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" -> "), operator=+)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=loopPath, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.strPath], call[Iterables.getLast, parameter[member[.loopPath]]]]
call[compiler.report, parameter[call[JSError.make, parameter[member[.n], member[.INTERFACE_EXTENDS_LOOP], call[loopPath.get, parameter[literal[0]]], member[.strPath]]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[checkInterface] operator[SEP] identifier[Node] identifier[n] , identifier[FunctionType] identifier[functionType] operator[SEP] {
Keyword[for] operator[SEP] identifier[ObjectType] identifier[extInterface] operator[:] identifier[functionType] operator[SEP] identifier[getExtendedInterfaces] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[extInterface] operator[SEP] identifier[getConstructor] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] identifier[extInterface] operator[SEP] identifier[getConstructor] operator[SEP] operator[SEP] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[SEP] {
identifier[compiler] operator[SEP] identifier[report] operator[SEP] identifier[JSError] operator[SEP] identifier[make] operator[SEP] identifier[n] , identifier[CONFLICTING_EXTENDED_TYPE] , literal[String] , identifier[getBestFunctionName] operator[SEP] identifier[n] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[functionType] operator[SEP] identifier[getExtendedInterfacesCount] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
identifier[HashMap] operator[<] identifier[String] , identifier[ObjectType] operator[>] identifier[properties] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[ObjectType] operator[>] identifier[currentProperties] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ObjectType] identifier[interfaceType] operator[:] identifier[functionType] operator[SEP] identifier[getExtendedInterfaces] operator[SEP] operator[SEP] operator[SEP] {
identifier[currentProperties] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[checkInterfaceConflictProperties] operator[SEP] identifier[n] , identifier[getBestFunctionName] operator[SEP] identifier[n] operator[SEP] , identifier[properties] , identifier[currentProperties] , identifier[interfaceType] operator[SEP] operator[SEP] identifier[properties] operator[SEP] identifier[putAll] operator[SEP] identifier[currentProperties] operator[SEP] operator[SEP]
}
}
identifier[List] operator[<] identifier[FunctionType] operator[>] identifier[loopPath] operator[=] identifier[functionType] operator[SEP] identifier[checkExtendsLoop] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[loopPath] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[strPath] operator[=] literal[String] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[loopPath] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[strPath] operator[+=] identifier[loopPath] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP]
}
identifier[strPath] operator[+=] identifier[Iterables] operator[SEP] identifier[getLast] operator[SEP] identifier[loopPath] operator[SEP] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] operator[SEP] identifier[compiler] operator[SEP] identifier[report] operator[SEP] identifier[JSError] operator[SEP] identifier[make] operator[SEP] identifier[n] , identifier[INTERFACE_EXTENDS_LOOP] , identifier[loopPath] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getDisplayName] operator[SEP] operator[SEP] , identifier[strPath] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void addAssignments(MpxjTreeNode parentNode, ProjectFile file)
{
for (ResourceAssignment assignment : file.getResourceAssignments())
{
final ResourceAssignment a = assignment;
MpxjTreeNode childNode = new MpxjTreeNode(a)
{
@Override public String toString()
{
Resource resource = a.getResource();
String resourceName = resource == null ? "(unknown resource)" : resource.getName();
Task task = a.getTask();
String taskName = task == null ? "(unknown task)" : task.getName();
return resourceName + "->" + taskName;
}
};
parentNode.add(childNode);
}
} | class class_name[name] begin[{]
method[addAssignments, return_type[void], modifier[private], parameter[parentNode, file]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=assignment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=a)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ResourceAssignment, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResource, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), name=resource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Resource, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="(unknown resource)")), name=resourceName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTask, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), name=task)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Task, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=task, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=task, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="(unknown task)")), name=taskName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=resourceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="->"), operator=+), operandr=MemberReference(member=taskName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), label=None)], documentation=None, modifiers={'public'}, name=toString, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, 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=MpxjTreeNode, sub_type=None)), name=childNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MpxjTreeNode, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=parentNode, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getResourceAssignments, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=assignment)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResourceAssignment, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addAssignments] operator[SEP] identifier[MpxjTreeNode] identifier[parentNode] , identifier[ProjectFile] identifier[file] operator[SEP] {
Keyword[for] operator[SEP] identifier[ResourceAssignment] identifier[assignment] operator[:] identifier[file] operator[SEP] identifier[getResourceAssignments] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[ResourceAssignment] identifier[a] operator[=] identifier[assignment] operator[SEP] identifier[MpxjTreeNode] identifier[childNode] operator[=] Keyword[new] identifier[MpxjTreeNode] operator[SEP] identifier[a] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[toString] operator[SEP] operator[SEP] {
identifier[Resource] identifier[resource] operator[=] identifier[a] operator[SEP] identifier[getResource] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[resourceName] operator[=] identifier[resource] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[resource] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[Task] identifier[task] operator[=] identifier[a] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[taskName] operator[=] identifier[task] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[task] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[resourceName] operator[+] literal[String] operator[+] identifier[taskName] operator[SEP]
}
} operator[SEP] identifier[parentNode] operator[SEP] identifier[add] operator[SEP] identifier[childNode] operator[SEP] operator[SEP]
}
}
|
static final void put6Bit(final WritableMemory wmem, final int offsetBytes, final int slotNo,
final int newValue) {
final int startBit = slotNo * 6;
final int shift = startBit & 0X7;
final int byteIdx = (startBit >>> 3) + offsetBytes;
final int valShifted = (newValue & 0X3F) << shift;
final int curMasked = wmem.getShort(byteIdx) & (~(VAL_MASK_6 << shift));
final short insert = (short) (curMasked | valShifted);
wmem.putShort(byteIdx, insert);
} | class class_name[name] begin[{]
method[put6Bit, return_type[void], modifier[final static], parameter[wmem, offsetBytes, slotNo, newValue]] begin[{]
local_variable[type[int], startBit]
local_variable[type[int], shift]
local_variable[type[int], byteIdx]
local_variable[type[int], valShifted]
local_variable[type[int], curMasked]
local_variable[type[short], insert]
call[wmem.putShort, parameter[member[.byteIdx], member[.insert]]]
end[}]
END[}] | Keyword[static] Keyword[final] Keyword[void] identifier[put6Bit] operator[SEP] Keyword[final] identifier[WritableMemory] identifier[wmem] , Keyword[final] Keyword[int] identifier[offsetBytes] , Keyword[final] Keyword[int] identifier[slotNo] , Keyword[final] Keyword[int] identifier[newValue] operator[SEP] {
Keyword[final] Keyword[int] identifier[startBit] operator[=] identifier[slotNo] operator[*] Other[6] operator[SEP] Keyword[final] Keyword[int] identifier[shift] operator[=] identifier[startBit] operator[&] literal[Integer] operator[SEP] Keyword[final] Keyword[int] identifier[byteIdx] operator[=] operator[SEP] identifier[startBit] operator[>] operator[>] operator[>] Other[3] operator[SEP] operator[+] identifier[offsetBytes] operator[SEP] Keyword[final] Keyword[int] identifier[valShifted] operator[=] operator[SEP] identifier[newValue] operator[&] literal[Integer] operator[SEP] operator[<<] identifier[shift] operator[SEP] Keyword[final] Keyword[int] identifier[curMasked] operator[=] identifier[wmem] operator[SEP] identifier[getShort] operator[SEP] identifier[byteIdx] operator[SEP] operator[&] operator[SEP] operator[~] operator[SEP] identifier[VAL_MASK_6] operator[<<] identifier[shift] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[short] identifier[insert] operator[=] operator[SEP] Keyword[short] operator[SEP] operator[SEP] identifier[curMasked] operator[|] identifier[valShifted] operator[SEP] operator[SEP] identifier[wmem] operator[SEP] identifier[putShort] operator[SEP] identifier[byteIdx] , identifier[insert] operator[SEP] operator[SEP]
}
|
public static StringBuilder getContextUrlString(String baseUrl, String context) throws MalformedURLException {
StringBuilder urlStr = new StringBuilder(baseUrl);
ensureEndsWithSlash(urlStr);
if (context != null && context.length() > 0) {
if (context.startsWith("/")) {
urlStr.append(context.substring(1));
} else {
urlStr.append(context);
}
ensureEndsWithSlash(urlStr);
}
return urlStr;
} | class class_name[name] begin[{]
method[getContextUrlString, return_type[type[StringBuilder]], modifier[public static], parameter[baseUrl, context]] begin[{]
local_variable[type[StringBuilder], urlStr]
call[.ensureEndsWithSlash, parameter[member[.urlStr]]]
if[binary_operation[binary_operation[member[.context], !=, literal[null]], &&, binary_operation[call[context.length, parameter[]], >, literal[0]]]] begin[{]
if[call[context.startsWith, parameter[literal["/"]]]] begin[{]
call[urlStr.append, parameter[call[context.substring, parameter[literal[1]]]]]
else begin[{]
call[urlStr.append, parameter[member[.context]]]
end[}]
call[.ensureEndsWithSlash, parameter[member[.urlStr]]]
else begin[{]
None
end[}]
return[member[.urlStr]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[StringBuilder] identifier[getContextUrlString] operator[SEP] identifier[String] identifier[baseUrl] , identifier[String] identifier[context] operator[SEP] Keyword[throws] identifier[MalformedURLException] {
identifier[StringBuilder] identifier[urlStr] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[baseUrl] operator[SEP] operator[SEP] identifier[ensureEndsWithSlash] operator[SEP] identifier[urlStr] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[context] operator[!=] Other[null] operator[&&] identifier[context] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[context] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[urlStr] operator[SEP] identifier[append] operator[SEP] identifier[context] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[urlStr] operator[SEP] identifier[append] operator[SEP] identifier[context] operator[SEP] operator[SEP]
}
identifier[ensureEndsWithSlash] operator[SEP] identifier[urlStr] operator[SEP] operator[SEP]
}
Keyword[return] identifier[urlStr] operator[SEP]
}
|
public DataObject object(File[] files, int start, int count) {
return STRUCT.fromMapsAndCollections(map(files, start, count));
} | class class_name[name] begin[{]
method[object, return_type[type[DataObject]], modifier[public], parameter[files, start, count]] begin[{]
return[call[STRUCT.fromMapsAndCollections, parameter[call[.map, parameter[member[.files], member[.start], member[.count]]]]]]
end[}]
END[}] | Keyword[public] identifier[DataObject] identifier[object] operator[SEP] identifier[File] operator[SEP] operator[SEP] identifier[files] , Keyword[int] identifier[start] , Keyword[int] identifier[count] operator[SEP] {
Keyword[return] identifier[STRUCT] operator[SEP] identifier[fromMapsAndCollections] operator[SEP] identifier[map] operator[SEP] identifier[files] , identifier[start] , identifier[count] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
for (val delegate : this.delegates) {
if (delegate.canHandle(request, response)) {
return delegate.handleRequestInternal(request, response);
}
}
return generateErrorView(CasProtocolConstants.ERROR_CODE_INVALID_REQUEST, null);
} | class class_name[name] begin[{]
method[handleRequestInternal, return_type[type[ModelAndView]], modifier[protected], parameter[request, response]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=canHandle, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleRequestInternal, postfix_operators=[], prefix_operators=[], qualifier=delegate, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=delegates, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=delegate)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=val, sub_type=None))), label=None)
return[call[.generateErrorView, parameter[member[CasProtocolConstants.ERROR_CODE_INVALID_REQUEST], literal[null]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[ModelAndView] identifier[handleRequestInternal] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[request] , Keyword[final] identifier[HttpServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[for] operator[SEP] identifier[val] identifier[delegate] operator[:] Keyword[this] operator[SEP] identifier[delegates] operator[SEP] {
Keyword[if] operator[SEP] identifier[delegate] operator[SEP] identifier[canHandle] operator[SEP] identifier[request] , identifier[response] operator[SEP] operator[SEP] {
Keyword[return] identifier[delegate] operator[SEP] identifier[handleRequestInternal] operator[SEP] identifier[request] , identifier[response] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[generateErrorView] operator[SEP] identifier[CasProtocolConstants] operator[SEP] identifier[ERROR_CODE_INVALID_REQUEST] , Other[null] operator[SEP] operator[SEP]
}
|
public ListTopicsResult withTopics(Topic... topics) {
if (this.topics == null) {
setTopics(new com.amazonaws.internal.SdkInternalList<Topic>(topics.length));
}
for (Topic ele : topics) {
this.topics.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withTopics, return_type[type[ListTopicsResult]], modifier[public], parameter[topics]] begin[{]
if[binary_operation[THIS[member[None.topics]], ==, literal[null]]] begin[{]
call[.setTopics, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=topics, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Topic, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=topics, 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=topics, 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=Topic, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ListTopicsResult] identifier[withTopics] operator[SEP] identifier[Topic] operator[...] identifier[topics] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[topics] operator[==] Other[null] operator[SEP] {
identifier[setTopics] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[Topic] operator[>] operator[SEP] identifier[topics] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Topic] identifier[ele] operator[:] identifier[topics] operator[SEP] {
Keyword[this] operator[SEP] identifier[topics] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public void becomeCloneOf(ManagedObject other)
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass,
"becomeCloneOf",
"Other="
+ other);
super.becomeCloneOf(other);
concurrentListToken = ((ConcurrentSubList) other).concurrentListToken;
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass,
"becomeCloneOf");
} | class class_name[name] begin[{]
method[becomeCloneOf, return_type[void], modifier[public], parameter[other]] begin[{]
if[binary_operation[call[Tracing.isAnyTracingEnabled, parameter[]], &&, call[trace.isEntryEnabled, parameter[]]]] begin[{]
call[trace.entry, parameter[THIS[], member[.cclass], literal["becomeCloneOf"], binary_operation[literal["Other="], +, member[.other]]]]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=becomeCloneOf, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
assign[member[.concurrentListToken], Cast(expression=MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ConcurrentSubList, sub_type=None))]
if[binary_operation[call[Tracing.isAnyTracingEnabled, parameter[]], &&, call[trace.isEntryEnabled, parameter[]]]] begin[{]
call[trace.exit, parameter[THIS[], member[.cclass], literal["becomeCloneOf"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[becomeCloneOf] operator[SEP] identifier[ManagedObject] identifier[other] operator[SEP] {
Keyword[if] operator[SEP] identifier[Tracing] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[trace] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[trace] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[cclass] , literal[String] , literal[String] operator[+] identifier[other] operator[SEP] operator[SEP] Keyword[super] operator[SEP] identifier[becomeCloneOf] operator[SEP] identifier[other] operator[SEP] operator[SEP] identifier[concurrentListToken] operator[=] operator[SEP] operator[SEP] identifier[ConcurrentSubList] operator[SEP] identifier[other] operator[SEP] operator[SEP] identifier[concurrentListToken] operator[SEP] Keyword[if] operator[SEP] identifier[Tracing] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[trace] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[trace] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[cclass] , literal[String] operator[SEP] operator[SEP]
}
|
public StylesheetComposed getImportComposed(int i)
throws ArrayIndexOutOfBoundsException
{
StylesheetRoot root = getStylesheetRoot();
// Get the stylesheet that is offset past this stylesheet.
// Thus, if the index of this stylesheet is 3, an argument
// to getImportComposed of 0 will return the 4th stylesheet
// in the global import list.
return root.getGlobalImport(1 + m_importNumber + i);
} | class class_name[name] begin[{]
method[getImportComposed, return_type[type[StylesheetComposed]], modifier[public], parameter[i]] begin[{]
local_variable[type[StylesheetRoot], root]
return[call[root.getGlobalImport, parameter[binary_operation[binary_operation[literal[1], +, member[.m_importNumber]], +, member[.i]]]]]
end[}]
END[}] | Keyword[public] identifier[StylesheetComposed] identifier[getImportComposed] operator[SEP] Keyword[int] identifier[i] operator[SEP] Keyword[throws] identifier[ArrayIndexOutOfBoundsException] {
identifier[StylesheetRoot] identifier[root] operator[=] identifier[getStylesheetRoot] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[root] operator[SEP] identifier[getGlobalImport] operator[SEP] Other[1] operator[+] identifier[m_importNumber] operator[+] identifier[i] operator[SEP] operator[SEP]
}
|
private String getServletPath(final String relativePath) {
if (relativePath == null) {
LOG.error("relativePath must not be null");
}
String context = getHostFreeBaseUrl();
if (!Util.empty(context)) {
return context + relativePath;
}
return relativePath;
} | class class_name[name] begin[{]
method[getServletPath, return_type[type[String]], modifier[private], parameter[relativePath]] begin[{]
if[binary_operation[member[.relativePath], ==, literal[null]]] begin[{]
call[LOG.error, parameter[literal["relativePath must not be null"]]]
else begin[{]
None
end[}]
local_variable[type[String], context]
if[call[Util.empty, parameter[member[.context]]]] begin[{]
return[binary_operation[member[.context], +, member[.relativePath]]]
else begin[{]
None
end[}]
return[member[.relativePath]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[getServletPath] operator[SEP] Keyword[final] identifier[String] identifier[relativePath] operator[SEP] {
Keyword[if] operator[SEP] identifier[relativePath] operator[==] Other[null] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[context] operator[=] identifier[getHostFreeBaseUrl] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Util] operator[SEP] identifier[empty] operator[SEP] identifier[context] operator[SEP] operator[SEP] {
Keyword[return] identifier[context] operator[+] identifier[relativePath] operator[SEP]
}
Keyword[return] identifier[relativePath] operator[SEP]
}
|
public static int getInt(String name, int defaultVal){
if(getConfiguration().containsKey(name)){
return getConfiguration().getInt(name);
} else {
return defaultVal;
}
} | class class_name[name] begin[{]
method[getInt, return_type[type[int]], modifier[public static], parameter[name, defaultVal]] begin[{]
if[call[.getConfiguration, parameter[]]] begin[{]
return[call[.getConfiguration, parameter[]]]
else begin[{]
return[member[.defaultVal]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[getInt] operator[SEP] identifier[String] identifier[name] , Keyword[int] identifier[defaultVal] operator[SEP] {
Keyword[if] operator[SEP] identifier[getConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[containsKey] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[getConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getInt] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[defaultVal] operator[SEP]
}
}
|
@Override
public SocketRuntime createRuntime(DefaultFuture future, Options options, List<FunctionWrapper> functions) {
return new SerialSocketRuntime(transportInUse, options, new DefaultFuture(this), this, functions);
} | class class_name[name] begin[{]
method[createRuntime, return_type[type[SocketRuntime]], modifier[public], parameter[future, options, functions]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=transportInUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=options, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=DefaultFuture, sub_type=None)), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=functions, 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=SerialSocketRuntime, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[SocketRuntime] identifier[createRuntime] operator[SEP] identifier[DefaultFuture] identifier[future] , identifier[Options] identifier[options] , identifier[List] operator[<] identifier[FunctionWrapper] operator[>] identifier[functions] operator[SEP] {
Keyword[return] Keyword[new] identifier[SerialSocketRuntime] operator[SEP] identifier[transportInUse] , identifier[options] , Keyword[new] identifier[DefaultFuture] operator[SEP] Keyword[this] operator[SEP] , Keyword[this] , identifier[functions] operator[SEP] operator[SEP]
}
|
protected Set<IEntityGroup> primGetAncestorGroups(IGroupMember member, Set<IEntityGroup> rslt)
throws GroupsException {
for (IEntityGroup group : member.getParentGroups()) {
// avoid stack overflow in case of circular group dependencies
if (!rslt.contains(group)) {
rslt.add(group);
primGetAncestorGroups(group, rslt);
}
}
return rslt;
} | class class_name[name] begin[{]
method[primGetAncestorGroups, return_type[type[Set]], modifier[protected], parameter[member, rslt]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=group, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=rslt, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=group, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=rslt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=group, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rslt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=primGetAncestorGroups, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getParentGroups, postfix_operators=[], prefix_operators=[], qualifier=member, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=group)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IEntityGroup, sub_type=None))), label=None)
return[member[.rslt]]
end[}]
END[}] | Keyword[protected] identifier[Set] operator[<] identifier[IEntityGroup] operator[>] identifier[primGetAncestorGroups] operator[SEP] identifier[IGroupMember] identifier[member] , identifier[Set] operator[<] identifier[IEntityGroup] operator[>] identifier[rslt] operator[SEP] Keyword[throws] identifier[GroupsException] {
Keyword[for] operator[SEP] identifier[IEntityGroup] identifier[group] operator[:] identifier[member] operator[SEP] identifier[getParentGroups] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[rslt] operator[SEP] identifier[contains] operator[SEP] identifier[group] operator[SEP] operator[SEP] {
identifier[rslt] operator[SEP] identifier[add] operator[SEP] identifier[group] operator[SEP] operator[SEP] identifier[primGetAncestorGroups] operator[SEP] identifier[group] , identifier[rslt] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[rslt] operator[SEP]
}
|
@Override
public java.util.concurrent.Future<BatchWriteItemResult> batchWriteItemAsync(java.util.Map<String, java.util.List<WriteRequest>> requestItems) {
return batchWriteItemAsync(new BatchWriteItemRequest().withRequestItems(requestItems));
} | class class_name[name] begin[{]
method[batchWriteItemAsync, return_type[type[java]], modifier[public], parameter[requestItems]] begin[{]
return[call[.batchWriteItemAsync, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=requestItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=withRequestItems, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BatchWriteItemRequest, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[concurrent] operator[SEP] identifier[Future] operator[<] identifier[BatchWriteItemResult] operator[>] identifier[batchWriteItemAsync] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[WriteRequest] operator[>] operator[>] identifier[requestItems] operator[SEP] {
Keyword[return] identifier[batchWriteItemAsync] operator[SEP] Keyword[new] identifier[BatchWriteItemRequest] operator[SEP] operator[SEP] operator[SEP] identifier[withRequestItems] operator[SEP] identifier[requestItems] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.