code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
@Override
public String getSimpleName() {
if (qualifiedName == null)
return "[unknown]";
int idx = qualifiedName.lastIndexOf('.');
int dollar = qualifiedName.lastIndexOf('$');
int max = Math.max(idx, dollar);
if (max != -1 && max < qualifiedName.length() - 1) {
return qualifiedName.substring(max + 1);
}
return qualifiedName;
}
|
class class_name[name] begin[{]
method[getSimpleName, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.qualifiedName], ==, literal[null]]] begin[{]
return[literal["[unknown]"]]
else begin[{]
None
end[}]
local_variable[type[int], idx]
local_variable[type[int], dollar]
local_variable[type[int], max]
if[binary_operation[binary_operation[member[.max], !=, literal[1]], &&, binary_operation[member[.max], <, binary_operation[call[qualifiedName.length, parameter[]], -, literal[1]]]]] begin[{]
return[call[qualifiedName.substring, parameter[binary_operation[member[.max], +, literal[1]]]]]
else begin[{]
None
end[}]
return[member[.qualifiedName]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getSimpleName] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[qualifiedName] operator[==] Other[null] operator[SEP] Keyword[return] literal[String] operator[SEP] Keyword[int] identifier[idx] operator[=] identifier[qualifiedName] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[dollar] operator[=] identifier[qualifiedName] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[max] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[idx] , identifier[dollar] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[max] operator[!=] operator[-] Other[1] operator[&&] identifier[max] operator[<] identifier[qualifiedName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] {
Keyword[return] identifier[qualifiedName] operator[SEP] identifier[substring] operator[SEP] identifier[max] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] identifier[qualifiedName] operator[SEP]
}
|
public void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) {
StringBuilder sb = new StringBuilder();
method.addJavaDocLine("/**");
if (StringUtility.stringHasValue(introspectedColumn.getRemarks())) {
sb.append(" * 获取");
sb.append(introspectedColumn.getRemarks());
method.addJavaDocLine(sb.toString());
method.addJavaDocLine(" *");
}
sb.setLength(0);
sb.append(" * @return ");
sb.append(introspectedColumn.getActualColumnName());
if (StringUtility.stringHasValue(introspectedColumn.getRemarks())) {
sb.append(" - ");
sb.append(introspectedColumn.getRemarks());
}
method.addJavaDocLine(sb.toString());
method.addJavaDocLine(" */");
}
|
class class_name[name] begin[{]
method[addGetterComment, return_type[void], modifier[public], parameter[method, introspectedTable, introspectedColumn]] begin[{]
local_variable[type[StringBuilder], sb]
call[method.addJavaDocLine, parameter[literal["/**"]]]
if[call[StringUtility.stringHasValue, parameter[call[introspectedColumn.getRemarks, parameter[]]]]] begin[{]
call[sb.append, parameter[literal[" * 获取"]]]
call[sb.append, parameter[call[introspectedColumn.getRemarks, parameter[]]]]
call[method.addJavaDocLine, parameter[call[sb.toString, parameter[]]]]
call[method.addJavaDocLine, parameter[literal[" *"]]]
else begin[{]
None
end[}]
call[sb.setLength, parameter[literal[0]]]
call[sb.append, parameter[literal[" * @return "]]]
call[sb.append, parameter[call[introspectedColumn.getActualColumnName, parameter[]]]]
if[call[StringUtility.stringHasValue, parameter[call[introspectedColumn.getRemarks, parameter[]]]]] begin[{]
call[sb.append, parameter[literal[" - "]]]
call[sb.append, parameter[call[introspectedColumn.getRemarks, parameter[]]]]
else begin[{]
None
end[}]
call[method.addJavaDocLine, parameter[call[sb.toString, parameter[]]]]
call[method.addJavaDocLine, parameter[literal[" */"]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addGetterComment] operator[SEP] identifier[Method] identifier[method] , identifier[IntrospectedTable] identifier[introspectedTable] , identifier[IntrospectedColumn] identifier[introspectedColumn] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[method] operator[SEP] identifier[addJavaDocLine] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtility] operator[SEP] identifier[stringHasValue] operator[SEP] identifier[introspectedColumn] operator[SEP] identifier[getRemarks] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[introspectedColumn] operator[SEP] identifier[getRemarks] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[method] operator[SEP] identifier[addJavaDocLine] operator[SEP] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[method] operator[SEP] identifier[addJavaDocLine] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[introspectedColumn] operator[SEP] identifier[getActualColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtility] operator[SEP] identifier[stringHasValue] operator[SEP] identifier[introspectedColumn] operator[SEP] identifier[getRemarks] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[introspectedColumn] operator[SEP] identifier[getRemarks] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[method] operator[SEP] identifier[addJavaDocLine] operator[SEP] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[method] operator[SEP] identifier[addJavaDocLine] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public static BufferedReader getBufferedReader(String source) throws FileNotFoundException {
InputStream is = IOUtils.class.getResourceAsStream(source);
if (is != null) {
return new BufferedReader(new InputStreamReader(is));
} else {
File file;
URL url = IOUtils.class.getResource(source);
if (url != null) {
file = new File(url.getPath());
} else {
file = new File(source);
}
return new BufferedReader(new FileReader(file));
}
}
|
class class_name[name] begin[{]
method[getBufferedReader, return_type[type[BufferedReader]], modifier[public static], parameter[source]] begin[{]
local_variable[type[InputStream], is]
if[binary_operation[member[.is], !=, literal[null]]] begin[{]
return[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=is, 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=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None))]
else begin[{]
local_variable[type[File], file]
local_variable[type[URL], url]
if[binary_operation[member[.url], !=, literal[null]]] begin[{]
assign[member[.file], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))]
else begin[{]
assign[member[.file], ClassCreator(arguments=[MemberReference(member=source, 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=File, sub_type=None))]
end[}]
return[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None))]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BufferedReader] identifier[getBufferedReader] operator[SEP] identifier[String] identifier[source] operator[SEP] Keyword[throws] identifier[FileNotFoundException] {
identifier[InputStream] identifier[is] operator[=] identifier[IOUtils] operator[SEP] Keyword[class] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[source] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[is] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[is] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[File] identifier[file] operator[SEP] identifier[URL] identifier[url] operator[=] identifier[IOUtils] operator[SEP] Keyword[class] operator[SEP] identifier[getResource] operator[SEP] identifier[source] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[url] operator[!=] Other[null] operator[SEP] {
identifier[file] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[url] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[file] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[source] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[FileReader] operator[SEP] identifier[file] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static AuthToken custom( String principal, String credentials, String realm, String scheme)
{
return custom( principal, credentials, realm, scheme, null );
}
|
class class_name[name] begin[{]
method[custom, return_type[type[AuthToken]], modifier[public static], parameter[principal, credentials, realm, scheme]] begin[{]
return[call[.custom, parameter[member[.principal], member[.credentials], member[.realm], member[.scheme], literal[null]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[AuthToken] identifier[custom] operator[SEP] identifier[String] identifier[principal] , identifier[String] identifier[credentials] , identifier[String] identifier[realm] , identifier[String] identifier[scheme] operator[SEP] {
Keyword[return] identifier[custom] operator[SEP] identifier[principal] , identifier[credentials] , identifier[realm] , identifier[scheme] , Other[null] operator[SEP] operator[SEP]
}
|
public static Set<String> readColumnSet(String infile, int field) throws IOException
{
BufferedReader br = IOUtils.getBufferedFileReader(infile);
String line;
Set<String> set = new HashSet<String>();
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.length() > 0) {
if (field < 0) {
set.add(line);
} else {
String[] fields = tab.split(line);
if (field < fields.length) {
set.add(fields[field]);
}
}
}
}
br.close();
return set;
}
|
class class_name[name] begin[{]
method[readColumnSet, return_type[type[Set]], modifier[public static], parameter[infile, field]] begin[{]
local_variable[type[BufferedReader], br]
local_variable[type[String], line]
local_variable[type[Set], set]
while[binary_operation[assign[member[.line], call[br.readLine, parameter[]]], !=, literal[null]]] begin[{]
assign[member[.line], call[line.trim, parameter[]]]
if[binary_operation[call[line.length, parameter[]], >, literal[0]]] begin[{]
if[binary_operation[member[.field], <, literal[0]]] begin[{]
call[set.add, parameter[member[.line]]]
else begin[{]
local_variable[type[String], fields]
if[binary_operation[member[.field], <, member[fields.length]]] begin[{]
call[set.add, parameter[member[.fields]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
call[br.close, parameter[]]
return[member[.set]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[String] operator[>] identifier[readColumnSet] operator[SEP] identifier[String] identifier[infile] , Keyword[int] identifier[field] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[BufferedReader] identifier[br] operator[=] identifier[IOUtils] operator[SEP] identifier[getBufferedFileReader] operator[SEP] identifier[infile] operator[SEP] operator[SEP] identifier[String] identifier[line] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[set] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[br] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[line] operator[=] identifier[line] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] operator[<] Other[0] operator[SEP] {
identifier[set] operator[SEP] identifier[add] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[String] operator[SEP] operator[SEP] identifier[fields] operator[=] identifier[tab] operator[SEP] identifier[split] operator[SEP] identifier[line] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[field] operator[<] identifier[fields] operator[SEP] identifier[length] operator[SEP] {
identifier[set] operator[SEP] identifier[add] operator[SEP] identifier[fields] operator[SEP] identifier[field] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
identifier[br] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[set] operator[SEP]
}
|
@ColorInt
public static int opaqueColor(@ColorInt int color) {
int alpha = Color.alpha(color);
if (alpha == 0) return color;
int red = Color.red(color);
int green = Color.green(color);
int blue = Color.blue(color);
return Color.argb(255, red, green, blue);
}
|
class class_name[name] begin[{]
method[opaqueColor, return_type[type[int]], modifier[public static], parameter[color]] begin[{]
local_variable[type[int], alpha]
if[binary_operation[member[.alpha], ==, literal[0]]] begin[{]
return[member[.color]]
else begin[{]
None
end[}]
local_variable[type[int], red]
local_variable[type[int], green]
local_variable[type[int], blue]
return[call[Color.argb, parameter[literal[255], member[.red], member[.green], member[.blue]]]]
end[}]
END[}]
|
annotation[@] identifier[ColorInt] Keyword[public] Keyword[static] Keyword[int] identifier[opaqueColor] operator[SEP] annotation[@] identifier[ColorInt] Keyword[int] identifier[color] operator[SEP] {
Keyword[int] identifier[alpha] operator[=] identifier[Color] operator[SEP] identifier[alpha] operator[SEP] identifier[color] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[alpha] operator[==] Other[0] operator[SEP] Keyword[return] identifier[color] operator[SEP] Keyword[int] identifier[red] operator[=] identifier[Color] operator[SEP] identifier[red] operator[SEP] identifier[color] operator[SEP] operator[SEP] Keyword[int] identifier[green] operator[=] identifier[Color] operator[SEP] identifier[green] operator[SEP] identifier[color] operator[SEP] operator[SEP] Keyword[int] identifier[blue] operator[=] identifier[Color] operator[SEP] identifier[blue] operator[SEP] identifier[color] operator[SEP] operator[SEP] Keyword[return] identifier[Color] operator[SEP] identifier[argb] operator[SEP] Other[255] , identifier[red] , identifier[green] , identifier[blue] operator[SEP] operator[SEP]
}
|
private static Map<Transition, Collection<TileRef>> getTransitions(MapTile map)
{
final Map<Transition, Collection<TileRef>> transitions = new HashMap<>();
final MapTransitionExtractor extractor = new MapTransitionExtractor(map);
for (int ty = 1; ty < map.getInTileHeight() - 1; ty++)
{
for (int tx = 1; tx < map.getInTileWidth() - 1; tx++)
{
final Tile tile = map.getTile(tx, ty);
if (tile != null)
{
checkTransition(transitions, extractor, tile);
}
}
}
return transitions;
}
|
class class_name[name] begin[{]
method[getTransitions, return_type[type[Map]], modifier[private static], parameter[map]] begin[{]
local_variable[type[Map], transitions]
local_variable[type[MapTransitionExtractor], extractor]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTile, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), name=tile)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Tile, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tile, 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=transitions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=extractor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkTransition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=tx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getInTileWidth, postfix_operators=[], prefix_operators=[], qualifier=map, 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=1), name=tx)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=tx, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getInTileHeight, postfix_operators=[], prefix_operators=[], qualifier=map, 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=1), name=ty)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ty, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.transitions]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Map] operator[<] identifier[Transition] , identifier[Collection] operator[<] identifier[TileRef] operator[>] operator[>] identifier[getTransitions] operator[SEP] identifier[MapTile] identifier[map] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[Transition] , identifier[Collection] operator[<] identifier[TileRef] operator[>] operator[>] identifier[transitions] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[MapTransitionExtractor] identifier[extractor] operator[=] Keyword[new] identifier[MapTransitionExtractor] operator[SEP] identifier[map] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ty] operator[=] Other[1] operator[SEP] identifier[ty] operator[<] identifier[map] operator[SEP] identifier[getInTileHeight] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[ty] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[tx] operator[=] Other[1] operator[SEP] identifier[tx] operator[<] identifier[map] operator[SEP] identifier[getInTileWidth] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] identifier[tx] operator[++] operator[SEP] {
Keyword[final] identifier[Tile] identifier[tile] operator[=] identifier[map] operator[SEP] identifier[getTile] operator[SEP] identifier[tx] , identifier[ty] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tile] operator[!=] Other[null] operator[SEP] {
identifier[checkTransition] operator[SEP] identifier[transitions] , identifier[extractor] , identifier[tile] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[transitions] operator[SEP]
}
|
@Override
public State getFinalState() {
ConstructState state = new ConstructState();
if (this.converter != null) {
state.addConstructState(Constructs.CONVERTER, new ConstructState(this.converter.getFinalState()));
}
if (this.rowLevelPolicyChecker != null) {
state.addConstructState(Constructs.ROW_QUALITY_CHECKER,
new ConstructState(this.rowLevelPolicyChecker.getFinalState()));
}
if (this.writer.isPresent() && this.writer.get() instanceof FinalState) {
state.addConstructState(Constructs.WRITER, new ConstructState(((FinalState) this.writer.get()).getFinalState()));
}
return state;
}
|
class class_name[name] begin[{]
method[getFinalState, return_type[type[State]], modifier[public], parameter[]] begin[{]
local_variable[type[ConstructState], state]
if[binary_operation[THIS[member[None.converter]], !=, literal[null]]] begin[{]
call[state.addConstructState, parameter[member[Constructs.CONVERTER], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=converter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getFinalState, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstructState, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.rowLevelPolicyChecker]], !=, literal[null]]] begin[{]
call[state.addConstructState, parameter[member[Constructs.ROW_QUALITY_CHECKER], ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=rowLevelPolicyChecker, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getFinalState, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstructState, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.writer]call[None.isPresent, parameter[]]], &&, binary_operation[THIS[member[None.writer]call[None.get, parameter[]]], instanceof, type[FinalState]]]] begin[{]
call[state.addConstructState, parameter[member[Constructs.WRITER], ClassCreator(arguments=[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=writer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=FinalState, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstructState, sub_type=None))]]
else begin[{]
None
end[}]
return[member[.state]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[State] identifier[getFinalState] operator[SEP] operator[SEP] {
identifier[ConstructState] identifier[state] operator[=] Keyword[new] identifier[ConstructState] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[converter] operator[!=] Other[null] operator[SEP] {
identifier[state] operator[SEP] identifier[addConstructState] operator[SEP] identifier[Constructs] operator[SEP] identifier[CONVERTER] , Keyword[new] identifier[ConstructState] operator[SEP] Keyword[this] operator[SEP] identifier[converter] operator[SEP] identifier[getFinalState] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[rowLevelPolicyChecker] operator[!=] Other[null] operator[SEP] {
identifier[state] operator[SEP] identifier[addConstructState] operator[SEP] identifier[Constructs] operator[SEP] identifier[ROW_QUALITY_CHECKER] , Keyword[new] identifier[ConstructState] operator[SEP] Keyword[this] operator[SEP] identifier[rowLevelPolicyChecker] operator[SEP] identifier[getFinalState] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[&&] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[get] operator[SEP] operator[SEP] Keyword[instanceof] identifier[FinalState] operator[SEP] {
identifier[state] operator[SEP] identifier[addConstructState] operator[SEP] identifier[Constructs] operator[SEP] identifier[WRITER] , Keyword[new] identifier[ConstructState] operator[SEP] operator[SEP] operator[SEP] identifier[FinalState] operator[SEP] Keyword[this] operator[SEP] identifier[writer] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getFinalState] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[state] operator[SEP]
}
|
private void initializeSessionCounters() {
if (monitoringEntityFactory == null) {
return;
}
numberOfSessionsCounter = monitoringEntityFactory.makeLongMonitoringCounter(CURRENT_NUMBER_OF_SESSIONS);
numberOfNativeSessionsCounter = monitoringEntityFactory.makeLongMonitoringCounter(CURRENT_NUMBER_OF_NATIVE_SESSIONS);
numberOfEmulatedSessionsCounter = monitoringEntityFactory.makeLongMonitoringCounter(CURRENT_NUMBER_OF_EMULATED_SESSIONS);
cumulativeSessionsCounter = monitoringEntityFactory.makeLongMonitoringCounter(CUMULATIVE_NUMBER_OF_SESSIONS);
cumulativeNativeSessionsCounter =
monitoringEntityFactory.makeLongMonitoringCounter(CUMULATIVE_NUMBER_OF_NATIVE_SESSIONS);
cumulativeEmulatedSessionsCounter =
monitoringEntityFactory.makeLongMonitoringCounter(CUMULATIVE_NUMBER_OF_EMULATED_SESSIONS);
}
|
class class_name[name] begin[{]
method[initializeSessionCounters, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.monitoringEntityFactory], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
assign[member[.numberOfSessionsCounter], call[monitoringEntityFactory.makeLongMonitoringCounter, parameter[member[.CURRENT_NUMBER_OF_SESSIONS]]]]
assign[member[.numberOfNativeSessionsCounter], call[monitoringEntityFactory.makeLongMonitoringCounter, parameter[member[.CURRENT_NUMBER_OF_NATIVE_SESSIONS]]]]
assign[member[.numberOfEmulatedSessionsCounter], call[monitoringEntityFactory.makeLongMonitoringCounter, parameter[member[.CURRENT_NUMBER_OF_EMULATED_SESSIONS]]]]
assign[member[.cumulativeSessionsCounter], call[monitoringEntityFactory.makeLongMonitoringCounter, parameter[member[.CUMULATIVE_NUMBER_OF_SESSIONS]]]]
assign[member[.cumulativeNativeSessionsCounter], call[monitoringEntityFactory.makeLongMonitoringCounter, parameter[member[.CUMULATIVE_NUMBER_OF_NATIVE_SESSIONS]]]]
assign[member[.cumulativeEmulatedSessionsCounter], call[monitoringEntityFactory.makeLongMonitoringCounter, parameter[member[.CUMULATIVE_NUMBER_OF_EMULATED_SESSIONS]]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[initializeSessionCounters] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[monitoringEntityFactory] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[numberOfSessionsCounter] operator[=] identifier[monitoringEntityFactory] operator[SEP] identifier[makeLongMonitoringCounter] operator[SEP] identifier[CURRENT_NUMBER_OF_SESSIONS] operator[SEP] operator[SEP] identifier[numberOfNativeSessionsCounter] operator[=] identifier[monitoringEntityFactory] operator[SEP] identifier[makeLongMonitoringCounter] operator[SEP] identifier[CURRENT_NUMBER_OF_NATIVE_SESSIONS] operator[SEP] operator[SEP] identifier[numberOfEmulatedSessionsCounter] operator[=] identifier[monitoringEntityFactory] operator[SEP] identifier[makeLongMonitoringCounter] operator[SEP] identifier[CURRENT_NUMBER_OF_EMULATED_SESSIONS] operator[SEP] operator[SEP] identifier[cumulativeSessionsCounter] operator[=] identifier[monitoringEntityFactory] operator[SEP] identifier[makeLongMonitoringCounter] operator[SEP] identifier[CUMULATIVE_NUMBER_OF_SESSIONS] operator[SEP] operator[SEP] identifier[cumulativeNativeSessionsCounter] operator[=] identifier[monitoringEntityFactory] operator[SEP] identifier[makeLongMonitoringCounter] operator[SEP] identifier[CUMULATIVE_NUMBER_OF_NATIVE_SESSIONS] operator[SEP] operator[SEP] identifier[cumulativeEmulatedSessionsCounter] operator[=] identifier[monitoringEntityFactory] operator[SEP] identifier[makeLongMonitoringCounter] operator[SEP] identifier[CUMULATIVE_NUMBER_OF_EMULATED_SESSIONS] operator[SEP] operator[SEP]
}
|
private static HttpURLConnection setMetadata(final URI uri, final FileRequestOptions fileOptions,
final OperationContext opContext, final AccessCondition accessCondition, final UriQueryBuilder builder)
throws IOException, URISyntaxException, StorageException {
final HttpURLConnection request = BaseRequest.setMetadata(uri, fileOptions, builder, opContext);
if (accessCondition != null) {
accessCondition.applyConditionToRequest(request);
}
return request;
}
|
class class_name[name] begin[{]
method[setMetadata, return_type[type[HttpURLConnection]], modifier[private static], parameter[uri, fileOptions, opContext, accessCondition, builder]] begin[{]
local_variable[type[HttpURLConnection], request]
if[binary_operation[member[.accessCondition], !=, literal[null]]] begin[{]
call[accessCondition.applyConditionToRequest, parameter[member[.request]]]
else begin[{]
None
end[}]
return[member[.request]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[HttpURLConnection] identifier[setMetadata] operator[SEP] Keyword[final] identifier[URI] identifier[uri] , Keyword[final] identifier[FileRequestOptions] identifier[fileOptions] , Keyword[final] identifier[OperationContext] identifier[opContext] , Keyword[final] identifier[AccessCondition] identifier[accessCondition] , Keyword[final] identifier[UriQueryBuilder] identifier[builder] operator[SEP] Keyword[throws] identifier[IOException] , identifier[URISyntaxException] , identifier[StorageException] {
Keyword[final] identifier[HttpURLConnection] identifier[request] operator[=] identifier[BaseRequest] operator[SEP] identifier[setMetadata] operator[SEP] identifier[uri] , identifier[fileOptions] , identifier[builder] , identifier[opContext] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[accessCondition] operator[!=] Other[null] operator[SEP] {
identifier[accessCondition] operator[SEP] identifier[applyConditionToRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
Keyword[return] identifier[request] operator[SEP]
}
|
public void setUserAttributes(java.util.Collection<Attribute> userAttributes) {
if (userAttributes == null) {
this.userAttributes = null;
return;
}
this.userAttributes = new java.util.ArrayList<Attribute>(userAttributes);
}
|
class class_name[name] begin[{]
method[setUserAttributes, return_type[void], modifier[public], parameter[userAttributes]] begin[{]
if[binary_operation[member[.userAttributes], ==, literal[null]]] begin[{]
assign[THIS[member[None.userAttributes]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.userAttributes]], ClassCreator(arguments=[MemberReference(member=userAttributes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setUserAttributes] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[Attribute] operator[>] identifier[userAttributes] operator[SEP] {
Keyword[if] operator[SEP] identifier[userAttributes] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[userAttributes] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[userAttributes] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[Attribute] operator[>] operator[SEP] identifier[userAttributes] operator[SEP] operator[SEP]
}
|
public CmsUUID getElementView() {
String elementViewString = getString(CmsEditorConstants.ATTR_ELEMENT_VIEW);
if (elementViewString == null) {
return null;
}
return new CmsUUID(elementViewString);
}
|
class class_name[name] begin[{]
method[getElementView, return_type[type[CmsUUID]], modifier[public], parameter[]] begin[{]
local_variable[type[String], elementViewString]
if[binary_operation[member[.elementViewString], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=elementViewString, 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=CmsUUID, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[CmsUUID] identifier[getElementView] operator[SEP] operator[SEP] {
identifier[String] identifier[elementViewString] operator[=] identifier[getString] operator[SEP] identifier[CmsEditorConstants] operator[SEP] identifier[ATTR_ELEMENT_VIEW] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[elementViewString] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] Keyword[new] identifier[CmsUUID] operator[SEP] identifier[elementViewString] operator[SEP] operator[SEP]
}
|
public void asyncRequestWithSession(AsyncRequest asyncRequest, AsyncResponseCallback asyncResponseCallback) {
doRequest.doRequest(asyncRequest, true, asyncResponseCallback);
}
|
class class_name[name] begin[{]
method[asyncRequestWithSession, return_type[void], modifier[public], parameter[asyncRequest, asyncResponseCallback]] begin[{]
call[doRequest.doRequest, parameter[member[.asyncRequest], literal[true], member[.asyncResponseCallback]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[asyncRequestWithSession] operator[SEP] identifier[AsyncRequest] identifier[asyncRequest] , identifier[AsyncResponseCallback] identifier[asyncResponseCallback] operator[SEP] {
identifier[doRequest] operator[SEP] identifier[doRequest] operator[SEP] identifier[asyncRequest] , literal[boolean] , identifier[asyncResponseCallback] operator[SEP] operator[SEP]
}
|
public static EscMeta createEscMeta(@NotNull final SerializerRegistry registry, @NotNull final EnhancedMimeType targetContentType,
@Nullable final CommonEvent commonEvent) {
Contract.requireArgNotNull("registry", registry);
Contract.requireArgNotNull("targetContentType", targetContentType);
if (commonEvent == null) {
return null;
}
final String dataType = commonEvent.getDataType().asBaseType();
final Serializer dataSerializer = registry.getSerializer(new SerializedDataType(dataType));
final EnhancedMimeType dataContentType = contentType(dataSerializer.getMimeType(), targetContentType);
if (commonEvent.getMeta() == null) {
return new EscMeta(dataType, dataContentType);
}
final String metaType = commonEvent.getMetaType().asBaseType();
final SerializedDataType serDataType = new SerializedDataType(metaType);
final Serializer metaSerializer = registry.getSerializer(serDataType);
if (metaSerializer.getMimeType().matchEncoding(targetContentType)) {
return new EscMeta(dataType, dataContentType, metaType, metaSerializer.getMimeType(), commonEvent.getMeta());
}
final byte[] serMeta = metaSerializer.marshal(commonEvent.getMeta(), serDataType);
final EnhancedMimeType metaContentType = contentType(metaSerializer.getMimeType(), targetContentType);
return new EscMeta(dataType, dataContentType, metaType, metaContentType, new Base64Data(serMeta));
}
|
class class_name[name] begin[{]
method[createEscMeta, return_type[type[EscMeta]], modifier[public static], parameter[registry, targetContentType, commonEvent]] begin[{]
call[Contract.requireArgNotNull, parameter[literal["registry"], member[.registry]]]
call[Contract.requireArgNotNull, parameter[literal["targetContentType"], member[.targetContentType]]]
if[binary_operation[member[.commonEvent], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], dataType]
local_variable[type[Serializer], dataSerializer]
local_variable[type[EnhancedMimeType], dataContentType]
if[binary_operation[call[commonEvent.getMeta, parameter[]], ==, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=dataType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataContentType, 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=EscMeta, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[String], metaType]
local_variable[type[SerializedDataType], serDataType]
local_variable[type[Serializer], metaSerializer]
if[call[metaSerializer.getMimeType, parameter[]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=dataType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataContentType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=metaType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getMimeType, postfix_operators=[], prefix_operators=[], qualifier=metaSerializer, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMeta, postfix_operators=[], prefix_operators=[], qualifier=commonEvent, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EscMeta, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[byte], serMeta]
local_variable[type[EnhancedMimeType], metaContentType]
return[ClassCreator(arguments=[MemberReference(member=dataType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dataContentType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=metaType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=metaContentType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=serMeta, 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=Base64Data, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EscMeta, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[EscMeta] identifier[createEscMeta] operator[SEP] annotation[@] identifier[NotNull] Keyword[final] identifier[SerializerRegistry] identifier[registry] , annotation[@] identifier[NotNull] Keyword[final] identifier[EnhancedMimeType] identifier[targetContentType] , annotation[@] identifier[Nullable] Keyword[final] identifier[CommonEvent] identifier[commonEvent] operator[SEP] {
identifier[Contract] operator[SEP] identifier[requireArgNotNull] operator[SEP] literal[String] , identifier[registry] operator[SEP] operator[SEP] identifier[Contract] operator[SEP] identifier[requireArgNotNull] operator[SEP] literal[String] , identifier[targetContentType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[commonEvent] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[final] identifier[String] identifier[dataType] operator[=] identifier[commonEvent] operator[SEP] identifier[getDataType] operator[SEP] operator[SEP] operator[SEP] identifier[asBaseType] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Serializer] identifier[dataSerializer] operator[=] identifier[registry] operator[SEP] identifier[getSerializer] operator[SEP] Keyword[new] identifier[SerializedDataType] operator[SEP] identifier[dataType] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[EnhancedMimeType] identifier[dataContentType] operator[=] identifier[contentType] operator[SEP] identifier[dataSerializer] operator[SEP] identifier[getMimeType] operator[SEP] operator[SEP] , identifier[targetContentType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[commonEvent] operator[SEP] identifier[getMeta] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[EscMeta] operator[SEP] identifier[dataType] , identifier[dataContentType] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[metaType] operator[=] identifier[commonEvent] operator[SEP] identifier[getMetaType] operator[SEP] operator[SEP] operator[SEP] identifier[asBaseType] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[SerializedDataType] identifier[serDataType] operator[=] Keyword[new] identifier[SerializedDataType] operator[SEP] identifier[metaType] operator[SEP] operator[SEP] Keyword[final] identifier[Serializer] identifier[metaSerializer] operator[=] identifier[registry] operator[SEP] identifier[getSerializer] operator[SEP] identifier[serDataType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[metaSerializer] operator[SEP] identifier[getMimeType] operator[SEP] operator[SEP] operator[SEP] identifier[matchEncoding] operator[SEP] identifier[targetContentType] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[EscMeta] operator[SEP] identifier[dataType] , identifier[dataContentType] , identifier[metaType] , identifier[metaSerializer] operator[SEP] identifier[getMimeType] operator[SEP] operator[SEP] , identifier[commonEvent] operator[SEP] identifier[getMeta] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[serMeta] operator[=] identifier[metaSerializer] operator[SEP] identifier[marshal] operator[SEP] identifier[commonEvent] operator[SEP] identifier[getMeta] operator[SEP] operator[SEP] , identifier[serDataType] operator[SEP] operator[SEP] Keyword[final] identifier[EnhancedMimeType] identifier[metaContentType] operator[=] identifier[contentType] operator[SEP] identifier[metaSerializer] operator[SEP] identifier[getMimeType] operator[SEP] operator[SEP] , identifier[targetContentType] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[EscMeta] operator[SEP] identifier[dataType] , identifier[dataContentType] , identifier[metaType] , identifier[metaContentType] , Keyword[new] identifier[Base64Data] operator[SEP] identifier[serMeta] operator[SEP] operator[SEP] operator[SEP]
}
|
public static List<String> getServiceUrlsFromConfig(EurekaClientConfig clientConfig, String instanceZone, boolean preferSameZone) {
List<String> orderedUrls = new ArrayList<String>();
String region = getRegion(clientConfig);
String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion());
if (availZones == null || availZones.length == 0) {
availZones = new String[1];
availZones[0] = DEFAULT_ZONE;
}
logger.debug("The availability zone for the given region {} are {}", region, availZones);
int myZoneOffset = getZoneOffset(instanceZone, preferSameZone, availZones);
List<String> serviceUrls = clientConfig.getEurekaServerServiceUrls(availZones[myZoneOffset]);
if (serviceUrls != null) {
orderedUrls.addAll(serviceUrls);
}
int currentOffset = myZoneOffset == (availZones.length - 1) ? 0 : (myZoneOffset + 1);
while (currentOffset != myZoneOffset) {
serviceUrls = clientConfig.getEurekaServerServiceUrls(availZones[currentOffset]);
if (serviceUrls != null) {
orderedUrls.addAll(serviceUrls);
}
if (currentOffset == (availZones.length - 1)) {
currentOffset = 0;
} else {
currentOffset++;
}
}
if (orderedUrls.size() < 1) {
throw new IllegalArgumentException("DiscoveryClient: invalid serviceUrl specified!");
}
return orderedUrls;
}
|
class class_name[name] begin[{]
method[getServiceUrlsFromConfig, return_type[type[List]], modifier[public static], parameter[clientConfig, instanceZone, preferSameZone]] begin[{]
local_variable[type[List], orderedUrls]
local_variable[type[String], region]
local_variable[type[String], availZones]
if[binary_operation[binary_operation[member[.availZones], ==, literal[null]], ||, binary_operation[member[availZones.length], ==, literal[0]]]] begin[{]
assign[member[.availZones], ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
assign[member[.availZones], member[.DEFAULT_ZONE]]
else begin[{]
None
end[}]
call[logger.debug, parameter[literal["The availability zone for the given region {} are {}"], member[.region], member[.availZones]]]
local_variable[type[int], myZoneOffset]
local_variable[type[List], serviceUrls]
if[binary_operation[member[.serviceUrls], !=, literal[null]]] begin[{]
call[orderedUrls.addAll, parameter[member[.serviceUrls]]]
else begin[{]
None
end[}]
local_variable[type[int], currentOffset]
while[binary_operation[member[.currentOffset], !=, member[.myZoneOffset]]] begin[{]
assign[member[.serviceUrls], call[clientConfig.getEurekaServerServiceUrls, parameter[member[.availZones]]]]
if[binary_operation[member[.serviceUrls], !=, literal[null]]] begin[{]
call[orderedUrls.addAll, parameter[member[.serviceUrls]]]
else begin[{]
None
end[}]
if[binary_operation[member[.currentOffset], ==, binary_operation[member[availZones.length], -, literal[1]]]] begin[{]
assign[member[.currentOffset], literal[0]]
else begin[{]
member[.currentOffset]
end[}]
end[}]
if[binary_operation[call[orderedUrls.size, parameter[]], <, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DiscoveryClient: invalid serviceUrl specified!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.orderedUrls]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[getServiceUrlsFromConfig] operator[SEP] identifier[EurekaClientConfig] identifier[clientConfig] , identifier[String] identifier[instanceZone] , Keyword[boolean] identifier[preferSameZone] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[orderedUrls] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[region] operator[=] identifier[getRegion] operator[SEP] identifier[clientConfig] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[availZones] operator[=] identifier[clientConfig] operator[SEP] identifier[getAvailabilityZones] operator[SEP] identifier[clientConfig] operator[SEP] identifier[getRegion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[availZones] operator[==] Other[null] operator[||] identifier[availZones] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
identifier[availZones] operator[=] Keyword[new] identifier[String] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[availZones] operator[SEP] Other[0] operator[SEP] operator[=] identifier[DEFAULT_ZONE] operator[SEP]
}
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[region] , identifier[availZones] operator[SEP] operator[SEP] Keyword[int] identifier[myZoneOffset] operator[=] identifier[getZoneOffset] operator[SEP] identifier[instanceZone] , identifier[preferSameZone] , identifier[availZones] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[serviceUrls] operator[=] identifier[clientConfig] operator[SEP] identifier[getEurekaServerServiceUrls] operator[SEP] identifier[availZones] operator[SEP] identifier[myZoneOffset] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[serviceUrls] operator[!=] Other[null] operator[SEP] {
identifier[orderedUrls] operator[SEP] identifier[addAll] operator[SEP] identifier[serviceUrls] operator[SEP] operator[SEP]
}
Keyword[int] identifier[currentOffset] operator[=] identifier[myZoneOffset] operator[==] operator[SEP] identifier[availZones] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[?] Other[0] operator[:] operator[SEP] identifier[myZoneOffset] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[currentOffset] operator[!=] identifier[myZoneOffset] operator[SEP] {
identifier[serviceUrls] operator[=] identifier[clientConfig] operator[SEP] identifier[getEurekaServerServiceUrls] operator[SEP] identifier[availZones] operator[SEP] identifier[currentOffset] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[serviceUrls] operator[!=] Other[null] operator[SEP] {
identifier[orderedUrls] operator[SEP] identifier[addAll] operator[SEP] identifier[serviceUrls] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[currentOffset] operator[==] operator[SEP] identifier[availZones] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] {
identifier[currentOffset] operator[=] Other[0] operator[SEP]
}
Keyword[else] {
identifier[currentOffset] operator[++] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[orderedUrls] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[orderedUrls] operator[SEP]
}
|
public static Result requestHeaderFieldsTooLarge(File content, boolean inline) {
return requestHeaderFieldsTooLarge(content, inline, StaticFileMimeTypes.fileMimeTypes());
}
|
class class_name[name] begin[{]
method[requestHeaderFieldsTooLarge, return_type[type[Result]], modifier[public static], parameter[content, inline]] begin[{]
return[call[.requestHeaderFieldsTooLarge, parameter[member[.content], member[.inline], call[StaticFileMimeTypes.fileMimeTypes, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Result] identifier[requestHeaderFieldsTooLarge] operator[SEP] identifier[File] identifier[content] , Keyword[boolean] identifier[inline] operator[SEP] {
Keyword[return] identifier[requestHeaderFieldsTooLarge] operator[SEP] identifier[content] , identifier[inline] , identifier[StaticFileMimeTypes] operator[SEP] identifier[fileMimeTypes] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLDatatypeRestrictionImpl instance) throws SerializationException {
deserialize(streamReader, instance);
}
|
class class_name[name] begin[{]
method[deserializeInstance, return_type[void], modifier[public], parameter[streamReader, instance]] begin[{]
call[.deserialize, parameter[member[.streamReader], member[.instance]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[deserializeInstance] operator[SEP] identifier[SerializationStreamReader] identifier[streamReader] , identifier[OWLDatatypeRestrictionImpl] identifier[instance] operator[SEP] Keyword[throws] identifier[SerializationException] {
identifier[deserialize] operator[SEP] identifier[streamReader] , identifier[instance] operator[SEP] operator[SEP]
}
|
@Override
public Future<U> save(BasicProfile user, SaveMode mode) {
return toScala(doSave(user, mode));
}
|
class class_name[name] begin[{]
method[save, return_type[type[Future]], modifier[public], parameter[user, mode]] begin[{]
return[call[.toScala, parameter[call[.doSave, parameter[member[.user], member[.mode]]]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Future] operator[<] identifier[U] operator[>] identifier[save] operator[SEP] identifier[BasicProfile] identifier[user] , identifier[SaveMode] identifier[mode] operator[SEP] {
Keyword[return] identifier[toScala] operator[SEP] identifier[doSave] operator[SEP] identifier[user] , identifier[mode] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void dump(Writer writer, Pattern filter) throws IOException {
String linesep = System.getProperty("line.separator"); //$NON-NLS-1$
for (Map.Entry<String, ILayer> entry : cacheMap.entrySet()) {
if (filter != null) {
Matcher m = filter.matcher(entry.getKey());
if (!m.find())
continue;
}
writer.append("ILayer key: ").append(entry.getKey()).append(linesep); //$NON-NLS-1$
writer.append(entry.getValue().toString()).append(linesep).append(linesep);
}
writer.append("Number of layer cache entires = ").append(Integer.toString(cacheMap.size())).append(linesep); //$NON-NLS-1$
writer.append("Number of layer cache evictions = ").append(Integer.toString(numEvictions.get())).append(linesep); //$NON-NLS-1$
}
|
class class_name[name] begin[{]
method[dump, return_type[void], modifier[public], parameter[writer, filter]] begin[{]
local_variable[type[String], linesep]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=matcher, postfix_operators=[], prefix_operators=[], qualifier=filter, selectors=[], type_arguments=None), name=m)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Matcher, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=find, postfix_operators=[], prefix_operators=['!'], qualifier=m, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None))])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ILayer key: ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=linesep, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[MethodInvocation(arguments=[MemberReference(member=linesep, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=linesep, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], 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=entrySet, postfix_operators=[], prefix_operators=[], qualifier=cacheMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ILayer, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
call[writer.append, parameter[literal["Number of layer cache entires = "]]]
call[writer.append, parameter[literal["Number of layer cache evictions = "]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[dump] operator[SEP] identifier[Writer] identifier[writer] , identifier[Pattern] identifier[filter] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[linesep] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[ILayer] operator[>] identifier[entry] operator[:] identifier[cacheMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[filter] operator[!=] Other[null] operator[SEP] {
identifier[Matcher] identifier[m] operator[=] identifier[filter] operator[SEP] identifier[matcher] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[m] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[writer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[linesep] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[append] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[linesep] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[linesep] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[cacheMap] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[linesep] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[numEvictions] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[linesep] operator[SEP] operator[SEP]
}
|
public String toTreeString(int indent) {
StringBuilder sb = new StringBuilder();
sb.append(SPACES, 0, indent).append("[").append(master).append("]\n");
return sb.toString();
}
|
class class_name[name] begin[{]
method[toTreeString, return_type[type[String]], modifier[public], parameter[indent]] begin[{]
local_variable[type[StringBuilder], sb]
call[sb.append, parameter[member[.SPACES], literal[0], member[.indent]]]
return[call[sb.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[toTreeString] operator[SEP] Keyword[int] identifier[indent] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[SPACES] , Other[0] , identifier[indent] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[master] 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 void removeDefaultBindingIfNotExists(Properties properties) {
List<Bw> bwServices = this.getBWServices();
for (Bw bw : bwServices) {
String path = "bw[" + bw.getName() + "]/bindings/binding[]/machine";
List<Binding> bindings = bw.getBindings().getBinding();
for (Iterator<Binding> iterator = bindings.iterator(); iterator.hasNext();) {
Binding binding = (Binding) iterator.next();
// if (binding.getName().equals("") && properties.getString(path) == null) {
if (binding.getName().equals("") && !properties.containsKey(path)) {
iterator.remove();
}
}
}
List<Adapter> adapterServices = this.getAdapterServices();
for (Adapter adapter : adapterServices) {
String path = "adapter[" + adapter.getName() + "]/bindings/binding[]/machine";
List<Binding> bindings = adapter.getBindings().getBinding();
for (Iterator<Binding> iterator = bindings.iterator(); iterator.hasNext();) {
Binding binding = (Binding) iterator.next();
// if (binding.getName().equals("") && properties.getString(path) == null) {
if (binding.getName().equals("") && !properties.containsKey(path)) {
iterator.remove();
}
}
}
}
|
class class_name[name] begin[{]
method[removeDefaultBindingIfNotExists, return_type[void], modifier[public], parameter[properties]] begin[{]
local_variable[type[List], bwServices]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="bw["), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=bw, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]/bindings/binding[]/machine"), operator=+), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBindings, postfix_operators=[], prefix_operators=[], qualifier=bw, selectors=[MethodInvocation(arguments=[], member=getBinding, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=bindings)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Binding, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Binding, sub_type=None)), name=binding)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Binding, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=binding, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=properties, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=remove, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=bindings, selectors=[], type_arguments=None), name=iterator)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Binding, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=bwServices, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bw)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Bw, sub_type=None))), label=None)
local_variable[type[List], adapterServices]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="adapter["), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]/bindings/binding[]/machine"), operator=+), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBindings, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[MethodInvocation(arguments=[], member=getBinding, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=bindings)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Binding, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Binding, sub_type=None)), name=binding)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Binding, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=binding, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=properties, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=remove, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=bindings, selectors=[], type_arguments=None), name=iterator)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Binding, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=adapterServices, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=adapter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Adapter, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[removeDefaultBindingIfNotExists] operator[SEP] identifier[Properties] identifier[properties] operator[SEP] {
identifier[List] operator[<] identifier[Bw] operator[>] identifier[bwServices] operator[=] Keyword[this] operator[SEP] identifier[getBWServices] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Bw] identifier[bw] operator[:] identifier[bwServices] operator[SEP] {
identifier[String] identifier[path] operator[=] literal[String] operator[+] identifier[bw] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[List] operator[<] identifier[Binding] operator[>] identifier[bindings] operator[=] identifier[bw] operator[SEP] identifier[getBindings] operator[SEP] operator[SEP] operator[SEP] identifier[getBinding] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[Binding] operator[>] identifier[iterator] operator[=] identifier[bindings] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Binding] identifier[binding] operator[=] operator[SEP] identifier[Binding] operator[SEP] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binding] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[properties] operator[SEP] identifier[containsKey] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
identifier[iterator] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[List] operator[<] identifier[Adapter] operator[>] identifier[adapterServices] operator[=] Keyword[this] operator[SEP] identifier[getAdapterServices] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Adapter] identifier[adapter] operator[:] identifier[adapterServices] operator[SEP] {
identifier[String] identifier[path] operator[=] literal[String] operator[+] identifier[adapter] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[List] operator[<] identifier[Binding] operator[>] identifier[bindings] operator[=] identifier[adapter] operator[SEP] identifier[getBindings] operator[SEP] operator[SEP] operator[SEP] identifier[getBinding] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[Binding] operator[>] identifier[iterator] operator[=] identifier[bindings] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Binding] identifier[binding] operator[=] operator[SEP] identifier[Binding] operator[SEP] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binding] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[properties] operator[SEP] identifier[containsKey] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
identifier[iterator] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public static BufferedImage loadImage(String fileName, int imageType){
BufferedImage img = loadImage(fileName);
if(img.getType() != imageType){
img = BufferedImageFactory.get(img, imageType);
}
return img;
}
|
class class_name[name] begin[{]
method[loadImage, return_type[type[BufferedImage]], modifier[public static], parameter[fileName, imageType]] begin[{]
local_variable[type[BufferedImage], img]
if[binary_operation[call[img.getType, parameter[]], !=, member[.imageType]]] begin[{]
assign[member[.img], call[BufferedImageFactory.get, parameter[member[.img], member[.imageType]]]]
else begin[{]
None
end[}]
return[member[.img]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BufferedImage] identifier[loadImage] operator[SEP] identifier[String] identifier[fileName] , Keyword[int] identifier[imageType] operator[SEP] {
identifier[BufferedImage] identifier[img] operator[=] identifier[loadImage] operator[SEP] identifier[fileName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[img] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[!=] identifier[imageType] operator[SEP] {
identifier[img] operator[=] identifier[BufferedImageFactory] operator[SEP] identifier[get] operator[SEP] identifier[img] , identifier[imageType] operator[SEP] operator[SEP]
}
Keyword[return] identifier[img] operator[SEP]
}
|
protected void updateResource(I_CmsIndexWriter indexWriter, String rootPath, I_CmsSearchDocument doc) {
try {
indexWriter.updateDocument(rootPath, doc);
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn(
Messages.get().getBundle().key(
Messages.LOG_IO_INDEX_DOCUMENT_UPDATE_2,
rootPath,
m_index.getName()),
e);
}
}
}
|
class class_name[name] begin[{]
method[updateResource, return_type[void], modifier[protected], parameter[indexWriter, rootPath, doc]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rootPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=updateDocument, postfix_operators=[], prefix_operators=[], qualifier=indexWriter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isWarnEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[], member=getBundle, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=LOG_IO_INDEX_DOCUMENT_UPDATE_2, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MemberReference(member=rootPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=m_index, selectors=[], type_arguments=None)], member=key, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[updateResource] operator[SEP] identifier[I_CmsIndexWriter] identifier[indexWriter] , identifier[String] identifier[rootPath] , identifier[I_CmsSearchDocument] identifier[doc] operator[SEP] {
Keyword[try] {
identifier[indexWriter] operator[SEP] identifier[updateDocument] operator[SEP] identifier[rootPath] , identifier[doc] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isWarnEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[LOG_IO_INDEX_DOCUMENT_UPDATE_2] , identifier[rootPath] , identifier[m_index] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
@Override
public GetContactReachabilityStatusResult getContactReachabilityStatus(GetContactReachabilityStatusRequest request) {
request = beforeClientExecution(request);
return executeGetContactReachabilityStatus(request);
}
|
class class_name[name] begin[{]
method[getContactReachabilityStatus, return_type[type[GetContactReachabilityStatusResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeGetContactReachabilityStatus, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[GetContactReachabilityStatusResult] identifier[getContactReachabilityStatus] operator[SEP] identifier[GetContactReachabilityStatusRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeGetContactReachabilityStatus] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public void setXfrUnits(Integer newXfrUnits) {
Integer oldXfrUnits = xfrUnits;
xfrUnits = newXfrUnits;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.FNC__XFR_UNITS, oldXfrUnits, xfrUnits));
}
|
class class_name[name] begin[{]
method[setXfrUnits, return_type[void], modifier[public], parameter[newXfrUnits]] begin[{]
local_variable[type[Integer], oldXfrUnits]
assign[member[.xfrUnits], member[.newXfrUnits]]
if[call[.eNotificationRequired, parameter[]]] begin[{]
call[.eNotify, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=SET, postfix_operators=[], prefix_operators=[], qualifier=Notification, selectors=[]), MemberReference(member=FNC__XFR_UNITS, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[]), MemberReference(member=oldXfrUnits, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=xfrUnits, 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=ENotificationImpl, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setXfrUnits] operator[SEP] identifier[Integer] identifier[newXfrUnits] operator[SEP] {
identifier[Integer] identifier[oldXfrUnits] operator[=] identifier[xfrUnits] operator[SEP] identifier[xfrUnits] operator[=] identifier[newXfrUnits] operator[SEP] Keyword[if] operator[SEP] identifier[eNotificationRequired] operator[SEP] operator[SEP] operator[SEP] identifier[eNotify] operator[SEP] Keyword[new] identifier[ENotificationImpl] operator[SEP] Keyword[this] , identifier[Notification] operator[SEP] identifier[SET] , identifier[AfplibPackage] operator[SEP] identifier[FNC__XFR_UNITS] , identifier[oldXfrUnits] , identifier[xfrUnits] operator[SEP] operator[SEP] operator[SEP]
}
|
synchronized void stop(){
if(status.equals("stopped"))
return;
long t = System.currentTimeMillis();
run = false;
try {
serverSocket.close();
} catch (IOException e) {
throw S1SystemError.wrap(e);
}
executor.shutdown();
while (!executor.isTerminated()) {
}
status = "stopped";
LOG.info("Node "+nodeId+" file server stopped ("+(System.currentTimeMillis()-t)+" ms.)");
}
|
class class_name[name] begin[{]
method[stop, return_type[void], modifier[synchronized], parameter[]] begin[{]
if[call[status.equals, parameter[literal["stopped"]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[long], t]
assign[member[.run], literal[false]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=serverSocket, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrap, postfix_operators=[], prefix_operators=[], qualifier=S1SystemError, 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)
call[executor.shutdown, parameter[]]
while[call[executor.isTerminated, parameter[]]] begin[{]
end[}]
assign[member[.status], literal["stopped"]]
call[LOG.info, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["Node "], +, member[.nodeId]], +, literal[" file server stopped ("]], +, binary_operation[call[System.currentTimeMillis, parameter[]], -, member[.t]]], +, literal[" ms.)"]]]]
end[}]
END[}]
|
Keyword[synchronized] Keyword[void] identifier[stop] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[status] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[long] identifier[t] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[run] operator[=] literal[boolean] operator[SEP] Keyword[try] {
identifier[serverSocket] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] identifier[S1SystemError] operator[SEP] identifier[wrap] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
identifier[executor] operator[SEP] identifier[shutdown] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[executor] operator[SEP] identifier[isTerminated] operator[SEP] operator[SEP] operator[SEP] {
}
identifier[status] operator[=] literal[String] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[nodeId] operator[+] literal[String] operator[+] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[t] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
public <T0, T1, T2> DataSource<Tuple3<T0, T1, T2>> types(Class<T0> type0, Class<T1> type1, Class<T2> type2) {
TupleTypeInfo<Tuple3<T0, T1, T2>> types = TupleTypeInfo.getBasicTupleTypeInfo(type0, type1, type2);
CsvInputFormat<Tuple3<T0, T1, T2>> inputFormat = new CsvInputFormat<Tuple3<T0, T1, T2>>(path);
configureInputFormat(inputFormat, type0, type1, type2);
return new DataSource<Tuple3<T0, T1, T2>>(executionContext, inputFormat, types);
}
|
class class_name[name] begin[{]
method[types, return_type[type[DataSource]], modifier[public], parameter[type0, type1, type2]] begin[{]
local_variable[type[TupleTypeInfo], types]
local_variable[type[CsvInputFormat], inputFormat]
call[.configureInputFormat, parameter[member[.inputFormat], member[.type0], member[.type1], member[.type2]]]
return[ClassCreator(arguments=[MemberReference(member=executionContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=inputFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=types, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T0, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T1, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T2, sub_type=None))], dimensions=[], name=Tuple3, sub_type=None))], dimensions=None, name=DataSource, sub_type=None))]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T0] , identifier[T1] , identifier[T2] operator[>] identifier[DataSource] operator[<] identifier[Tuple3] operator[<] identifier[T0] , identifier[T1] , identifier[T2] operator[>] operator[>] identifier[types] operator[SEP] identifier[Class] operator[<] identifier[T0] operator[>] identifier[type0] , identifier[Class] operator[<] identifier[T1] operator[>] identifier[type1] , identifier[Class] operator[<] identifier[T2] operator[>] identifier[type2] operator[SEP] {
identifier[TupleTypeInfo] operator[<] identifier[Tuple3] operator[<] identifier[T0] , identifier[T1] , identifier[T2] operator[>] operator[>] identifier[types] operator[=] identifier[TupleTypeInfo] operator[SEP] identifier[getBasicTupleTypeInfo] operator[SEP] identifier[type0] , identifier[type1] , identifier[type2] operator[SEP] operator[SEP] identifier[CsvInputFormat] operator[<] identifier[Tuple3] operator[<] identifier[T0] , identifier[T1] , identifier[T2] operator[>] operator[>] identifier[inputFormat] operator[=] Keyword[new] identifier[CsvInputFormat] operator[<] identifier[Tuple3] operator[<] identifier[T0] , identifier[T1] , identifier[T2] operator[>] operator[>] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[configureInputFormat] operator[SEP] identifier[inputFormat] , identifier[type0] , identifier[type1] , identifier[type2] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[DataSource] operator[<] identifier[Tuple3] operator[<] identifier[T0] , identifier[T1] , identifier[T2] operator[>] operator[>] operator[SEP] identifier[executionContext] , identifier[inputFormat] , identifier[types] operator[SEP] operator[SEP]
}
|
public void marshall(DeleteEventSubscriptionRequest deleteEventSubscriptionRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteEventSubscriptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteEventSubscriptionRequest.getSubscriptionName(), SUBSCRIPTIONNAME_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[deleteEventSubscriptionRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.deleteEventSubscriptionRequest], ==, 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=getSubscriptionName, postfix_operators=[], prefix_operators=[], qualifier=deleteEventSubscriptionRequest, selectors=[], type_arguments=None), MemberReference(member=SUBSCRIPTIONNAME_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[DeleteEventSubscriptionRequest] identifier[deleteEventSubscriptionRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[deleteEventSubscriptionRequest] 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[deleteEventSubscriptionRequest] operator[SEP] identifier[getSubscriptionName] operator[SEP] operator[SEP] , identifier[SUBSCRIPTIONNAME_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static boolean isAbsolutePath(String path) {
if (StrUtil.isEmpty(path)) {
return false;
}
if (StrUtil.C_SLASH == path.charAt(0) || path.matches("^[a-zA-Z]:[/\\\\].*")) {
// 给定的路径已经是绝对路径了
return true;
}
return false;
}
|
class class_name[name] begin[{]
method[isAbsolutePath, return_type[type[boolean]], modifier[public static], parameter[path]] begin[{]
if[call[StrUtil.isEmpty, parameter[member[.path]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[StrUtil.C_SLASH], ==, call[path.charAt, parameter[literal[0]]]], ||, call[path.matches, parameter[literal["^[a-zA-Z]:[/\\\\].*"]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[isAbsolutePath] operator[SEP] identifier[String] identifier[path] operator[SEP] {
Keyword[if] operator[SEP] identifier[StrUtil] operator[SEP] identifier[isEmpty] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[StrUtil] operator[SEP] identifier[C_SLASH] operator[==] identifier[path] operator[SEP] identifier[charAt] operator[SEP] Other[0] operator[SEP] operator[||] identifier[path] operator[SEP] identifier[matches] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static HttpRequest parseMessage(InputStream in) throws IOException {
HttpRequest m = new HttpRequest();
m.parse(in);
return m;
}
|
class class_name[name] begin[{]
method[parseMessage, return_type[type[HttpRequest]], modifier[public static], parameter[in]] begin[{]
local_variable[type[HttpRequest], m]
call[m.parse, parameter[member[.in]]]
return[member[.m]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[HttpRequest] identifier[parseMessage] operator[SEP] identifier[InputStream] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[HttpRequest] identifier[m] operator[=] Keyword[new] identifier[HttpRequest] operator[SEP] operator[SEP] operator[SEP] identifier[m] operator[SEP] identifier[parse] operator[SEP] identifier[in] operator[SEP] operator[SEP] Keyword[return] identifier[m] operator[SEP]
}
|
@Override
public Long serialize(Date value) {
if (value != null) {
return value.getTime();
}
return null;
}
|
class class_name[name] begin[{]
method[serialize, return_type[type[Long]], modifier[public], parameter[value]] begin[{]
if[binary_operation[member[.value], !=, literal[null]]] begin[{]
return[call[value.getTime, parameter[]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Long] identifier[serialize] operator[SEP] identifier[Date] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[value] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
void command_inout_reply(int timeout)
{
DevError[] errors = null;
DeviceData argout = null;
try
{
if (timeout==NO_TIMEOUT)
argout = dev.command_inout_reply(this);
else
argout = dev.command_inout_reply(this, timeout);
}
catch(AsynReplyNotArrived e)
{
errors = e.errors;
}
catch(DevFailed e)
{
errors = e.errors;
}
cb.cmd_ended(new CmdDoneEvent(dev, names[0], argout, errors));
}
|
class class_name[name] begin[{]
method[command_inout_reply, return_type[void], modifier[default], parameter[timeout]] begin[{]
local_variable[type[DevError], errors]
local_variable[type[DeviceData], argout]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NO_TIMEOUT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=argout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=command_inout_reply, postfix_operators=[], prefix_operators=[], qualifier=dev, selectors=[], type_arguments=None)), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=argout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=command_inout_reply, postfix_operators=[], prefix_operators=[], qualifier=dev, selectors=[], type_arguments=None)), label=None))], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[])), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['AsynReplyNotArrived'])), CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=errors, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[])), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['DevFailed']))], finally_block=None, label=None, resources=None)
call[cb.cmd_ended, parameter[ClassCreator(arguments=[MemberReference(member=dev, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=names, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MemberReference(member=argout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=errors, 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=CmdDoneEvent, sub_type=None))]]
end[}]
END[}]
|
Keyword[void] identifier[command_inout_reply] operator[SEP] Keyword[int] identifier[timeout] operator[SEP] {
identifier[DevError] operator[SEP] operator[SEP] identifier[errors] operator[=] Other[null] operator[SEP] identifier[DeviceData] identifier[argout] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[timeout] operator[==] identifier[NO_TIMEOUT] operator[SEP] identifier[argout] operator[=] identifier[dev] operator[SEP] identifier[command_inout_reply] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[else] identifier[argout] operator[=] identifier[dev] operator[SEP] identifier[command_inout_reply] operator[SEP] Keyword[this] , identifier[timeout] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AsynReplyNotArrived] identifier[e] operator[SEP] {
identifier[errors] operator[=] identifier[e] operator[SEP] identifier[errors] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[DevFailed] identifier[e] operator[SEP] {
identifier[errors] operator[=] identifier[e] operator[SEP] identifier[errors] operator[SEP]
}
identifier[cb] operator[SEP] identifier[cmd_ended] operator[SEP] Keyword[new] identifier[CmdDoneEvent] operator[SEP] identifier[dev] , identifier[names] operator[SEP] Other[0] operator[SEP] , identifier[argout] , identifier[errors] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public Principal getCallerPrincipal() {
String securityName = null;
Principal principal = null;
Subject callerSubject = getCallerSubject();
if (callerSubject == null) {
return null;
}
SubjectHelper subjectHelper = new SubjectHelper();
if (subjectHelper.isUnauthenticated(callerSubject)) {
return null;
}
// Here is the order to get the callerPrincipal
// 1) jsonWebToken in subject
// 2) From JASPIC property
// 3) From WSCredential.getSecurityName
// 4) From WSPrincipal
// 5) First Principal in Subject
// 1) From jsonWebToken in subject
Principal jsonWebToken = MpJwtHelper.getJsonWebTokenPricipal(callerSubject);
if (jsonWebToken != null) {
return jsonWebToken;
}
WSCredential wscredential = getWSCredential(callerSubject);
// 2) From JASPIC property
if (wscredential != null) {
try {
principal = (Principal) wscredential.get("com.ibm.wsspi.security.cred.jaspi.principal");
if (principal != null)
return principal;
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Internal error getting JASPIC Principal from credential", e);
}
}
// 3) From WSCredential.getSecurityName
try {
securityName = wscredential.getSecurityName();
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Error getting securityName from WSCredential", e);
}
}
WSPrincipal wsPrincipal = null;
if (securityName != null) {
Set<WSPrincipal> principals = callerSubject.getPrincipals(WSPrincipal.class);
if (!principals.isEmpty()) {
wsPrincipal = principals.iterator().next();
wsPrincipal = new WSPrincipal(securityName, wsPrincipal.getAccessId(), wsPrincipal.getAuthenticationMethod());
}
if (wsPrincipal != null) {
return wsPrincipal;
}
}
// 4) From WSPrincipal
Set<Principal> principals = callerSubject.getPrincipals();
if (principals.size() > 0) {
for (Iterator<Principal> iterator = principals.iterator(); iterator.hasNext();) {
principal = iterator.next();
if (principal instanceof WSPrincipal)
return principal;
}
}
// There is no WSPrincipal so just return first one
// 5) First Principal in Subject
return principals.iterator().next();
}
return null;
}
|
class class_name[name] begin[{]
method[getCallerPrincipal, return_type[type[Principal]], modifier[public], parameter[]] begin[{]
local_variable[type[String], securityName]
local_variable[type[Principal], principal]
local_variable[type[Subject], callerSubject]
if[binary_operation[member[.callerSubject], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[SubjectHelper], subjectHelper]
if[call[subjectHelper.isUnauthenticated, parameter[member[.callerSubject]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Principal], jsonWebToken]
if[binary_operation[member[.jsonWebToken], !=, literal[null]]] begin[{]
return[member[.jsonWebToken]]
else begin[{]
None
end[}]
local_variable[type[WSCredential], wscredential]
if[binary_operation[member[.wscredential], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=principal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.wsspi.security.cred.jaspi.principal")], member=get, postfix_operators=[], prefix_operators=[], qualifier=wscredential, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Principal, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=principal, 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=ReturnStatement(expression=MemberReference(member=principal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Internal error getting JASPIC Principal from credential"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=securityName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getSecurityName, postfix_operators=[], prefix_operators=[], qualifier=wscredential, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error getting securityName from WSCredential"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
local_variable[type[WSPrincipal], wsPrincipal]
if[binary_operation[member[.securityName], !=, literal[null]]] begin[{]
local_variable[type[Set], principals]
if[call[principals.isEmpty, parameter[]]] begin[{]
assign[member[.wsPrincipal], call[principals.iterator, parameter[]]]
assign[member[.wsPrincipal], ClassCreator(arguments=[MemberReference(member=securityName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getAccessId, postfix_operators=[], prefix_operators=[], qualifier=wsPrincipal, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getAuthenticationMethod, postfix_operators=[], prefix_operators=[], qualifier=wsPrincipal, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WSPrincipal, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.wsPrincipal], !=, literal[null]]] begin[{]
return[member[.wsPrincipal]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[Set], principals]
if[binary_operation[call[principals.size, parameter[]], >, literal[0]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=principal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=principal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=WSPrincipal, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=principal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=principals, selectors=[], type_arguments=None), name=iterator)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Principal, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
else begin[{]
None
end[}]
return[call[principals.iterator, parameter[]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Principal] identifier[getCallerPrincipal] operator[SEP] operator[SEP] {
identifier[String] identifier[securityName] operator[=] Other[null] operator[SEP] identifier[Principal] identifier[principal] operator[=] Other[null] operator[SEP] identifier[Subject] identifier[callerSubject] operator[=] identifier[getCallerSubject] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[callerSubject] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[SubjectHelper] identifier[subjectHelper] operator[=] Keyword[new] identifier[SubjectHelper] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[subjectHelper] operator[SEP] identifier[isUnauthenticated] operator[SEP] identifier[callerSubject] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Principal] identifier[jsonWebToken] operator[=] identifier[MpJwtHelper] operator[SEP] identifier[getJsonWebTokenPricipal] operator[SEP] identifier[callerSubject] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jsonWebToken] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[jsonWebToken] operator[SEP]
}
identifier[WSCredential] identifier[wscredential] operator[=] identifier[getWSCredential] operator[SEP] identifier[callerSubject] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[wscredential] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[principal] operator[=] operator[SEP] identifier[Principal] operator[SEP] identifier[wscredential] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[principal] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[principal] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[try] {
identifier[securityName] operator[=] identifier[wscredential] operator[SEP] identifier[getSecurityName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
identifier[WSPrincipal] identifier[wsPrincipal] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[securityName] operator[!=] Other[null] operator[SEP] {
identifier[Set] operator[<] identifier[WSPrincipal] operator[>] identifier[principals] operator[=] identifier[callerSubject] operator[SEP] identifier[getPrincipals] operator[SEP] identifier[WSPrincipal] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[principals] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[wsPrincipal] operator[=] identifier[principals] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[wsPrincipal] operator[=] Keyword[new] identifier[WSPrincipal] operator[SEP] identifier[securityName] , identifier[wsPrincipal] operator[SEP] identifier[getAccessId] operator[SEP] operator[SEP] , identifier[wsPrincipal] operator[SEP] identifier[getAuthenticationMethod] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[wsPrincipal] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[wsPrincipal] operator[SEP]
}
}
identifier[Set] operator[<] identifier[Principal] operator[>] identifier[principals] operator[=] identifier[callerSubject] operator[SEP] identifier[getPrincipals] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[principals] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[Principal] operator[>] identifier[iterator] operator[=] identifier[principals] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[principal] operator[=] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[principal] Keyword[instanceof] identifier[WSPrincipal] operator[SEP] Keyword[return] identifier[principal] operator[SEP]
}
}
Keyword[return] identifier[principals] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public static server get(nitro_service service, String name) throws Exception{
server obj = new server();
obj.set_name(name);
server response = (server) obj.get_resource(service);
return response;
}
|
class class_name[name] begin[{]
method[get, return_type[type[server]], modifier[public static], parameter[service, name]] begin[{]
local_variable[type[server], obj]
call[obj.set_name, parameter[member[.name]]]
local_variable[type[server], response]
return[member[.response]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[server] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[server] identifier[obj] operator[=] Keyword[new] identifier[server] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_name] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[server] identifier[response] operator[=] operator[SEP] identifier[server] operator[SEP] identifier[obj] operator[SEP] identifier[get_resource] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
public List<PathAddressTransformer> getPathTransformations(final PathAddress address, PlaceholderResolver placeholderResolver) {
final List<PathAddressTransformer> list = new ArrayList<PathAddressTransformer>();
final Iterator<PathElement> iterator = address.iterator();
resolvePathTransformers(iterator, list, placeholderResolver);
if(iterator.hasNext()) {
while(iterator.hasNext()) {
iterator.next();
list.add(PathAddressTransformer.DEFAULT);
}
}
return list;
}
|
class class_name[name] begin[{]
method[getPathTransformations, return_type[type[List]], modifier[public], parameter[address, placeholderResolver]] begin[{]
local_variable[type[List], list]
local_variable[type[Iterator], iterator]
call[.resolvePathTransformers, parameter[member[.iterator], member[.list], member[.placeholderResolver]]]
if[call[iterator.hasNext, parameter[]]] begin[{]
while[call[iterator.hasNext, parameter[]]] begin[{]
call[iterator.next, parameter[]]
call[list.add, parameter[member[PathAddressTransformer.DEFAULT]]]
end[}]
else begin[{]
None
end[}]
return[member[.list]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[PathAddressTransformer] operator[>] identifier[getPathTransformations] operator[SEP] Keyword[final] identifier[PathAddress] identifier[address] , identifier[PlaceholderResolver] identifier[placeholderResolver] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[PathAddressTransformer] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[PathAddressTransformer] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[PathElement] operator[>] identifier[iterator] operator[=] identifier[address] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[resolvePathTransformers] operator[SEP] identifier[iterator] , identifier[list] , identifier[placeholderResolver] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[PathAddressTransformer] operator[SEP] identifier[DEFAULT] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[list] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public EList<Double> getSecondaryPlaneAngle() {
return (EList<Double>) eGet(Ifc4Package.Literals.IFC_LIGHT_DISTRIBUTION_DATA__SECONDARY_PLANE_ANGLE, true);
}
|
class class_name[name] begin[{]
method[getSecondaryPlaneAngle, return_type[type[EList]], modifier[public], parameter[]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=IFC_LIGHT_DISTRIBUTION_DATA__SECONDARY_PLANE_ANGLE, 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=Double, 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[Double] operator[>] identifier[getSecondaryPlaneAngle] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[EList] operator[<] identifier[Double] operator[>] operator[SEP] identifier[eGet] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[Literals] operator[SEP] identifier[IFC_LIGHT_DISTRIBUTION_DATA__SECONDARY_PLANE_ANGLE] , literal[boolean] operator[SEP] operator[SEP]
}
|
public static void serializePublishCommands(State state, QueryBasedHivePublishEntity queryBasedHivePublishEntity) {
state.setProp(HiveAvroORCQueryGenerator.SERIALIZED_PUBLISH_TABLE_COMMANDS,
GSON.toJson(queryBasedHivePublishEntity));
}
|
class class_name[name] begin[{]
method[serializePublishCommands, return_type[void], modifier[public static], parameter[state, queryBasedHivePublishEntity]] begin[{]
call[state.setProp, parameter[member[HiveAvroORCQueryGenerator.SERIALIZED_PUBLISH_TABLE_COMMANDS], call[GSON.toJson, parameter[member[.queryBasedHivePublishEntity]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[serializePublishCommands] operator[SEP] identifier[State] identifier[state] , identifier[QueryBasedHivePublishEntity] identifier[queryBasedHivePublishEntity] operator[SEP] {
identifier[state] operator[SEP] identifier[setProp] operator[SEP] identifier[HiveAvroORCQueryGenerator] operator[SEP] identifier[SERIALIZED_PUBLISH_TABLE_COMMANDS] , identifier[GSON] operator[SEP] identifier[toJson] operator[SEP] identifier[queryBasedHivePublishEntity] operator[SEP] operator[SEP] operator[SEP]
}
|
public ExportListResponse getExports(String exportType, UUID userId, Integer pageSize, String cursor, String sorting, String sortDirection) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/exports".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "exportType", exportType));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "userId", userId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "pageSize", pageSize));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sorting", sorting));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sortDirection", sortDirection));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType<ExportListResponse> localVarReturnType = new GenericType<ExportListResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
|
class class_name[name] begin[{]
method[getExports, return_type[type[ExportListResponse]], modifier[public], parameter[exportType, userId, pageSize, cursor, sorting, sortDirection]] begin[{]
local_variable[type[Object], localVarPostBody]
local_variable[type[String], localVarPath]
local_variable[type[List], localVarQueryParams]
local_variable[type[Map], localVarHeaderParams]
local_variable[type[Map], localVarFormParams]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["exportType"], member[.exportType]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["userId"], member[.userId]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["pageSize"], member[.pageSize]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["cursor"], member[.cursor]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["sorting"], member[.sorting]]]]]
call[localVarQueryParams.addAll, parameter[call[apiClient.parameterToPairs, parameter[literal[""], literal["sortDirection"], member[.sortDirection]]]]]
local_variable[type[String], localVarAccepts]
local_variable[type[String], localVarAccept]
local_variable[type[String], localVarContentTypes]
local_variable[type[String], localVarContentType]
local_variable[type[String], localVarAuthNames]
local_variable[type[GenericType], localVarReturnType]
return[call[apiClient.invokeAPI, parameter[member[.localVarPath], literal["GET"], member[.localVarQueryParams], member[.localVarPostBody], member[.localVarHeaderParams], member[.localVarFormParams], member[.localVarAccept], member[.localVarContentType], member[.localVarAuthNames], member[.localVarReturnType]]]]
end[}]
END[}]
|
Keyword[public] identifier[ExportListResponse] identifier[getExports] operator[SEP] identifier[String] identifier[exportType] , identifier[UUID] identifier[userId] , identifier[Integer] identifier[pageSize] , identifier[String] identifier[cursor] , identifier[String] identifier[sorting] , identifier[String] identifier[sortDirection] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[Object] identifier[localVarPostBody] operator[=] Other[null] operator[SEP] identifier[String] identifier[localVarPath] operator[=] literal[String] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Pair] operator[>] identifier[localVarQueryParams] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Pair] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[localVarHeaderParams] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[localVarFormParams] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[exportType] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[userId] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[pageSize] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[cursor] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[sorting] operator[SEP] operator[SEP] operator[SEP] identifier[localVarQueryParams] operator[SEP] identifier[addAll] operator[SEP] identifier[apiClient] operator[SEP] identifier[parameterToPairs] operator[SEP] literal[String] , literal[String] , identifier[sortDirection] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[localVarAccepts] operator[=] {
literal[String]
} operator[SEP] Keyword[final] identifier[String] identifier[localVarAccept] operator[=] identifier[apiClient] operator[SEP] identifier[selectHeaderAccept] operator[SEP] identifier[localVarAccepts] operator[SEP] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[localVarContentTypes] operator[=] {
} operator[SEP] Keyword[final] identifier[String] identifier[localVarContentType] operator[=] identifier[apiClient] operator[SEP] identifier[selectHeaderContentType] operator[SEP] identifier[localVarContentTypes] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[localVarAuthNames] operator[=] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
} operator[SEP] identifier[GenericType] operator[<] identifier[ExportListResponse] operator[>] identifier[localVarReturnType] operator[=] Keyword[new] identifier[GenericType] operator[<] identifier[ExportListResponse] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[invokeAPI] operator[SEP] identifier[localVarPath] , literal[String] , identifier[localVarQueryParams] , identifier[localVarPostBody] , identifier[localVarHeaderParams] , identifier[localVarFormParams] , identifier[localVarAccept] , identifier[localVarContentType] , identifier[localVarAuthNames] , identifier[localVarReturnType] operator[SEP] operator[SEP]
}
|
public static void createModulesOverview() {
Map<String, List<ClassField>> hmModules = HortonMachine.getInstance().moduleName2Fields;
Map<String, List<ClassField>> jggModules = JGrassGears.getInstance().moduleName2Fields;
Map<String, Class< ? >> hmModulesClasses = HortonMachine.getInstance().moduleName2Class;
Map<String, Class< ? >> jggModulesClasses = JGrassGears.getInstance().moduleName2Class;
Set<String> hmNames = hmModules.keySet();
String[] hmNamesArray = (String[]) hmNames.toArray(new String[hmNames.size()]);
Set<String> jggNames = jggModules.keySet();
String[] jggNamesArray = (String[]) jggNames.toArray(new String[jggNames.size()]);
Arrays.sort(hmNamesArray);
Arrays.sort(jggNamesArray);
StringBuilder sb = new StringBuilder();
sb.append("#summary An overview of the modules implemented in the HortonMachine\n\n");
sb.append("<wiki:toc max_depth=\"4\" />\n\n");
sb.append("= HortonMachine Modules Overview =\n");
sb.append("== !HortonMachine Modules ==\n");
String status = "CERTIFIED";
sb.append("=== Release ready ==\n");
dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status);
status = "TESTED";
sb.append("=== Tested but not for upcoming release ==\n");
dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status);
status = "DRAFT";
sb.append("=== Module that are not passing the QA rules yet ==\n");
dumpModules(hmModules, hmModulesClasses, hmNamesArray, sb, status);
sb.append("\n<BR/><BR/><BR/>\n\n");
sb.append("== Gears Modules ==\n");
status = "CERTIFIED";
sb.append("=== Release ready ==\n");
dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status);
status = "TESTED";
sb.append("=== Tested but not for upcoming release ==\n");
dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status);
status = "DRAFT";
sb.append("=== Module that are not passing the QA rules yet ==\n");
dumpModules(jggModules, jggModulesClasses, jggNamesArray, sb, status);
System.out.println(sb.toString());
}
|
class class_name[name] begin[{]
method[createModulesOverview, return_type[void], modifier[public static], parameter[]] begin[{]
local_variable[type[Map], hmModules]
local_variable[type[Map], jggModules]
local_variable[type[Map], hmModulesClasses]
local_variable[type[Map], jggModulesClasses]
local_variable[type[Set], hmNames]
local_variable[type[String], hmNamesArray]
local_variable[type[Set], jggNames]
local_variable[type[String], jggNamesArray]
call[Arrays.sort, parameter[member[.hmNamesArray]]]
call[Arrays.sort, parameter[member[.jggNamesArray]]]
local_variable[type[StringBuilder], sb]
call[sb.append, parameter[literal["#summary An overview of the modules implemented in the HortonMachine\n\n"]]]
call[sb.append, parameter[literal["<wiki:toc max_depth=\"4\" />\n\n"]]]
call[sb.append, parameter[literal["= HortonMachine Modules Overview =\n"]]]
call[sb.append, parameter[literal["== !HortonMachine Modules ==\n"]]]
local_variable[type[String], status]
call[sb.append, parameter[literal["=== Release ready ==\n"]]]
call[.dumpModules, parameter[member[.hmModules], member[.hmModulesClasses], member[.hmNamesArray], member[.sb], member[.status]]]
assign[member[.status], literal["TESTED"]]
call[sb.append, parameter[literal["=== Tested but not for upcoming release ==\n"]]]
call[.dumpModules, parameter[member[.hmModules], member[.hmModulesClasses], member[.hmNamesArray], member[.sb], member[.status]]]
assign[member[.status], literal["DRAFT"]]
call[sb.append, parameter[literal["=== Module that are not passing the QA rules yet ==\n"]]]
call[.dumpModules, parameter[member[.hmModules], member[.hmModulesClasses], member[.hmNamesArray], member[.sb], member[.status]]]
call[sb.append, parameter[literal["\n<BR/><BR/><BR/>\n\n"]]]
call[sb.append, parameter[literal["== Gears Modules ==\n"]]]
assign[member[.status], literal["CERTIFIED"]]
call[sb.append, parameter[literal["=== Release ready ==\n"]]]
call[.dumpModules, parameter[member[.jggModules], member[.jggModulesClasses], member[.jggNamesArray], member[.sb], member[.status]]]
assign[member[.status], literal["TESTED"]]
call[sb.append, parameter[literal["=== Tested but not for upcoming release ==\n"]]]
call[.dumpModules, parameter[member[.jggModules], member[.jggModulesClasses], member[.jggNamesArray], member[.sb], member[.status]]]
assign[member[.status], literal["DRAFT"]]
call[sb.append, parameter[literal["=== Module that are not passing the QA rules yet ==\n"]]]
call[.dumpModules, parameter[member[.jggModules], member[.jggModulesClasses], member[.jggNamesArray], member[.sb], member[.status]]]
call[System.out.println, parameter[call[sb.toString, parameter[]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[createModulesOverview] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[ClassField] operator[>] operator[>] identifier[hmModules] operator[=] identifier[HortonMachine] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[moduleName2Fields] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[ClassField] operator[>] operator[>] identifier[jggModules] operator[=] identifier[JGrassGears] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[moduleName2Fields] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[hmModulesClasses] operator[=] identifier[HortonMachine] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[moduleName2Class] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Class] operator[<] operator[?] operator[>] operator[>] identifier[jggModulesClasses] operator[=] identifier[JGrassGears] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[moduleName2Class] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[hmNames] operator[=] identifier[hmModules] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[hmNamesArray] operator[=] operator[SEP] identifier[String] operator[SEP] operator[SEP] operator[SEP] identifier[hmNames] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[hmNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[jggNames] operator[=] identifier[jggModules] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[jggNamesArray] operator[=] operator[SEP] identifier[String] operator[SEP] operator[SEP] operator[SEP] identifier[jggNames] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[jggNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[hmNamesArray] operator[SEP] operator[SEP] identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[jggNamesArray] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[status] operator[=] literal[String] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dumpModules] operator[SEP] identifier[hmModules] , identifier[hmModulesClasses] , identifier[hmNamesArray] , identifier[sb] , identifier[status] operator[SEP] operator[SEP] identifier[status] operator[=] literal[String] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dumpModules] operator[SEP] identifier[hmModules] , identifier[hmModulesClasses] , identifier[hmNamesArray] , identifier[sb] , identifier[status] operator[SEP] operator[SEP] identifier[status] operator[=] literal[String] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dumpModules] operator[SEP] identifier[hmModules] , identifier[hmModulesClasses] , identifier[hmNamesArray] , identifier[sb] , identifier[status] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[status] operator[=] literal[String] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dumpModules] operator[SEP] identifier[jggModules] , identifier[jggModulesClasses] , identifier[jggNamesArray] , identifier[sb] , identifier[status] operator[SEP] operator[SEP] identifier[status] operator[=] literal[String] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dumpModules] operator[SEP] identifier[jggModules] , identifier[jggModulesClasses] , identifier[jggNamesArray] , identifier[sb] , identifier[status] operator[SEP] operator[SEP] identifier[status] operator[=] literal[String] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dumpModules] operator[SEP] identifier[jggModules] , identifier[jggModulesClasses] , identifier[jggNamesArray] , identifier[sb] , identifier[status] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<CustomMeasureDto> selectByMetricKeyAndTextValue(DbSession session, String metricKey, String textValue) {
return mapper(session).selectByMetricKeyAndTextValue(metricKey, textValue);
}
|
class class_name[name] begin[{]
method[selectByMetricKeyAndTextValue, return_type[type[List]], modifier[public], parameter[session, metricKey, textValue]] begin[{]
return[call[.mapper, parameter[member[.session]]]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[CustomMeasureDto] operator[>] identifier[selectByMetricKeyAndTextValue] operator[SEP] identifier[DbSession] identifier[session] , identifier[String] identifier[metricKey] , identifier[String] identifier[textValue] operator[SEP] {
Keyword[return] identifier[mapper] operator[SEP] identifier[session] operator[SEP] operator[SEP] identifier[selectByMetricKeyAndTextValue] operator[SEP] identifier[metricKey] , identifier[textValue] operator[SEP] operator[SEP]
}
|
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DroolsPackage.IMPORT_TYPE__NAME:
setName(NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
|
class class_name[name] begin[{]
method[eUnset, return_type[void], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=IMPORT_TYPE__NAME, postfix_operators=[], prefix_operators=[], qualifier=DroolsPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=NAME_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eUnset, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eUnset] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[DroolsPackage] operator[SEP] identifier[IMPORT_TYPE__NAME] operator[:] identifier[setName] operator[SEP] identifier[NAME_EDEFAULT] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eUnset] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public ProviderOperationsMetadataInner get(String resourceProviderNamespace, String expand) {
return getWithServiceResponseAsync(resourceProviderNamespace, expand).toBlocking().single().body();
}
|
class class_name[name] begin[{]
method[get, return_type[type[ProviderOperationsMetadataInner]], modifier[public], parameter[resourceProviderNamespace, expand]] begin[{]
return[call[.getWithServiceResponseAsync, parameter[member[.resourceProviderNamespace], member[.expand]]]]
end[}]
END[}]
|
Keyword[public] identifier[ProviderOperationsMetadataInner] identifier[get] operator[SEP] identifier[String] identifier[resourceProviderNamespace] , identifier[String] identifier[expand] operator[SEP] {
Keyword[return] identifier[getWithServiceResponseAsync] operator[SEP] identifier[resourceProviderNamespace] , identifier[expand] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
long getFirstWeekOfYearMillis(int year) {
long jan1millis = getYearMillis(year);
int jan1dayOfWeek = getDayOfWeek(jan1millis);
if (jan1dayOfWeek > (8 - iMinDaysInFirstWeek)) {
// First week is end of previous year because it doesn't have enough days.
return jan1millis + (8 - jan1dayOfWeek)
* (long)DateTimeConstants.MILLIS_PER_DAY;
} else {
// First week is start of this year because it has enough days.
return jan1millis - (jan1dayOfWeek - 1)
* (long)DateTimeConstants.MILLIS_PER_DAY;
}
}
|
class class_name[name] begin[{]
method[getFirstWeekOfYearMillis, return_type[type[long]], modifier[default], parameter[year]] begin[{]
local_variable[type[long], jan1millis]
local_variable[type[int], jan1dayOfWeek]
if[binary_operation[member[.jan1dayOfWeek], >, binary_operation[literal[8], -, member[.iMinDaysInFirstWeek]]]] begin[{]
return[binary_operation[member[.jan1millis], +, binary_operation[binary_operation[literal[8], -, member[.jan1dayOfWeek]], *, Cast(expression=MemberReference(member=MILLIS_PER_DAY, postfix_operators=[], prefix_operators=[], qualifier=DateTimeConstants, selectors=[]), type=BasicType(dimensions=[], name=long))]]]
else begin[{]
return[binary_operation[member[.jan1millis], -, binary_operation[binary_operation[member[.jan1dayOfWeek], -, literal[1]], *, Cast(expression=MemberReference(member=MILLIS_PER_DAY, postfix_operators=[], prefix_operators=[], qualifier=DateTimeConstants, selectors=[]), type=BasicType(dimensions=[], name=long))]]]
end[}]
end[}]
END[}]
|
Keyword[long] identifier[getFirstWeekOfYearMillis] operator[SEP] Keyword[int] identifier[year] operator[SEP] {
Keyword[long] identifier[jan1millis] operator[=] identifier[getYearMillis] operator[SEP] identifier[year] operator[SEP] operator[SEP] Keyword[int] identifier[jan1dayOfWeek] operator[=] identifier[getDayOfWeek] operator[SEP] identifier[jan1millis] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jan1dayOfWeek] operator[>] operator[SEP] Other[8] operator[-] identifier[iMinDaysInFirstWeek] operator[SEP] operator[SEP] {
Keyword[return] identifier[jan1millis] operator[+] operator[SEP] Other[8] operator[-] identifier[jan1dayOfWeek] operator[SEP] operator[*] operator[SEP] Keyword[long] operator[SEP] identifier[DateTimeConstants] operator[SEP] identifier[MILLIS_PER_DAY] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[jan1millis] operator[-] operator[SEP] identifier[jan1dayOfWeek] operator[-] Other[1] operator[SEP] operator[*] operator[SEP] Keyword[long] operator[SEP] identifier[DateTimeConstants] operator[SEP] identifier[MILLIS_PER_DAY] operator[SEP]
}
}
|
@Override
public Map<String, Number> status() {
Map<String, Number> ret = new HashMap<>();
ret.put("workers", workers);
ret.put("accumulatedUpdates", numUpdates());
return ret;
}
|
class class_name[name] begin[{]
method[status, return_type[type[Map]], modifier[public], parameter[]] begin[{]
local_variable[type[Map], ret]
call[ret.put, parameter[literal["workers"], member[.workers]]]
call[ret.put, parameter[literal["accumulatedUpdates"], call[.numUpdates, parameter[]]]]
return[member[.ret]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Number] operator[>] identifier[status] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Number] operator[>] identifier[ret] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[workers] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[numUpdates] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP]
}
|
public Map<Integer, String> listProjects() throws MPXJException
{
MPD9DatabaseReader reader = new MPD9DatabaseReader();
return reader.listProjects();
}
|
class class_name[name] begin[{]
method[listProjects, return_type[type[Map]], modifier[public], parameter[]] begin[{]
local_variable[type[MPD9DatabaseReader], reader]
return[call[reader.listProjects, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[Map] operator[<] identifier[Integer] , identifier[String] operator[>] identifier[listProjects] operator[SEP] operator[SEP] Keyword[throws] identifier[MPXJException] {
identifier[MPD9DatabaseReader] identifier[reader] operator[=] Keyword[new] identifier[MPD9DatabaseReader] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[reader] operator[SEP] identifier[listProjects] operator[SEP] operator[SEP] operator[SEP]
}
|
private void update(final Map<String, Object> values) {
for (final Entry<String, Object> entry : values.entrySet()) {
update(entry.getKey(), entry.getValue());
}
}
|
class class_name[name] begin[{]
method[update, return_type[void], modifier[private], parameter[values]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=update, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[update] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[values] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[entry] operator[:] identifier[values] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[update] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private static byte[] stringToByteArray(String str) {
byte[] result = new byte[str.length() + 1];
for (int i = 0; i < str.length(); i++) {
result[i] = (byte) str.charAt(i);
}
result[str.length()] = 0;
return result;
}
|
class class_name[name] begin[{]
method[stringToByteArray, return_type[type[byte]], modifier[private static], parameter[str]] begin[{]
local_variable[type[byte], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=byte))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.result], literal[0]]
return[member[.result]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[stringToByteArray] operator[SEP] identifier[String] identifier[str] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[i] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] identifier[str] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
identifier[result] operator[SEP] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[=] Other[0] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private void grow(int minCapacity) {
// overflow-conscious code
int oldCapacity = buf.length;
int newCapacity = oldCapacity << 1;
if (newCapacity - minCapacity < 0)
newCapacity = minCapacity;
if (newCapacity < 0) {
if (minCapacity < 0) // overflow
throw new OutOfMemoryError();
newCapacity = Integer.MAX_VALUE;
}
buf = copyOf(buf, newCapacity);
}
|
class class_name[name] begin[{]
method[grow, return_type[void], modifier[private], parameter[minCapacity]] begin[{]
local_variable[type[int], oldCapacity]
local_variable[type[int], newCapacity]
if[binary_operation[binary_operation[member[.newCapacity], -, member[.minCapacity]], <, literal[0]]] begin[{]
assign[member[.newCapacity], member[.minCapacity]]
else begin[{]
None
end[}]
if[binary_operation[member[.newCapacity], <, literal[0]]] begin[{]
if[binary_operation[member[.minCapacity], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OutOfMemoryError, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.newCapacity], member[Integer.MAX_VALUE]]
else begin[{]
None
end[}]
assign[member[.buf], call[.copyOf, parameter[member[.buf], member[.newCapacity]]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[grow] operator[SEP] Keyword[int] identifier[minCapacity] operator[SEP] {
Keyword[int] identifier[oldCapacity] operator[=] identifier[buf] operator[SEP] identifier[length] operator[SEP] Keyword[int] identifier[newCapacity] operator[=] identifier[oldCapacity] operator[<<] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[newCapacity] operator[-] identifier[minCapacity] operator[<] Other[0] operator[SEP] identifier[newCapacity] operator[=] identifier[minCapacity] operator[SEP] Keyword[if] operator[SEP] identifier[newCapacity] operator[<] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[minCapacity] operator[<] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[OutOfMemoryError] operator[SEP] operator[SEP] operator[SEP] identifier[newCapacity] operator[=] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP]
}
identifier[buf] operator[=] identifier[copyOf] operator[SEP] identifier[buf] , identifier[newCapacity] operator[SEP] operator[SEP]
}
|
public UndeliverableReturnCode handleUndeliverableMessage(
SIMPMessage msg,
int exceptionReason,
String[] exceptionInserts,
TransactionCommon tran,
String subscriptionID)
throws
SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"handleUndeliverableMessage",
new Object[] { msg, Integer.valueOf(exceptionReason), exceptionInserts, subscriptionID });
//If an ExceptionDestinationHandlerImpl instance does not exist yet, then create it
if (_exceptionDestination == null)
{
_exceptionDestination = new ExceptionDestinationHandlerImpl(this);
}
boolean tranCreated = false;
if (tran == null)
{
/* Create a new transaction under which to perform the reroute */
tran = txManager.createLocalTransaction(false);
tranCreated = true;
}
UndeliverableReturnCode rc = null;
try
{
/* Pass the undeliverable message to the exception destination */
// F001333-14610
// Pass the subscription ID to the exception handler
// so that it can be set on the exceptioned message.
rc = _exceptionDestination.handleUndeliverableMessage(msg,
tran,
exceptionReason,
exceptionInserts,
subscriptionID);
if (rc == UndeliverableReturnCode.OK
|| rc == UndeliverableReturnCode.DISCARD)
{
// Message is no longer required. Remove from the itemstream
try
{
if (msg.isInStore())
{
Transaction msTran = messageProcessor.resolveAndEnlistMsgStoreTransaction(tran);
if (rc == UndeliverableReturnCode.DISCARD) {
SibTr.info(tc, "DISCARD_MESSAGE_INFO_CWSIP00216", new Object[] { msg.getID() });
}
msg.remove(msTran, msg.getLockID());
}
} catch (MessageStoreException e)
{
// MessageStoreException shouldn't occur so FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BaseDestinationHandler.handleUndeliverableMessage",
"1:2051:1.700.3.45",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {
"com.ibm.ws.sib.processor.impl.BaseDestinationHandler",
"1:2058:1.700.3.45",
e,
getName() });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "handleUndeliverableMessage", e);
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {
"com.ibm.ws.sib.processor.impl.BaseDestinationHandler",
"1:2070:1.700.3.45",
e,
getName() },
null),
e);
}
try
{
if (tranCreated)
((LocalTransaction) tran).commit();
} catch (SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BaseDestinationHandler.handleUndeliverableMessage",
"1:2087:1.700.3.45",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.BaseDestinationHandler",
"1:2094:1.700.3.45",
e });
/* Persist operation FAILED therefore throw exception */
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "handleUndeliverableMessage", e);
if (e instanceof SIRollbackException)
tran = null;
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.BaseDestinationHandler",
"1:2109:1.700.3.45",
e },
null),
e);
}
}
else if (rc == UndeliverableReturnCode.BLOCK
|| rc == UndeliverableReturnCode.ERROR)
{
// Message could not be delivered. Unlock the message to make it available to other
// consumers
if (tranCreated)
handleRollback((LocalTransaction) tran);
}
} catch (SIResourceException e)
{
// No FFDC code needed
if (tranCreated)
handleRollback((LocalTransaction) tran);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "handleUndeliverableMessage", e);
}
throw e;
} catch (RuntimeException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.BaseDestinationHandler.handleUndeliverableMessage",
"1:2145:1.700.3.45",
this);
if (tranCreated)
handleRollback((LocalTransaction) tran);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.exception(tc, e);
SibTr.exit(tc, "handleUndeliverableMessage", e);
}
// 533027 Throwing a runtime exception out of this code is not appropriate,
// as we do not want our caller to fail because of an unexpected condition
// encountered while sending a message to the exception destination.
// In particular, exceptions generated within processor and thrown across
// message store boundaries (from inside callbacks) show up as runtime
// exceptions at this level.
throw new SIResourceException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.BaseDestinationHandler",
"1:2168:1.700.3.45",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "handleUndeliverableMessage", rc);
return rc;
}
|
class class_name[name] begin[{]
method[handleUndeliverableMessage, return_type[type[UndeliverableReturnCode]], modifier[public], parameter[msg, exceptionReason, exceptionInserts, tran, subscriptionID]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["handleUndeliverableMessage"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=exceptionReason, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), MemberReference(member=exceptionInserts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=subscriptionID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[member[._exceptionDestination], ==, literal[null]]] begin[{]
assign[member[._exceptionDestination], 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=ExceptionDestinationHandlerImpl, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[boolean], tranCreated]
if[binary_operation[member[.tran], ==, literal[null]]] begin[{]
assign[member[.tran], call[txManager.createLocalTransaction, parameter[literal[false]]]]
assign[member[.tranCreated], literal[true]]
else begin[{]
None
end[}]
local_variable[type[UndeliverableReturnCode], rc]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=rc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tran, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=exceptionReason, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=exceptionInserts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=subscriptionID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleUndeliverableMessage, postfix_operators=[], prefix_operators=[], qualifier=_exceptionDestination, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=rc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=OK, postfix_operators=[], prefix_operators=[], qualifier=UndeliverableReturnCode, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=rc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DISCARD, postfix_operators=[], prefix_operators=[], qualifier=UndeliverableReturnCode, selectors=[]), operator===), operator=||), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=rc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=BLOCK, postfix_operators=[], prefix_operators=[], qualifier=UndeliverableReturnCode, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=rc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ERROR, postfix_operators=[], prefix_operators=[], qualifier=UndeliverableReturnCode, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=tranCreated, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=tran, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LocalTransaction, sub_type=None))], member=handleRollback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None))])), label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isInStore, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tran, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resolveAndEnlistMsgStoreTransaction, postfix_operators=[], prefix_operators=[], qualifier=messageProcessor, selectors=[], type_arguments=None), name=msTran)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Transaction, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DISCARD, postfix_operators=[], prefix_operators=[], qualifier=UndeliverableReturnCode, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DISCARD_MESSAGE_INFO_CWSIP00216"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getID, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=info, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=msTran, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getLockID, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.BaseDestinationHandler.handleUndeliverableMessage"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:2051:1.700.3.45"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTERNAL_MESSAGING_ERROR_CWSIP0003"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.BaseDestinationHandler"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:2058:1.700.3.45"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=error, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="handleUndeliverableMessage"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTERNAL_MESSAGING_ERROR_CWSIP0003"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.BaseDestinationHandler"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:2070:1.700.3.45"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=nls, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SIResourceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MessageStoreException']))], finally_block=None, label=None, resources=None), TryStatement(block=[IfStatement(condition=MemberReference(member=tranCreated, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=Cast(expression=MemberReference(member=tran, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LocalTransaction, sub_type=None)), label=None))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.BaseDestinationHandler.handleUndeliverableMessage"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:2087:1.700.3.45"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTERNAL_MESSAGING_ERROR_CWSIP0002"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.BaseDestinationHandler"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:2094:1.700.3.45"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))], member=error, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="handleUndeliverableMessage"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=SIRollbackException, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=tran, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTERNAL_MESSAGING_ERROR_CWSIP0002"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.BaseDestinationHandler"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:2109:1.700.3.45"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=nls, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SIResourceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SIException']))], finally_block=None, label=None, resources=None)]))], catches=[CatchClause(block=[IfStatement(condition=MemberReference(member=tranCreated, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=tran, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LocalTransaction, sub_type=None))], member=handleRollback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="handleUndeliverableMessage"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)])), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SIResourceException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.BaseDestinationHandler.handleUndeliverableMessage"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:2145:1.700.3.45"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=FFDCFilter, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=tranCreated, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=tran, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LocalTransaction, sub_type=None))], member=handleRollback, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isEntryEnabled, postfix_operators=[], prefix_operators=[], qualifier=tc, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exception, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="handleUndeliverableMessage"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exit, postfix_operators=[], prefix_operators=[], qualifier=SibTr, selectors=[], type_arguments=None), label=None)])), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTERNAL_MESSAGING_ERROR_CWSIP0002"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.sib.processor.impl.BaseDestinationHandler"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="1:2168:1.700.3.45"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getFormattedMessage, postfix_operators=[], prefix_operators=[], qualifier=nls, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SIResourceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RuntimeException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["handleUndeliverableMessage"], member[.rc]]]
else begin[{]
None
end[}]
return[member[.rc]]
end[}]
END[}]
|
Keyword[public] identifier[UndeliverableReturnCode] identifier[handleUndeliverableMessage] operator[SEP] identifier[SIMPMessage] identifier[msg] , Keyword[int] identifier[exceptionReason] , identifier[String] operator[SEP] operator[SEP] identifier[exceptionInserts] , identifier[TransactionCommon] identifier[tran] , identifier[String] identifier[subscriptionID] operator[SEP] Keyword[throws] identifier[SIResourceException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[msg] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[exceptionReason] operator[SEP] , identifier[exceptionInserts] , identifier[subscriptionID]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_exceptionDestination] operator[==] Other[null] operator[SEP] {
identifier[_exceptionDestination] operator[=] Keyword[new] identifier[ExceptionDestinationHandlerImpl] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
Keyword[boolean] identifier[tranCreated] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[tran] operator[==] Other[null] operator[SEP] {
identifier[tran] operator[=] identifier[txManager] operator[SEP] identifier[createLocalTransaction] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[tranCreated] operator[=] literal[boolean] operator[SEP]
}
identifier[UndeliverableReturnCode] identifier[rc] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[rc] operator[=] identifier[_exceptionDestination] operator[SEP] identifier[handleUndeliverableMessage] operator[SEP] identifier[msg] , identifier[tran] , identifier[exceptionReason] , identifier[exceptionInserts] , identifier[subscriptionID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rc] operator[==] identifier[UndeliverableReturnCode] operator[SEP] identifier[OK] operator[||] identifier[rc] operator[==] identifier[UndeliverableReturnCode] operator[SEP] identifier[DISCARD] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[msg] operator[SEP] identifier[isInStore] operator[SEP] operator[SEP] operator[SEP] {
identifier[Transaction] identifier[msTran] operator[=] identifier[messageProcessor] operator[SEP] identifier[resolveAndEnlistMsgStoreTransaction] operator[SEP] identifier[tran] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rc] operator[==] identifier[UndeliverableReturnCode] operator[SEP] identifier[DISCARD] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[info] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[msg] operator[SEP] identifier[getID] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
identifier[msg] operator[SEP] identifier[remove] operator[SEP] identifier[msTran] , identifier[msg] operator[SEP] identifier[getLockID] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[MessageStoreException] identifier[e] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , literal[String] , identifier[e] , identifier[getName] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SIResourceException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , literal[String] , identifier[e] , identifier[getName] operator[SEP] operator[SEP]
} , Other[null] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[if] operator[SEP] identifier[tranCreated] operator[SEP] operator[SEP] operator[SEP] identifier[LocalTransaction] operator[SEP] identifier[tran] operator[SEP] operator[SEP] identifier[commit] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SIException] identifier[e] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , literal[String] , identifier[e]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] Keyword[instanceof] identifier[SIRollbackException] operator[SEP] identifier[tran] operator[=] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[SIResourceException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , literal[String] , identifier[e]
} , Other[null] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[rc] operator[==] identifier[UndeliverableReturnCode] operator[SEP] identifier[BLOCK] operator[||] identifier[rc] operator[==] identifier[UndeliverableReturnCode] operator[SEP] identifier[ERROR] operator[SEP] {
Keyword[if] operator[SEP] identifier[tranCreated] operator[SEP] identifier[handleRollback] operator[SEP] operator[SEP] identifier[LocalTransaction] operator[SEP] identifier[tran] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[SIResourceException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[tranCreated] operator[SEP] identifier[handleRollback] operator[SEP] operator[SEP] identifier[LocalTransaction] operator[SEP] identifier[tran] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[e] operator[SEP] {
identifier[FFDCFilter] operator[SEP] identifier[processException] operator[SEP] identifier[e] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tranCreated] operator[SEP] identifier[handleRollback] operator[SEP] operator[SEP] identifier[LocalTransaction] operator[SEP] identifier[tran] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[SibTr] operator[SEP] identifier[exception] operator[SEP] identifier[tc] , identifier[e] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[SIResourceException] operator[SEP] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
literal[String] , literal[String] , identifier[e]
} , Other[null] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[rc] operator[SEP] operator[SEP] Keyword[return] identifier[rc] operator[SEP]
}
|
public void addTag(Tag tag) {
set(PackageMetadata.TAGS, concat(getTags(), singletonList(tag)));
}
|
class class_name[name] begin[{]
method[addTag, return_type[void], modifier[public], parameter[tag]] begin[{]
call[.set, parameter[member[PackageMetadata.TAGS], call[.concat, parameter[call[.getTags, parameter[]], call[.singletonList, parameter[member[.tag]]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addTag] operator[SEP] identifier[Tag] identifier[tag] operator[SEP] {
identifier[set] operator[SEP] identifier[PackageMetadata] operator[SEP] identifier[TAGS] , identifier[concat] operator[SEP] identifier[getTags] operator[SEP] operator[SEP] , identifier[singletonList] operator[SEP] identifier[tag] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Geometry execute(Geometry geometry) {
if (geometry instanceof Polygon) {
Polygon polygon = (Polygon) geometry;
// No rings? return null:
if (polygon.getNumInteriorRing() == 0) {
return null;
}
// Correct the index if necessary:
if (ringIndex < 0) {
ringIndex = 0;
} else if (ringIndex >= polygon.getNumInteriorRing()) {
ringIndex = polygon.getNumInteriorRing() - 1;
}
// Create the new array of interior rings:
LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing() - 1];
int count = 0;
for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
if (n != ringIndex) {
interiorRings[count++] = polygon.getInteriorRingN(n);
}
}
return geometry.getGeometryFactory().createPolygon(polygon.getExteriorRing(), interiorRings);
}
return null;
}
|
class class_name[name] begin[{]
method[execute, return_type[type[Geometry]], modifier[public], parameter[geometry]] begin[{]
if[binary_operation[member[.geometry], instanceof, type[Polygon]]] begin[{]
local_variable[type[Polygon], polygon]
if[binary_operation[call[polygon.getNumInteriorRing, parameter[]], ==, literal[0]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.ringIndex], <, literal[0]]] begin[{]
assign[member[.ringIndex], literal[0]]
else begin[{]
if[binary_operation[member[.ringIndex], >=, call[polygon.getNumInteriorRing, parameter[]]]] begin[{]
assign[member[.ringIndex], binary_operation[call[polygon.getNumInteriorRing, parameter[]], -, literal[1]]]
else begin[{]
None
end[}]
end[}]
local_variable[type[LinearRing], interiorRings]
local_variable[type[int], count]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ringIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=interiorRings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=count, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInteriorRingN, postfix_operators=[], prefix_operators=[], qualifier=polygon, selectors=[], type_arguments=None)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumInteriorRing, postfix_operators=[], prefix_operators=[], qualifier=polygon, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=n)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=n, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[geometry.getGeometryFactory, parameter[]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[public] identifier[Geometry] identifier[execute] operator[SEP] identifier[Geometry] identifier[geometry] operator[SEP] {
Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[Polygon] operator[SEP] {
identifier[Polygon] identifier[polygon] operator[=] operator[SEP] identifier[Polygon] operator[SEP] identifier[geometry] operator[SEP] Keyword[if] operator[SEP] identifier[polygon] operator[SEP] identifier[getNumInteriorRing] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ringIndex] operator[<] Other[0] operator[SEP] {
identifier[ringIndex] operator[=] Other[0] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ringIndex] operator[>=] identifier[polygon] operator[SEP] identifier[getNumInteriorRing] operator[SEP] operator[SEP] operator[SEP] {
identifier[ringIndex] operator[=] identifier[polygon] operator[SEP] identifier[getNumInteriorRing] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP]
}
identifier[LinearRing] operator[SEP] operator[SEP] identifier[interiorRings] operator[=] Keyword[new] identifier[LinearRing] operator[SEP] identifier[polygon] operator[SEP] identifier[getNumInteriorRing] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[n] operator[=] Other[0] operator[SEP] identifier[n] operator[<] identifier[polygon] operator[SEP] identifier[getNumInteriorRing] operator[SEP] operator[SEP] operator[SEP] identifier[n] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[n] operator[!=] identifier[ringIndex] operator[SEP] {
identifier[interiorRings] operator[SEP] identifier[count] operator[++] operator[SEP] operator[=] identifier[polygon] operator[SEP] identifier[getInteriorRingN] operator[SEP] identifier[n] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[geometry] operator[SEP] identifier[getGeometryFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createPolygon] operator[SEP] identifier[polygon] operator[SEP] identifier[getExteriorRing] operator[SEP] operator[SEP] , identifier[interiorRings] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public static String readString(ChannelBuffer buffer, int length,
Charset charset)
{
String str = null;
if (null == charset)
{
charset = CharsetUtil.UTF_8;
}
try
{
ChannelBuffer stringBuffer = buffer.readSlice(length);
str = stringBuffer.toString(charset);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
return str;
}
|
class class_name[name] begin[{]
method[readString, return_type[type[String]], modifier[public static], parameter[buffer, length, charset]] begin[{]
local_variable[type[String], str]
if[binary_operation[literal[null], ==, member[.charset]]] begin[{]
assign[member[.charset], member[CharsetUtil.UTF_8]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readSlice, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), name=stringBuffer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ChannelBuffer, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=charset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=stringBuffer, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[member[.str]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[readString] operator[SEP] identifier[ChannelBuffer] identifier[buffer] , Keyword[int] identifier[length] , identifier[Charset] identifier[charset] operator[SEP] {
identifier[String] identifier[str] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[==] identifier[charset] operator[SEP] {
identifier[charset] operator[=] identifier[CharsetUtil] operator[SEP] identifier[UTF_8] operator[SEP]
}
Keyword[try] {
identifier[ChannelBuffer] identifier[stringBuffer] operator[=] identifier[buffer] operator[SEP] identifier[readSlice] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[str] operator[=] identifier[stringBuffer] operator[SEP] identifier[toString] operator[SEP] identifier[charset] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[str] operator[SEP]
}
|
public static base_response update(nitro_service client, vpnformssoaction resource) throws Exception {
vpnformssoaction updateresource = new vpnformssoaction();
updateresource.name = resource.name;
updateresource.actionurl = resource.actionurl;
updateresource.userfield = resource.userfield;
updateresource.passwdfield = resource.passwdfield;
updateresource.ssosuccessrule = resource.ssosuccessrule;
updateresource.responsesize = resource.responsesize;
updateresource.namevaluepair = resource.namevaluepair;
updateresource.nvtype = resource.nvtype;
updateresource.submitmethod = resource.submitmethod;
return updateresource.update_resource(client);
}
|
class class_name[name] begin[{]
method[update, return_type[type[base_response]], modifier[public static], parameter[client, resource]] begin[{]
local_variable[type[vpnformssoaction], updateresource]
assign[member[updateresource.name], member[resource.name]]
assign[member[updateresource.actionurl], member[resource.actionurl]]
assign[member[updateresource.userfield], member[resource.userfield]]
assign[member[updateresource.passwdfield], member[resource.passwdfield]]
assign[member[updateresource.ssosuccessrule], member[resource.ssosuccessrule]]
assign[member[updateresource.responsesize], member[resource.responsesize]]
assign[member[updateresource.namevaluepair], member[resource.namevaluepair]]
assign[member[updateresource.nvtype], member[resource.nvtype]]
assign[member[updateresource.submitmethod], member[resource.submitmethod]]
return[call[updateresource.update_resource, parameter[member[.client]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[base_response] identifier[update] operator[SEP] identifier[nitro_service] identifier[client] , identifier[vpnformssoaction] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[vpnformssoaction] identifier[updateresource] operator[=] Keyword[new] identifier[vpnformssoaction] operator[SEP] operator[SEP] operator[SEP] identifier[updateresource] operator[SEP] identifier[name] operator[=] identifier[resource] operator[SEP] identifier[name] operator[SEP] identifier[updateresource] operator[SEP] identifier[actionurl] operator[=] identifier[resource] operator[SEP] identifier[actionurl] operator[SEP] identifier[updateresource] operator[SEP] identifier[userfield] operator[=] identifier[resource] operator[SEP] identifier[userfield] operator[SEP] identifier[updateresource] operator[SEP] identifier[passwdfield] operator[=] identifier[resource] operator[SEP] identifier[passwdfield] operator[SEP] identifier[updateresource] operator[SEP] identifier[ssosuccessrule] operator[=] identifier[resource] operator[SEP] identifier[ssosuccessrule] operator[SEP] identifier[updateresource] operator[SEP] identifier[responsesize] operator[=] identifier[resource] operator[SEP] identifier[responsesize] operator[SEP] identifier[updateresource] operator[SEP] identifier[namevaluepair] operator[=] identifier[resource] operator[SEP] identifier[namevaluepair] operator[SEP] identifier[updateresource] operator[SEP] identifier[nvtype] operator[=] identifier[resource] operator[SEP] identifier[nvtype] operator[SEP] identifier[updateresource] operator[SEP] identifier[submitmethod] operator[=] identifier[resource] operator[SEP] identifier[submitmethod] operator[SEP] Keyword[return] identifier[updateresource] operator[SEP] identifier[update_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP]
}
|
public InputSource resolveEntity( String pPublicId, String pSystemId )
throws SAXException, IOException
{
final InputSource source = resolver.resolveEntity( pPublicId, pSystemId );
if ( source != null )
{
return source;
}
URL url = resolve( pSystemId );
if ( url != null )
{
return asInputSource( url );
}
return null;
}
|
class class_name[name] begin[{]
method[resolveEntity, return_type[type[InputSource]], modifier[public], parameter[pPublicId, pSystemId]] begin[{]
local_variable[type[InputSource], source]
if[binary_operation[member[.source], !=, literal[null]]] begin[{]
return[member[.source]]
else begin[{]
None
end[}]
local_variable[type[URL], url]
if[binary_operation[member[.url], !=, literal[null]]] begin[{]
return[call[.asInputSource, parameter[member[.url]]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[public] identifier[InputSource] identifier[resolveEntity] operator[SEP] identifier[String] identifier[pPublicId] , identifier[String] identifier[pSystemId] operator[SEP] Keyword[throws] identifier[SAXException] , identifier[IOException] {
Keyword[final] identifier[InputSource] identifier[source] operator[=] identifier[resolver] operator[SEP] identifier[resolveEntity] operator[SEP] identifier[pPublicId] , identifier[pSystemId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[source] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[source] operator[SEP]
}
identifier[URL] identifier[url] operator[=] identifier[resolve] operator[SEP] identifier[pSystemId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[url] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[asInputSource] operator[SEP] identifier[url] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public int getValueId(Clusterable c) {
currentItems++;
/*
* if(isLeafNode()) { return id; }
*/
int index = TreeUtils.findNearestNodeIndex(subNodes, c);
if (index >= 0) {
KMeansTreeNode node = subNodes.get(index);
return node.getValueId(c);
}
return id;
}
|
class class_name[name] begin[{]
method[getValueId, return_type[type[int]], modifier[public], parameter[c]] begin[{]
member[.currentItems]
local_variable[type[int], index]
if[binary_operation[member[.index], >=, literal[0]]] begin[{]
local_variable[type[KMeansTreeNode], node]
return[call[node.getValueId, parameter[member[.c]]]]
else begin[{]
None
end[}]
return[member[.id]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[getValueId] operator[SEP] identifier[Clusterable] identifier[c] operator[SEP] {
identifier[currentItems] operator[++] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[TreeUtils] operator[SEP] identifier[findNearestNodeIndex] operator[SEP] identifier[subNodes] , identifier[c] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[>=] Other[0] operator[SEP] {
identifier[KMeansTreeNode] identifier[node] operator[=] identifier[subNodes] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] operator[SEP] Keyword[return] identifier[node] operator[SEP] identifier[getValueId] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[return] identifier[id] operator[SEP]
}
|
public void removeConnection(WebSocketConnection conn) {
conns.remove(conn);
for (IWebSocketDataListener listener : listeners) {
listener.onWSDisconnect(conn);
}
}
|
class class_name[name] begin[{]
method[removeConnection, return_type[void], modifier[public], parameter[conn]] begin[{]
call[conns.remove, parameter[member[.conn]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onWSDisconnect, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=listeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IWebSocketDataListener, sub_type=None))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[removeConnection] operator[SEP] identifier[WebSocketConnection] identifier[conn] operator[SEP] {
identifier[conns] operator[SEP] identifier[remove] operator[SEP] identifier[conn] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[IWebSocketDataListener] identifier[listener] operator[:] identifier[listeners] operator[SEP] {
identifier[listener] operator[SEP] identifier[onWSDisconnect] operator[SEP] identifier[conn] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("unchecked")
@Override
public T isNull(final String col) {
context().param(CaseFormat.CAMEL_CASE.convert(col), new IsNull(col));
this.useOperator = true;
return (T) this;
}
|
class class_name[name] begin[{]
method[isNull, return_type[type[T]], modifier[public], parameter[col]] begin[{]
call[.context, parameter[]]
assign[THIS[member[None.useOperator]], literal[true]]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[T] identifier[isNull] operator[SEP] Keyword[final] identifier[String] identifier[col] operator[SEP] {
identifier[context] operator[SEP] operator[SEP] operator[SEP] identifier[param] operator[SEP] identifier[CaseFormat] operator[SEP] identifier[CAMEL_CASE] operator[SEP] identifier[convert] operator[SEP] identifier[col] operator[SEP] , Keyword[new] identifier[IsNull] operator[SEP] identifier[col] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[useOperator] operator[=] literal[boolean] operator[SEP] Keyword[return] operator[SEP] identifier[T] operator[SEP] Keyword[this] operator[SEP]
}
|
public static BigDecimal min(EvaluationContext ctx, Object... args) {
if (args.length == 0) {
throw new RuntimeException("Wrong number of arguments");
}
BigDecimal result = null;
for (Object arg : args) {
BigDecimal _arg = Conversions.toDecimal(arg, ctx);
result = result != null ? _arg.min(result) : _arg;
}
return result;
}
|
class class_name[name] begin[{]
method[min, return_type[type[BigDecimal]], modifier[public static], parameter[ctx, args]] begin[{]
if[binary_operation[member[args.length], ==, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Wrong number of arguments")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[BigDecimal], result]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=arg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toDecimal, postfix_operators=[], prefix_operators=[], qualifier=Conversions, selectors=[], type_arguments=None), name=_arg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BigDecimal, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=_arg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=min, postfix_operators=[], prefix_operators=[], qualifier=_arg, selectors=[], type_arguments=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=arg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BigDecimal] identifier[min] operator[SEP] identifier[EvaluationContext] identifier[ctx] , identifier[Object] operator[...] identifier[args] operator[SEP] {
Keyword[if] operator[SEP] identifier[args] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[BigDecimal] identifier[result] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[arg] operator[:] identifier[args] operator[SEP] {
identifier[BigDecimal] identifier[_arg] operator[=] identifier[Conversions] operator[SEP] identifier[toDecimal] operator[SEP] identifier[arg] , identifier[ctx] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[result] operator[!=] Other[null] operator[?] identifier[_arg] operator[SEP] identifier[min] operator[SEP] identifier[result] operator[SEP] operator[:] identifier[_arg] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
private Filter createValueMatchFilter(
FilterAdapterContext context, SingleColumnValueFilter filter) throws IOException {
ValueFilter valueFilter = new ValueFilter(filter.getOperator(), filter.getComparator());
return delegateAdapter.toFilter(context, valueFilter);
}
|
class class_name[name] begin[{]
method[createValueMatchFilter, return_type[type[Filter]], modifier[private], parameter[context, filter]] begin[{]
local_variable[type[ValueFilter], valueFilter]
return[call[delegateAdapter.toFilter, parameter[member[.context], member[.valueFilter]]]]
end[}]
END[}]
|
Keyword[private] identifier[Filter] identifier[createValueMatchFilter] operator[SEP] identifier[FilterAdapterContext] identifier[context] , identifier[SingleColumnValueFilter] identifier[filter] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[ValueFilter] identifier[valueFilter] operator[=] Keyword[new] identifier[ValueFilter] operator[SEP] identifier[filter] operator[SEP] identifier[getOperator] operator[SEP] operator[SEP] , identifier[filter] operator[SEP] identifier[getComparator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[delegateAdapter] operator[SEP] identifier[toFilter] operator[SEP] identifier[context] , identifier[valueFilter] operator[SEP] operator[SEP]
}
|
public final <T> TcpServer attr(AttributeKey<T> key, @Nullable T value) {
Objects.requireNonNull(key, "key");
return bootstrap(b -> b.childAttr(key, value));
}
|
class class_name[name] begin[{]
method[attr, return_type[type[TcpServer]], modifier[final public], parameter[key, value]] begin[{]
call[Objects.requireNonNull, parameter[member[.key], literal["key"]]]
return[call[.bootstrap, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=childAttr, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None), parameters=[MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}]
|
Keyword[public] Keyword[final] operator[<] identifier[T] operator[>] identifier[TcpServer] identifier[attr] operator[SEP] identifier[AttributeKey] operator[<] identifier[T] operator[>] identifier[key] , annotation[@] identifier[Nullable] identifier[T] identifier[value] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[key] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[bootstrap] operator[SEP] identifier[b] operator[->] identifier[b] operator[SEP] identifier[childAttr] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public static DropwizardMeterRegistry newRegistry(HierarchicalNameMapper nameMapper, Clock clock) {
return newRegistry(new MetricRegistry(), nameMapper, clock);
}
|
class class_name[name] begin[{]
method[newRegistry, return_type[type[DropwizardMeterRegistry]], modifier[public static], parameter[nameMapper, clock]] begin[{]
return[call[.newRegistry, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MetricRegistry, sub_type=None)), member[.nameMapper], member[.clock]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DropwizardMeterRegistry] identifier[newRegistry] operator[SEP] identifier[HierarchicalNameMapper] identifier[nameMapper] , identifier[Clock] identifier[clock] operator[SEP] {
Keyword[return] identifier[newRegistry] operator[SEP] Keyword[new] identifier[MetricRegistry] operator[SEP] operator[SEP] , identifier[nameMapper] , identifier[clock] operator[SEP] operator[SEP]
}
|
public static Optional<ButtonType> alert(String title, String header, String content) {
return alert(title, header, content, AlertType.INFORMATION);
}
|
class class_name[name] begin[{]
method[alert, return_type[type[Optional]], modifier[public static], parameter[title, header, content]] begin[{]
return[call[.alert, parameter[member[.title], member[.header], member[.content], member[AlertType.INFORMATION]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Optional] operator[<] identifier[ButtonType] operator[>] identifier[alert] operator[SEP] identifier[String] identifier[title] , identifier[String] identifier[header] , identifier[String] identifier[content] operator[SEP] {
Keyword[return] identifier[alert] operator[SEP] identifier[title] , identifier[header] , identifier[content] , identifier[AlertType] operator[SEP] identifier[INFORMATION] operator[SEP] operator[SEP]
}
|
public boolean addAll(Collection<E> items){
boolean modified = false;
for(E e : items){
modified = add(e) || modified;
}
return modified;
}
|
class class_name[name] begin[{]
method[addAll, return_type[type[boolean]], modifier[public], parameter[items]] begin[{]
local_variable[type[boolean], modified]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=modified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=MemberReference(member=modified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=||)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None))), label=None)
return[member[.modified]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[addAll] operator[SEP] identifier[Collection] operator[<] identifier[E] operator[>] identifier[items] operator[SEP] {
Keyword[boolean] identifier[modified] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[E] identifier[e] operator[:] identifier[items] operator[SEP] {
identifier[modified] operator[=] identifier[add] operator[SEP] identifier[e] operator[SEP] operator[||] identifier[modified] operator[SEP]
}
Keyword[return] identifier[modified] operator[SEP]
}
|
public static base_response update(nitro_service client, pqpolicy resource) throws Exception {
pqpolicy updateresource = new pqpolicy();
updateresource.policyname = resource.policyname;
updateresource.weight = resource.weight;
updateresource.qdepth = resource.qdepth;
updateresource.polqdepth = resource.polqdepth;
return updateresource.update_resource(client);
}
|
class class_name[name] begin[{]
method[update, return_type[type[base_response]], modifier[public static], parameter[client, resource]] begin[{]
local_variable[type[pqpolicy], updateresource]
assign[member[updateresource.policyname], member[resource.policyname]]
assign[member[updateresource.weight], member[resource.weight]]
assign[member[updateresource.qdepth], member[resource.qdepth]]
assign[member[updateresource.polqdepth], member[resource.polqdepth]]
return[call[updateresource.update_resource, parameter[member[.client]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[base_response] identifier[update] operator[SEP] identifier[nitro_service] identifier[client] , identifier[pqpolicy] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[pqpolicy] identifier[updateresource] operator[=] Keyword[new] identifier[pqpolicy] operator[SEP] operator[SEP] operator[SEP] identifier[updateresource] operator[SEP] identifier[policyname] operator[=] identifier[resource] operator[SEP] identifier[policyname] operator[SEP] identifier[updateresource] operator[SEP] identifier[weight] operator[=] identifier[resource] operator[SEP] identifier[weight] operator[SEP] identifier[updateresource] operator[SEP] identifier[qdepth] operator[=] identifier[resource] operator[SEP] identifier[qdepth] operator[SEP] identifier[updateresource] operator[SEP] identifier[polqdepth] operator[=] identifier[resource] operator[SEP] identifier[polqdepth] operator[SEP] Keyword[return] identifier[updateresource] operator[SEP] identifier[update_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP]
}
|
public void write(OutputStream out)
throws IOException
{
Writer writer = new OutputStreamWriter(out);
write(writer);
writer.flush();
}
|
class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[out]] begin[{]
local_variable[type[Writer], writer]
call[.write, parameter[member[.writer]]]
call[writer.flush, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[write] operator[SEP] identifier[OutputStream] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Writer] identifier[writer] operator[=] Keyword[new] identifier[OutputStreamWriter] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[write] operator[SEP] identifier[writer] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
|
public static double[] readTS(BufferedReader br, int columnIdx, int sizeLimit)
throws IOException, SAXException {
ArrayList<Double> preRes = new ArrayList<Double>();
int lineCounter = 0;
String line = null;
while ((line = br.readLine()) != null) {
String[] split = line.trim().split("\\s+");
if (split.length < columnIdx) {
String message = "Unable to read data from column " + columnIdx;
br.close();
throw new SAXException(message);
}
String str = split[columnIdx];
double num = Double.NaN;
try {
num = Double.valueOf(str);
}
catch (NumberFormatException e) {
LOGGER.info("Skipping the row " + lineCounter + " with value \"" + str + "\"");
continue;
}
preRes.add(num);
lineCounter++;
if ((0 != sizeLimit) && (lineCounter >= sizeLimit)) {
break;
}
}
br.close();
double[] res = new double[preRes.size()];
for (int i = 0; i < preRes.size(); i++) {
res[i] = preRes.get(i);
}
return res;
}
|
class class_name[name] begin[{]
method[readTS, return_type[type[double]], modifier[public static], parameter[br, columnIdx, sizeLimit]] begin[{]
local_variable[type[ArrayList], preRes]
local_variable[type[int], lineCounter]
local_variable[type[String], line]
while[binary_operation[assign[member[.line], call[br.readLine, parameter[]]], !=, literal[null]]] begin[{]
local_variable[type[String], split]
if[binary_operation[member[split.length], <, member[.columnIdx]]] begin[{]
local_variable[type[String], message]
call[br.close, parameter[]]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=message, 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=SAXException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], str]
local_variable[type[double], num]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=num, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Skipping the row "), operandr=MemberReference(member=lineCounter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" with value \""), operator=+), operandr=MemberReference(member=str, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\""), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
call[preRes.add, parameter[member[.num]]]
member[.lineCounter]
if[binary_operation[binary_operation[literal[0], !=, member[.sizeLimit]], &&, binary_operation[member[.lineCounter], >=, member[.sizeLimit]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
call[br.close, parameter[]]
local_variable[type[double], res]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=res, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=preRes, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=preRes, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.res]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[double] operator[SEP] operator[SEP] identifier[readTS] operator[SEP] identifier[BufferedReader] identifier[br] , Keyword[int] identifier[columnIdx] , Keyword[int] identifier[sizeLimit] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SAXException] {
identifier[ArrayList] operator[<] identifier[Double] operator[>] identifier[preRes] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Double] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[lineCounter] operator[=] Other[0] operator[SEP] identifier[String] identifier[line] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[br] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[split] operator[=] identifier[line] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[split] operator[SEP] identifier[length] operator[<] identifier[columnIdx] operator[SEP] {
identifier[String] identifier[message] operator[=] literal[String] operator[+] identifier[columnIdx] operator[SEP] identifier[br] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SAXException] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
identifier[String] identifier[str] operator[=] identifier[split] operator[SEP] identifier[columnIdx] operator[SEP] operator[SEP] Keyword[double] identifier[num] operator[=] identifier[Double] operator[SEP] identifier[NaN] operator[SEP] Keyword[try] {
identifier[num] operator[=] identifier[Double] operator[SEP] identifier[valueOf] operator[SEP] identifier[str] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[lineCounter] operator[+] literal[String] operator[+] identifier[str] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[preRes] operator[SEP] identifier[add] operator[SEP] identifier[num] operator[SEP] operator[SEP] identifier[lineCounter] operator[++] operator[SEP] Keyword[if] operator[SEP] operator[SEP] Other[0] operator[!=] identifier[sizeLimit] operator[SEP] operator[&&] operator[SEP] identifier[lineCounter] operator[>=] identifier[sizeLimit] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
}
identifier[br] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[res] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[preRes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[preRes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[res] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[preRes] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] identifier[res] operator[SEP]
}
|
public Translation addTranslation(String locale, String value, boolean isApproximate) {
LocaleCodeSpecification.assertCode(locale);
if (isBlank(value)) {
throw new IllegalArgumentException("The translation can't be blank");
}
Translation translation = createOrUpdateTranslation(locale, value, isApproximate);
checkOutdatedStatus();
return translation;
}
|
class class_name[name] begin[{]
method[addTranslation, return_type[type[Translation]], modifier[public], parameter[locale, value, isApproximate]] begin[{]
call[LocaleCodeSpecification.assertCode, parameter[member[.locale]]]
if[call[.isBlank, parameter[member[.value]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The translation can't be blank")], 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[Translation], translation]
call[.checkOutdatedStatus, parameter[]]
return[member[.translation]]
end[}]
END[}]
|
Keyword[public] identifier[Translation] identifier[addTranslation] operator[SEP] identifier[String] identifier[locale] , identifier[String] identifier[value] , Keyword[boolean] identifier[isApproximate] operator[SEP] {
identifier[LocaleCodeSpecification] operator[SEP] identifier[assertCode] operator[SEP] identifier[locale] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isBlank] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Translation] identifier[translation] operator[=] identifier[createOrUpdateTranslation] operator[SEP] identifier[locale] , identifier[value] , identifier[isApproximate] operator[SEP] operator[SEP] identifier[checkOutdatedStatus] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[translation] operator[SEP]
}
|
@NullSafe
protected boolean isRunning(ServerSocket serverSocket) {
return Optional.ofNullable(serverSocket)
.map(localServerSocket -> !localServerSocket.isClosed() && localServerSocket.isBound())
.orElse(false);
}
|
class class_name[name] begin[{]
method[isRunning, return_type[type[boolean]], modifier[protected], parameter[serverSocket]] begin[{]
return[call[Optional.ofNullable, parameter[member[.serverSocket]]]]
end[}]
END[}]
|
annotation[@] identifier[NullSafe] Keyword[protected] Keyword[boolean] identifier[isRunning] operator[SEP] identifier[ServerSocket] identifier[serverSocket] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[ofNullable] operator[SEP] identifier[serverSocket] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[localServerSocket] operator[->] operator[!] identifier[localServerSocket] operator[SEP] identifier[isClosed] operator[SEP] operator[SEP] operator[&&] identifier[localServerSocket] operator[SEP] identifier[isBound] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
public String getFormatString(Locale locale, String key) {
String[] suffixes = toStrings(locale);
while(true) {
for (int i=0; i<suffixes.length; i++) {
String suffix = suffixes[i];
String msg = get(suffix).getProperty(key);
if(msg!=null && msg.length()>0)
// ignore a definition without value, because stapler:i18n generates
// value-less definitions
return msg;
int idx = suffix.lastIndexOf('_');
if(idx<0) // failed to find
return null;
suffixes[i] = suffix.substring(0,idx);
}
}
}
|
class class_name[name] begin[{]
method[getFormatString, return_type[type[String]], modifier[public], parameter[locale, key]] begin[{]
local_variable[type[String], suffixes]
while[literal[true]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=suffixes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=suffix)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=suffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operator=&&), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='_')], member=lastIndexOf, postfix_operators=[], prefix_operators=[], qualifier=suffix, selectors=[], type_arguments=None), name=idx)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=idx, 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=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=suffixes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=suffix, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=suffixes, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getFormatString] operator[SEP] identifier[Locale] identifier[locale] , identifier[String] identifier[key] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[suffixes] operator[=] identifier[toStrings] operator[SEP] identifier[locale] operator[SEP] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[suffixes] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[suffix] operator[=] identifier[suffixes] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[String] identifier[msg] operator[=] identifier[get] operator[SEP] identifier[suffix] operator[SEP] operator[SEP] identifier[getProperty] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[msg] operator[!=] Other[null] operator[&&] identifier[msg] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[return] identifier[msg] operator[SEP] Keyword[int] identifier[idx] operator[=] identifier[suffix] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[<] Other[0] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[suffixes] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[suffix] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[idx] operator[SEP] operator[SEP]
}
}
}
|
public <T> T handleResponse(Response response, Type returnType) throws ApiException {
if (response.isSuccessful()) {
if (returnType == null || response.code() == 204) {
// returning null if the returnType is not defined,
// or the status code is 204 (No Content)
return null;
} else {
return deserialize(response, returnType);
}
} else {
String respBody = null;
if (response.body() != null) {
try {
respBody = response.body().string();
} catch (IOException e) {
throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
}
}
throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody);
}
}
|
class class_name[name] begin[{]
method[handleResponse, return_type[type[T]], modifier[public], parameter[response, returnType]] begin[{]
if[call[response.isSuccessful, parameter[]]] begin[{]
if[binary_operation[binary_operation[member[.returnType], ==, literal[null]], ||, binary_operation[call[response.code, parameter[]], ==, literal[204]]]] begin[{]
return[literal[null]]
else begin[{]
return[call[.deserialize, parameter[member[.response], member[.returnType]]]]
end[}]
else begin[{]
local_variable[type[String], respBody]
if[binary_operation[call[response.body, parameter[]], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=respBody, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=body, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[MethodInvocation(arguments=[], member=string, 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=[MethodInvocation(arguments=[], member=message, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=code, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=headers, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[MethodInvocation(arguments=[], member=toMultimap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ApiException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=message, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=code, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=headers, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[MethodInvocation(arguments=[], member=toMultimap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=respBody, 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=ApiException, sub_type=None)), label=None)
end[}]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[handleResponse] operator[SEP] identifier[Response] identifier[response] , identifier[Type] identifier[returnType] operator[SEP] Keyword[throws] identifier[ApiException] {
Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[isSuccessful] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[returnType] operator[==] Other[null] operator[||] identifier[response] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[==] Other[204] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[deserialize] operator[SEP] identifier[response] , identifier[returnType] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[String] identifier[respBody] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[respBody] operator[=] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] identifier[string] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ApiException] operator[SEP] identifier[response] operator[SEP] identifier[message] operator[SEP] operator[SEP] , identifier[e] , identifier[response] operator[SEP] identifier[code] operator[SEP] operator[SEP] , identifier[response] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[toMultimap] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[ApiException] operator[SEP] identifier[response] operator[SEP] identifier[message] operator[SEP] operator[SEP] , identifier[response] operator[SEP] identifier[code] operator[SEP] operator[SEP] , identifier[response] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[toMultimap] operator[SEP] operator[SEP] , identifier[respBody] operator[SEP] operator[SEP]
}
}
|
public OvhSnapshot serviceName_partition_partitionName_snapshot_snapshotType_GET(String serviceName, String partitionName, net.minidev.ovh.api.dedicated.storage.OvhSnapshotEnum snapshotType) throws IOException {
String qPath = "/dedicated/nasha/{serviceName}/partition/{partitionName}/snapshot/{snapshotType}";
StringBuilder sb = path(qPath, serviceName, partitionName, snapshotType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSnapshot.class);
}
|
class class_name[name] begin[{]
method[serviceName_partition_partitionName_snapshot_snapshotType_GET, return_type[type[OvhSnapshot]], modifier[public], parameter[serviceName, partitionName, snapshotType]] 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=OvhSnapshot, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[OvhSnapshot] identifier[serviceName_partition_partitionName_snapshot_snapshotType_GET] operator[SEP] identifier[String] identifier[serviceName] , identifier[String] identifier[partitionName] , identifier[net] operator[SEP] identifier[minidev] operator[SEP] identifier[ovh] operator[SEP] identifier[api] operator[SEP] identifier[dedicated] operator[SEP] identifier[storage] operator[SEP] identifier[OvhSnapshotEnum] identifier[snapshotType] 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] , identifier[partitionName] , identifier[snapshotType] 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[OvhSnapshot] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public CertPath engineGenerateCertPath(InputStream inStream,
String encoding) throws CertificateException
{
if (inStream == null) {
throw new CertificateException("Missing input stream");
}
try {
byte[] data = readOneBlock(inStream);
if (data != null) {
return new X509CertPath(new ByteArrayInputStream(data), encoding);
} else {
throw new IOException("Empty input");
}
} catch (IOException ioe) {
throw new CertificateException(ioe.getMessage());
}
}
|
class class_name[name] begin[{]
method[engineGenerateCertPath, return_type[type[CertPath]], modifier[public], parameter[inStream, encoding]] begin[{]
if[binary_operation[member[.inStream], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing input stream")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CertificateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=inStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readOneBlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=data)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Empty input")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=data, 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=ByteArrayInputStream, sub_type=None)), MemberReference(member=encoding, 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=X509CertPath, sub_type=None)), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ioe, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CertificateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ioe, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[CertPath] identifier[engineGenerateCertPath] operator[SEP] identifier[InputStream] identifier[inStream] , identifier[String] identifier[encoding] operator[SEP] Keyword[throws] identifier[CertificateException] {
Keyword[if] operator[SEP] identifier[inStream] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CertificateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[readOneBlock] operator[SEP] identifier[inStream] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[X509CertPath] operator[SEP] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[data] operator[SEP] , identifier[encoding] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ioe] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CertificateException] operator[SEP] identifier[ioe] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static <T> T median(List<? extends T> data, Comparator<? super T> comparator) {
return median(data, comparator, 0, data.size());
}
|
class class_name[name] begin[{]
method[median, return_type[type[T]], modifier[public static], parameter[data, comparator]] begin[{]
return[call[.median, parameter[member[.data], member[.comparator], literal[0], call[data.size, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[median] operator[SEP] identifier[List] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] identifier[data] , identifier[Comparator] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[comparator] operator[SEP] {
Keyword[return] identifier[median] operator[SEP] identifier[data] , identifier[comparator] , Other[0] , identifier[data] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public List<? extends Trigger> getTriggers(JobKey jobKey) throws SchedulerException {
List<Trigger> triggers = new ArrayList<>();
if (!CollectionUtils.isEmpty(scheduler.getTriggersOfJob(jobKey))) {
triggers.addAll(scheduler.getTriggersOfJob(jobKey));
Collections.sort(triggers, new Comparator<Trigger>() {
@Override
public int compare(Trigger o1, Trigger o2) {
return o1.getKey().compareTo(o2.getKey());
}
});
}
return triggers;
}
|
class class_name[name] begin[{]
method[getTriggers, return_type[type[List]], modifier[public], parameter[jobKey]] begin[{]
local_variable[type[List], triggers]
if[call[CollectionUtils.isEmpty, parameter[call[scheduler.getTriggersOfJob, parameter[member[.jobKey]]]]]] begin[{]
call[triggers.addAll, parameter[call[scheduler.getTriggersOfJob, parameter[member[.jobKey]]]]]
call[Collections.sort, parameter[member[.triggers], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=o1, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=o2, selectors=[], type_arguments=None)], member=compareTo, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=compare, parameters=[FormalParameter(annotations=[], modifiers=set(), name=o1, type=ReferenceType(arguments=None, dimensions=[], name=Trigger, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=o2, type=ReferenceType(arguments=None, dimensions=[], name=Trigger, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Trigger, sub_type=None))], dimensions=None, name=Comparator, sub_type=None))]]
else begin[{]
None
end[}]
return[member[.triggers]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] operator[?] Keyword[extends] identifier[Trigger] operator[>] identifier[getTriggers] operator[SEP] identifier[JobKey] identifier[jobKey] operator[SEP] Keyword[throws] identifier[SchedulerException] {
identifier[List] operator[<] identifier[Trigger] operator[>] identifier[triggers] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[CollectionUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[scheduler] operator[SEP] identifier[getTriggersOfJob] operator[SEP] identifier[jobKey] operator[SEP] operator[SEP] operator[SEP] {
identifier[triggers] operator[SEP] identifier[addAll] operator[SEP] identifier[scheduler] operator[SEP] identifier[getTriggersOfJob] operator[SEP] identifier[jobKey] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[triggers] , Keyword[new] identifier[Comparator] operator[<] identifier[Trigger] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[Trigger] identifier[o1] , identifier[Trigger] identifier[o2] operator[SEP] {
Keyword[return] identifier[o1] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[o2] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[return] identifier[triggers] operator[SEP]
}
|
@Nonnull
public static <T> LTernaryOperatorBuilder<T> ternaryOperator(Consumer<LTernaryOperator<T>> consumer) {
return new LTernaryOperatorBuilder(consumer);
}
|
class class_name[name] begin[{]
method[ternaryOperator, return_type[type[LTernaryOperatorBuilder]], modifier[public static], parameter[consumer]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=consumer, 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=LTernaryOperatorBuilder, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[LTernaryOperatorBuilder] operator[<] identifier[T] operator[>] identifier[ternaryOperator] operator[SEP] identifier[Consumer] operator[<] identifier[LTernaryOperator] operator[<] identifier[T] operator[>] operator[>] identifier[consumer] operator[SEP] {
Keyword[return] Keyword[new] identifier[LTernaryOperatorBuilder] operator[SEP] identifier[consumer] operator[SEP] operator[SEP]
}
|
final void printAsciiBucket(final StringBuilder out, final int i) {
out.append('[')
.append(bucketLowInterval(i))
.append('-')
.append(i == buckets.length - 1 ? "Inf" : bucketHighInterval(i))
.append("): ")
.append(buckets[i])
.append('\n');
}
|
class class_name[name] begin[{]
method[printAsciiBucket, return_type[void], modifier[final], parameter[out, i]] begin[{]
call[out.append, parameter[literal['[']]]
end[}]
END[}]
|
Keyword[final] Keyword[void] identifier[printAsciiBucket] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[out] , Keyword[final] Keyword[int] identifier[i] operator[SEP] {
identifier[out] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[bucketLowInterval] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[i] operator[==] identifier[buckets] operator[SEP] identifier[length] operator[-] Other[1] operator[?] literal[String] operator[:] identifier[bucketHighInterval] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[buckets] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
@Override
public <E extends R> boolean exists(final UniqueKey<E> uniqueKey) {
boolean res;
synchronized (this.componentMap) {
// Check from singleton map it he key exists and if the weak reference is not null
res = this.componentMap.containsKey(uniqueKey) && !this.componentMap.get(uniqueKey).isEmpty();
}
return res;
}
|
class class_name[name] begin[{]
method[exists, return_type[type[boolean]], modifier[public], parameter[uniqueKey]] begin[{]
local_variable[type[boolean], res]
SYNCHRONIZED[THIS[member[None.componentMap]]] BEGIN[{]
assign[member[.res], binary_operation[THIS[member[None.componentMap]call[None.containsKey, parameter[member[.uniqueKey]]]], &&, THIS[member[None.componentMap]call[None.get, parameter[member[.uniqueKey]]]call[None.isEmpty, parameter[]]]]]
END[}]
return[member[.res]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] operator[<] identifier[E] Keyword[extends] identifier[R] operator[>] Keyword[boolean] identifier[exists] operator[SEP] Keyword[final] identifier[UniqueKey] operator[<] identifier[E] operator[>] identifier[uniqueKey] operator[SEP] {
Keyword[boolean] identifier[res] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] identifier[componentMap] operator[SEP] {
identifier[res] operator[=] Keyword[this] operator[SEP] identifier[componentMap] operator[SEP] identifier[containsKey] operator[SEP] identifier[uniqueKey] operator[SEP] operator[&&] operator[!] Keyword[this] operator[SEP] identifier[componentMap] operator[SEP] identifier[get] operator[SEP] identifier[uniqueKey] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[res] operator[SEP]
}
|
@SuppressWarnings("unchecked")
protected Constructor resolveCompatibleConstructor(final Class<?> objectType, final Class<?>[] parameterTypes) {
for (Constructor constructor : objectType.getConstructors()) {
Class[] constructorParameterTypes = constructor.getParameterTypes();
if (parameterTypes.length == constructorParameterTypes.length) {
boolean match = true;
for (int index = 0; index < constructorParameterTypes.length; index++) {
match &= constructorParameterTypes[index].isAssignableFrom(parameterTypes[index]);
}
if (match) {
return constructor;
}
}
}
return null;
}
|
class class_name[name] begin[{]
method[resolveCompatibleConstructor, return_type[type[Constructor]], modifier[protected], parameter[objectType, parameterTypes]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=constructor, selectors=[], type_arguments=None), name=constructorParameterTypes)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=Class, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=parameterTypes, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=constructorParameterTypes, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), name=match)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=&=, value=MemberReference(member=constructorParameterTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=parameterTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=constructorParameterTypes, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=index, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), IfStatement(condition=MemberReference(member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=constructor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getConstructors, postfix_operators=[], prefix_operators=[], qualifier=objectType, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=constructor)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Constructor, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] identifier[Constructor] identifier[resolveCompatibleConstructor] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[objectType] , Keyword[final] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[parameterTypes] operator[SEP] {
Keyword[for] operator[SEP] identifier[Constructor] identifier[constructor] operator[:] identifier[objectType] operator[SEP] identifier[getConstructors] operator[SEP] operator[SEP] operator[SEP] {
identifier[Class] operator[SEP] operator[SEP] identifier[constructorParameterTypes] operator[=] identifier[constructor] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[parameterTypes] operator[SEP] identifier[length] operator[==] identifier[constructorParameterTypes] operator[SEP] identifier[length] operator[SEP] {
Keyword[boolean] identifier[match] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[index] operator[=] Other[0] operator[SEP] identifier[index] operator[<] identifier[constructorParameterTypes] operator[SEP] identifier[length] operator[SEP] identifier[index] operator[++] operator[SEP] {
identifier[match] operator[&=] identifier[constructorParameterTypes] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[parameterTypes] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[match] operator[SEP] {
Keyword[return] identifier[constructor] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public List<Execution> getSpecificationExecutions(Specification specification, SystemUnderTest sut, int maxResults) throws GreenPepperServerException {
try {
sessionService.startSession();
/*
* Repository repository = loadRepository(specification.getRepository().getUid());
* verifyRepositoryPermission(repository, Permission.READ);
*/
return documentDao.getSpecificationExecutions(specification, sut, maxResults);
} catch (Exception ex) {
throw handleException(RETRIEVE_EXECUTIONS, ex);
} finally {
sessionService.closeSession();
}
}
|
class class_name[name] begin[{]
method[getSpecificationExecutions, return_type[type[List]], modifier[public], parameter[specification, sut, maxResults]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=startSession, postfix_operators=[], prefix_operators=[], qualifier=sessionService, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=specification, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=maxResults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSpecificationExecutions, postfix_operators=[], prefix_operators=[], qualifier=documentDao, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=RETRIEVE_EXECUTIONS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=closeSession, postfix_operators=[], prefix_operators=[], qualifier=sessionService, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[Execution] operator[>] identifier[getSpecificationExecutions] operator[SEP] identifier[Specification] identifier[specification] , identifier[SystemUnderTest] identifier[sut] , Keyword[int] identifier[maxResults] operator[SEP] Keyword[throws] identifier[GreenPepperServerException] {
Keyword[try] {
identifier[sessionService] operator[SEP] identifier[startSession] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[documentDao] operator[SEP] identifier[getSpecificationExecutions] operator[SEP] identifier[specification] , identifier[sut] , identifier[maxResults] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] identifier[handleException] operator[SEP] identifier[RETRIEVE_EXECUTIONS] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[sessionService] operator[SEP] identifier[closeSession] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void maybeSetProperty(final String name, final String value) {
if (System.getProperty(name) == null) {
System.setProperty(name, value);
}
}
|
class class_name[name] begin[{]
method[maybeSetProperty, return_type[void], modifier[private], parameter[name, value]] begin[{]
if[binary_operation[call[System.getProperty, parameter[member[.name]]], ==, literal[null]]] begin[{]
call[System.setProperty, parameter[member[.name], member[.value]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[maybeSetProperty] operator[SEP] Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[name] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[setProperty] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP]
}
}
|
public Map<String, Double> extractAmounts(XTrace trace) {
return XCostAmount.instance().extractValues(trace);
}
|
class class_name[name] begin[{]
method[extractAmounts, return_type[type[Map]], modifier[public], parameter[trace]] begin[{]
return[call[XCostAmount.instance, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Double] operator[>] identifier[extractAmounts] operator[SEP] identifier[XTrace] identifier[trace] operator[SEP] {
Keyword[return] identifier[XCostAmount] operator[SEP] identifier[instance] operator[SEP] operator[SEP] operator[SEP] identifier[extractValues] operator[SEP] identifier[trace] operator[SEP] operator[SEP]
}
|
public static Writable encodeHex(final byte[] data) {
return new Writable() {
public Writer writeTo(Writer out) throws IOException {
for (int i = 0; i < data.length; i++) {
// convert byte into unsigned hex string
String hexString = Integer.toHexString(data[i] & 0xFF);
// add leading zero if the length of the string is one
if (hexString.length() < 2) {
out.write("0");
}
// write hex string to writer
out.write(hexString);
}
return out;
}
public String toString() {
StringWriter buffer = new StringWriter();
try {
writeTo(buffer);
} catch (IOException e) {
throw new StringWriterIOException(e);
}
return buffer.toString();
}
};
}
|
class class_name[name] begin[{]
method[encodeHex, return_type[type[Writable]], modifier[public static], parameter[data]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=data, 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=0xFF), operator=&)], member=toHexString, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=hexString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=hexString, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="0")], member=write, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=hexString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=data, 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), ReturnStatement(expression=MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=writeTo, parameters=[FormalParameter(annotations=[], modifiers=set(), name=out, type=ReferenceType(arguments=None, dimensions=[], name=Writer, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Writer, sub_type=None), throws=['IOException'], type_parameters=None), MethodDeclaration(annotations=[], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringWriter, sub_type=None)), name=buffer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringWriter, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeTo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringWriterIOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), 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=Writable, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Writable] identifier[encodeHex] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[SEP] {
Keyword[return] Keyword[new] identifier[Writable] operator[SEP] operator[SEP] {
Keyword[public] identifier[Writer] identifier[writeTo] operator[SEP] identifier[Writer] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[data] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[hexString] operator[=] identifier[Integer] operator[SEP] identifier[toHexString] operator[SEP] identifier[data] operator[SEP] identifier[i] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hexString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<] Other[2] operator[SEP] {
identifier[out] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[hexString] operator[SEP] operator[SEP]
}
Keyword[return] identifier[out] operator[SEP]
}
Keyword[public] identifier[String] identifier[toString] operator[SEP] operator[SEP] {
identifier[StringWriter] identifier[buffer] operator[=] Keyword[new] identifier[StringWriter] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[writeTo] operator[SEP] identifier[buffer] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[StringWriterIOException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[buffer] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public static void addFilter(Document doc, Element root) {
Element filter = doc.createElement("filter");
Element filterName = doc.createElement("filter-name");
filterName.appendChild(doc.createTextNode("ShiroFilter"));
filter.appendChild(filterName);
Element filterClass = doc.createElement("filter-class");
filterClass.appendChild(doc
.createTextNode("org.apache.shiro.web.servlet.ShiroFilter"));
filter.appendChild(filterClass);
addRelativeTo(root, filter, "filter", true);
}
|
class class_name[name] begin[{]
method[addFilter, return_type[void], modifier[public static], parameter[doc, root]] begin[{]
local_variable[type[Element], filter]
local_variable[type[Element], filterName]
call[filterName.appendChild, parameter[call[doc.createTextNode, parameter[literal["ShiroFilter"]]]]]
call[filter.appendChild, parameter[member[.filterName]]]
local_variable[type[Element], filterClass]
call[filterClass.appendChild, parameter[call[doc.createTextNode, parameter[literal["org.apache.shiro.web.servlet.ShiroFilter"]]]]]
call[filter.appendChild, parameter[member[.filterClass]]]
call[.addRelativeTo, parameter[member[.root], member[.filter], literal["filter"], literal[true]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[addFilter] operator[SEP] identifier[Document] identifier[doc] , identifier[Element] identifier[root] operator[SEP] {
identifier[Element] identifier[filter] operator[=] identifier[doc] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Element] identifier[filterName] operator[=] identifier[doc] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[filterName] operator[SEP] identifier[appendChild] operator[SEP] identifier[doc] operator[SEP] identifier[createTextNode] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[appendChild] operator[SEP] identifier[filterName] operator[SEP] operator[SEP] identifier[Element] identifier[filterClass] operator[=] identifier[doc] operator[SEP] identifier[createElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[filterClass] operator[SEP] identifier[appendChild] operator[SEP] identifier[doc] operator[SEP] identifier[createTextNode] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[appendChild] operator[SEP] identifier[filterClass] operator[SEP] operator[SEP] identifier[addRelativeTo] operator[SEP] identifier[root] , identifier[filter] , literal[String] , literal[boolean] operator[SEP] operator[SEP]
}
|
void processAlterTableRename(Table table) {
HsqlName name = readNewSchemaObjectName(SchemaObject.TABLE);
name.setSchemaIfNull(table.getSchemaName());
if (table.getSchemaName() != name.schema) {
throw Error.error(ErrorCode.X_42505);
}
database.schemaManager.renameSchemaObject(table.getName(), name);
}
|
class class_name[name] begin[{]
method[processAlterTableRename, return_type[void], modifier[default], parameter[table]] begin[{]
local_variable[type[HsqlName], name]
call[name.setSchemaIfNull, parameter[call[table.getSchemaName, parameter[]]]]
if[binary_operation[call[table.getSchemaName, parameter[]], !=, member[name.schema]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=X_42505, postfix_operators=[], prefix_operators=[], qualifier=ErrorCode, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=Error, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
call[database.schemaManager.renameSchemaObject, parameter[call[table.getName, parameter[]], member[.name]]]
end[}]
END[}]
|
Keyword[void] identifier[processAlterTableRename] operator[SEP] identifier[Table] identifier[table] operator[SEP] {
identifier[HsqlName] identifier[name] operator[=] identifier[readNewSchemaObjectName] operator[SEP] identifier[SchemaObject] operator[SEP] identifier[TABLE] operator[SEP] operator[SEP] identifier[name] operator[SEP] identifier[setSchemaIfNull] operator[SEP] identifier[table] operator[SEP] identifier[getSchemaName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[table] operator[SEP] identifier[getSchemaName] operator[SEP] operator[SEP] operator[!=] identifier[name] operator[SEP] identifier[schema] operator[SEP] {
Keyword[throw] identifier[Error] operator[SEP] identifier[error] operator[SEP] identifier[ErrorCode] operator[SEP] identifier[X_42505] operator[SEP] operator[SEP]
}
identifier[database] operator[SEP] identifier[schemaManager] operator[SEP] identifier[renameSchemaObject] operator[SEP] identifier[table] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[name] operator[SEP] operator[SEP]
}
|
public static Type[] getGenerics(final Type type, final Map<String, Type> generics) {
Type[] res = NO_TYPES;
Type analyzingType = type;
if (type instanceof TypeVariable) {
// if type is pure generic recovering parametrization
analyzingType = declaredGeneric((TypeVariable) type, generics);
}
if ((analyzingType instanceof ParameterizedType)
&& ((ParameterizedType) analyzingType).getActualTypeArguments().length > 0) {
res = ((ParameterizedType) analyzingType).getActualTypeArguments();
} else if (type instanceof Class) {
// if type is class return raw declaration
final Class<?> actual = (Class<?>) analyzingType;
if (actual.getTypeParameters().length > 0) {
res = GenericsResolutionUtils.resolveDirectRawGenerics(actual)
.values().toArray(new Type[0]);
}
}
return res;
}
|
class class_name[name] begin[{]
method[getGenerics, return_type[type[Type]], modifier[public static], parameter[type, generics]] begin[{]
local_variable[type[Type], res]
local_variable[type[Type], analyzingType]
if[binary_operation[member[.type], instanceof, type[TypeVariable]]] begin[{]
assign[member[.analyzingType], call[.declaredGeneric, parameter[Cast(expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=TypeVariable, sub_type=None)), member[.generics]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.analyzingType], instanceof, type[ParameterizedType]], &&, binary_operation[Cast(expression=MemberReference(member=analyzingType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ParameterizedType, sub_type=None)), >, literal[0]]]] begin[{]
assign[member[.res], Cast(expression=MemberReference(member=analyzingType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ParameterizedType, sub_type=None))]
else begin[{]
if[binary_operation[member[.type], instanceof, type[Class]]] begin[{]
local_variable[type[Class], actual]
if[binary_operation[call[actual.getTypeParameters, parameter[]], >, literal[0]]] begin[{]
assign[member[.res], call[GenericsResolutionUtils.resolveDirectRawGenerics, parameter[member[.actual]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
return[member[.res]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Type] operator[SEP] operator[SEP] identifier[getGenerics] operator[SEP] Keyword[final] identifier[Type] identifier[type] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Type] operator[>] identifier[generics] operator[SEP] {
identifier[Type] operator[SEP] operator[SEP] identifier[res] operator[=] identifier[NO_TYPES] operator[SEP] identifier[Type] identifier[analyzingType] operator[=] identifier[type] operator[SEP] Keyword[if] operator[SEP] identifier[type] Keyword[instanceof] identifier[TypeVariable] operator[SEP] {
identifier[analyzingType] operator[=] identifier[declaredGeneric] operator[SEP] operator[SEP] identifier[TypeVariable] operator[SEP] identifier[type] , identifier[generics] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[analyzingType] Keyword[instanceof] identifier[ParameterizedType] operator[SEP] operator[&&] operator[SEP] operator[SEP] identifier[ParameterizedType] operator[SEP] identifier[analyzingType] operator[SEP] operator[SEP] identifier[getActualTypeArguments] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[res] operator[=] operator[SEP] operator[SEP] identifier[ParameterizedType] operator[SEP] identifier[analyzingType] operator[SEP] operator[SEP] identifier[getActualTypeArguments] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] Keyword[instanceof] identifier[Class] operator[SEP] {
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[actual] operator[=] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] identifier[analyzingType] operator[SEP] Keyword[if] operator[SEP] identifier[actual] operator[SEP] identifier[getTypeParameters] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[res] operator[=] identifier[GenericsResolutionUtils] operator[SEP] identifier[resolveDirectRawGenerics] operator[SEP] identifier[actual] operator[SEP] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[Type] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[res] operator[SEP]
}
|
protected Template getTemplate(String name) {
try {
return configuration.getTemplate(name);
} catch (IOException e) {
throw new GenException(Message.DOMAGEN9001, e, e);
}
}
|
class class_name[name] begin[{]
method[getTemplate, return_type[type[Template]], modifier[protected], parameter[name]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTemplate, postfix_operators=[], prefix_operators=[], qualifier=configuration, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=DOMAGEN9001, postfix_operators=[], prefix_operators=[], qualifier=Message, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=GenException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[protected] identifier[Template] identifier[getTemplate] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[configuration] operator[SEP] identifier[getTemplate] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[GenException] operator[SEP] identifier[Message] operator[SEP] identifier[DOMAGEN9001] , identifier[e] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static <X> List<X> mostVotedFor(Map<X, Double> votes) {
// Choose the label with the greatest number of votes
// If there is a tie, choose the one with the least index
double maxTalley = Double.NEGATIVE_INFINITY;
List<X> maxTickets = new ArrayList<X>();
for(Entry<X,Double> entry : votes.entrySet()) {
X ticket = entry.getKey();
double talley = entry.getValue();
if (talley > maxTalley) {
maxTickets = new ArrayList<X>();
maxTickets.add(ticket);
maxTalley = talley;
} else if (talley == maxTalley) {
maxTickets.add(ticket);
}
}
return maxTickets;
}
|
class class_name[name] begin[{]
method[mostVotedFor, return_type[type[List]], modifier[public static], parameter[votes]] begin[{]
local_variable[type[double], maxTalley]
local_variable[type[List], maxTickets]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=ticket)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=X, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=talley)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=talley, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxTalley, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=talley, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maxTalley, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ticket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=maxTickets, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxTickets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=X, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ticket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=maxTickets, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxTalley, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=talley, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=votes, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=X, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
return[member[.maxTickets]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[X] operator[>] identifier[List] operator[<] identifier[X] operator[>] identifier[mostVotedFor] operator[SEP] identifier[Map] operator[<] identifier[X] , identifier[Double] operator[>] identifier[votes] operator[SEP] {
Keyword[double] identifier[maxTalley] operator[=] identifier[Double] operator[SEP] identifier[NEGATIVE_INFINITY] operator[SEP] identifier[List] operator[<] identifier[X] operator[>] identifier[maxTickets] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[X] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[X] , identifier[Double] operator[>] identifier[entry] operator[:] identifier[votes] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[X] identifier[ticket] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[talley] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[talley] operator[>] identifier[maxTalley] operator[SEP] {
identifier[maxTickets] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[X] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[maxTickets] operator[SEP] identifier[add] operator[SEP] identifier[ticket] operator[SEP] operator[SEP] identifier[maxTalley] operator[=] identifier[talley] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[talley] operator[==] identifier[maxTalley] operator[SEP] {
identifier[maxTickets] operator[SEP] identifier[add] operator[SEP] identifier[ticket] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[maxTickets] operator[SEP]
}
|
public org.openprovenance.prov.model.Value getValue() {
if (value==null) {
if (all!=null) { // TODO: inefficient, I search this list every time getValue is called, though there may be no value
for (Attribute attr: all) {
if (attr instanceof org.openprovenance.prov.model.Value) {
value=(Value)attr;
}
}
}
}
return value;
}
|
class class_name[name] begin[{]
method[getValue, return_type[type[org]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
if[binary_operation[member[.all], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=attr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=org, sub_type=ReferenceType(arguments=None, dimensions=None, name=openprovenance, sub_type=ReferenceType(arguments=None, dimensions=None, name=prov, sub_type=ReferenceType(arguments=None, dimensions=None, name=model, sub_type=ReferenceType(arguments=None, dimensions=None, name=Value, sub_type=None))))), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=attr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Value, sub_type=None))), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=all, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=attr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None))), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}]
|
Keyword[public] identifier[org] operator[SEP] identifier[openprovenance] operator[SEP] identifier[prov] operator[SEP] identifier[model] operator[SEP] identifier[Value] identifier[getValue] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[all] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Attribute] identifier[attr] operator[:] identifier[all] operator[SEP] {
Keyword[if] operator[SEP] identifier[attr] Keyword[instanceof] identifier[org] operator[SEP] identifier[openprovenance] operator[SEP] identifier[prov] operator[SEP] identifier[model] operator[SEP] identifier[Value] operator[SEP] {
identifier[value] operator[=] operator[SEP] identifier[Value] operator[SEP] identifier[attr] operator[SEP]
}
}
}
}
Keyword[return] identifier[value] operator[SEP]
}
|
private String computeTypeFromMappingSource(String source)
throws MtasParserException {
if (source.equals(MtasParserMapping.SOURCE_OWN)) {
return null;
} else if (source.equals(MtasParserMapping.SOURCE_ANCESTOR_GROUP)) {
return MAPPING_TYPE_GROUP;
} else if (source
.equals(MtasParserMapping.SOURCE_ANCESTOR_GROUP_ANNOTATION)) {
return MAPPING_TYPE_GROUP_ANNOTATION;
} else if (source.equals(MtasParserMapping.SOURCE_ANCESTOR_WORD)) {
return MAPPING_TYPE_WORD;
} else if (source
.equals(MtasParserMapping.SOURCE_ANCESTOR_WORD_ANNOTATION)) {
return MAPPING_TYPE_WORD_ANNOTATION;
} else if (source.equals(MtasParserMapping.SOURCE_ANCESTOR_RELATION)) {
return MAPPING_TYPE_RELATION;
} else if (source
.equals(MtasParserMapping.SOURCE_ANCESTOR_RELATION_ANNOTATION)) {
return MAPPING_TYPE_RELATION_ANNOTATION;
} else {
throw new MtasParserException("unknown source " + source);
}
}
|
class class_name[name] begin[{]
method[computeTypeFromMappingSource, return_type[type[String]], modifier[private], parameter[source]] begin[{]
if[call[source.equals, parameter[member[MtasParserMapping.SOURCE_OWN]]]] begin[{]
return[literal[null]]
else begin[{]
if[call[source.equals, parameter[member[MtasParserMapping.SOURCE_ANCESTOR_GROUP]]]] begin[{]
return[member[.MAPPING_TYPE_GROUP]]
else begin[{]
if[call[source.equals, parameter[member[MtasParserMapping.SOURCE_ANCESTOR_GROUP_ANNOTATION]]]] begin[{]
return[member[.MAPPING_TYPE_GROUP_ANNOTATION]]
else begin[{]
if[call[source.equals, parameter[member[MtasParserMapping.SOURCE_ANCESTOR_WORD]]]] begin[{]
return[member[.MAPPING_TYPE_WORD]]
else begin[{]
if[call[source.equals, parameter[member[MtasParserMapping.SOURCE_ANCESTOR_WORD_ANNOTATION]]]] begin[{]
return[member[.MAPPING_TYPE_WORD_ANNOTATION]]
else begin[{]
if[call[source.equals, parameter[member[MtasParserMapping.SOURCE_ANCESTOR_RELATION]]]] begin[{]
return[member[.MAPPING_TYPE_RELATION]]
else begin[{]
if[call[source.equals, parameter[member[MtasParserMapping.SOURCE_ANCESTOR_RELATION_ANNOTATION]]]] begin[{]
return[member[.MAPPING_TYPE_RELATION_ANNOTATION]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unknown source "), operandr=MemberReference(member=source, 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=MtasParserException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] identifier[String] identifier[computeTypeFromMappingSource] operator[SEP] identifier[String] identifier[source] operator[SEP] Keyword[throws] identifier[MtasParserException] {
Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[equals] operator[SEP] identifier[MtasParserMapping] operator[SEP] identifier[SOURCE_OWN] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[equals] operator[SEP] identifier[MtasParserMapping] operator[SEP] identifier[SOURCE_ANCESTOR_GROUP] operator[SEP] operator[SEP] {
Keyword[return] identifier[MAPPING_TYPE_GROUP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[equals] operator[SEP] identifier[MtasParserMapping] operator[SEP] identifier[SOURCE_ANCESTOR_GROUP_ANNOTATION] operator[SEP] operator[SEP] {
Keyword[return] identifier[MAPPING_TYPE_GROUP_ANNOTATION] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[equals] operator[SEP] identifier[MtasParserMapping] operator[SEP] identifier[SOURCE_ANCESTOR_WORD] operator[SEP] operator[SEP] {
Keyword[return] identifier[MAPPING_TYPE_WORD] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[equals] operator[SEP] identifier[MtasParserMapping] operator[SEP] identifier[SOURCE_ANCESTOR_WORD_ANNOTATION] operator[SEP] operator[SEP] {
Keyword[return] identifier[MAPPING_TYPE_WORD_ANNOTATION] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[equals] operator[SEP] identifier[MtasParserMapping] operator[SEP] identifier[SOURCE_ANCESTOR_RELATION] operator[SEP] operator[SEP] {
Keyword[return] identifier[MAPPING_TYPE_RELATION] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[source] operator[SEP] identifier[equals] operator[SEP] identifier[MtasParserMapping] operator[SEP] identifier[SOURCE_ANCESTOR_RELATION_ANNOTATION] operator[SEP] operator[SEP] {
Keyword[return] identifier[MAPPING_TYPE_RELATION_ANNOTATION] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[MtasParserException] operator[SEP] literal[String] operator[+] identifier[source] operator[SEP] operator[SEP]
}
}
|
public COPACNeighborPredicate.Instance instantiate(Database database, Relation<V> relation) {
DistanceQuery<V> dq = database.getDistanceQuery(relation, EuclideanDistanceFunction.STATIC);
KNNQuery<V> knnq = database.getKNNQuery(dq, settings.k);
WritableDataStore<COPACModel> storage = DataStoreUtil.makeStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, COPACModel.class);
Duration time = LOG.newDuration(this.getClass().getName() + ".preprocessing-time").begin();
FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress(this.getClass().getName(), relation.size(), LOG) : null;
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
DoubleDBIDList ref = knnq.getKNNForDBID(iditer, settings.k);
storage.put(iditer, computeLocalModel(iditer, ref, relation));
LOG.incrementProcessed(progress);
}
LOG.ensureCompleted(progress);
LOG.statistics(time.end());
return new Instance(relation.getDBIDs(), storage);
}
|
class class_name[name] begin[{]
method[instantiate, return_type[type[COPACNeighborPredicate]], modifier[public], parameter[database, relation]] begin[{]
local_variable[type[DistanceQuery], dq]
local_variable[type[KNNQuery], knnq]
local_variable[type[WritableDataStore], storage]
local_variable[type[Duration], time]
local_variable[type[FiniteProgress], progress]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=iditer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=settings, selectors=[])], member=getKNNForDBID, postfix_operators=[], prefix_operators=[], qualifier=knnq, selectors=[], type_arguments=None), name=ref)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DoubleDBIDList, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=iditer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=iditer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=relation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=computeLocalModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=storage, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=progress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=incrementProcessed, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=valid, postfix_operators=[], prefix_operators=[], qualifier=iditer, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterDBIDs, postfix_operators=[], prefix_operators=[], qualifier=relation, selectors=[], type_arguments=None), name=iditer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DBIDIter, sub_type=None)), update=[MethodInvocation(arguments=[], member=advance, postfix_operators=[], prefix_operators=[], qualifier=iditer, selectors=[], type_arguments=None)]), label=None)
call[LOG.ensureCompleted, parameter[member[.progress]]]
call[LOG.statistics, parameter[call[time.end, parameter[]]]]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getDBIDs, postfix_operators=[], prefix_operators=[], qualifier=relation, selectors=[], type_arguments=None), MemberReference(member=storage, 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=Instance, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[COPACNeighborPredicate] operator[SEP] identifier[Instance] identifier[instantiate] operator[SEP] identifier[Database] identifier[database] , identifier[Relation] operator[<] identifier[V] operator[>] identifier[relation] operator[SEP] {
identifier[DistanceQuery] operator[<] identifier[V] operator[>] identifier[dq] operator[=] identifier[database] operator[SEP] identifier[getDistanceQuery] operator[SEP] identifier[relation] , identifier[EuclideanDistanceFunction] operator[SEP] identifier[STATIC] operator[SEP] operator[SEP] identifier[KNNQuery] operator[<] identifier[V] operator[>] identifier[knnq] operator[=] identifier[database] operator[SEP] identifier[getKNNQuery] operator[SEP] identifier[dq] , identifier[settings] operator[SEP] identifier[k] operator[SEP] operator[SEP] identifier[WritableDataStore] operator[<] identifier[COPACModel] operator[>] identifier[storage] operator[=] identifier[DataStoreUtil] operator[SEP] identifier[makeStorage] operator[SEP] identifier[relation] operator[SEP] identifier[getDBIDs] operator[SEP] operator[SEP] , identifier[DataStoreFactory] operator[SEP] identifier[HINT_HOT] operator[|] identifier[DataStoreFactory] operator[SEP] identifier[HINT_TEMP] , identifier[COPACModel] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Duration] identifier[time] operator[=] identifier[LOG] operator[SEP] identifier[newDuration] operator[SEP] Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[begin] operator[SEP] operator[SEP] operator[SEP] identifier[FiniteProgress] identifier[progress] operator[=] identifier[LOG] operator[SEP] identifier[isVerbose] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[FiniteProgress] operator[SEP] Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[relation] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[LOG] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[DBIDIter] identifier[iditer] operator[=] identifier[relation] operator[SEP] identifier[iterDBIDs] operator[SEP] operator[SEP] operator[SEP] identifier[iditer] operator[SEP] identifier[valid] operator[SEP] operator[SEP] operator[SEP] identifier[iditer] operator[SEP] identifier[advance] operator[SEP] operator[SEP] operator[SEP] {
identifier[DoubleDBIDList] identifier[ref] operator[=] identifier[knnq] operator[SEP] identifier[getKNNForDBID] operator[SEP] identifier[iditer] , identifier[settings] operator[SEP] identifier[k] operator[SEP] operator[SEP] identifier[storage] operator[SEP] identifier[put] operator[SEP] identifier[iditer] , identifier[computeLocalModel] operator[SEP] identifier[iditer] , identifier[ref] , identifier[relation] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[incrementProcessed] operator[SEP] identifier[progress] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[ensureCompleted] operator[SEP] identifier[progress] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[statistics] operator[SEP] identifier[time] operator[SEP] identifier[end] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Instance] operator[SEP] identifier[relation] operator[SEP] identifier[getDBIDs] operator[SEP] operator[SEP] , identifier[storage] operator[SEP] operator[SEP]
}
|
void insertPath(int pathIndex, Point2D[] points, int pointsOffset,
int count, boolean bForward) {
m_impl.insertPath(pathIndex, points, pointsOffset, count, bForward);
}
|
class class_name[name] begin[{]
method[insertPath, return_type[void], modifier[default], parameter[pathIndex, points, pointsOffset, count, bForward]] begin[{]
call[m_impl.insertPath, parameter[member[.pathIndex], member[.points], member[.pointsOffset], member[.count], member[.bForward]]]
end[}]
END[}]
|
Keyword[void] identifier[insertPath] operator[SEP] Keyword[int] identifier[pathIndex] , identifier[Point2D] operator[SEP] operator[SEP] identifier[points] , Keyword[int] identifier[pointsOffset] , Keyword[int] identifier[count] , Keyword[boolean] identifier[bForward] operator[SEP] {
identifier[m_impl] operator[SEP] identifier[insertPath] operator[SEP] identifier[pathIndex] , identifier[points] , identifier[pointsOffset] , identifier[count] , identifier[bForward] operator[SEP] operator[SEP]
}
|
protected int checkWrite(int length) {
checkWrite(position, length);
int previousPosition = this.position;
this.position = previousPosition + length;
return offset(previousPosition);
}
|
class class_name[name] begin[{]
method[checkWrite, return_type[type[int]], modifier[protected], parameter[length]] begin[{]
call[.checkWrite, parameter[member[.position], member[.length]]]
local_variable[type[int], previousPosition]
assign[THIS[member[None.position]], binary_operation[member[.previousPosition], +, member[.length]]]
return[call[.offset, parameter[member[.previousPosition]]]]
end[}]
END[}]
|
Keyword[protected] Keyword[int] identifier[checkWrite] operator[SEP] Keyword[int] identifier[length] operator[SEP] {
identifier[checkWrite] operator[SEP] identifier[position] , identifier[length] operator[SEP] operator[SEP] Keyword[int] identifier[previousPosition] operator[=] Keyword[this] operator[SEP] identifier[position] operator[SEP] Keyword[this] operator[SEP] identifier[position] operator[=] identifier[previousPosition] operator[+] identifier[length] operator[SEP] Keyword[return] identifier[offset] operator[SEP] identifier[previousPosition] operator[SEP] operator[SEP]
}
|
private void initComponents()//GEN-BEGIN:initComponents
{
jMenuBar1 = new javax.swing.JMenuBar();
mnuFile = new javax.swing.JMenu();
mnuFileSave = new javax.swing.JMenuItem();
jSplitPane1 = new javax.swing.JSplitPane();
jScrollPane1 = new javax.swing.JScrollPane();
jTree1 = new javax.swing.JTree();
jScrlProperty = new javax.swing.JScrollPane();
mnuFile.setMnemonic('F');
mnuFile.setText("File");
mnuFileSave.setAction(new ActionSaveAsOJBRepository(aRepository));
mnuFile.add(mnuFileSave);
jMenuBar1.add(mnuFile);
setClosable(true);
setIconifiable(true);
setMaximizable(true);
setResizable(true);
jTree1.addMouseListener(new java.awt.event.MouseAdapter()
{
public void mousePressed(java.awt.event.MouseEvent evt)
{
jTree1MousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt)
{
jTree1MousePressed(evt);
}
});
jTree1.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener()
{
public void valueChanged(javax.swing.event.TreeSelectionEvent evt)
{
jTree1ValueChanged(evt);
}
});
jScrollPane1.setViewportView(jTree1);
jSplitPane1.setLeftComponent(jScrollPane1);
jSplitPane1.setRightComponent(jScrlProperty);
getContentPane().add(jSplitPane1, java.awt.BorderLayout.CENTER);
pack();
}
|
class class_name[name] begin[{]
method[initComponents, return_type[void], modifier[private], parameter[]] begin[{]
assign[member[.jMenuBar1], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JMenuBar, sub_type=None))))]
assign[member[.mnuFile], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JMenu, sub_type=None))))]
assign[member[.mnuFileSave], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JMenuItem, sub_type=None))))]
assign[member[.jSplitPane1], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JSplitPane, sub_type=None))))]
assign[member[.jScrollPane1], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JScrollPane, sub_type=None))))]
assign[member[.jTree1], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JTree, sub_type=None))))]
assign[member[.jScrlProperty], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=JScrollPane, sub_type=None))))]
call[mnuFile.setMnemonic, parameter[literal['F']]]
call[mnuFile.setText, parameter[literal["File"]]]
call[mnuFileSave.setAction, parameter[ClassCreator(arguments=[MemberReference(member=aRepository, 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=ActionSaveAsOJBRepository, sub_type=None))]]
call[mnuFile.add, parameter[member[.mnuFileSave]]]
call[jMenuBar1.add, parameter[member[.mnuFile]]]
call[.setClosable, parameter[literal[true]]]
call[.setIconifiable, parameter[literal[true]]]
call[.setMaximizable, parameter[literal[true]]]
call[.setResizable, parameter[literal[true]]]
call[jTree1.addMouseListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=evt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=jTree1MousePressed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=mousePressed, parameters=[FormalParameter(annotations=[], modifiers=set(), name=evt, type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=MouseEvent, sub_type=None)))), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=evt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=jTree1MousePressed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=mouseReleased, parameters=[FormalParameter(annotations=[], modifiers=set(), name=evt, type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=MouseEvent, sub_type=None)))), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=awt, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=MouseAdapter, sub_type=None)))))]]
call[jTree1.addTreeSelectionListener, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=evt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=jTree1ValueChanged, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=valueChanged, parameters=[FormalParameter(annotations=[], modifiers=set(), name=evt, type=ReferenceType(arguments=None, dimensions=[], name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=TreeSelectionEvent, sub_type=None)))), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=javax, sub_type=ReferenceType(arguments=None, dimensions=None, name=swing, sub_type=ReferenceType(arguments=None, dimensions=None, name=event, sub_type=ReferenceType(arguments=None, dimensions=None, name=TreeSelectionListener, sub_type=None)))))]]
call[jScrollPane1.setViewportView, parameter[member[.jTree1]]]
call[jSplitPane1.setLeftComponent, parameter[member[.jScrollPane1]]]
call[jSplitPane1.setRightComponent, parameter[member[.jScrlProperty]]]
call[.getContentPane, parameter[]]
call[.pack, parameter[]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[initComponents] operator[SEP] operator[SEP] {
identifier[jMenuBar1] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JMenuBar] operator[SEP] operator[SEP] operator[SEP] identifier[mnuFile] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JMenu] operator[SEP] operator[SEP] operator[SEP] identifier[mnuFileSave] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JMenuItem] operator[SEP] operator[SEP] operator[SEP] identifier[jSplitPane1] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JSplitPane] operator[SEP] operator[SEP] operator[SEP] identifier[jScrollPane1] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JScrollPane] operator[SEP] operator[SEP] operator[SEP] identifier[jTree1] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JTree] operator[SEP] operator[SEP] operator[SEP] identifier[jScrlProperty] operator[=] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[JScrollPane] operator[SEP] operator[SEP] operator[SEP] identifier[mnuFile] operator[SEP] identifier[setMnemonic] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[mnuFile] operator[SEP] identifier[setText] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[mnuFileSave] operator[SEP] identifier[setAction] operator[SEP] Keyword[new] identifier[ActionSaveAsOJBRepository] operator[SEP] identifier[aRepository] operator[SEP] operator[SEP] operator[SEP] identifier[mnuFile] operator[SEP] identifier[add] operator[SEP] identifier[mnuFileSave] operator[SEP] operator[SEP] identifier[jMenuBar1] operator[SEP] identifier[add] operator[SEP] identifier[mnuFile] operator[SEP] operator[SEP] identifier[setClosable] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[setIconifiable] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[setMaximizable] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[setResizable] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[jTree1] operator[SEP] identifier[addMouseListener] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[MouseAdapter] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[mousePressed] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[MouseEvent] identifier[evt] operator[SEP] {
identifier[jTree1MousePressed] operator[SEP] identifier[evt] operator[SEP] operator[SEP]
}
Keyword[public] Keyword[void] identifier[mouseReleased] operator[SEP] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[event] operator[SEP] identifier[MouseEvent] identifier[evt] operator[SEP] {
identifier[jTree1MousePressed] operator[SEP] identifier[evt] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[jTree1] operator[SEP] identifier[addTreeSelectionListener] operator[SEP] Keyword[new] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[event] operator[SEP] identifier[TreeSelectionListener] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[valueChanged] operator[SEP] identifier[javax] operator[SEP] identifier[swing] operator[SEP] identifier[event] operator[SEP] identifier[TreeSelectionEvent] identifier[evt] operator[SEP] {
identifier[jTree1ValueChanged] operator[SEP] identifier[evt] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[jScrollPane1] operator[SEP] identifier[setViewportView] operator[SEP] identifier[jTree1] operator[SEP] operator[SEP] identifier[jSplitPane1] operator[SEP] identifier[setLeftComponent] operator[SEP] identifier[jScrollPane1] operator[SEP] operator[SEP] identifier[jSplitPane1] operator[SEP] identifier[setRightComponent] operator[SEP] identifier[jScrlProperty] operator[SEP] operator[SEP] identifier[getContentPane] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[jSplitPane1] , identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[BorderLayout] operator[SEP] identifier[CENTER] operator[SEP] operator[SEP] identifier[pack] operator[SEP] operator[SEP] operator[SEP]
}
|
public AssetRef retrieveRef(String name) throws IOException, SQLException {
String select = "select definition_id, name, ref from ASSET_REF where name = ?";
try (Connection conn = getDbConnection();
PreparedStatement stmt = conn.prepareStatement(select)) {
stmt.setString(1, name);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
return new AssetRef(name, rs.getLong("definition_id"), rs.getString("ref"));
}
}
}
return null;
}
|
class class_name[name] begin[{]
method[retrieveRef, return_type[type[AssetRef]], modifier[public], parameter[name]] begin[{]
local_variable[type[String], select]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setString, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="definition_id")], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ref")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AssetRef, sub_type=None)), label=None)]))], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=rs, type=ReferenceType(arguments=None, dimensions=[], name=ResultSet, sub_type=None), value=MethodInvocation(arguments=[], member=executeQuery, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None))])], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=conn, type=ReferenceType(arguments=None, dimensions=[], name=Connection, sub_type=None), value=MethodInvocation(arguments=[], member=getDbConnection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), TryResource(annotations=[], modifiers=set(), name=stmt, type=ReferenceType(arguments=None, dimensions=[], name=PreparedStatement, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=select, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None))])
return[literal[null]]
end[}]
END[}]
|
Keyword[public] identifier[AssetRef] identifier[retrieveRef] operator[SEP] identifier[String] identifier[name] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SQLException] {
identifier[String] identifier[select] operator[=] literal[String] operator[SEP] Keyword[try] operator[SEP] identifier[Connection] identifier[conn] operator[=] identifier[getDbConnection] operator[SEP] operator[SEP] operator[SEP] identifier[PreparedStatement] identifier[stmt] operator[=] identifier[conn] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[select] operator[SEP] operator[SEP] {
identifier[stmt] operator[SEP] identifier[setString] operator[SEP] Other[1] , identifier[name] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[ResultSet] identifier[rs] operator[=] identifier[stmt] operator[SEP] identifier[executeQuery] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[rs] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[AssetRef] operator[SEP] identifier[name] , identifier[rs] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] , identifier[rs] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public void setEnableLogTypes(java.util.Collection<String> enableLogTypes) {
if (enableLogTypes == null) {
this.enableLogTypes = null;
return;
}
this.enableLogTypes = new com.amazonaws.internal.SdkInternalList<String>(enableLogTypes);
}
|
class class_name[name] begin[{]
method[setEnableLogTypes, return_type[void], modifier[public], parameter[enableLogTypes]] begin[{]
if[binary_operation[member[.enableLogTypes], ==, literal[null]]] begin[{]
assign[THIS[member[None.enableLogTypes]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.enableLogTypes]], ClassCreator(arguments=[MemberReference(member=enableLogTypes, 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=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setEnableLogTypes] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[enableLogTypes] operator[SEP] {
Keyword[if] operator[SEP] identifier[enableLogTypes] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[enableLogTypes] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[enableLogTypes] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] identifier[enableLogTypes] operator[SEP] operator[SEP]
}
|
public WebFacesUIComponentDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
}
|
class class_name[name] begin[{]
method[addNamespace, return_type[type[WebFacesUIComponentDescriptor]], modifier[public], parameter[name, value]] begin[{]
call[model.attribute, parameter[member[.name], member[.value]]]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[WebFacesUIComponentDescriptor] identifier[addNamespace] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[value] operator[SEP] {
identifier[model] operator[SEP] identifier[attribute] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
protected SimpleSlot getFreeSlotForTask(ExecutionVertex vertex,
Iterable<TaskManagerLocation> requestedLocations,
boolean localOnly) {
// we need potentially to loop multiple times, because there may be false positives
// in the set-with-available-instances
while (true) {
Pair<Instance, Locality> instanceLocalityPair = findInstance(requestedLocations, localOnly);
if (instanceLocalityPair == null){
return null;
}
Instance instanceToUse = instanceLocalityPair.getLeft();
Locality locality = instanceLocalityPair.getRight();
try {
SimpleSlot slot = instanceToUse.allocateSimpleSlot();
// if the instance has further available slots, re-add it to the set of available resources.
if (instanceToUse.hasResourcesAvailable()) {
this.instancesWithAvailableResources.put(instanceToUse.getTaskManagerID(), instanceToUse);
}
if (slot != null) {
slot.setLocality(locality);
return slot;
}
}
catch (InstanceDiedException e) {
// the instance died it has not yet been propagated to this scheduler
// remove the instance from the set of available instances
removeInstance(instanceToUse);
}
// if we failed to get a slot, fall through the loop
}
}
|
class class_name[name] begin[{]
method[getFreeSlotForTask, return_type[type[SimpleSlot]], modifier[protected], parameter[vertex, requestedLocations, localOnly]] begin[{]
while[literal[true]] begin[{]
local_variable[type[Pair], instanceLocalityPair]
if[binary_operation[member[.instanceLocalityPair], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Instance], instanceToUse]
local_variable[type[Locality], locality]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=allocateSimpleSlot, postfix_operators=[], prefix_operators=[], qualifier=instanceToUse, selectors=[], type_arguments=None), name=slot)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SimpleSlot, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=hasResourcesAvailable, postfix_operators=[], prefix_operators=[], qualifier=instanceToUse, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=instancesWithAvailableResources, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTaskManagerID, postfix_operators=[], prefix_operators=[], qualifier=instanceToUse, selectors=[], type_arguments=None), MemberReference(member=instanceToUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=slot, 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=locality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLocality, postfix_operators=[], prefix_operators=[], qualifier=slot, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=slot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=instanceToUse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InstanceDiedException']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
END[}]
|
Keyword[protected] identifier[SimpleSlot] identifier[getFreeSlotForTask] operator[SEP] identifier[ExecutionVertex] identifier[vertex] , identifier[Iterable] operator[<] identifier[TaskManagerLocation] operator[>] identifier[requestedLocations] , Keyword[boolean] identifier[localOnly] operator[SEP] {
Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
identifier[Pair] operator[<] identifier[Instance] , identifier[Locality] operator[>] identifier[instanceLocalityPair] operator[=] identifier[findInstance] operator[SEP] identifier[requestedLocations] , identifier[localOnly] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[instanceLocalityPair] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Instance] identifier[instanceToUse] operator[=] identifier[instanceLocalityPair] operator[SEP] identifier[getLeft] operator[SEP] operator[SEP] operator[SEP] identifier[Locality] identifier[locality] operator[=] identifier[instanceLocalityPair] operator[SEP] identifier[getRight] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[SimpleSlot] identifier[slot] operator[=] identifier[instanceToUse] operator[SEP] identifier[allocateSimpleSlot] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[instanceToUse] operator[SEP] identifier[hasResourcesAvailable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[instancesWithAvailableResources] operator[SEP] identifier[put] operator[SEP] identifier[instanceToUse] operator[SEP] identifier[getTaskManagerID] operator[SEP] operator[SEP] , identifier[instanceToUse] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[slot] operator[!=] Other[null] operator[SEP] {
identifier[slot] operator[SEP] identifier[setLocality] operator[SEP] identifier[locality] operator[SEP] operator[SEP] Keyword[return] identifier[slot] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InstanceDiedException] identifier[e] operator[SEP] {
identifier[removeInstance] operator[SEP] identifier[instanceToUse] operator[SEP] operator[SEP]
}
}
}
|
private boolean linksToOtherDomain(Adaptable adaptable, Page currentPage, Resource targetResource) {
if (currentPage == null || targetResource == null) {
return false;
}
UrlHandlerConfig urlHandlerConfig = AdaptTo.notNull(adaptable, UrlHandlerConfig.class);
Resource currentResource = AdaptTo.notNull(currentPage, Resource.class);
ResourceResolver resourceResolver = currentResource.getResourceResolver();
String currentSiteRoot = getRootPath(currentPage.getPath(), urlHandlerConfig.getSiteRootLevel(currentResource), resourceResolver);
String pathSiteRoot = getRootPath(targetResource.getPath(), urlHandlerConfig.getSiteRootLevel(targetResource), resourceResolver);
boolean notInCurrentSite = !StringUtils.equals(currentSiteRoot, pathSiteRoot);
if (notInCurrentSite) {
UrlConfig targetUrlConfig = new UrlConfig(targetResource);
return targetUrlConfig.isValid();
}
else {
return false;
}
}
|
class class_name[name] begin[{]
method[linksToOtherDomain, return_type[type[boolean]], modifier[private], parameter[adaptable, currentPage, targetResource]] begin[{]
if[binary_operation[binary_operation[member[.currentPage], ==, literal[null]], ||, binary_operation[member[.targetResource], ==, literal[null]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[UrlHandlerConfig], urlHandlerConfig]
local_variable[type[Resource], currentResource]
local_variable[type[ResourceResolver], resourceResolver]
local_variable[type[String], currentSiteRoot]
local_variable[type[String], pathSiteRoot]
local_variable[type[boolean], notInCurrentSite]
if[member[.notInCurrentSite]] begin[{]
local_variable[type[UrlConfig], targetUrlConfig]
return[call[targetUrlConfig.isValid, parameter[]]]
else begin[{]
return[literal[false]]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[linksToOtherDomain] operator[SEP] identifier[Adaptable] identifier[adaptable] , identifier[Page] identifier[currentPage] , identifier[Resource] identifier[targetResource] operator[SEP] {
Keyword[if] operator[SEP] identifier[currentPage] operator[==] Other[null] operator[||] identifier[targetResource] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[UrlHandlerConfig] identifier[urlHandlerConfig] operator[=] identifier[AdaptTo] operator[SEP] identifier[notNull] operator[SEP] identifier[adaptable] , identifier[UrlHandlerConfig] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Resource] identifier[currentResource] operator[=] identifier[AdaptTo] operator[SEP] identifier[notNull] operator[SEP] identifier[currentPage] , identifier[Resource] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[ResourceResolver] identifier[resourceResolver] operator[=] identifier[currentResource] operator[SEP] identifier[getResourceResolver] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[currentSiteRoot] operator[=] identifier[getRootPath] operator[SEP] identifier[currentPage] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , identifier[urlHandlerConfig] operator[SEP] identifier[getSiteRootLevel] operator[SEP] identifier[currentResource] operator[SEP] , identifier[resourceResolver] operator[SEP] operator[SEP] identifier[String] identifier[pathSiteRoot] operator[=] identifier[getRootPath] operator[SEP] identifier[targetResource] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , identifier[urlHandlerConfig] operator[SEP] identifier[getSiteRootLevel] operator[SEP] identifier[targetResource] operator[SEP] , identifier[resourceResolver] operator[SEP] operator[SEP] Keyword[boolean] identifier[notInCurrentSite] operator[=] operator[!] identifier[StringUtils] operator[SEP] identifier[equals] operator[SEP] identifier[currentSiteRoot] , identifier[pathSiteRoot] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[notInCurrentSite] operator[SEP] {
identifier[UrlConfig] identifier[targetUrlConfig] operator[=] Keyword[new] identifier[UrlConfig] operator[SEP] identifier[targetResource] operator[SEP] operator[SEP] Keyword[return] identifier[targetUrlConfig] operator[SEP] identifier[isValid] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
private Object getPropertyValue(GDLParser.LiteralContext literalContext) {
String text;
if (literalContext.StringLiteral() != null) {
return parseString(literalContext.StringLiteral().getText());
} else if (literalContext.BooleanLiteral() != null) {
return Boolean.parseBoolean(literalContext.BooleanLiteral().getText());
} else if (literalContext.IntegerLiteral() != null) {
text = literalContext.IntegerLiteral().getText().toLowerCase();
if (text.endsWith("l")) {
return Long.parseLong(text.substring(0, text.length() - 1));
}
return Integer.parseInt(text);
} else if (literalContext.FloatingPointLiteral() != null) {
text = literalContext.FloatingPointLiteral().getText().toLowerCase();
if (text.endsWith("f")) {
return Float.parseFloat(text.substring(0, text.length() - 1));
} else if (text.endsWith("d")) {
return Double.parseDouble(text.substring(0, text.length() - 1));
}
return Float.parseFloat(text);
}
return null;
}
|
class class_name[name] begin[{]
method[getPropertyValue, return_type[type[Object]], modifier[private], parameter[literalContext]] begin[{]
local_variable[type[String], text]
if[binary_operation[call[literalContext.StringLiteral, parameter[]], !=, literal[null]]] begin[{]
return[call[.parseString, parameter[call[literalContext.StringLiteral, parameter[]]]]]
else begin[{]
if[binary_operation[call[literalContext.BooleanLiteral, parameter[]], !=, literal[null]]] begin[{]
return[call[Boolean.parseBoolean, parameter[call[literalContext.BooleanLiteral, parameter[]]]]]
else begin[{]
if[binary_operation[call[literalContext.IntegerLiteral, parameter[]], !=, literal[null]]] begin[{]
assign[member[.text], call[literalContext.IntegerLiteral, parameter[]]]
if[call[text.endsWith, parameter[literal["l"]]]] begin[{]
return[call[Long.parseLong, parameter[call[text.substring, parameter[literal[0], binary_operation[call[text.length, parameter[]], -, literal[1]]]]]]]
else begin[{]
None
end[}]
return[call[Integer.parseInt, parameter[member[.text]]]]
else begin[{]
if[binary_operation[call[literalContext.FloatingPointLiteral, parameter[]], !=, literal[null]]] begin[{]
assign[member[.text], call[literalContext.FloatingPointLiteral, parameter[]]]
if[call[text.endsWith, parameter[literal["f"]]]] begin[{]
return[call[Float.parseFloat, parameter[call[text.substring, parameter[literal[0], binary_operation[call[text.length, parameter[]], -, literal[1]]]]]]]
else begin[{]
if[call[text.endsWith, parameter[literal["d"]]]] begin[{]
return[call[Double.parseDouble, parameter[call[text.substring, parameter[literal[0], binary_operation[call[text.length, parameter[]], -, literal[1]]]]]]]
else begin[{]
None
end[}]
end[}]
return[call[Float.parseFloat, parameter[member[.text]]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[private] identifier[Object] identifier[getPropertyValue] operator[SEP] identifier[GDLParser] operator[SEP] identifier[LiteralContext] identifier[literalContext] operator[SEP] {
identifier[String] identifier[text] operator[SEP] Keyword[if] operator[SEP] identifier[literalContext] operator[SEP] identifier[StringLiteral] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[parseString] operator[SEP] identifier[literalContext] operator[SEP] identifier[StringLiteral] operator[SEP] operator[SEP] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[literalContext] operator[SEP] identifier[BooleanLiteral] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[literalContext] operator[SEP] identifier[BooleanLiteral] operator[SEP] operator[SEP] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[literalContext] operator[SEP] identifier[IntegerLiteral] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[text] operator[=] identifier[literalContext] operator[SEP] identifier[IntegerLiteral] operator[SEP] operator[SEP] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[text] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[text] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[text] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[literalContext] operator[SEP] identifier[FloatingPointLiteral] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[text] operator[=] identifier[literalContext] operator[SEP] identifier[FloatingPointLiteral] operator[SEP] operator[SEP] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[text] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[Float] operator[SEP] identifier[parseFloat] operator[SEP] identifier[text] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[text] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[text] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[text] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Float] operator[SEP] identifier[parseFloat] operator[SEP] identifier[text] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public double coveringRadiusFromEntries(DBID routingObjectID, AbstractMTree<O, N, E, ?> mTree) {
double coveringRadius = 0.;
for(int i = 0; i < getNumEntries(); i++) {
E entry = getEntry(i);
final double cover = entry.getParentDistance() + entry.getCoveringRadius();
coveringRadius = coveringRadius < cover ? cover : coveringRadius;
}
return coveringRadius;
}
|
class class_name[name] begin[{]
method[coveringRadiusFromEntries, return_type[type[double]], modifier[public], parameter[routingObjectID, mTree]] begin[{]
local_variable[type[double], coveringRadius]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEntry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=E, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getParentDistance, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getCoveringRadius, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), operator=+), name=cover)], modifiers={'final'}, type=BasicType(dimensions=[], name=double)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=coveringRadius, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=coveringRadius, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=MemberReference(member=coveringRadius, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=cover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumEntries, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.coveringRadius]]
end[}]
END[}]
|
Keyword[public] Keyword[double] identifier[coveringRadiusFromEntries] operator[SEP] identifier[DBID] identifier[routingObjectID] , identifier[AbstractMTree] operator[<] identifier[O] , identifier[N] , identifier[E] , operator[?] operator[>] identifier[mTree] operator[SEP] {
Keyword[double] identifier[coveringRadius] operator[=] literal[Float] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[getNumEntries] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[E] identifier[entry] operator[=] identifier[getEntry] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[final] Keyword[double] identifier[cover] operator[=] identifier[entry] operator[SEP] identifier[getParentDistance] operator[SEP] operator[SEP] operator[+] identifier[entry] operator[SEP] identifier[getCoveringRadius] operator[SEP] operator[SEP] operator[SEP] identifier[coveringRadius] operator[=] identifier[coveringRadius] operator[<] identifier[cover] operator[?] identifier[cover] operator[:] identifier[coveringRadius] operator[SEP]
}
Keyword[return] identifier[coveringRadius] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.