code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public String request(Bundle parameters)
throws MalformedURLException, IOException {
if (!parameters.containsKey("method")) {
throw new IllegalArgumentException("API method must be specified. "
+ "(parameters must contain key \"method\" and value). See"
+ " http://developers.facebook.com/docs/reference/rest/");
}
return request(null, parameters, "GET");
}
|
class class_name[name] begin[{]
method[request, return_type[type[String]], modifier[public], parameter[parameters]] begin[{]
if[call[parameters.containsKey, parameter[literal["method"]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="API method must be specified. "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="(parameters must contain key \"method\" and value). See"), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" http://developers.facebook.com/docs/reference/rest/"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.request, parameter[literal[null], member[.parameters], literal["GET"]]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[request] operator[SEP] identifier[Bundle] identifier[parameters] operator[SEP] Keyword[throws] identifier[MalformedURLException] , identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[parameters] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[request] operator[SEP] Other[null] , identifier[parameters] , literal[String] operator[SEP] operator[SEP]
}
|
private Set<String> getControllerPaths(Class<?> controllerClass) {
Set<String> parentPaths = Collections.emptySet();
if (controllerClass.getSuperclass() != null) {
parentPaths = getControllerPaths(controllerClass.getSuperclass());
}
Set<String> paths = new LinkedHashSet<>();
Path controllerPath = controllerClass.getAnnotation(Path.class);
if (controllerPath != null && controllerPath.value().length > 0) {
if (parentPaths.isEmpty()) {
// add all controller paths
paths.addAll(Arrays.asList(controllerPath.value()));
} else {
// create controller paths based on the parent paths
for (String parentPath : parentPaths) {
for (String path : controllerPath.value()) {
paths.add(StringUtils.removeEnd(parentPath, "/") + "/" + StringUtils.removeStart(path, "/"));
}
}
}
} else {
// add all parent paths
paths.addAll(parentPaths);
}
return paths;
}
|
class class_name[name] begin[{]
method[getControllerPaths, return_type[type[Set]], modifier[private], parameter[controllerClass]] begin[{]
local_variable[type[Set], parentPaths]
if[binary_operation[call[controllerClass.getSuperclass, parameter[]], !=, literal[null]]] begin[{]
assign[member[.parentPaths], call[.getControllerPaths, parameter[call[controllerClass.getSuperclass, parameter[]]]]]
else begin[{]
None
end[}]
local_variable[type[Set], paths]
local_variable[type[Path], controllerPath]
if[binary_operation[binary_operation[member[.controllerPath], !=, literal[null]], &&, binary_operation[call[controllerPath.value, parameter[]], >, literal[0]]]] begin[{]
if[call[parentPaths.isEmpty, parameter[]]] begin[{]
call[paths.addAll, parameter[call[Arrays.asList, parameter[call[controllerPath.value, parameter[]]]]]]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=parentPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=removeEnd, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operator=+), operandr=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=removeStart, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), operator=+)], member=add, postfix_operators=[], prefix_operators=[], qualifier=paths, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=value, postfix_operators=[], prefix_operators=[], qualifier=controllerPath, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=parentPaths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=parentPath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
else begin[{]
call[paths.addAll, parameter[member[.parentPaths]]]
end[}]
return[member[.paths]]
end[}]
END[}]
|
Keyword[private] identifier[Set] operator[<] identifier[String] operator[>] identifier[getControllerPaths] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[controllerClass] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[parentPaths] operator[=] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[controllerClass] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[parentPaths] operator[=] identifier[getControllerPaths] operator[SEP] identifier[controllerClass] operator[SEP] identifier[getSuperclass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Set] operator[<] identifier[String] operator[>] identifier[paths] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Path] identifier[controllerPath] operator[=] identifier[controllerClass] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[Path] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[controllerPath] operator[!=] Other[null] operator[&&] identifier[controllerPath] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[parentPaths] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[paths] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[controllerPath] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[String] identifier[parentPath] operator[:] identifier[parentPaths] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[path] operator[:] identifier[controllerPath] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] {
identifier[paths] operator[SEP] identifier[add] operator[SEP] identifier[StringUtils] operator[SEP] identifier[removeEnd] operator[SEP] identifier[parentPath] , literal[String] operator[SEP] operator[+] literal[String] operator[+] identifier[StringUtils] operator[SEP] identifier[removeStart] operator[SEP] identifier[path] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[else] {
identifier[paths] operator[SEP] identifier[addAll] operator[SEP] identifier[parentPaths] operator[SEP] operator[SEP]
}
Keyword[return] identifier[paths] operator[SEP]
}
|
Boolean isStdMapClsSupported() {
// its ok to use Class.forName here instead of nameSpace.classForName,
// because all standard map classes are loaded by the boot loader
boolean isSup = false;
switch (type) {
case Types.SQL_ARRAY : {
try {
Class.forName("java.sql.Array");
isSup = true;
} catch (Exception e) {
isSup = false;
}
break;
}
case Types.SQL_BLOB : {
try {
Class.forName("java.sql.Blob");
isSup = true;
} catch (Exception e) {
isSup = false;
}
break;
}
case Types.SQL_CLOB : {
try {
Class.forName("java.sql.Clob");
isSup = true;
} catch (Exception e) {
isSup = false;
}
break;
}
case Types.NCLOB : {
try {
Class.forName("java.sql.NClob");
isSup = true;
} catch (Exception e) {
isSup = false;
}
break;
}
case Types.DISTINCT : {
isSup = false;
break;
}
case Types.REF : {
try {
Class.forName("java.sql.Ref");
isSup = true;
} catch (Exception e) {
isSup = false;
}
break;
}
case Types.STRUCT : {
try {
Class.forName("java.sql.Struct");
isSup = true;
} catch (Exception e) {
isSup = false;
}
break;
}
case Types.ROWID : {
try {
Class.forName("java.sql.RowId");
isSup = true;
} catch (Exception e) {
isSup = false;
}
break;
}
case Types.SQL_XML : {
try {
Class.forName("java.sql.SQLXML");
isSup = true;
} catch (Exception e) {
isSup = false;
}
break;
}
default : {
isSup = (getStdMapClsName() != null);
break;
}
}
return ValuePool.getBoolean(isSup);
}
|
class class_name[name] begin[{]
method[isStdMapClsSupported, return_type[type[Boolean]], modifier[default], parameter[]] begin[{]
local_variable[type[boolean], isSup]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=SQL_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.sql.Array")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=SQL_BLOB, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.sql.Blob")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=SQL_CLOB, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.sql.Clob")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=NCLOB, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.sql.NClob")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=DISTINCT, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=REF, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.sql.Ref")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=STRUCT, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.sql.Struct")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=ROWID, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.sql.RowId")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=SQL_XML, postfix_operators=[], prefix_operators=[], qualifier=Types, selectors=[])], statements=[BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="java.sql.SQLXML")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isSup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStdMapClsName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None), BreakStatement(goto=None, label=None)])])], expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[call[ValuePool.getBoolean, parameter[member[.isSup]]]]
end[}]
END[}]
|
identifier[Boolean] identifier[isStdMapClsSupported] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[isSup] operator[=] literal[boolean] operator[SEP] Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[Types] operator[SEP] identifier[SQL_ARRAY] operator[:] {
Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[case] identifier[Types] operator[SEP] identifier[SQL_BLOB] operator[:] {
Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[case] identifier[Types] operator[SEP] identifier[SQL_CLOB] operator[:] {
Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[case] identifier[Types] operator[SEP] identifier[NCLOB] operator[:] {
Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[case] identifier[Types] operator[SEP] identifier[DISTINCT] operator[:] {
identifier[isSup] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[case] identifier[Types] operator[SEP] identifier[REF] operator[:] {
Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[case] identifier[Types] operator[SEP] identifier[STRUCT] operator[:] {
Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[case] identifier[Types] operator[SEP] identifier[ROWID] operator[:] {
Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[case] identifier[Types] operator[SEP] identifier[SQL_XML] operator[:] {
Keyword[try] {
identifier[Class] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[isSup] operator[=] literal[boolean] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[default] operator[:] {
identifier[isSup] operator[=] operator[SEP] identifier[getStdMapClsName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[ValuePool] operator[SEP] identifier[getBoolean] operator[SEP] identifier[isSup] operator[SEP] operator[SEP]
}
|
public <DPO> SingleDataProviderContext<DPO> read(DataProvider<DPO> dataProvider) {
List<DataProvider<DPO>> addedDataProviders = new ArrayList<DataProvider<DPO>>();
if (dataProvider != null) {
addedDataProviders.add(dataProvider);
}
// Change context
return new SingleDataProviderContext<DPO>(addedTriggers, addedDataProviders);
}
|
class class_name[name] begin[{]
method[read, return_type[type[SingleDataProviderContext]], modifier[public], parameter[dataProvider]] begin[{]
local_variable[type[List], addedDataProviders]
if[binary_operation[member[.dataProvider], !=, literal[null]]] begin[{]
call[addedDataProviders.add, parameter[member[.dataProvider]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=addedTriggers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=addedDataProviders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DPO, sub_type=None))], dimensions=None, name=SingleDataProviderContext, sub_type=None))]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[DPO] operator[>] identifier[SingleDataProviderContext] operator[<] identifier[DPO] operator[>] identifier[read] operator[SEP] identifier[DataProvider] operator[<] identifier[DPO] operator[>] identifier[dataProvider] operator[SEP] {
identifier[List] operator[<] identifier[DataProvider] operator[<] identifier[DPO] operator[>] operator[>] identifier[addedDataProviders] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[DataProvider] operator[<] identifier[DPO] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataProvider] operator[!=] Other[null] operator[SEP] {
identifier[addedDataProviders] operator[SEP] identifier[add] operator[SEP] identifier[dataProvider] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[SingleDataProviderContext] operator[<] identifier[DPO] operator[>] operator[SEP] identifier[addedTriggers] , identifier[addedDataProviders] operator[SEP] operator[SEP]
}
|
@Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException
{
checkClosed();
this.sysCatalog.setString(1, "TABLES");
JDBC4ResultSet res = (JDBC4ResultSet) this.sysCatalog.executeQuery();
VoltTable vtable = res.getVoltTable().clone(0);
List<String> typeStrings = null;
if (types != null) {
typeStrings = Arrays.asList(types);
}
// If no pattern is specified, default to matching any/all.
if (tableNamePattern == null || tableNamePattern.length() == 0)
{
tableNamePattern = "%";
}
Pattern table_pattern = computeJavaPattern(tableNamePattern);
// Filter tables based on type and pattern
while (res.next()) {
if (typeStrings == null || typeStrings.contains(res.getString("TABLE_TYPE"))) {
Matcher table_matcher = table_pattern.matcher(res.getString("TABLE_NAME"));
if (table_matcher.matches())
{
vtable.addRow(res.getRowData());
}
}
}
return new JDBC4ResultSet(this.sysCatalog, vtable);
}
|
class class_name[name] begin[{]
method[getTables, return_type[type[ResultSet]], modifier[public], parameter[catalog, schemaPattern, tableNamePattern, types]] begin[{]
call[.checkClosed, parameter[]]
THIS[member[None.sysCatalog]call[None.setString, parameter[literal[1], literal["TABLES"]]]]
local_variable[type[JDBC4ResultSet], res]
local_variable[type[VoltTable], vtable]
local_variable[type[List], typeStrings]
if[binary_operation[member[.types], !=, literal[null]]] begin[{]
assign[member[.typeStrings], call[Arrays.asList, parameter[member[.types]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.tableNamePattern], ==, literal[null]], ||, binary_operation[call[tableNamePattern.length, parameter[]], ==, literal[0]]]] begin[{]
assign[member[.tableNamePattern], literal["%"]]
else begin[{]
None
end[}]
local_variable[type[Pattern], table_pattern]
while[call[res.next, parameter[]]] begin[{]
if[binary_operation[binary_operation[member[.typeStrings], ==, literal[null]], ||, call[typeStrings.contains, parameter[call[res.getString, parameter[literal["TABLE_TYPE"]]]]]]] begin[{]
local_variable[type[Matcher], table_matcher]
if[call[table_matcher.matches, parameter[]]] begin[{]
call[vtable.addRow, parameter[call[res.getRowData, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=sysCatalog, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MemberReference(member=vtable, 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=JDBC4ResultSet, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ResultSet] identifier[getTables] operator[SEP] identifier[String] identifier[catalog] , identifier[String] identifier[schemaPattern] , identifier[String] identifier[tableNamePattern] , identifier[String] operator[SEP] operator[SEP] identifier[types] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[checkClosed] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[sysCatalog] operator[SEP] identifier[setString] operator[SEP] Other[1] , literal[String] operator[SEP] operator[SEP] identifier[JDBC4ResultSet] identifier[res] operator[=] operator[SEP] identifier[JDBC4ResultSet] operator[SEP] Keyword[this] operator[SEP] identifier[sysCatalog] operator[SEP] identifier[executeQuery] operator[SEP] operator[SEP] operator[SEP] identifier[VoltTable] identifier[vtable] operator[=] identifier[res] operator[SEP] identifier[getVoltTable] operator[SEP] operator[SEP] operator[SEP] identifier[clone] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[typeStrings] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[types] operator[!=] Other[null] operator[SEP] {
identifier[typeStrings] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[types] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[tableNamePattern] operator[==] Other[null] operator[||] identifier[tableNamePattern] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[tableNamePattern] operator[=] literal[String] operator[SEP]
}
identifier[Pattern] identifier[table_pattern] operator[=] identifier[computeJavaPattern] operator[SEP] identifier[tableNamePattern] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[res] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[typeStrings] operator[==] Other[null] operator[||] identifier[typeStrings] operator[SEP] identifier[contains] operator[SEP] identifier[res] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[Matcher] identifier[table_matcher] operator[=] identifier[table_pattern] operator[SEP] identifier[matcher] operator[SEP] identifier[res] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[table_matcher] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[vtable] operator[SEP] identifier[addRow] operator[SEP] identifier[res] operator[SEP] identifier[getRowData] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Keyword[new] identifier[JDBC4ResultSet] operator[SEP] Keyword[this] operator[SEP] identifier[sysCatalog] , identifier[vtable] operator[SEP] operator[SEP]
}
|
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.PPO__RG:
return rg != null && !rg.isEmpty();
}
return super.eIsSet(featureID);
}
|
class class_name[name] begin[{]
method[eIsSet, return_type[type[boolean]], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=PPO__RG, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=rg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=rg, selectors=[], type_arguments=None), operator=&&), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eIsSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[eIsSet] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[PPO__RG] operator[:] Keyword[return] identifier[rg] operator[!=] Other[null] operator[&&] operator[!] identifier[rg] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eIsSet] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public VersionHistoryImpl versionHistory(boolean pool) throws UnsupportedRepositoryOperationException,
RepositoryException
{
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
throw new UnsupportedRepositoryOperationException("Node is not mix:versionable " + getPath());
}
PropertyData vhProp =
(PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONHISTORY, 1),
ItemType.PROPERTY);
if (vhProp == null)
{
throw new UnsupportedRepositoryOperationException("Node does not have jcr:versionHistory " + getPath());
}
return (VersionHistoryImpl)dataManager.getItemByIdentifier(ValueDataUtil.getString(vhProp.getValues().get(0)),
pool, false);
}
|
class class_name[name] begin[{]
method[versionHistory, return_type[type[VersionHistoryImpl]], modifier[public], parameter[pool]] begin[{]
if[THIS[call[None.isNodeType, parameter[member[Constants.MIX_VERSIONABLE]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Node is not mix:versionable "), operandr=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedRepositoryOperationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[PropertyData], vhProp]
if[binary_operation[member[.vhProp], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Node does not have jcr:versionHistory "), operandr=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedRepositoryOperationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValues, postfix_operators=[], prefix_operators=[], qualifier=vhProp, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=getString, postfix_operators=[], prefix_operators=[], qualifier=ValueDataUtil, selectors=[], type_arguments=None), MemberReference(member=pool, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getItemByIdentifier, postfix_operators=[], prefix_operators=[], qualifier=dataManager, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=VersionHistoryImpl, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[VersionHistoryImpl] identifier[versionHistory] operator[SEP] Keyword[boolean] identifier[pool] operator[SEP] Keyword[throws] identifier[UnsupportedRepositoryOperationException] , identifier[RepositoryException] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[isNodeType] operator[SEP] identifier[Constants] operator[SEP] identifier[MIX_VERSIONABLE] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedRepositoryOperationException] operator[SEP] literal[String] operator[+] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[PropertyData] identifier[vhProp] operator[=] operator[SEP] identifier[PropertyData] operator[SEP] identifier[dataManager] operator[SEP] identifier[getItemData] operator[SEP] identifier[nodeData] operator[SEP] operator[SEP] , Keyword[new] identifier[QPathEntry] operator[SEP] identifier[Constants] operator[SEP] identifier[JCR_VERSIONHISTORY] , Other[1] operator[SEP] , identifier[ItemType] operator[SEP] identifier[PROPERTY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[vhProp] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedRepositoryOperationException] operator[SEP] literal[String] operator[+] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[VersionHistoryImpl] operator[SEP] identifier[dataManager] operator[SEP] identifier[getItemByIdentifier] operator[SEP] identifier[ValueDataUtil] operator[SEP] identifier[getString] operator[SEP] identifier[vhProp] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] , identifier[pool] , literal[boolean] operator[SEP] operator[SEP]
}
|
public AttachInstancesToLoadBalancerRequest withInstanceNames(String... instanceNames) {
if (this.instanceNames == null) {
setInstanceNames(new java.util.ArrayList<String>(instanceNames.length));
}
for (String ele : instanceNames) {
this.instanceNames.add(ele);
}
return this;
}
|
class class_name[name] begin[{]
method[withInstanceNames, return_type[type[AttachInstancesToLoadBalancerRequest]], modifier[public], parameter[instanceNames]] begin[{]
if[binary_operation[THIS[member[None.instanceNames]], ==, literal[null]]] begin[{]
call[.setInstanceNames, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=instanceNames, 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=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=instanceNames, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=instanceNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[AttachInstancesToLoadBalancerRequest] identifier[withInstanceNames] operator[SEP] identifier[String] operator[...] identifier[instanceNames] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[instanceNames] operator[==] Other[null] operator[SEP] {
identifier[setInstanceNames] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[instanceNames] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[instanceNames] operator[SEP] {
Keyword[this] operator[SEP] identifier[instanceNames] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public void applySettings(@NotNull SocketChannel channel) throws IOException {
if (sendBufferSize != 0) {
channel.setOption(SO_SNDBUF, sendBufferSize);
}
if (receiveBufferSize != 0) {
channel.setOption(SO_RCVBUF, receiveBufferSize);
}
if (keepAlive != DEF_BOOL) {
channel.setOption(SO_KEEPALIVE, keepAlive != FALSE);
}
if (reuseAddress != DEF_BOOL) {
channel.setOption(SO_REUSEADDR, reuseAddress != FALSE);
}
if (tcpNoDelay != DEF_BOOL) {
channel.setOption(TCP_NODELAY, tcpNoDelay != FALSE);
}
}
|
class class_name[name] begin[{]
method[applySettings, return_type[void], modifier[public], parameter[channel]] begin[{]
if[binary_operation[member[.sendBufferSize], !=, literal[0]]] begin[{]
call[channel.setOption, parameter[member[.SO_SNDBUF], member[.sendBufferSize]]]
else begin[{]
None
end[}]
if[binary_operation[member[.receiveBufferSize], !=, literal[0]]] begin[{]
call[channel.setOption, parameter[member[.SO_RCVBUF], member[.receiveBufferSize]]]
else begin[{]
None
end[}]
if[binary_operation[member[.keepAlive], !=, member[.DEF_BOOL]]] begin[{]
call[channel.setOption, parameter[member[.SO_KEEPALIVE], binary_operation[member[.keepAlive], !=, member[.FALSE]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.reuseAddress], !=, member[.DEF_BOOL]]] begin[{]
call[channel.setOption, parameter[member[.SO_REUSEADDR], binary_operation[member[.reuseAddress], !=, member[.FALSE]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.tcpNoDelay], !=, member[.DEF_BOOL]]] begin[{]
call[channel.setOption, parameter[member[.TCP_NODELAY], binary_operation[member[.tcpNoDelay], !=, member[.FALSE]]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[applySettings] operator[SEP] annotation[@] identifier[NotNull] identifier[SocketChannel] identifier[channel] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[sendBufferSize] operator[!=] Other[0] operator[SEP] {
identifier[channel] operator[SEP] identifier[setOption] operator[SEP] identifier[SO_SNDBUF] , identifier[sendBufferSize] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[receiveBufferSize] operator[!=] Other[0] operator[SEP] {
identifier[channel] operator[SEP] identifier[setOption] operator[SEP] identifier[SO_RCVBUF] , identifier[receiveBufferSize] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[keepAlive] operator[!=] identifier[DEF_BOOL] operator[SEP] {
identifier[channel] operator[SEP] identifier[setOption] operator[SEP] identifier[SO_KEEPALIVE] , identifier[keepAlive] operator[!=] identifier[FALSE] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[reuseAddress] operator[!=] identifier[DEF_BOOL] operator[SEP] {
identifier[channel] operator[SEP] identifier[setOption] operator[SEP] identifier[SO_REUSEADDR] , identifier[reuseAddress] operator[!=] identifier[FALSE] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[tcpNoDelay] operator[!=] identifier[DEF_BOOL] operator[SEP] {
identifier[channel] operator[SEP] identifier[setOption] operator[SEP] identifier[TCP_NODELAY] , identifier[tcpNoDelay] operator[!=] identifier[FALSE] operator[SEP] operator[SEP]
}
}
|
public static Optional<TypeElement> maybeAsTypeElement(TypeMirror type) {
Optional<DeclaredType> declaredType = maybeDeclared(type);
if (declaredType.isPresent()) {
return maybeType(declaredType.get().asElement());
} else {
return Optional.empty();
}
}
|
class class_name[name] begin[{]
method[maybeAsTypeElement, return_type[type[Optional]], modifier[public static], parameter[type]] begin[{]
local_variable[type[Optional], declaredType]
if[call[declaredType.isPresent, parameter[]]] begin[{]
return[call[.maybeType, parameter[call[declaredType.get, parameter[]]]]]
else begin[{]
return[call[Optional.empty, parameter[]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Optional] operator[<] identifier[TypeElement] operator[>] identifier[maybeAsTypeElement] operator[SEP] identifier[TypeMirror] identifier[type] operator[SEP] {
identifier[Optional] operator[<] identifier[DeclaredType] operator[>] identifier[declaredType] operator[=] identifier[maybeDeclared] operator[SEP] identifier[type] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[declaredType] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[maybeType] operator[SEP] identifier[declaredType] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[asElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Optional] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void error(TraceComponent tc, String msgKey) {
if(isTracing()) SibTr.error(tc, msgKey);
}
|
class class_name[name] begin[{]
method[error, return_type[void], modifier[public static], parameter[tc, msgKey]] begin[{]
if[call[.isTracing, parameter[]]] begin[{]
call[SibTr.error, parameter[member[.tc], member[.msgKey]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[error] operator[SEP] identifier[TraceComponent] identifier[tc] , identifier[String] identifier[msgKey] operator[SEP] {
Keyword[if] operator[SEP] identifier[isTracing] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , identifier[msgKey] operator[SEP] operator[SEP]
}
|
private Format createAppropriateFormat(String type, String style) {
Format newFormat = null;
int subformatType = findKeyword(type, typeList);
switch (subformatType){
case TYPE_NUMBER:
switch (findKeyword(style, modifierList)) {
case MODIFIER_EMPTY:
newFormat = NumberFormat.getInstance(ulocale);
break;
case MODIFIER_CURRENCY:
newFormat = NumberFormat.getCurrencyInstance(ulocale);
break;
case MODIFIER_PERCENT:
newFormat = NumberFormat.getPercentInstance(ulocale);
break;
case MODIFIER_INTEGER:
newFormat = NumberFormat.getIntegerInstance(ulocale);
break;
default: // pattern
newFormat = new DecimalFormat(style,
new DecimalFormatSymbols(ulocale));
break;
}
break;
case TYPE_DATE:
switch (findKeyword(style, dateModifierList)) {
case DATE_MODIFIER_EMPTY:
newFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, ulocale);
break;
case DATE_MODIFIER_SHORT:
newFormat = DateFormat.getDateInstance(DateFormat.SHORT, ulocale);
break;
case DATE_MODIFIER_MEDIUM:
newFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, ulocale);
break;
case DATE_MODIFIER_LONG:
newFormat = DateFormat.getDateInstance(DateFormat.LONG, ulocale);
break;
case DATE_MODIFIER_FULL:
newFormat = DateFormat.getDateInstance(DateFormat.FULL, ulocale);
break;
default:
newFormat = new SimpleDateFormat(style, ulocale);
break;
}
break;
case TYPE_TIME:
switch (findKeyword(style, dateModifierList)) {
case DATE_MODIFIER_EMPTY:
newFormat = DateFormat.getTimeInstance(DateFormat.DEFAULT, ulocale);
break;
case DATE_MODIFIER_SHORT:
newFormat = DateFormat.getTimeInstance(DateFormat.SHORT, ulocale);
break;
case DATE_MODIFIER_MEDIUM:
newFormat = DateFormat.getTimeInstance(DateFormat.DEFAULT, ulocale);
break;
case DATE_MODIFIER_LONG:
newFormat = DateFormat.getTimeInstance(DateFormat.LONG, ulocale);
break;
case DATE_MODIFIER_FULL:
newFormat = DateFormat.getTimeInstance(DateFormat.FULL, ulocale);
break;
default:
newFormat = new SimpleDateFormat(style, ulocale);
break;
}
break;
case TYPE_SPELLOUT:
{
RuleBasedNumberFormat rbnf = new RuleBasedNumberFormat(ulocale,
RuleBasedNumberFormat.SPELLOUT);
String ruleset = style.trim();
if (ruleset.length() != 0) {
try {
rbnf.setDefaultRuleSet(ruleset);
}
catch (Exception e) {
// warn invalid ruleset
}
}
newFormat = rbnf;
}
break;
case TYPE_ORDINAL:
{
RuleBasedNumberFormat rbnf = new RuleBasedNumberFormat(ulocale,
RuleBasedNumberFormat.ORDINAL);
String ruleset = style.trim();
if (ruleset.length() != 0) {
try {
rbnf.setDefaultRuleSet(ruleset);
}
catch (Exception e) {
// warn invalid ruleset
}
}
newFormat = rbnf;
}
break;
case TYPE_DURATION:
{
RuleBasedNumberFormat rbnf = new RuleBasedNumberFormat(ulocale,
RuleBasedNumberFormat.DURATION);
String ruleset = style.trim();
if (ruleset.length() != 0) {
try {
rbnf.setDefaultRuleSet(ruleset);
}
catch (Exception e) {
// warn invalid ruleset
}
}
newFormat = rbnf;
}
break;
default:
throw new IllegalArgumentException("Unknown format type \"" + type + "\"");
}
return newFormat;
}
|
class class_name[name] begin[{]
method[createAppropriateFormat, return_type[type[Format]], modifier[private], parameter[type, style]] begin[{]
local_variable[type[Format], newFormat]
local_variable[type[int], subformatType]
SwitchStatement(cases=[SwitchStatementCase(case=['TYPE_NUMBER'], statements=[SwitchStatement(cases=[SwitchStatementCase(case=['MODIFIER_EMPTY'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=NumberFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MODIFIER_CURRENCY'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCurrencyInstance, postfix_operators=[], prefix_operators=[], qualifier=NumberFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MODIFIER_PERCENT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPercentInstance, postfix_operators=[], prefix_operators=[], qualifier=NumberFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MODIFIER_INTEGER'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getIntegerInstance, postfix_operators=[], prefix_operators=[], qualifier=NumberFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=ulocale, 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=DecimalFormatSymbols, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DecimalFormat, sub_type=None))), label=None), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=modifierList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findKeyword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['TYPE_DATE'], statements=[SwitchStatement(cases=[SwitchStatementCase(case=['DATE_MODIFIER_EMPTY'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=DEFAULT, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDateInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DATE_MODIFIER_SHORT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=SHORT, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDateInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DATE_MODIFIER_MEDIUM'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=DEFAULT, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDateInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DATE_MODIFIER_LONG'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDateInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DATE_MODIFIER_FULL'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=FULL, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDateInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ulocale, 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=SimpleDateFormat, sub_type=None))), label=None), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dateModifierList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findKeyword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['TYPE_TIME'], statements=[SwitchStatement(cases=[SwitchStatementCase(case=['DATE_MODIFIER_EMPTY'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=DEFAULT, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTimeInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DATE_MODIFIER_SHORT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=SHORT, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTimeInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DATE_MODIFIER_MEDIUM'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=DEFAULT, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTimeInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DATE_MODIFIER_LONG'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTimeInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DATE_MODIFIER_FULL'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=FULL, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[]), MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTimeInstance, postfix_operators=[], prefix_operators=[], qualifier=DateFormat, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ulocale, 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=SimpleDateFormat, sub_type=None))), label=None), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[MemberReference(member=style, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dateModifierList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findKeyword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['TYPE_SPELLOUT'], statements=[BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=SPELLOUT, postfix_operators=[], prefix_operators=[], qualifier=RuleBasedNumberFormat, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuleBasedNumberFormat, sub_type=None)), name=rbnf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RuleBasedNumberFormat, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=style, selectors=[], type_arguments=None), name=ruleset)], 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=ruleset, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ruleset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDefaultRuleSet, postfix_operators=[], prefix_operators=[], qualifier=rbnf, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=rbnf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['TYPE_ORDINAL'], statements=[BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ORDINAL, postfix_operators=[], prefix_operators=[], qualifier=RuleBasedNumberFormat, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuleBasedNumberFormat, sub_type=None)), name=rbnf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RuleBasedNumberFormat, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=style, selectors=[], type_arguments=None), name=ruleset)], 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=ruleset, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ruleset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDefaultRuleSet, postfix_operators=[], prefix_operators=[], qualifier=rbnf, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=rbnf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['TYPE_DURATION'], statements=[BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=ulocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=DURATION, postfix_operators=[], prefix_operators=[], qualifier=RuleBasedNumberFormat, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuleBasedNumberFormat, sub_type=None)), name=rbnf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RuleBasedNumberFormat, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=style, selectors=[], type_arguments=None), name=ruleset)], 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=ruleset, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ruleset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDefaultRuleSet, postfix_operators=[], prefix_operators=[], qualifier=rbnf, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=rbnf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown format type \""), operandr=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\""), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)])], expression=MemberReference(member=subformatType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[member[.newFormat]]
end[}]
END[}]
|
Keyword[private] identifier[Format] identifier[createAppropriateFormat] operator[SEP] identifier[String] identifier[type] , identifier[String] identifier[style] operator[SEP] {
identifier[Format] identifier[newFormat] operator[=] Other[null] operator[SEP] Keyword[int] identifier[subformatType] operator[=] identifier[findKeyword] operator[SEP] identifier[type] , identifier[typeList] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[subformatType] operator[SEP] {
Keyword[case] identifier[TYPE_NUMBER] operator[:] Keyword[switch] operator[SEP] identifier[findKeyword] operator[SEP] identifier[style] , identifier[modifierList] operator[SEP] operator[SEP] {
Keyword[case] identifier[MODIFIER_EMPTY] operator[:] identifier[newFormat] operator[=] identifier[NumberFormat] operator[SEP] identifier[getInstance] operator[SEP] identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[MODIFIER_CURRENCY] operator[:] identifier[newFormat] operator[=] identifier[NumberFormat] operator[SEP] identifier[getCurrencyInstance] operator[SEP] identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[MODIFIER_PERCENT] operator[:] identifier[newFormat] operator[=] identifier[NumberFormat] operator[SEP] identifier[getPercentInstance] operator[SEP] identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[MODIFIER_INTEGER] operator[:] identifier[newFormat] operator[=] identifier[NumberFormat] operator[SEP] identifier[getIntegerInstance] operator[SEP] identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[newFormat] operator[=] Keyword[new] identifier[DecimalFormat] operator[SEP] identifier[style] , Keyword[new] identifier[DecimalFormatSymbols] operator[SEP] identifier[ulocale] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[TYPE_DATE] operator[:] Keyword[switch] operator[SEP] identifier[findKeyword] operator[SEP] identifier[style] , identifier[dateModifierList] operator[SEP] operator[SEP] {
Keyword[case] identifier[DATE_MODIFIER_EMPTY] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getDateInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[DEFAULT] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DATE_MODIFIER_SHORT] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getDateInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[SHORT] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DATE_MODIFIER_MEDIUM] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getDateInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[DEFAULT] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DATE_MODIFIER_LONG] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getDateInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[LONG] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DATE_MODIFIER_FULL] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getDateInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[FULL] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[newFormat] operator[=] Keyword[new] identifier[SimpleDateFormat] operator[SEP] identifier[style] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[TYPE_TIME] operator[:] Keyword[switch] operator[SEP] identifier[findKeyword] operator[SEP] identifier[style] , identifier[dateModifierList] operator[SEP] operator[SEP] {
Keyword[case] identifier[DATE_MODIFIER_EMPTY] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getTimeInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[DEFAULT] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DATE_MODIFIER_SHORT] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getTimeInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[SHORT] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DATE_MODIFIER_MEDIUM] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getTimeInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[DEFAULT] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DATE_MODIFIER_LONG] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getTimeInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[LONG] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DATE_MODIFIER_FULL] operator[:] identifier[newFormat] operator[=] identifier[DateFormat] operator[SEP] identifier[getTimeInstance] operator[SEP] identifier[DateFormat] operator[SEP] identifier[FULL] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[newFormat] operator[=] Keyword[new] identifier[SimpleDateFormat] operator[SEP] identifier[style] , identifier[ulocale] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[TYPE_SPELLOUT] operator[:] {
identifier[RuleBasedNumberFormat] identifier[rbnf] operator[=] Keyword[new] identifier[RuleBasedNumberFormat] operator[SEP] identifier[ulocale] , identifier[RuleBasedNumberFormat] operator[SEP] identifier[SPELLOUT] operator[SEP] operator[SEP] identifier[String] identifier[ruleset] operator[=] identifier[style] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ruleset] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[try] {
identifier[rbnf] operator[SEP] identifier[setDefaultRuleSet] operator[SEP] identifier[ruleset] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
identifier[newFormat] operator[=] identifier[rbnf] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[TYPE_ORDINAL] operator[:] {
identifier[RuleBasedNumberFormat] identifier[rbnf] operator[=] Keyword[new] identifier[RuleBasedNumberFormat] operator[SEP] identifier[ulocale] , identifier[RuleBasedNumberFormat] operator[SEP] identifier[ORDINAL] operator[SEP] operator[SEP] identifier[String] identifier[ruleset] operator[=] identifier[style] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ruleset] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[try] {
identifier[rbnf] operator[SEP] identifier[setDefaultRuleSet] operator[SEP] identifier[ruleset] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
identifier[newFormat] operator[=] identifier[rbnf] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[TYPE_DURATION] operator[:] {
identifier[RuleBasedNumberFormat] identifier[rbnf] operator[=] Keyword[new] identifier[RuleBasedNumberFormat] operator[SEP] identifier[ulocale] , identifier[RuleBasedNumberFormat] operator[SEP] identifier[DURATION] operator[SEP] operator[SEP] identifier[String] identifier[ruleset] operator[=] identifier[style] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ruleset] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[try] {
identifier[rbnf] operator[SEP] identifier[setDefaultRuleSet] operator[SEP] identifier[ruleset] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
identifier[newFormat] operator[=] identifier[rbnf] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[type] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[newFormat] operator[SEP]
}
|
@SuppressWarnings("fallthrough")
protected DCIdentifier identifier() throws ParseException {
skipWhitespace();
int pos = bp;
if (isJavaIdentifierStart(ch)) {
Name name = readJavaIdentifier();
return m.at(pos).newIdentifierTree(name);
}
throw new ParseException("dc.identifier.expected");
}
|
class class_name[name] begin[{]
method[identifier, return_type[type[DCIdentifier]], modifier[protected], parameter[]] begin[{]
call[.skipWhitespace, parameter[]]
local_variable[type[int], pos]
if[call[.isJavaIdentifierStart, parameter[member[.ch]]]] begin[{]
local_variable[type[Name], name]
return[call[m.at, parameter[member[.pos]]]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dc.identifier.expected")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None)), label=None)
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] identifier[DCIdentifier] identifier[identifier] operator[SEP] operator[SEP] Keyword[throws] identifier[ParseException] {
identifier[skipWhitespace] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[pos] operator[=] identifier[bp] operator[SEP] Keyword[if] operator[SEP] identifier[isJavaIdentifierStart] operator[SEP] identifier[ch] operator[SEP] operator[SEP] {
identifier[Name] identifier[name] operator[=] identifier[readJavaIdentifier] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[m] operator[SEP] identifier[at] operator[SEP] identifier[pos] operator[SEP] operator[SEP] identifier[newIdentifierTree] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[ParseException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
private synchronized void increaseClientCount(Entry<K, V> entry) {
Preconditions.checkNotNull(entry);
Preconditions.checkState(!entry.isOrphan);
entry.clientCount++;
}
|
class class_name[name] begin[{]
method[increaseClientCount, return_type[void], modifier[synchronized private], parameter[entry]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.entry]]]
call[Preconditions.checkState, parameter[member[entry.isOrphan]]]
member[entry.clientCount]
end[}]
END[}]
|
Keyword[private] Keyword[synchronized] Keyword[void] identifier[increaseClientCount] operator[SEP] identifier[Entry] operator[<] identifier[K] , identifier[V] operator[>] identifier[entry] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[entry] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] operator[!] identifier[entry] operator[SEP] identifier[isOrphan] operator[SEP] operator[SEP] identifier[entry] operator[SEP] identifier[clientCount] operator[++] operator[SEP]
}
|
@Override
public <BD extends BehaviorData, B extends Behavior<BD, ?>> BD getBehaviorData(final Class<B> behaviorClass) {
BD data = null;
final B behavior = getBehavior(behaviorClass);
if (behavior != null) {
data = behavior.data();
}
return data;
}
|
class class_name[name] begin[{]
method[getBehaviorData, return_type[type[BD]], modifier[public], parameter[behaviorClass]] begin[{]
local_variable[type[BD], data]
local_variable[type[B], behavior]
if[binary_operation[member[.behavior], !=, literal[null]]] begin[{]
assign[member[.data], call[behavior.data, parameter[]]]
else begin[{]
None
end[}]
return[member[.data]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] operator[<] identifier[BD] Keyword[extends] identifier[BehaviorData] , identifier[B] Keyword[extends] identifier[Behavior] operator[<] identifier[BD] , operator[?] operator[>] operator[>] identifier[BD] identifier[getBehaviorData] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[B] operator[>] identifier[behaviorClass] operator[SEP] {
identifier[BD] identifier[data] operator[=] Other[null] operator[SEP] Keyword[final] identifier[B] identifier[behavior] operator[=] identifier[getBehavior] operator[SEP] identifier[behaviorClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[behavior] operator[!=] Other[null] operator[SEP] {
identifier[data] operator[=] identifier[behavior] operator[SEP] identifier[data] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[data] operator[SEP]
}
|
public static AhcWSClient create(
AhcWSClientConfig config, AhcHttpCache cache, Materializer materializer) {
final StandaloneAhcWSClient client = StandaloneAhcWSClient.create(config, cache, materializer);
return new AhcWSClient(client, materializer);
}
|
class class_name[name] begin[{]
method[create, return_type[type[AhcWSClient]], modifier[public static], parameter[config, cache, materializer]] begin[{]
local_variable[type[StandaloneAhcWSClient], client]
return[ClassCreator(arguments=[MemberReference(member=client, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=materializer, 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=AhcWSClient, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[AhcWSClient] identifier[create] operator[SEP] identifier[AhcWSClientConfig] identifier[config] , identifier[AhcHttpCache] identifier[cache] , identifier[Materializer] identifier[materializer] operator[SEP] {
Keyword[final] identifier[StandaloneAhcWSClient] identifier[client] operator[=] identifier[StandaloneAhcWSClient] operator[SEP] identifier[create] operator[SEP] identifier[config] , identifier[cache] , identifier[materializer] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[AhcWSClient] operator[SEP] identifier[client] , identifier[materializer] operator[SEP] operator[SEP]
}
|
public List<Long> getProcessInstancesWaitingForEvent(String type) {
EntityManager entityManager = getEntityManager();
if (entityManager != null) {
Query processInstancesForEvent = getEntityManager().createNamedQuery( "ProcessInstancesWaitingForEvent" );
processInstancesForEvent.setParameter( "type",
type );
return (List<Long>) processInstancesForEvent.getResultList();
} else {
// entity manager can be null when fireActivationCreated is
// called on session unmarshalling
return new ArrayList<Long>();
}
}
|
class class_name[name] begin[{]
method[getProcessInstancesWaitingForEvent, return_type[type[List]], modifier[public], parameter[type]] begin[{]
local_variable[type[EntityManager], entityManager]
if[binary_operation[member[.entityManager], !=, literal[null]]] begin[{]
local_variable[type[Query], processInstancesForEvent]
call[processInstancesForEvent.setParameter, parameter[literal["type"], member[.type]]]
return[Cast(expression=MethodInvocation(arguments=[], member=getResultList, postfix_operators=[], prefix_operators=[], qualifier=processInstancesForEvent, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))], dimensions=[], name=List, sub_type=None))]
else begin[{]
return[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=Long, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[Long] operator[>] identifier[getProcessInstancesWaitingForEvent] operator[SEP] identifier[String] identifier[type] operator[SEP] {
identifier[EntityManager] identifier[entityManager] operator[=] identifier[getEntityManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entityManager] operator[!=] Other[null] operator[SEP] {
identifier[Query] identifier[processInstancesForEvent] operator[=] identifier[getEntityManager] operator[SEP] operator[SEP] operator[SEP] identifier[createNamedQuery] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[processInstancesForEvent] operator[SEP] identifier[setParameter] operator[SEP] literal[String] , identifier[type] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[List] operator[<] identifier[Long] operator[>] operator[SEP] identifier[processInstancesForEvent] operator[SEP] identifier[getResultList] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[ArrayList] operator[<] identifier[Long] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public int findHeaderPositionUnder(int x, int y) {
for (int i = 0; i < mHeaderRects.size(); i++) {
Rect rect = mHeaderRects.get(mHeaderRects.keyAt(i));
if (rect.contains(x, y)) {
int position = mHeaderRects.keyAt(i);
if (mVisibilityAdapter == null || mVisibilityAdapter.isPositionVisible(position)) {
return position;
}
}
}
return -1;
}
|
class class_name[name] begin[{]
method[findHeaderPositionUnder, return_type[type[int]], modifier[public], parameter[x, y]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=keyAt, postfix_operators=[], prefix_operators=[], qualifier=mHeaderRects, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=mHeaderRects, selectors=[], type_arguments=None), name=rect)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Rect, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=rect, 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=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=keyAt, postfix_operators=[], prefix_operators=[], qualifier=mHeaderRects, selectors=[], type_arguments=None), name=position)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=mVisibilityAdapter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isPositionVisible, postfix_operators=[], prefix_operators=[], qualifier=mVisibilityAdapter, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=position, 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=size, postfix_operators=[], prefix_operators=[], qualifier=mHeaderRects, 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[literal[1]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[findHeaderPositionUnder] operator[SEP] Keyword[int] identifier[x] , Keyword[int] identifier[y] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[mHeaderRects] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Rect] identifier[rect] operator[=] identifier[mHeaderRects] operator[SEP] identifier[get] operator[SEP] identifier[mHeaderRects] operator[SEP] identifier[keyAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rect] operator[SEP] identifier[contains] operator[SEP] identifier[x] , identifier[y] operator[SEP] operator[SEP] {
Keyword[int] identifier[position] operator[=] identifier[mHeaderRects] operator[SEP] identifier[keyAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mVisibilityAdapter] operator[==] Other[null] operator[||] identifier[mVisibilityAdapter] operator[SEP] identifier[isPositionVisible] operator[SEP] identifier[position] operator[SEP] operator[SEP] {
Keyword[return] identifier[position] operator[SEP]
}
}
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public Observable<VirtualNetworkTapInner> beginCreateOrUpdateAsync(String resourceGroupName, String tapName, VirtualNetworkTapInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, tapName, parameters).map(new Func1<ServiceResponse<VirtualNetworkTapInner>, VirtualNetworkTapInner>() {
@Override
public VirtualNetworkTapInner call(ServiceResponse<VirtualNetworkTapInner> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[beginCreateOrUpdateAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, tapName, parameters]] begin[{]
return[call[.beginCreateOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.tapName], member[.parameters]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[VirtualNetworkTapInner] operator[>] identifier[beginCreateOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[tapName] , identifier[VirtualNetworkTapInner] identifier[parameters] operator[SEP] {
Keyword[return] identifier[beginCreateOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[tapName] , identifier[parameters] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[VirtualNetworkTapInner] operator[>] , identifier[VirtualNetworkTapInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[VirtualNetworkTapInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[VirtualNetworkTapInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public Document createRaw(@NonNull String content) {
return createRaw(StringUtils.EMPTY, content, defaultLanguage, Collections.emptyMap());
}
|
class class_name[name] begin[{]
method[createRaw, return_type[type[Document]], modifier[public], parameter[content]] begin[{]
return[call[.createRaw, parameter[member[StringUtils.EMPTY], member[.content], member[.defaultLanguage], call[Collections.emptyMap, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] identifier[Document] identifier[createRaw] operator[SEP] annotation[@] identifier[NonNull] identifier[String] identifier[content] operator[SEP] {
Keyword[return] identifier[createRaw] operator[SEP] identifier[StringUtils] operator[SEP] identifier[EMPTY] , identifier[content] , identifier[defaultLanguage] , identifier[Collections] operator[SEP] identifier[emptyMap] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private Identity getIdentityFromResultSet()
{
try
{
// 1. get an empty instance of the target class
Constructor con = classDescriptor.getZeroArgumentConstructor();
Object obj = ConstructorHelper.instantiate(con);
// 2. fill only primary key values from Resultset
Object colValue;
FieldDescriptor fld;
FieldDescriptor[] pkfields = classDescriptor.getPkFields();
for (int i = 0; i < pkfields.length; i++)
{
fld = pkfields[i];
colValue = fld.getJdbcType().getObjectFromColumn(resultSetAndStatment.m_rs, fld.getColumnName());
fld.getPersistentField().set(obj, colValue);
}
// 3. return the representing identity object
return broker.serviceIdentity().buildIdentity(classDescriptor, obj);
}
catch (SQLException e)
{
throw new PersistenceBrokerSQLException("Error reading object from column", e);
}
catch (Exception e)
{
throw new PersistenceBrokerException("Error reading Identity from result set", e);
}
}
|
class class_name[name] begin[{]
method[getIdentityFromResultSet, return_type[type[Identity]], modifier[private], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getZeroArgumentConstructor, postfix_operators=[], prefix_operators=[], qualifier=classDescriptor, selectors=[], type_arguments=None), name=con)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Constructor, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=con, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=instantiate, postfix_operators=[], prefix_operators=[], qualifier=ConstructorHelper, selectors=[], type_arguments=None), name=obj)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=colValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=fld)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldDescriptor, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPkFields, postfix_operators=[], prefix_operators=[], qualifier=classDescriptor, selectors=[], type_arguments=None), name=pkfields)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=FieldDescriptor, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=fld, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=pkfields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=colValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getJdbcType, postfix_operators=[], prefix_operators=[], qualifier=fld, selectors=[MethodInvocation(arguments=[MemberReference(member=m_rs, postfix_operators=[], prefix_operators=[], qualifier=resultSetAndStatment, selectors=[]), MethodInvocation(arguments=[], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=fld, selectors=[], type_arguments=None)], member=getObjectFromColumn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getPersistentField, postfix_operators=[], prefix_operators=[], qualifier=fld, selectors=[MethodInvocation(arguments=[MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=colValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=pkfields, 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=MethodInvocation(arguments=[], member=serviceIdentity, postfix_operators=[], prefix_operators=[], qualifier=broker, selectors=[MethodInvocation(arguments=[MemberReference(member=classDescriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildIdentity, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error reading object from column"), 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=PersistenceBrokerSQLException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error reading Identity from result set"), 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=PersistenceBrokerException, 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[private] identifier[Identity] identifier[getIdentityFromResultSet] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[Constructor] identifier[con] operator[=] identifier[classDescriptor] operator[SEP] identifier[getZeroArgumentConstructor] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[obj] operator[=] identifier[ConstructorHelper] operator[SEP] identifier[instantiate] operator[SEP] identifier[con] operator[SEP] operator[SEP] identifier[Object] identifier[colValue] operator[SEP] identifier[FieldDescriptor] identifier[fld] operator[SEP] identifier[FieldDescriptor] operator[SEP] operator[SEP] identifier[pkfields] operator[=] identifier[classDescriptor] operator[SEP] identifier[getPkFields] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[pkfields] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[fld] operator[=] identifier[pkfields] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[colValue] operator[=] identifier[fld] operator[SEP] identifier[getJdbcType] operator[SEP] operator[SEP] operator[SEP] identifier[getObjectFromColumn] operator[SEP] identifier[resultSetAndStatment] operator[SEP] identifier[m_rs] , identifier[fld] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[fld] operator[SEP] identifier[getPersistentField] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[obj] , identifier[colValue] operator[SEP] operator[SEP]
}
Keyword[return] identifier[broker] operator[SEP] identifier[serviceIdentity] operator[SEP] operator[SEP] operator[SEP] identifier[buildIdentity] operator[SEP] identifier[classDescriptor] , identifier[obj] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PersistenceBrokerSQLException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PersistenceBrokerException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public Object getAttributeWithoutCache(String name) {
if (activity.getRequestAdapter() != null) {
return activity.getRequestAdapter().getAttribute(name);
} else {
return null;
}
}
|
class class_name[name] begin[{]
method[getAttributeWithoutCache, return_type[type[Object]], modifier[public], parameter[name]] begin[{]
if[binary_operation[call[activity.getRequestAdapter, parameter[]], !=, literal[null]]] begin[{]
return[call[activity.getRequestAdapter, parameter[]]]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[Object] identifier[getAttributeWithoutCache] operator[SEP] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[activity] operator[SEP] identifier[getRequestAdapter] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[activity] operator[SEP] identifier[getRequestAdapter] operator[SEP] operator[SEP] operator[SEP] identifier[getAttribute] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public static void fullViewLeft(CameraPinholeBrown paramLeft,
DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
DMatrixRMaj rectifyK)
{
ImplRectifyImageOps_F64.fullViewLeft(paramLeft, rectifyLeft, rectifyRight, rectifyK);
}
|
class class_name[name] begin[{]
method[fullViewLeft, return_type[void], modifier[public static], parameter[paramLeft, rectifyLeft, rectifyRight, rectifyK]] begin[{]
call[ImplRectifyImageOps_F64.fullViewLeft, parameter[member[.paramLeft], member[.rectifyLeft], member[.rectifyRight], member[.rectifyK]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[fullViewLeft] operator[SEP] identifier[CameraPinholeBrown] identifier[paramLeft] , identifier[DMatrixRMaj] identifier[rectifyLeft] , identifier[DMatrixRMaj] identifier[rectifyRight] , identifier[DMatrixRMaj] identifier[rectifyK] operator[SEP] {
identifier[ImplRectifyImageOps_F64] operator[SEP] identifier[fullViewLeft] operator[SEP] identifier[paramLeft] , identifier[rectifyLeft] , identifier[rectifyRight] , identifier[rectifyK] operator[SEP] operator[SEP]
}
|
public void setType(JvmType newType)
{
JvmType oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtypePackage.XFUNCTION_TYPE_REF__TYPE, oldType, type));
}
|
class class_name[name] begin[{]
method[setType, return_type[void], modifier[public], parameter[newType]] begin[{]
local_variable[type[JvmType], oldType]
assign[member[.type], member[.newType]]
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=XFUNCTION_TYPE_REF__TYPE, postfix_operators=[], prefix_operators=[], qualifier=XtypePackage, selectors=[]), MemberReference(member=oldType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, 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[setType] operator[SEP] identifier[JvmType] identifier[newType] operator[SEP] {
identifier[JvmType] identifier[oldType] operator[=] identifier[type] operator[SEP] identifier[type] operator[=] identifier[newType] 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[XtypePackage] operator[SEP] identifier[XFUNCTION_TYPE_REF__TYPE] , identifier[oldType] , identifier[type] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setFloatAttribute(String name, Float value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof FloatAttribute)) {
throw new IllegalStateException("Cannot set float value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((FloatAttribute) attribute).setValue(value);
}
|
class class_name[name] begin[{]
method[setFloatAttribute, return_type[void], modifier[public], parameter[name, value]] begin[{]
local_variable[type[Attribute], attribute]
if[binary_operation[member[.attribute], instanceof, type[FloatAttribute]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot set float value on attribute with different type, "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=attribute, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" setting value "), operator=+), operandr=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
Cast(expression=MemberReference(member=attribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=FloatAttribute, sub_type=None))
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setFloatAttribute] operator[SEP] identifier[String] identifier[name] , identifier[Float] identifier[value] operator[SEP] {
identifier[Attribute] identifier[attribute] operator[=] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[attribute] Keyword[instanceof] identifier[FloatAttribute] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[attribute] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[FloatAttribute] operator[SEP] identifier[attribute] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
|
protected IntHashSet findBorderEdgeIds(SpatialRuleLookup ruleLookup) {
AllEdgesIterator allEdgesIterator = graph.getAllEdges();
NodeAccess nodeAccess = graph.getNodeAccess();
IntHashSet inaccessible = new IntHashSet();
while (allEdgesIterator.next()) {
int adjNode = allEdgesIterator.getAdjNode();
SpatialRule ruleAdj = ruleLookup.lookupRule(nodeAccess.getLatitude(adjNode), nodeAccess.getLongitude(adjNode));
int baseNode = allEdgesIterator.getBaseNode();
SpatialRule ruleBase = ruleLookup.lookupRule(nodeAccess.getLatitude(baseNode), nodeAccess.getLongitude(baseNode));
if (ruleAdj != ruleBase) {
inaccessible.add(allEdgesIterator.getEdge());
}
}
return inaccessible;
}
|
class class_name[name] begin[{]
method[findBorderEdgeIds, return_type[type[IntHashSet]], modifier[protected], parameter[ruleLookup]] begin[{]
local_variable[type[AllEdgesIterator], allEdgesIterator]
local_variable[type[NodeAccess], nodeAccess]
local_variable[type[IntHashSet], inaccessible]
while[call[allEdgesIterator.next, parameter[]]] begin[{]
local_variable[type[int], adjNode]
local_variable[type[SpatialRule], ruleAdj]
local_variable[type[int], baseNode]
local_variable[type[SpatialRule], ruleBase]
if[binary_operation[member[.ruleAdj], !=, member[.ruleBase]]] begin[{]
call[inaccessible.add, parameter[call[allEdgesIterator.getEdge, parameter[]]]]
else begin[{]
None
end[}]
end[}]
return[member[.inaccessible]]
end[}]
END[}]
|
Keyword[protected] identifier[IntHashSet] identifier[findBorderEdgeIds] operator[SEP] identifier[SpatialRuleLookup] identifier[ruleLookup] operator[SEP] {
identifier[AllEdgesIterator] identifier[allEdgesIterator] operator[=] identifier[graph] operator[SEP] identifier[getAllEdges] operator[SEP] operator[SEP] operator[SEP] identifier[NodeAccess] identifier[nodeAccess] operator[=] identifier[graph] operator[SEP] identifier[getNodeAccess] operator[SEP] operator[SEP] operator[SEP] identifier[IntHashSet] identifier[inaccessible] operator[=] Keyword[new] identifier[IntHashSet] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[allEdgesIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[adjNode] operator[=] identifier[allEdgesIterator] operator[SEP] identifier[getAdjNode] operator[SEP] operator[SEP] operator[SEP] identifier[SpatialRule] identifier[ruleAdj] operator[=] identifier[ruleLookup] operator[SEP] identifier[lookupRule] operator[SEP] identifier[nodeAccess] operator[SEP] identifier[getLatitude] operator[SEP] identifier[adjNode] operator[SEP] , identifier[nodeAccess] operator[SEP] identifier[getLongitude] operator[SEP] identifier[adjNode] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[baseNode] operator[=] identifier[allEdgesIterator] operator[SEP] identifier[getBaseNode] operator[SEP] operator[SEP] operator[SEP] identifier[SpatialRule] identifier[ruleBase] operator[=] identifier[ruleLookup] operator[SEP] identifier[lookupRule] operator[SEP] identifier[nodeAccess] operator[SEP] identifier[getLatitude] operator[SEP] identifier[baseNode] operator[SEP] , identifier[nodeAccess] operator[SEP] identifier[getLongitude] operator[SEP] identifier[baseNode] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ruleAdj] operator[!=] identifier[ruleBase] operator[SEP] {
identifier[inaccessible] operator[SEP] identifier[add] operator[SEP] identifier[allEdgesIterator] operator[SEP] identifier[getEdge] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[inaccessible] operator[SEP]
}
|
public LineString getLineString(Geometry geometry) {
if (geometry instanceof MultiLineString) {
if (geometryIndex >= 0 && geometryIndex < geometry.getNumGeometries()) {
return getLinearRing(geometry.getGeometryN(geometryIndex));
}
} else if (geometry instanceof LineString) {
return (LineString) geometry;
}
return getLinearRing(geometry);
}
|
class class_name[name] begin[{]
method[getLineString, return_type[type[LineString]], modifier[public], parameter[geometry]] begin[{]
if[binary_operation[member[.geometry], instanceof, type[MultiLineString]]] begin[{]
if[binary_operation[binary_operation[member[.geometryIndex], >=, literal[0]], &&, binary_operation[member[.geometryIndex], <, call[geometry.getNumGeometries, parameter[]]]]] begin[{]
return[call[.getLinearRing, parameter[call[geometry.getGeometryN, parameter[member[.geometryIndex]]]]]]
else begin[{]
None
end[}]
else begin[{]
if[binary_operation[member[.geometry], instanceof, type[LineString]]] begin[{]
return[Cast(expression=MemberReference(member=geometry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=LineString, sub_type=None))]
else begin[{]
None
end[}]
end[}]
return[call[.getLinearRing, parameter[member[.geometry]]]]
end[}]
END[}]
|
Keyword[public] identifier[LineString] identifier[getLineString] operator[SEP] identifier[Geometry] identifier[geometry] operator[SEP] {
Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[MultiLineString] operator[SEP] {
Keyword[if] operator[SEP] identifier[geometryIndex] operator[>=] Other[0] operator[&&] identifier[geometryIndex] operator[<] identifier[geometry] operator[SEP] identifier[getNumGeometries] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[getLinearRing] operator[SEP] identifier[geometry] operator[SEP] identifier[getGeometryN] operator[SEP] identifier[geometryIndex] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[geometry] Keyword[instanceof] identifier[LineString] operator[SEP] {
Keyword[return] operator[SEP] identifier[LineString] operator[SEP] identifier[geometry] operator[SEP]
}
Keyword[return] identifier[getLinearRing] operator[SEP] identifier[geometry] operator[SEP] operator[SEP]
}
|
@Override
public void actionCommit() {
List<Throwable> errors = new ArrayList<Throwable>();
try {
// if new create it first
if (!m_searchManager.getSearchIndexSources().keySet().contains(m_indexsource.getName())) {
m_searchManager.addSearchIndexSource(m_indexsource);
}
writeConfiguration();
} catch (Throwable t) {
errors.add(t);
}
// set the list of errors to display when saving failed
setCommitErrors(errors);
}
|
class class_name[name] begin[{]
method[actionCommit, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[List], errors]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=getSearchIndexSources, postfix_operators=[], prefix_operators=['!'], qualifier=m_searchManager, selectors=[MethodInvocation(arguments=[], member=keySet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=m_indexsource, selectors=[], type_arguments=None)], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=m_indexsource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addSearchIndexSource, postfix_operators=[], prefix_operators=[], qualifier=m_searchManager, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=writeConfiguration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
call[.setCommitErrors, parameter[member[.errors]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[actionCommit] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Throwable] operator[>] identifier[errors] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Throwable] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[m_searchManager] operator[SEP] identifier[getSearchIndexSources] operator[SEP] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[m_indexsource] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_searchManager] operator[SEP] identifier[addSearchIndexSource] operator[SEP] identifier[m_indexsource] operator[SEP] operator[SEP]
}
identifier[writeConfiguration] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[errors] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
identifier[setCommitErrors] operator[SEP] identifier[errors] operator[SEP] operator[SEP]
}
|
public boolean isEmpty() {
for (Node p = head; p != null; p = succ(p)) {
if (!p.isMatched())
return !p.isData;
}
return true;
}
|
class class_name[name] begin[{]
method[isEmpty, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isMatched, postfix_operators=[], prefix_operators=['!'], qualifier=p, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=isData, postfix_operators=[], prefix_operators=['!'], qualifier=p, selectors=[]), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=head, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=succ, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]), label=None)
return[literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isEmpty] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[Node] identifier[p] operator[=] identifier[head] operator[SEP] identifier[p] operator[!=] Other[null] operator[SEP] identifier[p] operator[=] identifier[succ] operator[SEP] identifier[p] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[p] operator[SEP] identifier[isMatched] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[!] identifier[p] operator[SEP] identifier[isData] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static double polygonSimple( Polygon2D_F64 poly ) {
double total = 0;
Point2D_F64 v0 = poly.get(0);
Point2D_F64 v1 = poly.get(1);
for (int i = 2; i < poly.size(); i++) {
Point2D_F64 v2 = poly.get(i);
total += v1.x*( v2.y - v0.y);
v0 = v1; v1 = v2;
}
Point2D_F64 v2 = poly.get(0);
total += v1.x*( v2.y - v0.y);
v0 = v1; v1 = v2;
v2 = poly.get(1);
total += v1.x*( v2.y - v0.y);
return Math.abs(total/2.0);
}
|
class class_name[name] begin[{]
method[polygonSimple, return_type[type[double]], modifier[public static], parameter[poly]] begin[{]
local_variable[type[double], total]
local_variable[type[Point2D_F64], v0]
local_variable[type[Point2D_F64], v1]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=poly, selectors=[], type_arguments=None), name=v2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Point2D_F64, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=total, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=v1, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=v2, selectors=[]), operandr=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=v0, selectors=[]), operator=-), operator=*)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=v0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=v1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=v1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=v2, 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=size, postfix_operators=[], prefix_operators=[], qualifier=poly, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[Point2D_F64], v2]
assign[member[.total], binary_operation[member[v1.x], *, binary_operation[member[v2.y], -, member[v0.y]]]]
assign[member[.v0], member[.v1]]
assign[member[.v1], member[.v2]]
assign[member[.v2], call[poly.get, parameter[literal[1]]]]
assign[member[.total], binary_operation[member[v1.x], *, binary_operation[member[v2.y], -, member[v0.y]]]]
return[call[Math.abs, parameter[binary_operation[member[.total], /, literal[2.0]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[double] identifier[polygonSimple] operator[SEP] identifier[Polygon2D_F64] identifier[poly] operator[SEP] {
Keyword[double] identifier[total] operator[=] Other[0] operator[SEP] identifier[Point2D_F64] identifier[v0] operator[=] identifier[poly] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[Point2D_F64] identifier[v1] operator[=] identifier[poly] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[2] operator[SEP] identifier[i] operator[<] identifier[poly] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Point2D_F64] identifier[v2] operator[=] identifier[poly] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[total] operator[+=] identifier[v1] operator[SEP] identifier[x] operator[*] operator[SEP] identifier[v2] operator[SEP] identifier[y] operator[-] identifier[v0] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[v0] operator[=] identifier[v1] operator[SEP] identifier[v1] operator[=] identifier[v2] operator[SEP]
}
identifier[Point2D_F64] identifier[v2] operator[=] identifier[poly] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[total] operator[+=] identifier[v1] operator[SEP] identifier[x] operator[*] operator[SEP] identifier[v2] operator[SEP] identifier[y] operator[-] identifier[v0] operator[SEP] identifier[y] operator[SEP] operator[SEP] identifier[v0] operator[=] identifier[v1] operator[SEP] identifier[v1] operator[=] identifier[v2] operator[SEP] identifier[v2] operator[=] identifier[poly] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[total] operator[+=] identifier[v1] operator[SEP] identifier[x] operator[*] operator[SEP] identifier[v2] operator[SEP] identifier[y] operator[-] identifier[v0] operator[SEP] identifier[y] operator[SEP] operator[SEP] Keyword[return] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[total] operator[/] literal[Float] operator[SEP] operator[SEP]
}
|
@Override
public JapaneseDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
if (era instanceof JapaneseEra == false) {
throw new ClassCastException("Era must be JapaneseEra");
}
return JapaneseDate.ofYearDay((JapaneseEra) era, yearOfEra, dayOfYear);
}
|
class class_name[name] begin[{]
method[dateYearDay, return_type[type[JapaneseDate]], modifier[public], parameter[era, yearOfEra, dayOfYear]] begin[{]
if[binary_operation[binary_operation[member[.era], instanceof, type[JapaneseEra]], ==, literal[false]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Era must be JapaneseEra")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassCastException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[JapaneseDate.ofYearDay, parameter[Cast(expression=MemberReference(member=era, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JapaneseEra, sub_type=None)), member[.yearOfEra], member[.dayOfYear]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[JapaneseDate] identifier[dateYearDay] operator[SEP] identifier[Era] identifier[era] , Keyword[int] identifier[yearOfEra] , Keyword[int] identifier[dayOfYear] operator[SEP] {
Keyword[if] operator[SEP] identifier[era] Keyword[instanceof] identifier[JapaneseEra] operator[==] literal[boolean] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ClassCastException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[JapaneseDate] operator[SEP] identifier[ofYearDay] operator[SEP] operator[SEP] identifier[JapaneseEra] operator[SEP] identifier[era] , identifier[yearOfEra] , identifier[dayOfYear] operator[SEP] operator[SEP]
}
|
protected final String prepareUri(final URI uri) {
if (compareRelative) {
final String path = uri.getRawPath();
final String query = uri.getRawQuery();
final String fragment = uri.getRawFragment();
if (query != null && fragment != null) {
return path + "?" + query + "#" + fragment;
} else if (query != null) {
return path + "?" + query;
} else if (fragment != null) {
return path + "#" + fragment;
} else {
return path;
}
} else {
return uri.toString();
}
}
|
class class_name[name] begin[{]
method[prepareUri, return_type[type[String]], modifier[final protected], parameter[uri]] begin[{]
if[member[.compareRelative]] begin[{]
local_variable[type[String], path]
local_variable[type[String], query]
local_variable[type[String], fragment]
if[binary_operation[binary_operation[member[.query], !=, literal[null]], &&, binary_operation[member[.fragment], !=, literal[null]]]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[member[.path], +, literal["?"]], +, member[.query]], +, literal["#"]], +, member[.fragment]]]
else begin[{]
if[binary_operation[member[.query], !=, literal[null]]] begin[{]
return[binary_operation[binary_operation[member[.path], +, literal["?"]], +, member[.query]]]
else begin[{]
if[binary_operation[member[.fragment], !=, literal[null]]] begin[{]
return[binary_operation[binary_operation[member[.path], +, literal["#"]], +, member[.fragment]]]
else begin[{]
return[member[.path]]
end[}]
end[}]
end[}]
else begin[{]
return[call[uri.toString, parameter[]]]
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[final] identifier[String] identifier[prepareUri] operator[SEP] Keyword[final] identifier[URI] identifier[uri] operator[SEP] {
Keyword[if] operator[SEP] identifier[compareRelative] operator[SEP] {
Keyword[final] identifier[String] identifier[path] operator[=] identifier[uri] operator[SEP] identifier[getRawPath] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[query] operator[=] identifier[uri] operator[SEP] identifier[getRawQuery] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[fragment] operator[=] identifier[uri] operator[SEP] identifier[getRawFragment] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[query] operator[!=] Other[null] operator[&&] identifier[fragment] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[path] operator[+] literal[String] operator[+] identifier[query] operator[+] literal[String] operator[+] identifier[fragment] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[query] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[path] operator[+] literal[String] operator[+] identifier[query] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[fragment] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[path] operator[+] literal[String] operator[+] identifier[fragment] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[path] operator[SEP]
}
}
Keyword[else] {
Keyword[return] identifier[uri] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@GwtIncompatible // Array.newInstance(Class, int)
public static <T> T[] concat(T[] first, T[] second, Class<T> type) {
T[] result = newArray(type, first.length + second.length);
System.arraycopy(first, 0, result, 0, first.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
|
class class_name[name] begin[{]
method[concat, return_type[type[T]], modifier[public static], parameter[first, second, type]] begin[{]
local_variable[type[T], result]
call[System.arraycopy, parameter[member[.first], literal[0], member[.result], literal[0], member[first.length]]]
call[System.arraycopy, parameter[member[.second], literal[0], member[.result], member[first.length], member[second.length]]]
return[member[.result]]
end[}]
END[}]
|
annotation[@] identifier[GwtIncompatible] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] operator[SEP] operator[SEP] identifier[concat] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[first] , identifier[T] operator[SEP] operator[SEP] identifier[second] , identifier[Class] operator[<] identifier[T] operator[>] identifier[type] operator[SEP] {
identifier[T] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[newArray] operator[SEP] identifier[type] , identifier[first] operator[SEP] identifier[length] operator[+] identifier[second] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[first] , Other[0] , identifier[result] , Other[0] , identifier[first] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[second] , Other[0] , identifier[result] , identifier[first] operator[SEP] identifier[length] , identifier[second] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public boolean contains(Object e) {
if (N.isNullOrEmpty(coll)) {
return false;
}
return coll.contains(e);
}
|
class class_name[name] begin[{]
method[contains, return_type[type[boolean]], modifier[public], parameter[e]] begin[{]
if[call[N.isNullOrEmpty, parameter[member[.coll]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[call[coll.contains, parameter[member[.e]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[contains] operator[SEP] identifier[Object] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[N] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[coll] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[coll] operator[SEP] identifier[contains] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
|
public Map<String,Object> getRowData() {
if (resultSet == null) {
return (null);
} else if (!isRowAvailable()) {
throw new NoRowAvailableException();
}
try {
getMetaData();
return (new ResultSetMap(this, String.CASE_INSENSITIVE_ORDER));
} catch (SQLException e) {
throw new FacesException(e);
}
}
|
class class_name[name] begin[{]
method[getRowData, return_type[type[Map]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.resultSet], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
if[call[.isRowAvailable, parameter[]]] 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=NoRowAvailableException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getMetaData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=CASE_INSENSITIVE_ORDER, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResultSetMap, sub_type=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=FacesException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[getRowData] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[resultSet] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[isRowAvailable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoRowAvailableException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[getMetaData] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[new] identifier[ResultSetMap] operator[SEP] Keyword[this] , identifier[String] operator[SEP] identifier[CASE_INSENSITIVE_ORDER] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FacesException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static void setServletContext(ServletContext servletContext) {
if (servletContext == null) {
Mvcs.servletContext.remove();
}
if (def_servletContext == null)
def_servletContext = servletContext;
Mvcs.servletContext.set(servletContext);
}
|
class class_name[name] begin[{]
method[setServletContext, return_type[void], modifier[public static], parameter[servletContext]] begin[{]
if[binary_operation[member[.servletContext], ==, literal[null]]] begin[{]
call[Mvcs.servletContext.remove, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.def_servletContext], ==, literal[null]]] begin[{]
assign[member[.def_servletContext], member[.servletContext]]
else begin[{]
None
end[}]
call[Mvcs.servletContext.set, parameter[member[.servletContext]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[setServletContext] operator[SEP] identifier[ServletContext] identifier[servletContext] operator[SEP] {
Keyword[if] operator[SEP] identifier[servletContext] operator[==] Other[null] operator[SEP] {
identifier[Mvcs] operator[SEP] identifier[servletContext] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[def_servletContext] operator[==] Other[null] operator[SEP] identifier[def_servletContext] operator[=] identifier[servletContext] operator[SEP] identifier[Mvcs] operator[SEP] identifier[servletContext] operator[SEP] identifier[set] operator[SEP] identifier[servletContext] operator[SEP] operator[SEP]
}
|
public java.util.List<DistributionSummary> getItems() {
if (items == null) {
items = new com.amazonaws.internal.SdkInternalList<DistributionSummary>();
}
return items;
}
|
class class_name[name] begin[{]
method[getItems, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.items], ==, literal[null]]] begin[{]
assign[member[.items], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DistributionSummary, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.items]]
end[}]
END[}]
|
Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[DistributionSummary] operator[>] identifier[getItems] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[items] operator[==] Other[null] operator[SEP] {
identifier[items] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[DistributionSummary] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[items] operator[SEP]
}
|
public void pushHistory(String strHistory, boolean bPushToBrowser)
{
if (m_vHistory == null)
m_vHistory = new Vector<String>();
m_vHistory.addElement(strHistory);
String strHelp = Utility.fixDisplayURL(strHistory, true, true, true, this);
if (this.getAppletScreen() != null)
if (this.getAppletScreen().getScreenFieldView() != null)
this.getAppletScreen().getScreenFieldView().showDocument(strHelp, MenuConstants.HELP_WINDOW_CHANGE);
if (bPushToBrowser)
if (this.getAppletScreen() != null)
if (this.getAppletScreen().getTask() instanceof BaseAppletReference)
((BaseAppletReference)this.getAppletScreen().getTask()).pushBrowserHistory(strHistory, this.getTitle(), bPushToBrowser); // Let browser know about the new screen
}
|
class class_name[name] begin[{]
method[pushHistory, return_type[void], modifier[public], parameter[strHistory, bPushToBrowser]] begin[{]
if[binary_operation[member[.m_vHistory], ==, literal[null]]] begin[{]
assign[member[.m_vHistory], 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=String, sub_type=None))], dimensions=None, name=Vector, sub_type=None))]
else begin[{]
None
end[}]
call[m_vHistory.addElement, parameter[member[.strHistory]]]
local_variable[type[String], strHelp]
if[binary_operation[THIS[call[None.getAppletScreen, parameter[]]], !=, literal[null]]] begin[{]
if[binary_operation[THIS[call[None.getAppletScreen, parameter[]]call[None.getScreenFieldView, parameter[]]], !=, literal[null]]] begin[{]
THIS[call[None.getAppletScreen, parameter[]]call[None.getScreenFieldView, parameter[]]call[None.showDocument, parameter[member[.strHelp], member[MenuConstants.HELP_WINDOW_CHANGE]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[member[.bPushToBrowser]] begin[{]
if[binary_operation[THIS[call[None.getAppletScreen, parameter[]]], !=, literal[null]]] begin[{]
if[binary_operation[THIS[call[None.getAppletScreen, parameter[]]call[None.getTask, parameter[]]], instanceof, type[BaseAppletReference]]] begin[{]
Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getAppletScreen, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getTask, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=BaseAppletReference, sub_type=None))
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[pushHistory] operator[SEP] identifier[String] identifier[strHistory] , Keyword[boolean] identifier[bPushToBrowser] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_vHistory] operator[==] Other[null] operator[SEP] identifier[m_vHistory] operator[=] Keyword[new] identifier[Vector] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[m_vHistory] operator[SEP] identifier[addElement] operator[SEP] identifier[strHistory] operator[SEP] operator[SEP] identifier[String] identifier[strHelp] operator[=] identifier[Utility] operator[SEP] identifier[fixDisplayURL] operator[SEP] identifier[strHistory] , literal[boolean] , literal[boolean] , literal[boolean] , Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getAppletScreen] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getAppletScreen] operator[SEP] operator[SEP] operator[SEP] identifier[getScreenFieldView] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[getAppletScreen] operator[SEP] operator[SEP] operator[SEP] identifier[getScreenFieldView] operator[SEP] operator[SEP] operator[SEP] identifier[showDocument] operator[SEP] identifier[strHelp] , identifier[MenuConstants] operator[SEP] identifier[HELP_WINDOW_CHANGE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bPushToBrowser] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getAppletScreen] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getAppletScreen] operator[SEP] operator[SEP] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] Keyword[instanceof] identifier[BaseAppletReference] operator[SEP] operator[SEP] operator[SEP] identifier[BaseAppletReference] operator[SEP] Keyword[this] operator[SEP] identifier[getAppletScreen] operator[SEP] operator[SEP] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[pushBrowserHistory] operator[SEP] identifier[strHistory] , Keyword[this] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] , identifier[bPushToBrowser] operator[SEP] operator[SEP]
}
|
@Override
public List<String> getDelcaredDependencies(String mid) throws ProcessingDependenciesException {
List<String> result = null;
try {
getReadLock();
try {
DepTreeNode.DependencyInfo depInfo = depMap.get(mid);
if (depInfo != null) {
result = depInfo.getDeclaredDependencies();
}
} finally {
releaseReadLock();
}
} catch (InterruptedException e) {
if (log.isLoggable(Level.SEVERE)) {
log.log(Level.SEVERE, e.getMessage(), e);
}
}
return result;
}
|
class class_name[name] begin[{]
method[getDelcaredDependencies, return_type[type[List]], modifier[public], parameter[mid]] begin[{]
local_variable[type[List], result]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getReadLock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=mid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=depMap, selectors=[], type_arguments=None), name=depInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DepTreeNode, sub_type=ReferenceType(arguments=None, dimensions=None, name=DependencyInfo, sub_type=None))), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=depInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getDeclaredDependencies, postfix_operators=[], prefix_operators=[], qualifier=depInfo, selectors=[], type_arguments=None)), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=releaseReadLock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=isLoggable, 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=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
return[member[.result]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getDelcaredDependencies] operator[SEP] identifier[String] identifier[mid] operator[SEP] Keyword[throws] identifier[ProcessingDependenciesException] {
identifier[List] operator[<] identifier[String] operator[>] identifier[result] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[getReadLock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[DepTreeNode] operator[SEP] identifier[DependencyInfo] identifier[depInfo] operator[=] identifier[depMap] operator[SEP] identifier[get] operator[SEP] identifier[mid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[depInfo] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[=] identifier[depInfo] operator[SEP] identifier[getDeclaredDependencies] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[releaseReadLock] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static Geometry addZ(Geometry geometry, double z) throws SQLException {
if(geometry == null){
return null;
}
geometry.apply(new AddZCoordinateSequenceFilter(z));
return geometry;
}
|
class class_name[name] begin[{]
method[addZ, return_type[type[Geometry]], modifier[public static], parameter[geometry, z]] begin[{]
if[binary_operation[member[.geometry], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
call[geometry.apply, parameter[ClassCreator(arguments=[MemberReference(member=z, 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=AddZCoordinateSequenceFilter, sub_type=None))]]
return[member[.geometry]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Geometry] identifier[addZ] operator[SEP] identifier[Geometry] identifier[geometry] , Keyword[double] identifier[z] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[if] operator[SEP] identifier[geometry] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[geometry] operator[SEP] identifier[apply] operator[SEP] Keyword[new] identifier[AddZCoordinateSequenceFilter] operator[SEP] identifier[z] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[geometry] operator[SEP]
}
|
public static int lastIndexOfIgnoreCase(String pString, int pChar, int pPos) {
if ((pString == null)) {
return -1;
}
// Get first char
char lower = Character.toLowerCase((char) pChar);
char upper = Character.toUpperCase((char) pChar);
int indexLower;
int indexUpper;
// Test for char
indexLower = pString.lastIndexOf(lower, pPos);
indexUpper = pString.lastIndexOf(upper, pPos);
if (indexLower < 0) {
/* if (indexUpper < 0)
return -1; // First char not found
else */
return indexUpper;// Only upper
}
else if (indexUpper < 0) {
return indexLower;// Only lower
}
else {
// Both found, select last occurence
return (indexLower > indexUpper)
? indexLower
: indexUpper;
}
}
|
class class_name[name] begin[{]
method[lastIndexOfIgnoreCase, return_type[type[int]], modifier[public static], parameter[pString, pChar, pPos]] begin[{]
if[binary_operation[member[.pString], ==, literal[null]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
local_variable[type[char], lower]
local_variable[type[char], upper]
local_variable[type[int], indexLower]
local_variable[type[int], indexUpper]
assign[member[.indexLower], call[pString.lastIndexOf, parameter[member[.lower], member[.pPos]]]]
assign[member[.indexUpper], call[pString.lastIndexOf, parameter[member[.upper], member[.pPos]]]]
if[binary_operation[member[.indexLower], <, literal[0]]] begin[{]
return[member[.indexUpper]]
else begin[{]
if[binary_operation[member[.indexUpper], <, literal[0]]] begin[{]
return[member[.indexLower]]
else begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=indexLower, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=indexUpper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), if_false=MemberReference(member=indexUpper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=indexLower, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[lastIndexOfIgnoreCase] operator[SEP] identifier[String] identifier[pString] , Keyword[int] identifier[pChar] , Keyword[int] identifier[pPos] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[pString] operator[==] Other[null] operator[SEP] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[char] identifier[lower] operator[=] identifier[Character] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[pChar] operator[SEP] operator[SEP] Keyword[char] identifier[upper] operator[=] identifier[Character] operator[SEP] identifier[toUpperCase] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[pChar] operator[SEP] operator[SEP] Keyword[int] identifier[indexLower] operator[SEP] Keyword[int] identifier[indexUpper] operator[SEP] identifier[indexLower] operator[=] identifier[pString] operator[SEP] identifier[lastIndexOf] operator[SEP] identifier[lower] , identifier[pPos] operator[SEP] operator[SEP] identifier[indexUpper] operator[=] identifier[pString] operator[SEP] identifier[lastIndexOf] operator[SEP] identifier[upper] , identifier[pPos] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[indexLower] operator[<] Other[0] operator[SEP] {
Keyword[return] identifier[indexUpper] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[indexUpper] operator[<] Other[0] operator[SEP] {
Keyword[return] identifier[indexLower] operator[SEP]
}
Keyword[else] {
Keyword[return] operator[SEP] identifier[indexLower] operator[>] identifier[indexUpper] operator[SEP] operator[?] identifier[indexLower] operator[:] identifier[indexUpper] operator[SEP]
}
}
|
public static BitMatrix encode(String content, int width, int height) {
return encode(content, BarcodeFormat.QR_CODE, width, height);
}
|
class class_name[name] begin[{]
method[encode, return_type[type[BitMatrix]], modifier[public static], parameter[content, width, height]] begin[{]
return[call[.encode, parameter[member[.content], member[BarcodeFormat.QR_CODE], member[.width], member[.height]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BitMatrix] identifier[encode] operator[SEP] identifier[String] identifier[content] , Keyword[int] identifier[width] , Keyword[int] identifier[height] operator[SEP] {
Keyword[return] identifier[encode] operator[SEP] identifier[content] , identifier[BarcodeFormat] operator[SEP] identifier[QR_CODE] , identifier[width] , identifier[height] operator[SEP] operator[SEP]
}
|
@Override
protected final void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (!support.isLegal(request)) {
return;
}
//设置响应编码格式
response.setCharacterEncoding("UTF-8");
String resp = support.processRequest(request);
PrintWriter pw = response.getWriter();
pw.write(resp);
pw.flush();
pw.close();
}
|
class class_name[name] begin[{]
method[doPost, return_type[void], modifier[final protected], parameter[request, response]] begin[{]
if[call[support.isLegal, parameter[member[.request]]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[response.setCharacterEncoding, parameter[literal["UTF-8"]]]
local_variable[type[String], resp]
local_variable[type[PrintWriter], pw]
call[pw.write, parameter[member[.resp]]]
call[pw.flush, parameter[]]
call[pw.close, parameter[]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] Keyword[final] Keyword[void] identifier[doPost] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[ServletException] , identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[support] operator[SEP] identifier[isLegal] operator[SEP] identifier[request] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[response] operator[SEP] identifier[setCharacterEncoding] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[support] operator[SEP] identifier[processRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[PrintWriter] identifier[pw] operator[=] identifier[response] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] identifier[pw] operator[SEP] identifier[write] operator[SEP] identifier[resp] operator[SEP] operator[SEP] identifier[pw] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[pw] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public UpdateAgentResult updateAgent(UpdateAgentRequest request) {
request = beforeClientExecution(request);
return executeUpdateAgent(request);
}
|
class class_name[name] begin[{]
method[updateAgent, return_type[type[UpdateAgentResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeUpdateAgent, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[UpdateAgentResult] identifier[updateAgent] operator[SEP] identifier[UpdateAgentRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeUpdateAgent] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private Message receive(TestContext context) {
Endpoint messageEndpoint = getOrCreateEndpoint(context);
return receiveTimeout > 0 ? messageEndpoint.createConsumer().receive(context, receiveTimeout) :
messageEndpoint.createConsumer().receive(context, messageEndpoint.getEndpointConfiguration().getTimeout());
}
|
class class_name[name] begin[{]
method[receive, return_type[type[Message]], modifier[private], parameter[context]] begin[{]
local_variable[type[Endpoint], messageEndpoint]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=receiveTimeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), if_false=MethodInvocation(arguments=[], member=createConsumer, postfix_operators=[], prefix_operators=[], qualifier=messageEndpoint, selectors=[MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getEndpointConfiguration, postfix_operators=[], prefix_operators=[], qualifier=messageEndpoint, selectors=[MethodInvocation(arguments=[], member=getTimeout, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=receive, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=MethodInvocation(arguments=[], member=createConsumer, postfix_operators=[], prefix_operators=[], qualifier=messageEndpoint, selectors=[MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=receiveTimeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=receive, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None))]
end[}]
END[}]
|
Keyword[private] identifier[Message] identifier[receive] operator[SEP] identifier[TestContext] identifier[context] operator[SEP] {
identifier[Endpoint] identifier[messageEndpoint] operator[=] identifier[getOrCreateEndpoint] operator[SEP] identifier[context] operator[SEP] operator[SEP] Keyword[return] identifier[receiveTimeout] operator[>] Other[0] operator[?] identifier[messageEndpoint] operator[SEP] identifier[createConsumer] operator[SEP] operator[SEP] operator[SEP] identifier[receive] operator[SEP] identifier[context] , identifier[receiveTimeout] operator[SEP] operator[:] identifier[messageEndpoint] operator[SEP] identifier[createConsumer] operator[SEP] operator[SEP] operator[SEP] identifier[receive] operator[SEP] identifier[context] , identifier[messageEndpoint] operator[SEP] identifier[getEndpointConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[getTimeout] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public IfcBSplineCurveForm createIfcBSplineCurveFormFromString(EDataType eDataType, String initialValue) {
IfcBSplineCurveForm result = IfcBSplineCurveForm.get(initialValue);
if (result == null)
throw new IllegalArgumentException(
"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
}
|
class class_name[name] begin[{]
method[createIfcBSplineCurveFormFromString, return_type[type[IfcBSplineCurveForm]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[IfcBSplineCurveForm], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[IfcBSplineCurveForm] identifier[createIfcBSplineCurveFormFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[IfcBSplineCurveForm] identifier[result] operator[=] identifier[IfcBSplineCurveForm] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
private void visit(XmlSchema xmlSchema, XmlSchemaObjectBase element,
final int level, final ArrayNode avroFields) {
if (element instanceof XmlSchemaElement) {
visit(xmlSchema, (XmlSchemaElement) element, level, avroFields);
} else if (element instanceof XmlSchemaGroupRef) {
XmlSchemaGroupRef groupRef = (XmlSchemaGroupRef) element;
XmlSchemaGroup group = xmlSchema.getGroups().get(
groupRef.getRefName());
visit(xmlSchema, group.getParticle(), level, avroFields);
} else if (element instanceof XmlSchemaChoice) {
visit(xmlSchema, (XmlSchemaChoice) element, level, avroFields);
}
}
|
class class_name[name] begin[{]
method[visit, return_type[void], modifier[private], parameter[xmlSchema, element, level, avroFields]] begin[{]
if[binary_operation[member[.element], instanceof, type[XmlSchemaElement]]] begin[{]
call[.visit, parameter[member[.xmlSchema], Cast(expression=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=XmlSchemaElement, sub_type=None)), member[.level], member[.avroFields]]]
else begin[{]
if[binary_operation[member[.element], instanceof, type[XmlSchemaGroupRef]]] begin[{]
local_variable[type[XmlSchemaGroupRef], groupRef]
local_variable[type[XmlSchemaGroup], group]
call[.visit, parameter[member[.xmlSchema], call[group.getParticle, parameter[]], member[.level], member[.avroFields]]]
else begin[{]
if[binary_operation[member[.element], instanceof, type[XmlSchemaChoice]]] begin[{]
call[.visit, parameter[member[.xmlSchema], Cast(expression=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=XmlSchemaChoice, sub_type=None)), member[.level], member[.avroFields]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[visit] operator[SEP] identifier[XmlSchema] identifier[xmlSchema] , identifier[XmlSchemaObjectBase] identifier[element] , Keyword[final] Keyword[int] identifier[level] , Keyword[final] identifier[ArrayNode] identifier[avroFields] operator[SEP] {
Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[XmlSchemaElement] operator[SEP] {
identifier[visit] operator[SEP] identifier[xmlSchema] , operator[SEP] identifier[XmlSchemaElement] operator[SEP] identifier[element] , identifier[level] , identifier[avroFields] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[XmlSchemaGroupRef] operator[SEP] {
identifier[XmlSchemaGroupRef] identifier[groupRef] operator[=] operator[SEP] identifier[XmlSchemaGroupRef] operator[SEP] identifier[element] operator[SEP] identifier[XmlSchemaGroup] identifier[group] operator[=] identifier[xmlSchema] operator[SEP] identifier[getGroups] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[groupRef] operator[SEP] identifier[getRefName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[visit] operator[SEP] identifier[xmlSchema] , identifier[group] operator[SEP] identifier[getParticle] operator[SEP] operator[SEP] , identifier[level] , identifier[avroFields] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[XmlSchemaChoice] operator[SEP] {
identifier[visit] operator[SEP] identifier[xmlSchema] , operator[SEP] identifier[XmlSchemaChoice] operator[SEP] identifier[element] , identifier[level] , identifier[avroFields] operator[SEP] operator[SEP]
}
}
|
public static void rank1UpdateMultL(DMatrixRMaj A , double u[] ,
double gamma ,
int colA0,
int w0 , int w1 )
{
for( int i = colA0; i < A.numRows; i++ ) {
int startIndex = i*A.numCols+w0;
double sum = 0;
int rowIndex = startIndex;
for( int j = w0; j < w1; j++ ) {
sum += A.data[rowIndex++]*u[j];
}
sum = -gamma*sum;
rowIndex = startIndex;
for( int j = w0; j < w1; j++ ) {
A.data[rowIndex++] += sum*u[j];
}
}
}
|
class class_name[name] begin[{]
method[rank1UpdateMultL, return_type[void], modifier[public static], parameter[A, u, gamma, colA0, w0, w1]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numCols, postfix_operators=[], prefix_operators=[], qualifier=A, selectors=[]), operator=*), operandr=MemberReference(member=w0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=startIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=sum)], modifiers=set(), type=BasicType(dimensions=[], name=double)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=startIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=rowIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=A, selectors=[ArraySelector(index=MemberReference(member=rowIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=u, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=w1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=w0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=gamma, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[]), operandr=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rowIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=startIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=A, selectors=[ArraySelector(index=MemberReference(member=rowIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type=+=, value=BinaryOperation(operandl=MemberReference(member=sum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=u, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=w1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=w0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numRows, postfix_operators=[], prefix_operators=[], qualifier=A, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=colA0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[rank1UpdateMultL] operator[SEP] identifier[DMatrixRMaj] identifier[A] , Keyword[double] identifier[u] operator[SEP] operator[SEP] , Keyword[double] identifier[gamma] , Keyword[int] identifier[colA0] , Keyword[int] identifier[w0] , Keyword[int] identifier[w1] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[colA0] operator[SEP] identifier[i] operator[<] identifier[A] operator[SEP] identifier[numRows] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[startIndex] operator[=] identifier[i] operator[*] identifier[A] operator[SEP] identifier[numCols] operator[+] identifier[w0] operator[SEP] Keyword[double] identifier[sum] operator[=] Other[0] operator[SEP] Keyword[int] identifier[rowIndex] operator[=] identifier[startIndex] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[w0] operator[SEP] identifier[j] operator[<] identifier[w1] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[sum] operator[+=] identifier[A] operator[SEP] identifier[data] operator[SEP] identifier[rowIndex] operator[++] operator[SEP] operator[*] identifier[u] operator[SEP] identifier[j] operator[SEP] operator[SEP]
}
identifier[sum] operator[=] operator[-] identifier[gamma] operator[*] identifier[sum] operator[SEP] identifier[rowIndex] operator[=] identifier[startIndex] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[w0] operator[SEP] identifier[j] operator[<] identifier[w1] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[A] operator[SEP] identifier[data] operator[SEP] identifier[rowIndex] operator[++] operator[SEP] operator[+=] identifier[sum] operator[*] identifier[u] operator[SEP] identifier[j] operator[SEP] operator[SEP]
}
}
}
|
public void write(DataOutput out) throws IOException {
Text.writeString(out, jobFile);
taskId.write(out);
out.writeInt(partition);
out.writeInt(numSlotsRequired);
taskStatus.write(out);
skipRanges.write(out);
out.writeBoolean(skipping);
out.writeBoolean(jobCleanup);
if (jobCleanup) {
WritableUtils.writeEnum(out, jobRunStateForCleanup);
}
out.writeBoolean(jobSetup);
Text.writeString(out, username);
out.writeBoolean(writeSkipRecs);
out.writeBoolean(taskCleanup);
extraData.write(out);
}
|
class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[out]] begin[{]
call[Text.writeString, parameter[member[.out], member[.jobFile]]]
call[taskId.write, parameter[member[.out]]]
call[out.writeInt, parameter[member[.partition]]]
call[out.writeInt, parameter[member[.numSlotsRequired]]]
call[taskStatus.write, parameter[member[.out]]]
call[skipRanges.write, parameter[member[.out]]]
call[out.writeBoolean, parameter[member[.skipping]]]
call[out.writeBoolean, parameter[member[.jobCleanup]]]
if[member[.jobCleanup]] begin[{]
call[WritableUtils.writeEnum, parameter[member[.out], member[.jobRunStateForCleanup]]]
else begin[{]
None
end[}]
call[out.writeBoolean, parameter[member[.jobSetup]]]
call[Text.writeString, parameter[member[.out], member[.username]]]
call[out.writeBoolean, parameter[member[.writeSkipRecs]]]
call[out.writeBoolean, parameter[member[.taskCleanup]]]
call[extraData.write, parameter[member[.out]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[write] operator[SEP] identifier[DataOutput] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Text] operator[SEP] identifier[writeString] operator[SEP] identifier[out] , identifier[jobFile] operator[SEP] operator[SEP] identifier[taskId] operator[SEP] identifier[write] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeInt] operator[SEP] identifier[partition] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeInt] operator[SEP] identifier[numSlotsRequired] operator[SEP] operator[SEP] identifier[taskStatus] operator[SEP] identifier[write] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[skipRanges] operator[SEP] identifier[write] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeBoolean] operator[SEP] identifier[skipping] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeBoolean] operator[SEP] identifier[jobCleanup] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jobCleanup] operator[SEP] {
identifier[WritableUtils] operator[SEP] identifier[writeEnum] operator[SEP] identifier[out] , identifier[jobRunStateForCleanup] operator[SEP] operator[SEP]
}
identifier[out] operator[SEP] identifier[writeBoolean] operator[SEP] identifier[jobSetup] operator[SEP] operator[SEP] identifier[Text] operator[SEP] identifier[writeString] operator[SEP] identifier[out] , identifier[username] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeBoolean] operator[SEP] identifier[writeSkipRecs] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeBoolean] operator[SEP] identifier[taskCleanup] operator[SEP] operator[SEP] identifier[extraData] operator[SEP] identifier[write] operator[SEP] identifier[out] operator[SEP] operator[SEP]
}
|
public Future<AsperaTransaction> upload(String bucket, File localFileName, String remoteFileName) {
return upload(bucket, localFileName, remoteFileName, asperaConfig, null);
}
|
class class_name[name] begin[{]
method[upload, return_type[type[Future]], modifier[public], parameter[bucket, localFileName, remoteFileName]] begin[{]
return[call[.upload, parameter[member[.bucket], member[.localFileName], member[.remoteFileName], member[.asperaConfig], literal[null]]]]
end[}]
END[}]
|
Keyword[public] identifier[Future] operator[<] identifier[AsperaTransaction] operator[>] identifier[upload] operator[SEP] identifier[String] identifier[bucket] , identifier[File] identifier[localFileName] , identifier[String] identifier[remoteFileName] operator[SEP] {
Keyword[return] identifier[upload] operator[SEP] identifier[bucket] , identifier[localFileName] , identifier[remoteFileName] , identifier[asperaConfig] , Other[null] operator[SEP] operator[SEP]
}
|
public Observable<Void> createOrUpdateSecuritySettingsAsync(String deviceName, String resourceGroupName, AsymmetricEncryptedSecret deviceAdminPassword) {
return createOrUpdateSecuritySettingsWithServiceResponseAsync(deviceName, resourceGroupName, deviceAdminPassword).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[createOrUpdateSecuritySettingsAsync, return_type[type[Observable]], modifier[public], parameter[deviceName, resourceGroupName, deviceAdminPassword]] begin[{]
return[call[.createOrUpdateSecuritySettingsWithServiceResponseAsync, parameter[member[.deviceName], member[.resourceGroupName], member[.deviceAdminPassword]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[Void] operator[>] identifier[createOrUpdateSecuritySettingsAsync] operator[SEP] identifier[String] identifier[deviceName] , identifier[String] identifier[resourceGroupName] , identifier[AsymmetricEncryptedSecret] identifier[deviceAdminPassword] operator[SEP] {
Keyword[return] identifier[createOrUpdateSecuritySettingsWithServiceResponseAsync] operator[SEP] identifier[deviceName] , identifier[resourceGroupName] , identifier[deviceAdminPassword] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Void] operator[>] , identifier[Void] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Void] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Void] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public final void setProgressBarType(final ProgressBarType type) {
ProgressBarType currentType = getProgressBarType();
ProgressBarType typeToSet = type == null ? DEFAULT_TYPE : type;
if (typeToSet != currentType) {
getOrCreateComponentModel().barType = typeToSet;
}
}
|
class class_name[name] begin[{]
method[setProgressBarType, return_type[void], modifier[final public], parameter[type]] begin[{]
local_variable[type[ProgressBarType], currentType]
local_variable[type[ProgressBarType], typeToSet]
if[binary_operation[member[.typeToSet], !=, member[.currentType]]] begin[{]
assign[call[.getOrCreateComponentModel, parameter[]], member[.typeToSet]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[final] Keyword[void] identifier[setProgressBarType] operator[SEP] Keyword[final] identifier[ProgressBarType] identifier[type] operator[SEP] {
identifier[ProgressBarType] identifier[currentType] operator[=] identifier[getProgressBarType] operator[SEP] operator[SEP] operator[SEP] identifier[ProgressBarType] identifier[typeToSet] operator[=] identifier[type] operator[==] Other[null] operator[?] identifier[DEFAULT_TYPE] operator[:] identifier[type] operator[SEP] Keyword[if] operator[SEP] identifier[typeToSet] operator[!=] identifier[currentType] operator[SEP] {
identifier[getOrCreateComponentModel] operator[SEP] operator[SEP] operator[SEP] identifier[barType] operator[=] identifier[typeToSet] operator[SEP]
}
}
|
public static Object convert(Object maplist, Object model) {
StructureConvert convert = new StructureConvert(model);
return convert.convert(maplist);
}
|
class class_name[name] begin[{]
method[convert, return_type[type[Object]], modifier[public static], parameter[maplist, model]] begin[{]
local_variable[type[StructureConvert], convert]
return[call[convert.convert, parameter[member[.maplist]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Object] identifier[convert] operator[SEP] identifier[Object] identifier[maplist] , identifier[Object] identifier[model] operator[SEP] {
identifier[StructureConvert] identifier[convert] operator[=] Keyword[new] identifier[StructureConvert] operator[SEP] identifier[model] operator[SEP] operator[SEP] Keyword[return] identifier[convert] operator[SEP] identifier[convert] operator[SEP] identifier[maplist] operator[SEP] operator[SEP]
}
|
public static boolean hasNavigableWebContent(
Context context, AccessibilityNodeInfoCompat node) {
return (supportsWebActions(node) && isScriptInjectionEnabled(context))
|| hasNativeWebContent(node);
}
|
class class_name[name] begin[{]
method[hasNavigableWebContent, return_type[type[boolean]], modifier[public static], parameter[context, node]] begin[{]
return[binary_operation[binary_operation[call[.supportsWebActions, parameter[member[.node]]], &&, call[.isScriptInjectionEnabled, parameter[member[.context]]]], ||, call[.hasNativeWebContent, parameter[member[.node]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[hasNavigableWebContent] operator[SEP] identifier[Context] identifier[context] , identifier[AccessibilityNodeInfoCompat] identifier[node] operator[SEP] {
Keyword[return] operator[SEP] identifier[supportsWebActions] operator[SEP] identifier[node] operator[SEP] operator[&&] identifier[isScriptInjectionEnabled] operator[SEP] identifier[context] operator[SEP] operator[SEP] operator[||] identifier[hasNativeWebContent] operator[SEP] identifier[node] operator[SEP] operator[SEP]
}
|
public void normalize() {
for (int i = 0; i < size; i++) {
keys[i] = lowerCase(keys[i]);
}
}
|
class class_name[name] begin[{]
method[normalize, return_type[void], modifier[public], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=lowerCase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[normalize] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[size] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[keys] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[lowerCase] operator[SEP] identifier[keys] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public @Nonnull final <T extends Annotation> Optional<AnnotationValue<T>> getAnnotation(String member, Class<T> type) {
return getAnnotations(member, type).stream().findFirst();
}
|
class class_name[name] begin[{]
method[getAnnotation, return_type[type[Optional]], modifier[final public], parameter[member, type]] begin[{]
return[call[.getAnnotations, parameter[member[.member], member[.type]]]]
end[}]
END[}]
|
Keyword[public] annotation[@] identifier[Nonnull] Keyword[final] operator[<] identifier[T] Keyword[extends] identifier[Annotation] operator[>] identifier[Optional] operator[<] identifier[AnnotationValue] operator[<] identifier[T] operator[>] operator[>] identifier[getAnnotation] operator[SEP] identifier[String] identifier[member] , identifier[Class] operator[<] identifier[T] operator[>] identifier[type] operator[SEP] {
Keyword[return] identifier[getAnnotations] operator[SEP] identifier[member] , identifier[type] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[findFirst] operator[SEP] operator[SEP] operator[SEP]
}
|
public JSONObject simnet(String text1, String text2, HashMap<String, Object> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("text_1", text1);
request.addBody("text_2", text2);
if (options != null) {
request.addBody(options);
}
request.setUri(NlpConsts.SIMNET);
request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK);
request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
}
|
class class_name[name] begin[{]
method[simnet, return_type[type[JSONObject]], modifier[public], parameter[text1, text2, options]] begin[{]
local_variable[type[AipRequest], request]
call[.preOperation, parameter[member[.request]]]
call[request.addBody, parameter[literal["text_1"], member[.text1]]]
call[request.addBody, parameter[literal["text_2"], member[.text2]]]
if[binary_operation[member[.options], !=, literal[null]]] begin[{]
call[request.addBody, parameter[member[.options]]]
else begin[{]
None
end[}]
call[request.setUri, parameter[member[NlpConsts.SIMNET]]]
call[request.addHeader, parameter[member[Headers.CONTENT_ENCODING], member[HttpCharacterEncoding.ENCODE_GBK]]]
call[request.addHeader, parameter[member[Headers.CONTENT_TYPE], member[HttpContentType.JSON_DATA]]]
call[request.setBodyFormat, parameter[member[EBodyFormat.RAW_JSON]]]
call[.postOperation, parameter[member[.request]]]
return[call[.requestServer, parameter[member[.request]]]]
end[}]
END[}]
|
Keyword[public] identifier[JSONObject] identifier[simnet] operator[SEP] identifier[String] identifier[text1] , identifier[String] identifier[text2] , identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[options] operator[SEP] {
identifier[AipRequest] identifier[request] operator[=] Keyword[new] identifier[AipRequest] operator[SEP] operator[SEP] operator[SEP] identifier[preOperation] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addBody] operator[SEP] literal[String] , identifier[text1] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addBody] operator[SEP] literal[String] , identifier[text2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[options] operator[!=] Other[null] operator[SEP] {
identifier[request] operator[SEP] identifier[addBody] operator[SEP] identifier[options] operator[SEP] operator[SEP]
}
identifier[request] operator[SEP] identifier[setUri] operator[SEP] identifier[NlpConsts] operator[SEP] identifier[SIMNET] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[CONTENT_ENCODING] , identifier[HttpCharacterEncoding] operator[SEP] identifier[ENCODE_GBK] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[CONTENT_TYPE] , identifier[HttpContentType] operator[SEP] identifier[JSON_DATA] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setBodyFormat] operator[SEP] identifier[EBodyFormat] operator[SEP] identifier[RAW_JSON] operator[SEP] operator[SEP] identifier[postOperation] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[requestServer] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public static boolean alg_24(int[] blz, int[] number) {
int[] weights = {1, 2, 3, 1, 2, 3, 1, 2, 3};
int crc = 0;
int idx = 0;
switch (number[0]) {
case 3:
case 4:
case 5:
case 6:
number[0] = 0;
break;
case 9:
number[0] = number[1] = number[2] = 0;
break;
default:
break;
}
for (int i = 0; i < 9; i++) {
if (number[i] > 0) {
idx = i;
break;
}
}
for (int i = idx, j = 0; i < 9; i++, j++) {
crc += ((weights[j] * number[i]) + weights[j]) % 11;
}
return ((crc % 10) == number[9]);
}
|
class class_name[name] begin[{]
method[alg_24, return_type[type[boolean]], modifier[public static], parameter[blz, number]] begin[{]
local_variable[type[int], weights]
local_variable[type[int], crc]
local_variable[type[int], idx]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=9)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), type==, value=Assignment(expressionl=MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), type==, value=Assignment(expressionl=MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[BreakStatement(goto=None, label=None)])], expression=MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=9), 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)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=crc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=weights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=*), operandr=MemberReference(member=weights, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=11), operator=%)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=9), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i), VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[binary_operation[binary_operation[member[.crc], %, literal[10]], ==, member[.number]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[alg_24] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[blz] , Keyword[int] operator[SEP] operator[SEP] identifier[number] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[weights] operator[=] {
Other[1] , Other[2] , Other[3] , Other[1] , Other[2] , Other[3] , Other[1] , Other[2] , Other[3]
} operator[SEP] Keyword[int] identifier[crc] operator[=] Other[0] operator[SEP] Keyword[int] identifier[idx] operator[=] Other[0] operator[SEP] Keyword[switch] operator[SEP] identifier[number] operator[SEP] Other[0] operator[SEP] operator[SEP] {
Keyword[case] Other[3] operator[:] Keyword[case] Other[4] operator[:] Keyword[case] Other[5] operator[:] Keyword[case] Other[6] operator[:] identifier[number] operator[SEP] Other[0] operator[SEP] operator[=] Other[0] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[9] operator[:] identifier[number] operator[SEP] Other[0] operator[SEP] operator[=] identifier[number] operator[SEP] Other[1] operator[SEP] operator[=] identifier[number] operator[SEP] Other[2] operator[SEP] operator[=] Other[0] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[break] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Other[9] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[number] operator[SEP] identifier[i] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[idx] operator[=] identifier[i] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[idx] , identifier[j] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Other[9] operator[SEP] identifier[i] operator[++] , identifier[j] operator[++] operator[SEP] {
identifier[crc] operator[+=] operator[SEP] operator[SEP] identifier[weights] operator[SEP] identifier[j] operator[SEP] operator[*] identifier[number] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[+] identifier[weights] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[%] Other[11] operator[SEP]
}
Keyword[return] operator[SEP] operator[SEP] identifier[crc] operator[%] Other[10] operator[SEP] operator[==] identifier[number] operator[SEP] Other[9] operator[SEP] operator[SEP] operator[SEP]
}
|
public B preflightResponseHeader(CharSequence name, Iterable<?> values) {
requireNonNull(name, "name");
requireNonNull(values, "values");
checkArgument(!Iterables.isEmpty(values), "values should not be empty.");
final ImmutableList.Builder builder = new Builder();
int i = 0;
for (Object value : values) {
if (value == null) {
throw new NullPointerException("value[" + i + ']');
}
builder.add(value);
i++;
}
preflightResponseHeaders.put(HttpHeaderNames.of(name), new ConstantValueSupplier(builder.build()));
return self();
}
|
class class_name[name] begin[{]
method[preflightResponseHeader, return_type[type[B]], modifier[public], parameter[name, values]] begin[{]
call[.requireNonNull, parameter[member[.name], literal["name"]]]
call[.requireNonNull, parameter[member[.values], literal["values"]]]
call[.checkArgument, parameter[call[Iterables.isEmpty, parameter[member[.values]]], literal["values should not be empty."]]]
local_variable[type[ImmutableList], builder]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="value["), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=']'), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
call[preflightResponseHeaders.put, parameter[call[HttpHeaderNames.of, parameter[member[.name]]], ClassCreator(arguments=[MethodInvocation(arguments=[], member=build, postfix_operators=[], prefix_operators=[], qualifier=builder, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstantValueSupplier, sub_type=None))]]
return[call[.self, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[B] identifier[preflightResponseHeader] operator[SEP] identifier[CharSequence] identifier[name] , identifier[Iterable] operator[<] operator[?] operator[>] identifier[values] operator[SEP] {
identifier[requireNonNull] operator[SEP] identifier[name] , literal[String] operator[SEP] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[values] , literal[String] operator[SEP] operator[SEP] identifier[checkArgument] operator[SEP] operator[!] identifier[Iterables] operator[SEP] identifier[isEmpty] operator[SEP] identifier[values] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[ImmutableList] operator[SEP] identifier[Builder] identifier[builder] operator[=] Keyword[new] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[value] operator[:] identifier[values] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[+] identifier[i] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[builder] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP]
}
identifier[preflightResponseHeaders] operator[SEP] identifier[put] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[of] operator[SEP] identifier[name] operator[SEP] , Keyword[new] identifier[ConstantValueSupplier] operator[SEP] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[self] operator[SEP] operator[SEP] operator[SEP]
}
|
public EClass getImageResolution() {
if (imageResolutionEClass == null) {
imageResolutionEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(518);
}
return imageResolutionEClass;
}
|
class class_name[name] begin[{]
method[getImageResolution, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.imageResolutionEClass], ==, literal[null]]] begin[{]
assign[member[.imageResolutionEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=518)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.imageResolutionEClass]]
end[}]
END[}]
|
Keyword[public] identifier[EClass] identifier[getImageResolution] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[imageResolutionEClass] operator[==] Other[null] operator[SEP] {
identifier[imageResolutionEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[AfplibPackage] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[518] operator[SEP] operator[SEP]
}
Keyword[return] identifier[imageResolutionEClass] operator[SEP]
}
|
public List<EmbedApp> getEmbedApps(String token, String email) throws URISyntaxException, ClientProtocolException, IOException, ParserConfigurationException, SAXException, XPathExpressionException {
cleanError();
URIBuilder url = new URIBuilder(Constants.EMBED_APP_URL);
url.addParameter("token", token);
url.addParameter("email", email);
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(url.toString());
httpGet.setHeader("Accept", "application/json");
CloseableHttpResponse response = httpclient.execute(httpGet);
String xmlString = EntityUtils.toString(response.getEntity());
List<EmbedApp> embedApps = new ArrayList<EmbedApp>();
DocumentBuilderFactory docfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = docfactory.newDocumentBuilder();
Document doc = builder.parse(new InputSource(new StringReader(xmlString)));
XPath xpath = XPathFactory.newInstance().newXPath();
NodeList appNodeList = (NodeList) xpath.evaluate("/apps/app", doc, XPathConstants.NODESET);
if (appNodeList.getLength() > 0) {
Node appNode;
NodeList appAttrs;
EmbedApp embedApp;
for (int i = 0; i < appNodeList.getLength(); i++) {
appNode = appNodeList.item(0);
appAttrs = appNode.getChildNodes();
String appAttrName;
JSONObject appJson = new JSONObject();
Set<String> desiredAttrs = new HashSet<String>(Arrays.asList(new String[] {"id", "icon", "name", "provisioned", "extension_required", "personal", "login_id"}));
for (int j = 0; j < appAttrs.getLength(); j++) {
appAttrName = appAttrs.item(j).getNodeName();
if (desiredAttrs.contains(appAttrName)) {
appJson.put(appAttrName, appAttrs.item(j).getTextContent());
}
}
embedApp = new EmbedApp(appJson);
embedApps.add(embedApp);
}
}
return embedApps;
}
|
class class_name[name] begin[{]
method[getEmbedApps, return_type[type[List]], modifier[public], parameter[token, email]] begin[{]
call[.cleanError, parameter[]]
local_variable[type[URIBuilder], url]
call[url.addParameter, parameter[literal["token"], member[.token]]]
call[url.addParameter, parameter[literal["email"], member[.email]]]
local_variable[type[CloseableHttpClient], httpclient]
local_variable[type[HttpGet], httpGet]
call[httpGet.setHeader, parameter[literal["Accept"], literal["application/json"]]]
local_variable[type[CloseableHttpResponse], response]
local_variable[type[String], xmlString]
local_variable[type[List], embedApps]
local_variable[type[DocumentBuilderFactory], docfactory]
local_variable[type[DocumentBuilder], builder]
local_variable[type[Document], doc]
local_variable[type[XPath], xpath]
local_variable[type[NodeList], appNodeList]
if[binary_operation[call[appNodeList.getLength, parameter[]], >, literal[0]]] begin[{]
local_variable[type[Node], appNode]
local_variable[type[NodeList], appAttrs]
local_variable[type[EmbedApp], embedApp]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=appNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=item, postfix_operators=[], prefix_operators=[], qualifier=appNodeList, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=appAttrs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getChildNodes, postfix_operators=[], prefix_operators=[], qualifier=appNode, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=appAttrName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), 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=JSONObject, sub_type=None)), name=appJson)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JSONObject, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="id"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="icon"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="provisioned"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="extension_required"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="personal"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="login_id")]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashSet, sub_type=None)), name=desiredAttrs)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=appAttrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=item, postfix_operators=[], prefix_operators=[], qualifier=appAttrs, selectors=[MethodInvocation(arguments=[], member=getNodeName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=appAttrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=desiredAttrs, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=appAttrName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=item, postfix_operators=[], prefix_operators=[], qualifier=appAttrs, selectors=[MethodInvocation(arguments=[], member=getTextContent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=appJson, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=appAttrs, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=embedApp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=appJson, 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=EmbedApp, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=embedApp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=embedApps, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getLength, postfix_operators=[], prefix_operators=[], qualifier=appNodeList, 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)
else begin[{]
None
end[}]
return[member[.embedApps]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[EmbedApp] operator[>] identifier[getEmbedApps] operator[SEP] identifier[String] identifier[token] , identifier[String] identifier[email] operator[SEP] Keyword[throws] identifier[URISyntaxException] , identifier[ClientProtocolException] , identifier[IOException] , identifier[ParserConfigurationException] , identifier[SAXException] , identifier[XPathExpressionException] {
identifier[cleanError] operator[SEP] operator[SEP] operator[SEP] identifier[URIBuilder] identifier[url] operator[=] Keyword[new] identifier[URIBuilder] operator[SEP] identifier[Constants] operator[SEP] identifier[EMBED_APP_URL] operator[SEP] operator[SEP] identifier[url] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , identifier[token] operator[SEP] operator[SEP] identifier[url] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , identifier[email] operator[SEP] operator[SEP] identifier[CloseableHttpClient] identifier[httpclient] operator[=] identifier[HttpClients] operator[SEP] identifier[createDefault] operator[SEP] operator[SEP] operator[SEP] identifier[HttpGet] identifier[httpGet] operator[=] Keyword[new] identifier[HttpGet] operator[SEP] identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[httpGet] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[CloseableHttpResponse] identifier[response] operator[=] identifier[httpclient] operator[SEP] identifier[execute] operator[SEP] identifier[httpGet] operator[SEP] operator[SEP] identifier[String] identifier[xmlString] operator[=] identifier[EntityUtils] operator[SEP] identifier[toString] operator[SEP] identifier[response] operator[SEP] identifier[getEntity] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[EmbedApp] operator[>] identifier[embedApps] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[EmbedApp] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[DocumentBuilderFactory] identifier[docfactory] operator[=] identifier[DocumentBuilderFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[DocumentBuilder] identifier[builder] operator[=] identifier[docfactory] operator[SEP] identifier[newDocumentBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[Document] identifier[doc] operator[=] identifier[builder] operator[SEP] identifier[parse] operator[SEP] Keyword[new] identifier[InputSource] operator[SEP] Keyword[new] identifier[StringReader] operator[SEP] identifier[xmlString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[XPath] identifier[xpath] operator[=] identifier[XPathFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[newXPath] operator[SEP] operator[SEP] operator[SEP] identifier[NodeList] identifier[appNodeList] operator[=] operator[SEP] identifier[NodeList] operator[SEP] identifier[xpath] operator[SEP] identifier[evaluate] operator[SEP] literal[String] , identifier[doc] , identifier[XPathConstants] operator[SEP] identifier[NODESET] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[appNodeList] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[Node] identifier[appNode] operator[SEP] identifier[NodeList] identifier[appAttrs] operator[SEP] identifier[EmbedApp] identifier[embedApp] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[appNodeList] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[appNode] operator[=] identifier[appNodeList] operator[SEP] identifier[item] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[appAttrs] operator[=] identifier[appNode] operator[SEP] identifier[getChildNodes] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[appAttrName] operator[SEP] identifier[JSONObject] identifier[appJson] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[desiredAttrs] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String]
} operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[appAttrs] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
identifier[appAttrName] operator[=] identifier[appAttrs] operator[SEP] identifier[item] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[getNodeName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[desiredAttrs] operator[SEP] identifier[contains] operator[SEP] identifier[appAttrName] operator[SEP] operator[SEP] {
identifier[appJson] operator[SEP] identifier[put] operator[SEP] identifier[appAttrName] , identifier[appAttrs] operator[SEP] identifier[item] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[getTextContent] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[embedApp] operator[=] Keyword[new] identifier[EmbedApp] operator[SEP] identifier[appJson] operator[SEP] operator[SEP] identifier[embedApps] operator[SEP] identifier[add] operator[SEP] identifier[embedApp] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[embedApps] operator[SEP]
}
|
public static WebApp get(ServletContext context) {
Object o = context.getAttribute(WebApp.class.getName());
if(o==null) {
synchronized (WebApp.class) {
o = context.getAttribute(WebApp.class.getName());
if(o==null) {
o = new WebApp(context);
context.setAttribute(WebApp.class.getName(),o);
}
}
}
return (WebApp)o;
}
|
class class_name[name] begin[{]
method[get, return_type[type[WebApp]], modifier[public static], parameter[context]] begin[{]
local_variable[type[Object], o]
if[binary_operation[member[.o], ==, literal[null]]] begin[{]
SYNCHRONIZED[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebApp, sub_type=None))] BEGIN[{]
assign[member[.o], call[context.getAttribute, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=WebApp, sub_type=None))]]]
if[binary_operation[member[.o], ==, literal[null]]] begin[{]
assign[member[.o], ClassCreator(arguments=[MemberReference(member=context, 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=WebApp, sub_type=None))]
call[context.setAttribute, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=WebApp, sub_type=None)), member[.o]]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
return[Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=WebApp, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[WebApp] identifier[get] operator[SEP] identifier[ServletContext] identifier[context] operator[SEP] {
identifier[Object] identifier[o] operator[=] identifier[context] operator[SEP] identifier[getAttribute] operator[SEP] identifier[WebApp] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] operator[==] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[WebApp] operator[SEP] Keyword[class] operator[SEP] {
identifier[o] operator[=] identifier[context] operator[SEP] identifier[getAttribute] operator[SEP] identifier[WebApp] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] operator[==] Other[null] operator[SEP] {
identifier[o] operator[=] Keyword[new] identifier[WebApp] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[setAttribute] operator[SEP] identifier[WebApp] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[o] operator[SEP] operator[SEP]
}
}
}
Keyword[return] operator[SEP] identifier[WebApp] operator[SEP] identifier[o] operator[SEP]
}
|
private void obtainDialogPadding(@NonNull final TypedArray typedArray) {
int defaultLeftPadding =
getContext().getResources().getDimensionPixelSize(R.dimen.dialog_left_padding);
int defaultTopPadding =
getContext().getResources().getDimensionPixelSize(R.dimen.dialog_top_padding);
int defaultRightPadding =
getContext().getResources().getDimensionPixelSize(R.dimen.dialog_right_padding);
int defaultBottomPadding =
getContext().getResources().getDimensionPixelSize(R.dimen.dialog_bottom_padding);
int left = typedArray.getDimensionPixelSize(R.styleable.DialogPreference_dialogPaddingLeft,
defaultLeftPadding);
int top = typedArray.getDimensionPixelSize(R.styleable.DialogPreference_dialogPaddingTop,
defaultTopPadding);
int right = typedArray
.getDimensionPixelSize(R.styleable.DialogPreference_dialogPaddingRight,
defaultRightPadding);
int bottom = typedArray
.getDimensionPixelSize(R.styleable.DialogPreference_dialogPaddingBottom,
defaultBottomPadding);
setDialogPadding(left, top, right, bottom);
}
|
class class_name[name] begin[{]
method[obtainDialogPadding, return_type[void], modifier[private], parameter[typedArray]] begin[{]
local_variable[type[int], defaultLeftPadding]
local_variable[type[int], defaultTopPadding]
local_variable[type[int], defaultRightPadding]
local_variable[type[int], defaultBottomPadding]
local_variable[type[int], left]
local_variable[type[int], top]
local_variable[type[int], right]
local_variable[type[int], bottom]
call[.setDialogPadding, parameter[member[.left], member[.top], member[.right], member[.bottom]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[obtainDialogPadding] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[TypedArray] identifier[typedArray] operator[SEP] {
Keyword[int] identifier[defaultLeftPadding] operator[=] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[R] operator[SEP] identifier[dimen] operator[SEP] identifier[dialog_left_padding] operator[SEP] operator[SEP] Keyword[int] identifier[defaultTopPadding] operator[=] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[R] operator[SEP] identifier[dimen] operator[SEP] identifier[dialog_top_padding] operator[SEP] operator[SEP] Keyword[int] identifier[defaultRightPadding] operator[=] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[R] operator[SEP] identifier[dimen] operator[SEP] identifier[dialog_right_padding] operator[SEP] operator[SEP] Keyword[int] identifier[defaultBottomPadding] operator[=] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[R] operator[SEP] identifier[dimen] operator[SEP] identifier[dialog_bottom_padding] operator[SEP] operator[SEP] Keyword[int] identifier[left] operator[=] identifier[typedArray] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[R] operator[SEP] identifier[styleable] operator[SEP] identifier[DialogPreference_dialogPaddingLeft] , identifier[defaultLeftPadding] operator[SEP] operator[SEP] Keyword[int] identifier[top] operator[=] identifier[typedArray] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[R] operator[SEP] identifier[styleable] operator[SEP] identifier[DialogPreference_dialogPaddingTop] , identifier[defaultTopPadding] operator[SEP] operator[SEP] Keyword[int] identifier[right] operator[=] identifier[typedArray] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[R] operator[SEP] identifier[styleable] operator[SEP] identifier[DialogPreference_dialogPaddingRight] , identifier[defaultRightPadding] operator[SEP] operator[SEP] Keyword[int] identifier[bottom] operator[=] identifier[typedArray] operator[SEP] identifier[getDimensionPixelSize] operator[SEP] identifier[R] operator[SEP] identifier[styleable] operator[SEP] identifier[DialogPreference_dialogPaddingBottom] , identifier[defaultBottomPadding] operator[SEP] operator[SEP] identifier[setDialogPadding] operator[SEP] identifier[left] , identifier[top] , identifier[right] , identifier[bottom] operator[SEP] operator[SEP]
}
|
public static InputStream getClassAsStream(final String className, final ClassLoader classLoader) throws IOException {
return getResourceAsStream(ClassUtil.convertClassNameToFileName(className), classLoader);
}
|
class class_name[name] begin[{]
method[getClassAsStream, return_type[type[InputStream]], modifier[public static], parameter[className, classLoader]] begin[{]
return[call[.getResourceAsStream, parameter[call[ClassUtil.convertClassNameToFileName, parameter[member[.className]]], member[.classLoader]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[InputStream] identifier[getClassAsStream] operator[SEP] Keyword[final] identifier[String] identifier[className] , Keyword[final] identifier[ClassLoader] identifier[classLoader] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[getResourceAsStream] operator[SEP] identifier[ClassUtil] operator[SEP] identifier[convertClassNameToFileName] operator[SEP] identifier[className] operator[SEP] , identifier[classLoader] operator[SEP] operator[SEP]
}
|
public String readProperty(String propertyName) {
String propVal = null;
try {
propVal = getCms().readPropertyObject(getParamResource(), propertyName, false).getValue();
} catch (CmsException e) {
if (LOG.isInfoEnabled()) {
LOG.info(e.getLocalizedMessage());
}
}
if (CmsStringUtil.isEmpty(propVal)) {
propVal = "";
}
return propVal;
}
|
class class_name[name] begin[{]
method[readProperty, return_type[type[String]], modifier[public], parameter[propertyName]] begin[{]
local_variable[type[String], propVal]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=propVal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParamResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=propertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=readPropertyObject, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isInfoEnabled, 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=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CmsException']))], finally_block=None, label=None, resources=None)
if[call[CmsStringUtil.isEmpty, parameter[member[.propVal]]]] begin[{]
assign[member[.propVal], literal[""]]
else begin[{]
None
end[}]
return[member[.propVal]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[readProperty] operator[SEP] identifier[String] identifier[propertyName] operator[SEP] {
identifier[String] identifier[propVal] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[propVal] operator[=] identifier[getCms] operator[SEP] operator[SEP] operator[SEP] identifier[readPropertyObject] operator[SEP] identifier[getParamResource] operator[SEP] operator[SEP] , identifier[propertyName] , literal[boolean] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CmsException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[CmsStringUtil] operator[SEP] identifier[isEmpty] operator[SEP] identifier[propVal] operator[SEP] operator[SEP] {
identifier[propVal] operator[=] literal[String] operator[SEP]
}
Keyword[return] identifier[propVal] operator[SEP]
}
|
public Observable<Page<JobResourceInner>> listNextAsync(final String nextPageLink) {
return listNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<JobResourceInner>>, Page<JobResourceInner>>() {
@Override
public Page<JobResourceInner> call(ServiceResponse<Page<JobResourceInner>> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[listNextAsync, return_type[type[Observable]], modifier[public], parameter[nextPageLink]] begin[{]
return[call[.listNextWithServiceResponseAsync, parameter[member[.nextPageLink]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[JobResourceInner] operator[>] operator[>] identifier[listNextAsync] operator[SEP] Keyword[final] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listNextWithServiceResponseAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[JobResourceInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[JobResourceInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[JobResourceInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[JobResourceInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public HistoricalData getHistoricalData(Date from, Date to, String token, String interval, boolean continuous) throws KiteException, IOException, JSONException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Map<String, Object> params = new HashMap<>();
params.put("from", format.format(from));
params.put("to", format.format(to));
params.put("continuous", continuous ? 1 : 0);
String url = routes.get("market.historical").replace(":instrument_token", token).replace(":interval", interval);
HistoricalData historicalData = new HistoricalData();
historicalData.parseResponse(new KiteRequestHandler(proxy).getRequest(url, params, apiKey, accessToken));
return historicalData;
}
|
class class_name[name] begin[{]
method[getHistoricalData, return_type[type[HistoricalData]], modifier[public], parameter[from, to, token, interval, continuous]] begin[{]
local_variable[type[SimpleDateFormat], format]
local_variable[type[Map], params]
call[params.put, parameter[literal["from"], call[format.format, parameter[member[.from]]]]]
call[params.put, parameter[literal["to"], call[format.format, parameter[member[.to]]]]]
call[params.put, parameter[literal["continuous"], TernaryExpression(condition=MemberReference(member=continuous, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]]
local_variable[type[String], url]
local_variable[type[HistoricalData], historicalData]
call[historicalData.parseResponse, parameter[ClassCreator(arguments=[MemberReference(member=proxy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=params, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=apiKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=accessToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRequest, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=KiteRequestHandler, sub_type=None))]]
return[member[.historicalData]]
end[}]
END[}]
|
Keyword[public] identifier[HistoricalData] identifier[getHistoricalData] operator[SEP] identifier[Date] identifier[from] , identifier[Date] identifier[to] , identifier[String] identifier[token] , identifier[String] identifier[interval] , Keyword[boolean] identifier[continuous] operator[SEP] Keyword[throws] identifier[KiteException] , identifier[IOException] , identifier[JSONException] {
identifier[SimpleDateFormat] identifier[format] operator[=] Keyword[new] identifier[SimpleDateFormat] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[params] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[format] operator[SEP] identifier[format] operator[SEP] identifier[from] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[format] operator[SEP] identifier[format] operator[SEP] identifier[to] operator[SEP] operator[SEP] operator[SEP] identifier[params] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[continuous] operator[?] Other[1] operator[:] Other[0] operator[SEP] operator[SEP] identifier[String] identifier[url] operator[=] identifier[routes] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[token] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , identifier[interval] operator[SEP] operator[SEP] identifier[HistoricalData] identifier[historicalData] operator[=] Keyword[new] identifier[HistoricalData] operator[SEP] operator[SEP] operator[SEP] identifier[historicalData] operator[SEP] identifier[parseResponse] operator[SEP] Keyword[new] identifier[KiteRequestHandler] operator[SEP] identifier[proxy] operator[SEP] operator[SEP] identifier[getRequest] operator[SEP] identifier[url] , identifier[params] , identifier[apiKey] , identifier[accessToken] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[historicalData] operator[SEP]
}
|
@Override
public void indicateProgress(int number, int total) {
progressIndicatorActive = true;
String currMsg = lastMessage;
try {
updateStatus(currMsg + ' ' + number + " of " + total);
} finally {
lastMessage = currMsg;
}
}
|
class class_name[name] begin[{]
method[indicateProgress, return_type[void], modifier[public], parameter[number, total]] begin[{]
assign[member[.progressIndicatorActive], literal[true]]
local_variable[type[String], currMsg]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=currMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=+), operandr=MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" of "), operator=+), operandr=MemberReference(member=total, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=updateStatus, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=currMsg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[indicateProgress] operator[SEP] Keyword[int] identifier[number] , Keyword[int] identifier[total] operator[SEP] {
identifier[progressIndicatorActive] operator[=] literal[boolean] operator[SEP] identifier[String] identifier[currMsg] operator[=] identifier[lastMessage] operator[SEP] Keyword[try] {
identifier[updateStatus] operator[SEP] identifier[currMsg] operator[+] literal[String] operator[+] identifier[number] operator[+] literal[String] operator[+] identifier[total] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[lastMessage] operator[=] identifier[currMsg] operator[SEP]
}
}
|
public boolean touches(IndexRange other) {
checkArgNotNull(other, "other");
return other.end == start || end == other.start;
}
|
class class_name[name] begin[{]
method[touches, return_type[type[boolean]], modifier[public], parameter[other]] begin[{]
call[.checkArgNotNull, parameter[member[.other], literal["other"]]]
return[binary_operation[binary_operation[member[other.end], ==, member[.start]], ||, binary_operation[member[.end], ==, member[other.start]]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[touches] operator[SEP] identifier[IndexRange] identifier[other] operator[SEP] {
identifier[checkArgNotNull] operator[SEP] identifier[other] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[other] operator[SEP] identifier[end] operator[==] identifier[start] operator[||] identifier[end] operator[==] identifier[other] operator[SEP] identifier[start] operator[SEP]
}
|
private static Schema getSchema(String schemaPublicId)
throws SAXException {
Schema schema = schemaCache.get(schemaPublicId);
if (schema == null) {
synchronized (schemaCache) {
schema = schemaCache.get(schemaPublicId);
if (schema == null) {
SchemaFactory schemaFactory = SchemaFactory.newInstance(
XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setResourceResolver(
new MyLSResourceResolver());
schemaFactory.setErrorHandler(new MyErrorHandler());
String path = schemaPublicId;
if (schemaResourcePrefix != null) {
int index = schemaPublicId.lastIndexOf('/');
if (index != -1) {
path = schemaPublicId.substring(index+1);
}
path = schemaResourcePrefix + path;
}
InputStream input = null;
if (isSchemaResourcePrefixFileUrl) {
try {
File f = new File(new URI(path));
if (f.exists()) {
input = new FileInputStream(f);
}
} catch (Exception e) {
throw new SAXException(e);
}
} else {
input = ParserUtils.class.getResourceAsStream(path);
}
if (input == null) {
throw new SAXException(
Localizer.getMessage(
"jsp.error.internal.filenotfound",
schemaPublicId));
}
schema = schemaFactory.newSchema(new StreamSource(input));
schemaCache.put(schemaPublicId, schema);
}
}
}
return schema;
}
|
class class_name[name] begin[{]
method[getSchema, return_type[type[Schema]], modifier[private static], parameter[schemaPublicId]] begin[{]
local_variable[type[Schema], schema]
if[binary_operation[member[.schema], ==, literal[null]]] begin[{]
SYNCHRONIZED[member[.schemaCache]] BEGIN[{]
assign[member[.schema], call[schemaCache.get, parameter[member[.schemaPublicId]]]]
if[binary_operation[member[.schema], ==, literal[null]]] begin[{]
local_variable[type[SchemaFactory], schemaFactory]
call[schemaFactory.setResourceResolver, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MyLSResourceResolver, sub_type=None))]]
call[schemaFactory.setErrorHandler, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MyErrorHandler, sub_type=None))]]
local_variable[type[String], path]
if[binary_operation[member[.schemaResourcePrefix], !=, literal[null]]] begin[{]
local_variable[type[int], index]
if[binary_operation[member[.index], !=, literal[1]]] begin[{]
assign[member[.path], call[schemaPublicId.substring, parameter[binary_operation[member[.index], +, literal[1]]]]]
else begin[{]
None
end[}]
assign[member[.path], binary_operation[member[.schemaResourcePrefix], +, member[.path]]]
else begin[{]
None
end[}]
local_variable[type[InputStream], input]
if[member[.isSchemaResourcePrefixFileUrl]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=path, 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=URI, sub_type=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)), name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None))), 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=SAXException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
assign[member[.input], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResourceAsStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ParserUtils, sub_type=None))]
end[}]
if[binary_operation[member[.input], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="jsp.error.internal.filenotfound"), MemberReference(member=schemaPublicId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=Localizer, selectors=[], type_arguments=None)], 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[}]
assign[member[.schema], call[schemaFactory.newSchema, parameter[ClassCreator(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StreamSource, sub_type=None))]]]
call[schemaCache.put, parameter[member[.schemaPublicId], member[.schema]]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
return[member[.schema]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Schema] identifier[getSchema] operator[SEP] identifier[String] identifier[schemaPublicId] operator[SEP] Keyword[throws] identifier[SAXException] {
identifier[Schema] identifier[schema] operator[=] identifier[schemaCache] operator[SEP] identifier[get] operator[SEP] identifier[schemaPublicId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[schema] operator[==] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[schemaCache] operator[SEP] {
identifier[schema] operator[=] identifier[schemaCache] operator[SEP] identifier[get] operator[SEP] identifier[schemaPublicId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[schema] operator[==] Other[null] operator[SEP] {
identifier[SchemaFactory] identifier[schemaFactory] operator[=] identifier[SchemaFactory] operator[SEP] identifier[newInstance] operator[SEP] identifier[XMLConstants] operator[SEP] identifier[W3C_XML_SCHEMA_NS_URI] operator[SEP] operator[SEP] identifier[schemaFactory] operator[SEP] identifier[setResourceResolver] operator[SEP] Keyword[new] identifier[MyLSResourceResolver] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[schemaFactory] operator[SEP] identifier[setErrorHandler] operator[SEP] Keyword[new] identifier[MyErrorHandler] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[path] operator[=] identifier[schemaPublicId] operator[SEP] Keyword[if] operator[SEP] identifier[schemaResourcePrefix] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[schemaPublicId] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[path] operator[=] identifier[schemaPublicId] operator[SEP] identifier[substring] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[SEP]
}
identifier[path] operator[=] identifier[schemaResourcePrefix] operator[+] identifier[path] operator[SEP]
}
identifier[InputStream] identifier[input] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[isSchemaResourcePrefixFileUrl] operator[SEP] {
Keyword[try] {
identifier[File] identifier[f] operator[=] Keyword[new] identifier[File] operator[SEP] Keyword[new] identifier[URI] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[f] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
identifier[input] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[f] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SAXException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[input] operator[=] identifier[ParserUtils] operator[SEP] Keyword[class] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[input] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SAXException] operator[SEP] identifier[Localizer] operator[SEP] identifier[getMessage] operator[SEP] literal[String] , identifier[schemaPublicId] operator[SEP] operator[SEP] operator[SEP]
}
identifier[schema] operator[=] identifier[schemaFactory] operator[SEP] identifier[newSchema] operator[SEP] Keyword[new] identifier[StreamSource] operator[SEP] identifier[input] operator[SEP] operator[SEP] operator[SEP] identifier[schemaCache] operator[SEP] identifier[put] operator[SEP] identifier[schemaPublicId] , identifier[schema] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[schema] operator[SEP]
}
|
@Override
public DeleteHsmResult deleteHsm(DeleteHsmRequest request) {
request = beforeClientExecution(request);
return executeDeleteHsm(request);
}
|
class class_name[name] begin[{]
method[deleteHsm, return_type[type[DeleteHsmResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDeleteHsm, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[DeleteHsmResult] identifier[deleteHsm] operator[SEP] identifier[DeleteHsmRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDeleteHsm] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public List<SecurityRoleType<WebAppDescriptor>> getAllSecurityRole()
{
List<SecurityRoleType<WebAppDescriptor>> list = new ArrayList<SecurityRoleType<WebAppDescriptor>>();
List<Node> nodeList = model.get("security-role");
for(Node node: nodeList)
{
SecurityRoleType<WebAppDescriptor> type = new SecurityRoleTypeImpl<WebAppDescriptor>(this, "security-role", model, node);
list.add(type);
}
return list;
}
|
class class_name[name] begin[{]
method[getAllSecurityRole, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], list]
local_variable[type[List], nodeList]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="security-role"), MemberReference(member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=WebAppDescriptor, sub_type=None))], dimensions=None, name=SecurityRoleTypeImpl, sub_type=None)), name=type)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=WebAppDescriptor, sub_type=None))], dimensions=[], name=SecurityRoleType, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=nodeList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
return[member[.list]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[SecurityRoleType] operator[<] identifier[WebAppDescriptor] operator[>] operator[>] identifier[getAllSecurityRole] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[SecurityRoleType] operator[<] identifier[WebAppDescriptor] operator[>] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[SecurityRoleType] operator[<] identifier[WebAppDescriptor] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[model] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[node] operator[:] identifier[nodeList] operator[SEP] {
identifier[SecurityRoleType] operator[<] identifier[WebAppDescriptor] operator[>] identifier[type] operator[=] Keyword[new] identifier[SecurityRoleTypeImpl] operator[<] identifier[WebAppDescriptor] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[model] , identifier[node] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
private void constructPropertiesString(String propertyName, Object property) throws IOException {
getWriter().write(propertyName + String.valueOf(property) + "\n");
}
|
class class_name[name] begin[{]
method[constructPropertiesString, return_type[void], modifier[private], parameter[propertyName, property]] begin[{]
call[.getWriter, parameter[]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[constructPropertiesString] operator[SEP] identifier[String] identifier[propertyName] , identifier[Object] identifier[property] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] identifier[write] operator[SEP] identifier[propertyName] operator[+] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[property] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
protected LightweightTypeReference getSarlCapacityFieldType(IResolvedTypes resolvedTypes, JvmField field) {
// For capacity call redirection
LightweightTypeReference fieldType = resolvedTypes.getActualType(field);
final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field,
ImportedCapacityFeature.class);
if (capacityAnnotation != null) {
final JvmTypeReference ref = ((JvmTypeAnnotationValue) capacityAnnotation.getValues().get(0)).getValues().get(0);
fieldType = resolvedTypes.getActualType(ref.getType());
}
return fieldType;
}
|
class class_name[name] begin[{]
method[getSarlCapacityFieldType, return_type[type[LightweightTypeReference]], modifier[protected], parameter[resolvedTypes, field]] begin[{]
local_variable[type[LightweightTypeReference], fieldType]
local_variable[type[JvmAnnotationReference], capacityAnnotation]
if[binary_operation[member[.capacityAnnotation], !=, literal[null]]] begin[{]
local_variable[type[JvmTypeReference], ref]
assign[member[.fieldType], call[resolvedTypes.getActualType, parameter[call[ref.getType, parameter[]]]]]
else begin[{]
None
end[}]
return[member[.fieldType]]
end[}]
END[}]
|
Keyword[protected] identifier[LightweightTypeReference] identifier[getSarlCapacityFieldType] operator[SEP] identifier[IResolvedTypes] identifier[resolvedTypes] , identifier[JvmField] identifier[field] operator[SEP] {
identifier[LightweightTypeReference] identifier[fieldType] operator[=] identifier[resolvedTypes] operator[SEP] identifier[getActualType] operator[SEP] identifier[field] operator[SEP] operator[SEP] Keyword[final] identifier[JvmAnnotationReference] identifier[capacityAnnotation] operator[=] Keyword[this] operator[SEP] identifier[annotationLookup] operator[SEP] identifier[findAnnotation] operator[SEP] identifier[field] , identifier[ImportedCapacityFeature] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[capacityAnnotation] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[JvmTypeReference] identifier[ref] operator[=] operator[SEP] operator[SEP] identifier[JvmTypeAnnotationValue] operator[SEP] identifier[capacityAnnotation] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[fieldType] operator[=] identifier[resolvedTypes] operator[SEP] identifier[getActualType] operator[SEP] identifier[ref] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[fieldType] operator[SEP]
}
|
public Observable<ServiceResponse<List<EntityExtractor>>> listEntitiesWithServiceResponseAsync(UUID appId, String versionId, ListEntitiesOptionalParameter listEntitiesOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final Integer skip = listEntitiesOptionalParameter != null ? listEntitiesOptionalParameter.skip() : null;
final Integer take = listEntitiesOptionalParameter != null ? listEntitiesOptionalParameter.take() : null;
return listEntitiesWithServiceResponseAsync(appId, versionId, skip, take);
}
|
class class_name[name] begin[{]
method[listEntitiesWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[appId, versionId, listEntitiesOptionalParameter]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.endpoint, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.endpoint() is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.appId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter appId is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.versionId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter versionId is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Integer], skip]
local_variable[type[Integer], take]
return[call[.listEntitiesWithServiceResponseAsync, parameter[member[.appId], member[.versionId], member[.skip], member[.take]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[List] operator[<] identifier[EntityExtractor] operator[>] operator[>] operator[>] identifier[listEntitiesWithServiceResponseAsync] operator[SEP] identifier[UUID] identifier[appId] , identifier[String] identifier[versionId] , identifier[ListEntitiesOptionalParameter] identifier[listEntitiesOptionalParameter] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[endpoint] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[appId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[versionId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Integer] identifier[skip] operator[=] identifier[listEntitiesOptionalParameter] operator[!=] Other[null] operator[?] identifier[listEntitiesOptionalParameter] operator[SEP] identifier[skip] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[final] identifier[Integer] identifier[take] operator[=] identifier[listEntitiesOptionalParameter] operator[!=] Other[null] operator[?] identifier[listEntitiesOptionalParameter] operator[SEP] identifier[take] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[return] identifier[listEntitiesWithServiceResponseAsync] operator[SEP] identifier[appId] , identifier[versionId] , identifier[skip] , identifier[take] operator[SEP] operator[SEP]
}
|
public void writeEndCode(boolean bJavaFile)
{
m_StreamOut.setTabs(-1);
if (bJavaFile)
m_StreamOut.writeit("\n}");
m_StreamOut.writeit("\n");
m_StreamOut.free();
m_StreamOut = null;
m_IncludeNameList.free();
m_IncludeNameList = null;
}
|
class class_name[name] begin[{]
method[writeEndCode, return_type[void], modifier[public], parameter[bJavaFile]] begin[{]
call[m_StreamOut.setTabs, parameter[literal[1]]]
if[member[.bJavaFile]] begin[{]
call[m_StreamOut.writeit, parameter[literal["\n}"]]]
else begin[{]
None
end[}]
call[m_StreamOut.writeit, parameter[literal["\n"]]]
call[m_StreamOut.free, parameter[]]
assign[member[.m_StreamOut], literal[null]]
call[m_IncludeNameList.free, parameter[]]
assign[member[.m_IncludeNameList], literal[null]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[writeEndCode] operator[SEP] Keyword[boolean] identifier[bJavaFile] operator[SEP] {
identifier[m_StreamOut] operator[SEP] identifier[setTabs] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bJavaFile] operator[SEP] identifier[m_StreamOut] operator[SEP] identifier[writeit] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[m_StreamOut] operator[SEP] identifier[writeit] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[m_StreamOut] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP] identifier[m_StreamOut] operator[=] Other[null] operator[SEP] identifier[m_IncludeNameList] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP] identifier[m_IncludeNameList] operator[=] Other[null] operator[SEP]
}
|
public static List<AvPair> decode ( byte[] data ) throws CIFSException {
List<AvPair> pairs = new LinkedList<>();
int pos = 0;
boolean foundEnd = false;
while ( pos + 4 <= data.length ) {
int avId = SMBUtil.readInt2(data, pos);
int avLen = SMBUtil.readInt2(data, pos + 2);
pos += 4;
if ( avId == AvPair.MsvAvEOL ) {
if ( avLen != 0 ) {
throw new CIFSException("Invalid avLen for AvEOL");
}
foundEnd = true;
break;
}
byte[] raw = new byte[avLen];
System.arraycopy(data, pos, raw, 0, avLen);
pairs.add(parseAvPair(avId, raw));
pos += avLen;
}
if ( !foundEnd ) {
throw new CIFSException("Missing AvEOL");
}
return pairs;
}
|
class class_name[name] begin[{]
method[decode, return_type[type[List]], modifier[public static], parameter[data]] begin[{]
local_variable[type[List], pairs]
local_variable[type[int], pos]
local_variable[type[boolean], foundEnd]
while[binary_operation[binary_operation[member[.pos], +, literal[4]], <=, member[data.length]]] begin[{]
local_variable[type[int], avId]
local_variable[type[int], avLen]
assign[member[.pos], literal[4]]
if[binary_operation[member[.avId], ==, member[AvPair.MsvAvEOL]]] begin[{]
if[binary_operation[member[.avLen], !=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid avLen for AvEOL")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CIFSException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.foundEnd], literal[true]]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
local_variable[type[byte], raw]
call[System.arraycopy, parameter[member[.data], member[.pos], member[.raw], literal[0], member[.avLen]]]
call[pairs.add, parameter[call[.parseAvPair, parameter[member[.avId], member[.raw]]]]]
assign[member[.pos], member[.avLen]]
end[}]
if[member[.foundEnd]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing AvEOL")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CIFSException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.pairs]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[AvPair] operator[>] identifier[decode] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[SEP] Keyword[throws] identifier[CIFSException] {
identifier[List] operator[<] identifier[AvPair] operator[>] identifier[pairs] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[pos] operator[=] Other[0] operator[SEP] Keyword[boolean] identifier[foundEnd] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] identifier[pos] operator[+] Other[4] operator[<=] identifier[data] operator[SEP] identifier[length] operator[SEP] {
Keyword[int] identifier[avId] operator[=] identifier[SMBUtil] operator[SEP] identifier[readInt2] operator[SEP] identifier[data] , identifier[pos] operator[SEP] operator[SEP] Keyword[int] identifier[avLen] operator[=] identifier[SMBUtil] operator[SEP] identifier[readInt2] operator[SEP] identifier[data] , identifier[pos] operator[+] Other[2] operator[SEP] operator[SEP] identifier[pos] operator[+=] Other[4] operator[SEP] Keyword[if] operator[SEP] identifier[avId] operator[==] identifier[AvPair] operator[SEP] identifier[MsvAvEOL] operator[SEP] {
Keyword[if] operator[SEP] identifier[avLen] operator[!=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CIFSException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[foundEnd] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[byte] operator[SEP] operator[SEP] identifier[raw] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[avLen] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[data] , identifier[pos] , identifier[raw] , Other[0] , identifier[avLen] operator[SEP] operator[SEP] identifier[pairs] operator[SEP] identifier[add] operator[SEP] identifier[parseAvPair] operator[SEP] identifier[avId] , identifier[raw] operator[SEP] operator[SEP] operator[SEP] identifier[pos] operator[+=] identifier[avLen] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[foundEnd] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CIFSException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[pairs] operator[SEP]
}
|
public static FormElement generateForm(I_CmsEditableData editableData, boolean isNew, String target, String mode) {
// create a form to submit a post request to the editor JSP
Map<String, String> formValues = new HashMap<String, String>();
if (editableData.getSitePath() != null) {
formValues.put("resource", editableData.getSitePath());
}
if (editableData.getElementLanguage() != null) {
formValues.put("elementlanguage", editableData.getElementLanguage());
}
if (editableData.getElementName() != null) {
formValues.put("elementname", editableData.getElementName());
}
// in case the editor is opened within this window, use the current URI as back link
String backlink = "_self".equals(target)
? CmsCoreProvider.get().getUri()
: CmsCoreProvider.get().getContentEditorBacklinkUrl();
formValues.put("backlink", backlink);
formValues.put("redirect", "true");
formValues.put("directedit", "true");
formValues.put("editcontext", CmsCoreProvider.get().getUri());
formValues.put("nofoot", "1");
if (isNew) {
formValues.put("newlink", editableData.getNewLink());
formValues.put("editortitle", editableData.getNewTitle());
}
String postCreateHandler = editableData.getPostCreateHandler();
if (postCreateHandler != null) {
formValues.put("postCreateHandler", postCreateHandler);
}
if (mode != null) {
formValues.put("mode", mode);
}
FormElement formElement = CmsDomUtil.generateHiddenForm(
CmsCoreProvider.get().link(CmsCoreProvider.get().getContentEditorUrl()),
Method.post,
target,
formValues);
return formElement;
}
|
class class_name[name] begin[{]
method[generateForm, return_type[type[FormElement]], modifier[public static], parameter[editableData, isNew, target, mode]] begin[{]
local_variable[type[Map], formValues]
if[binary_operation[call[editableData.getSitePath, parameter[]], !=, literal[null]]] begin[{]
call[formValues.put, parameter[literal["resource"], call[editableData.getSitePath, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[editableData.getElementLanguage, parameter[]], !=, literal[null]]] begin[{]
call[formValues.put, parameter[literal["elementlanguage"], call[editableData.getElementLanguage, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[call[editableData.getElementName, parameter[]], !=, literal[null]]] begin[{]
call[formValues.put, parameter[literal["elementname"], call[editableData.getElementName, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[String], backlink]
call[formValues.put, parameter[literal["backlink"], member[.backlink]]]
call[formValues.put, parameter[literal["redirect"], literal["true"]]]
call[formValues.put, parameter[literal["directedit"], literal["true"]]]
call[formValues.put, parameter[literal["editcontext"], call[CmsCoreProvider.get, parameter[]]]]
call[formValues.put, parameter[literal["nofoot"], literal["1"]]]
if[member[.isNew]] begin[{]
call[formValues.put, parameter[literal["newlink"], call[editableData.getNewLink, parameter[]]]]
call[formValues.put, parameter[literal["editortitle"], call[editableData.getNewTitle, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[String], postCreateHandler]
if[binary_operation[member[.postCreateHandler], !=, literal[null]]] begin[{]
call[formValues.put, parameter[literal["postCreateHandler"], member[.postCreateHandler]]]
else begin[{]
None
end[}]
if[binary_operation[member[.mode], !=, literal[null]]] begin[{]
call[formValues.put, parameter[literal["mode"], member[.mode]]]
else begin[{]
None
end[}]
local_variable[type[FormElement], formElement]
return[member[.formElement]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[FormElement] identifier[generateForm] operator[SEP] identifier[I_CmsEditableData] identifier[editableData] , Keyword[boolean] identifier[isNew] , identifier[String] identifier[target] , identifier[String] identifier[mode] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[formValues] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[editableData] operator[SEP] identifier[getSitePath] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[editableData] operator[SEP] identifier[getSitePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[editableData] operator[SEP] identifier[getElementLanguage] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[editableData] operator[SEP] identifier[getElementLanguage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[editableData] operator[SEP] identifier[getElementName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[editableData] operator[SEP] identifier[getElementName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[backlink] operator[=] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[target] operator[SEP] operator[?] identifier[CmsCoreProvider] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[:] identifier[CmsCoreProvider] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getContentEditorBacklinkUrl] operator[SEP] operator[SEP] operator[SEP] identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[backlink] operator[SEP] operator[SEP] identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[CmsCoreProvider] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isNew] operator[SEP] {
identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[editableData] operator[SEP] identifier[getNewLink] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[editableData] operator[SEP] identifier[getNewTitle] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[postCreateHandler] operator[=] identifier[editableData] operator[SEP] identifier[getPostCreateHandler] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[postCreateHandler] operator[!=] Other[null] operator[SEP] {
identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[postCreateHandler] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mode] operator[!=] Other[null] operator[SEP] {
identifier[formValues] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[mode] operator[SEP] operator[SEP]
}
identifier[FormElement] identifier[formElement] operator[=] identifier[CmsDomUtil] operator[SEP] identifier[generateHiddenForm] operator[SEP] identifier[CmsCoreProvider] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[link] operator[SEP] identifier[CmsCoreProvider] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getContentEditorUrl] operator[SEP] operator[SEP] operator[SEP] , identifier[Method] operator[SEP] identifier[post] , identifier[target] , identifier[formValues] operator[SEP] operator[SEP] Keyword[return] identifier[formElement] operator[SEP]
}
|
public IntersectionClassType makeIntersectionType(List<Type> bounds, boolean allInterfaces) {
Assert.check(bounds.nonEmpty());
Type firstExplicitBound = bounds.head;
if (allInterfaces) {
bounds = bounds.prepend(syms.objectType);
}
ClassSymbol bc =
new ClassSymbol(ABSTRACT|PUBLIC|SYNTHETIC|COMPOUND|ACYCLIC,
Type.moreInfo
? names.fromString(bounds.toString())
: names.empty,
null,
syms.noSymbol);
IntersectionClassType intersectionType = new IntersectionClassType(bounds, bc, allInterfaces);
bc.type = intersectionType;
bc.erasure_field = (bounds.head.hasTag(TYPEVAR)) ?
syms.objectType : // error condition, recover
erasure(firstExplicitBound);
bc.members_field = WriteableScope.create(bc);
return intersectionType;
}
|
class class_name[name] begin[{]
method[makeIntersectionType, return_type[type[IntersectionClassType]], modifier[public], parameter[bounds, allInterfaces]] begin[{]
call[Assert.check, parameter[call[bounds.nonEmpty, parameter[]]]]
local_variable[type[Type], firstExplicitBound]
if[member[.allInterfaces]] begin[{]
assign[member[.bounds], call[bounds.prepend, parameter[member[syms.objectType]]]]
else begin[{]
None
end[}]
local_variable[type[ClassSymbol], bc]
local_variable[type[IntersectionClassType], intersectionType]
assign[member[bc.type], member[.intersectionType]]
assign[member[bc.erasure_field], TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=TYPEVAR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasTag, postfix_operators=[], prefix_operators=[], qualifier=bounds.head, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[MemberReference(member=firstExplicitBound, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=erasure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=MemberReference(member=objectType, postfix_operators=[], prefix_operators=[], qualifier=syms, selectors=[]))]
assign[member[bc.members_field], call[WriteableScope.create, parameter[member[.bc]]]]
return[member[.intersectionType]]
end[}]
END[}]
|
Keyword[public] identifier[IntersectionClassType] identifier[makeIntersectionType] operator[SEP] identifier[List] operator[<] identifier[Type] operator[>] identifier[bounds] , Keyword[boolean] identifier[allInterfaces] operator[SEP] {
identifier[Assert] operator[SEP] identifier[check] operator[SEP] identifier[bounds] operator[SEP] identifier[nonEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Type] identifier[firstExplicitBound] operator[=] identifier[bounds] operator[SEP] identifier[head] operator[SEP] Keyword[if] operator[SEP] identifier[allInterfaces] operator[SEP] {
identifier[bounds] operator[=] identifier[bounds] operator[SEP] identifier[prepend] operator[SEP] identifier[syms] operator[SEP] identifier[objectType] operator[SEP] operator[SEP]
}
identifier[ClassSymbol] identifier[bc] operator[=] Keyword[new] identifier[ClassSymbol] operator[SEP] identifier[ABSTRACT] operator[|] identifier[PUBLIC] operator[|] identifier[SYNTHETIC] operator[|] identifier[COMPOUND] operator[|] identifier[ACYCLIC] , identifier[Type] operator[SEP] identifier[moreInfo] operator[?] identifier[names] operator[SEP] identifier[fromString] operator[SEP] identifier[bounds] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[names] operator[SEP] identifier[empty] , Other[null] , identifier[syms] operator[SEP] identifier[noSymbol] operator[SEP] operator[SEP] identifier[IntersectionClassType] identifier[intersectionType] operator[=] Keyword[new] identifier[IntersectionClassType] operator[SEP] identifier[bounds] , identifier[bc] , identifier[allInterfaces] operator[SEP] operator[SEP] identifier[bc] operator[SEP] identifier[type] operator[=] identifier[intersectionType] operator[SEP] identifier[bc] operator[SEP] identifier[erasure_field] operator[=] operator[SEP] identifier[bounds] operator[SEP] identifier[head] operator[SEP] identifier[hasTag] operator[SEP] identifier[TYPEVAR] operator[SEP] operator[SEP] operator[?] identifier[syms] operator[SEP] identifier[objectType] operator[:] identifier[erasure] operator[SEP] identifier[firstExplicitBound] operator[SEP] operator[SEP] identifier[bc] operator[SEP] identifier[members_field] operator[=] identifier[WriteableScope] operator[SEP] identifier[create] operator[SEP] identifier[bc] operator[SEP] operator[SEP] Keyword[return] identifier[intersectionType] operator[SEP]
}
|
public static JinxConstants.GroupPrivacy privacyIdToGroupPrivacyEnum(Integer id) {
if (id == null) {
return null;
}
JinxConstants.GroupPrivacy privacy;
switch (id) {
case 1:
privacy = JinxConstants.GroupPrivacy.group_private;
break;
case 2:
privacy = JinxConstants.GroupPrivacy.group_invite_only_public;
break;
case 3:
privacy = JinxConstants.GroupPrivacy.group_open_public;
break;
default:
privacy = null;
break;
}
return privacy;
}
|
class class_name[name] begin[{]
method[privacyIdToGroupPrivacyEnum, return_type[type[JinxConstants]], modifier[public static], parameter[id]] begin[{]
if[binary_operation[member[.id], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[JinxConstants], privacy]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=privacy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=group_private, postfix_operators=[], prefix_operators=[], qualifier=JinxConstants.GroupPrivacy, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=privacy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=group_invite_only_public, postfix_operators=[], prefix_operators=[], qualifier=JinxConstants.GroupPrivacy, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=privacy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=group_open_public, postfix_operators=[], prefix_operators=[], qualifier=JinxConstants.GroupPrivacy, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=privacy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[member[.privacy]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[JinxConstants] operator[SEP] identifier[GroupPrivacy] identifier[privacyIdToGroupPrivacyEnum] operator[SEP] identifier[Integer] identifier[id] operator[SEP] {
Keyword[if] operator[SEP] identifier[id] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[JinxConstants] operator[SEP] identifier[GroupPrivacy] identifier[privacy] operator[SEP] Keyword[switch] operator[SEP] identifier[id] operator[SEP] {
Keyword[case] Other[1] operator[:] identifier[privacy] operator[=] identifier[JinxConstants] operator[SEP] identifier[GroupPrivacy] operator[SEP] identifier[group_private] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[2] operator[:] identifier[privacy] operator[=] identifier[JinxConstants] operator[SEP] identifier[GroupPrivacy] operator[SEP] identifier[group_invite_only_public] operator[SEP] Keyword[break] operator[SEP] Keyword[case] Other[3] operator[:] identifier[privacy] operator[=] identifier[JinxConstants] operator[SEP] identifier[GroupPrivacy] operator[SEP] identifier[group_open_public] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[privacy] operator[=] Other[null] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[return] identifier[privacy] operator[SEP]
}
|
public static Double negativeDouble(String value) {
Double doubleValue = Validate.isDouble(value);
negative(doubleValue);
return doubleValue;
}
|
class class_name[name] begin[{]
method[negativeDouble, return_type[type[Double]], modifier[public static], parameter[value]] begin[{]
local_variable[type[Double], doubleValue]
call[.negative, parameter[member[.doubleValue]]]
return[member[.doubleValue]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Double] identifier[negativeDouble] operator[SEP] identifier[String] identifier[value] operator[SEP] {
identifier[Double] identifier[doubleValue] operator[=] identifier[Validate] operator[SEP] identifier[isDouble] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[negative] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] Keyword[return] identifier[doubleValue] operator[SEP]
}
|
private void initializePrefixes()
{
if (namespaceMap == null) {
// TODO use logger
System.err
.println("Cannot use whitespace filter without initializing the namespace-prefix map for the current Wikipedia language version. DISABLING FILTER.");
}
else {
prefixesToAllow = new HashSet<String>();
prefixesToReject = new HashSet<String>();
for (Entry<Integer, String> namespace : namespaceMap.entrySet()) {
if (allowedNamespaces.contains(namespace.getKey())) {
prefixesToAllow.add(namespace.getValue() + ":");
}
else {
prefixesToReject.add(namespace.getValue() + ":");
}
}
}
}
|
class class_name[name] begin[{]
method[initializePrefixes, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.namespaceMap], ==, literal[null]]] begin[{]
call[System.err.println, parameter[literal["Cannot use whitespace filter without initializing the namespace-prefix map for the current Wikipedia language version. DISABLING FILTER."]]]
else begin[{]
assign[member[.prefixesToAllow], 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=String, sub_type=None))], dimensions=None, name=HashSet, sub_type=None))]
assign[member[.prefixesToReject], 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=String, sub_type=None))], dimensions=None, name=HashSet, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=namespace, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=[], qualifier=allowedNamespaces, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=namespace, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+)], member=add, postfix_operators=[], prefix_operators=[], qualifier=prefixesToReject, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=namespace, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+)], member=add, postfix_operators=[], prefix_operators=[], qualifier=prefixesToAllow, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=namespaceMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=namespace)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[initializePrefixes] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[namespaceMap] operator[==] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[prefixesToAllow] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[prefixesToReject] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[Integer] , identifier[String] operator[>] identifier[namespace] operator[:] identifier[namespaceMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[allowedNamespaces] operator[SEP] identifier[contains] operator[SEP] identifier[namespace] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[prefixesToAllow] operator[SEP] identifier[add] operator[SEP] identifier[namespace] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[prefixesToReject] operator[SEP] identifier[add] operator[SEP] identifier[namespace] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
}
|
public static List<String> childrenText(Element parentElement, String tagname) {
final Iterable<Element> children = children(parentElement, tagname);
List<String> result = new ArrayList<String>();
for (Element element : children) {
result.add(elementText(element));
}
return result;
}
|
class class_name[name] begin[{]
method[childrenText, return_type[type[List]], modifier[public static], parameter[parentElement, tagname]] begin[{]
local_variable[type[Iterable], children]
local_variable[type[List], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=elementText, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=children, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=element)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[String] operator[>] identifier[childrenText] operator[SEP] identifier[Element] identifier[parentElement] , identifier[String] identifier[tagname] operator[SEP] {
Keyword[final] identifier[Iterable] operator[<] identifier[Element] operator[>] identifier[children] operator[=] identifier[children] operator[SEP] identifier[parentElement] , identifier[tagname] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Element] identifier[element] operator[:] identifier[children] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[elementText] operator[SEP] identifier[element] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static boolean reflectionIsEmpty(final Object obj, final String... excludedFields) {
return reflectionIsEmpty(obj, IsEmptyConfig.create(), Arrays.asList(excludedFields));
}
|
class class_name[name] begin[{]
method[reflectionIsEmpty, return_type[type[boolean]], modifier[public static], parameter[obj, excludedFields]] begin[{]
return[call[.reflectionIsEmpty, parameter[member[.obj], call[IsEmptyConfig.create, parameter[]], call[Arrays.asList, parameter[member[.excludedFields]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[reflectionIsEmpty] operator[SEP] Keyword[final] identifier[Object] identifier[obj] , Keyword[final] identifier[String] operator[...] identifier[excludedFields] operator[SEP] {
Keyword[return] identifier[reflectionIsEmpty] operator[SEP] identifier[obj] , identifier[IsEmptyConfig] operator[SEP] identifier[create] operator[SEP] operator[SEP] , identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[excludedFields] operator[SEP] operator[SEP] operator[SEP]
}
|
public Object invokeSetter(final Object instance, final Object value)
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
final Class<?> valueClass = value.getClass();
final Method method = getInvokableMethodForClass(valueClass);
if (method == null) {
throw new IllegalArgumentException(
"class " + instance.getClass().getName()
+ " does not have an annotated setter for values of type " + valueClass.getName());
}
return method.invoke(instance, value);
}
|
class class_name[name] begin[{]
method[invokeSetter, return_type[type[Object]], modifier[public], parameter[instance, value]] begin[{]
local_variable[type[Class], valueClass]
local_variable[type[Method], method]
if[binary_operation[member[.method], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="class "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=instance, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" does not have an annotated setter for values of type "), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=valueClass, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[method.invoke, parameter[member[.instance], member[.value]]]]
end[}]
END[}]
|
Keyword[public] identifier[Object] identifier[invokeSetter] operator[SEP] Keyword[final] identifier[Object] identifier[instance] , Keyword[final] identifier[Object] identifier[value] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] , identifier[IllegalAccessException] , identifier[InvocationTargetException] {
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[valueClass] operator[=] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Method] identifier[method] operator[=] identifier[getInvokableMethodForClass] operator[SEP] identifier[valueClass] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[method] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[instance] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[valueClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[method] operator[SEP] identifier[invoke] operator[SEP] identifier[instance] , identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public ExplodedPlugin explode(PluginInfo pluginInfo) {
File toDir = new File(fs.getDeployedPluginsDir(), pluginInfo.getKey());
try {
forceMkdir(toDir);
org.sonar.core.util.FileUtils.cleanDirectory(toDir);
File jarSource = pluginInfo.getNonNullJarFile();
File jarTarget = new File(toDir, jarSource.getName());
FileUtils.copyFile(jarSource, jarTarget);
ZipUtils.unzip(jarSource, toDir, newLibFilter());
ExplodedPlugin explodedPlugin = explodeFromUnzippedDir(pluginInfo.getKey(), jarTarget, toDir);
pluginFileSystem.addInstalledPlugin(pluginInfo, jarTarget);
return explodedPlugin;
} catch (Exception e) {
throw new IllegalStateException(String.format(
"Fail to unzip plugin [%s] %s to %s", pluginInfo.getKey(), pluginInfo.getNonNullJarFile().getAbsolutePath(), toDir.getAbsolutePath()), e);
}
}
|
class class_name[name] begin[{]
method[explode, return_type[type[ExplodedPlugin]], modifier[public], parameter[pluginInfo]] begin[{]
local_variable[type[File], toDir]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=toDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forceMkdir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=toDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cleanDirectory, postfix_operators=[], prefix_operators=[], qualifier=org.sonar.core.util.FileUtils, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNonNullJarFile, postfix_operators=[], prefix_operators=[], qualifier=pluginInfo, selectors=[], type_arguments=None), name=jarSource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=toDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=jarSource, 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)), name=jarTarget)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jarSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jarTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copyFile, postfix_operators=[], prefix_operators=[], qualifier=FileUtils, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jarSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=toDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=newLibFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=unzip, postfix_operators=[], prefix_operators=[], qualifier=ZipUtils, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=pluginInfo, selectors=[], type_arguments=None), MemberReference(member=jarTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=toDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=explodeFromUnzippedDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=explodedPlugin)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExplodedPlugin, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pluginInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jarTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addInstalledPlugin, postfix_operators=[], prefix_operators=[], qualifier=pluginFileSystem, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=explodedPlugin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Fail to unzip plugin [%s] %s to %s"), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=pluginInfo, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getNonNullJarFile, postfix_operators=[], prefix_operators=[], qualifier=pluginInfo, selectors=[MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=toDir, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, 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=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[ExplodedPlugin] identifier[explode] operator[SEP] identifier[PluginInfo] identifier[pluginInfo] operator[SEP] {
identifier[File] identifier[toDir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[fs] operator[SEP] identifier[getDeployedPluginsDir] operator[SEP] operator[SEP] , identifier[pluginInfo] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[forceMkdir] operator[SEP] identifier[toDir] operator[SEP] operator[SEP] identifier[org] operator[SEP] identifier[sonar] operator[SEP] identifier[core] operator[SEP] identifier[util] operator[SEP] identifier[FileUtils] operator[SEP] identifier[cleanDirectory] operator[SEP] identifier[toDir] operator[SEP] operator[SEP] identifier[File] identifier[jarSource] operator[=] identifier[pluginInfo] operator[SEP] identifier[getNonNullJarFile] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[jarTarget] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[toDir] , identifier[jarSource] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[FileUtils] operator[SEP] identifier[copyFile] operator[SEP] identifier[jarSource] , identifier[jarTarget] operator[SEP] operator[SEP] identifier[ZipUtils] operator[SEP] identifier[unzip] operator[SEP] identifier[jarSource] , identifier[toDir] , identifier[newLibFilter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ExplodedPlugin] identifier[explodedPlugin] operator[=] identifier[explodeFromUnzippedDir] operator[SEP] identifier[pluginInfo] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[jarTarget] , identifier[toDir] operator[SEP] operator[SEP] identifier[pluginFileSystem] operator[SEP] identifier[addInstalledPlugin] operator[SEP] identifier[pluginInfo] , identifier[jarTarget] operator[SEP] operator[SEP] Keyword[return] identifier[explodedPlugin] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[pluginInfo] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[pluginInfo] operator[SEP] identifier[getNonNullJarFile] operator[SEP] operator[SEP] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , identifier[toDir] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public <C> C id(final Class<C> configInterface, final Optional<String> scopeNameOpt)
{
return MethodIdProxyFactory.getProxy(configInterface, scopeNameOpt);
}
|
class class_name[name] begin[{]
method[id, return_type[type[C]], modifier[public], parameter[configInterface, scopeNameOpt]] begin[{]
return[call[MethodIdProxyFactory.getProxy, parameter[member[.configInterface], member[.scopeNameOpt]]]]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[C] operator[>] identifier[C] identifier[id] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[C] operator[>] identifier[configInterface] , Keyword[final] identifier[Optional] operator[<] identifier[String] operator[>] identifier[scopeNameOpt] operator[SEP] {
Keyword[return] identifier[MethodIdProxyFactory] operator[SEP] identifier[getProxy] operator[SEP] identifier[configInterface] , identifier[scopeNameOpt] operator[SEP] operator[SEP]
}
|
public SparqlResult runQuery(String endpoint, String query) {
return SparqlClient.execute(endpoint, query, username, password);
}
|
class class_name[name] begin[{]
method[runQuery, return_type[type[SparqlResult]], modifier[public], parameter[endpoint, query]] begin[{]
return[call[SparqlClient.execute, parameter[member[.endpoint], member[.query], member[.username], member[.password]]]]
end[}]
END[}]
|
Keyword[public] identifier[SparqlResult] identifier[runQuery] operator[SEP] identifier[String] identifier[endpoint] , identifier[String] identifier[query] operator[SEP] {
Keyword[return] identifier[SparqlClient] operator[SEP] identifier[execute] operator[SEP] identifier[endpoint] , identifier[query] , identifier[username] , identifier[password] operator[SEP] operator[SEP]
}
|
private boolean validPath(final Path path) {
Path relativePath = relativePath(path);
if (relativePath.equals(path)) {
return true;
}
String d = relativePath.getName(0).toString().toLowerCase();
// loadPathの直下が現在のdialect以外と一致する場合は無効なパスと判定する
return !dialects.contains(d) || this.dialect.getDatabaseType().equals(d);
}
|
class class_name[name] begin[{]
method[validPath, return_type[type[boolean]], modifier[private], parameter[path]] begin[{]
local_variable[type[Path], relativePath]
if[call[relativePath.equals, parameter[member[.path]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
local_variable[type[String], d]
return[binary_operation[call[dialects.contains, parameter[member[.d]]], ||, THIS[member[None.dialect]call[None.getDatabaseType, parameter[]]call[None.equals, parameter[member[.d]]]]]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[validPath] operator[SEP] Keyword[final] identifier[Path] identifier[path] operator[SEP] {
identifier[Path] identifier[relativePath] operator[=] identifier[relativePath] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[relativePath] operator[SEP] identifier[equals] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[String] identifier[d] operator[=] identifier[relativePath] operator[SEP] identifier[getName] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[!] identifier[dialects] operator[SEP] identifier[contains] operator[SEP] identifier[d] operator[SEP] operator[||] Keyword[this] operator[SEP] identifier[dialect] operator[SEP] identifier[getDatabaseType] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[d] operator[SEP] operator[SEP]
}
|
public static String jsonJoin(String[] array) {
int arraySize = array.length;
int bufSize = arraySize * (array[0].length() + 3);
StringBuilder buf = new StringBuilder(bufSize);
for (int i = 0; i < arraySize; i++) {
if (i > 0) {
buf.append(',');
}
buf.append('"');
buf.append(array[i]);
buf.append('"');
}
return buf.toString();
}
|
class class_name[name] begin[{]
method[jsonJoin, return_type[type[String]], modifier[public static], parameter[array]] begin[{]
local_variable[type[int], arraySize]
local_variable[type[int], bufSize]
local_variable[type[StringBuilder], buf]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=',')], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"')], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='"')], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=arraySize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[buf.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[jsonJoin] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[array] operator[SEP] {
Keyword[int] identifier[arraySize] operator[=] identifier[array] operator[SEP] identifier[length] operator[SEP] Keyword[int] identifier[bufSize] operator[=] identifier[arraySize] operator[*] operator[SEP] identifier[array] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] Other[3] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[buf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[bufSize] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[arraySize] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
protected boolean handleUnmatchedRoute(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse, HttpMethod httpMethod, String requestPath) {
// If this resource matches a different method[s], error out specially
List<HttpMethod> otherHttpMethods = new ArrayList<>(HttpMethod.values().length);
for (HttpMethod otherHttpMethod : HttpMethod.values())
if (httpMethod != otherHttpMethod && routeMatcher.match(otherHttpMethod, requestPath).isPresent())
otherHttpMethods.add(otherHttpMethod);
// Handle OPTIONS specially by indicating we don't want to invoke the response handler
// Otherwise, throw an exception indicating a 405
if (otherHttpMethods.size() > 0) {
// Always write the Allow header
httpServletResponse.setHeader("Allow",
otherHttpMethods.stream().map(method -> method.name()).collect(joining(", ")));
if (httpMethod == HttpMethod.OPTIONS)
return false;
throw new MethodNotAllowedException(format("%s is not supported for this resource. Supported method%s %s",
httpMethod, (otherHttpMethods.size() == 1 ? " is" : "s are"),
otherHttpMethods.stream().map(method -> method.name()).collect(joining(", "))));
}
// No matching route, and no possible alternatives? It's a 404
throw new NotFoundException(format("No route was found for %s %s", httpMethod.name(), requestPath));
}
|
class class_name[name] begin[{]
method[handleUnmatchedRoute, return_type[type[boolean]], modifier[protected], parameter[httpServletRequest, httpServletResponse, httpMethod, requestPath]] begin[{]
local_variable[type[List], otherHttpMethods]
ForStatement(body=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=httpMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=otherHttpMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=otherHttpMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=requestPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=routeMatcher, selectors=[MethodInvocation(arguments=[], member=isPresent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=otherHttpMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=otherHttpMethods, selectors=[], type_arguments=None), label=None)), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=HttpMethod, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=otherHttpMethod)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HttpMethod, sub_type=None))), label=None)
if[binary_operation[call[otherHttpMethods.size, parameter[]], >, literal[0]]] begin[{]
call[httpServletResponse.setHeader, parameter[literal["Allow"], call[otherHttpMethods.stream, parameter[]]]]
if[binary_operation[member[.httpMethod], ==, member[HttpMethod.OPTIONS]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s is not supported for this resource. Supported method%s %s"), MemberReference(member=httpMethod, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=otherHttpMethods, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="s are"), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is")), MethodInvocation(arguments=[], member=stream, postfix_operators=[], prefix_operators=[], qualifier=otherHttpMethods, selectors=[MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), parameters=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=map, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", ")], member=joining, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=collect, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MethodNotAllowedException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No route was found for %s %s"), MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=httpMethod, selectors=[], type_arguments=None), MemberReference(member=requestPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotFoundException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[protected] Keyword[boolean] identifier[handleUnmatchedRoute] operator[SEP] identifier[HttpServletRequest] identifier[httpServletRequest] , identifier[HttpServletResponse] identifier[httpServletResponse] , identifier[HttpMethod] identifier[httpMethod] , identifier[String] identifier[requestPath] operator[SEP] {
identifier[List] operator[<] identifier[HttpMethod] operator[>] identifier[otherHttpMethods] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[HttpMethod] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[HttpMethod] identifier[otherHttpMethod] operator[:] identifier[HttpMethod] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[httpMethod] operator[!=] identifier[otherHttpMethod] operator[&&] identifier[routeMatcher] operator[SEP] identifier[match] operator[SEP] identifier[otherHttpMethod] , identifier[requestPath] operator[SEP] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] identifier[otherHttpMethods] operator[SEP] identifier[add] operator[SEP] identifier[otherHttpMethod] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[otherHttpMethods] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[httpServletResponse] operator[SEP] identifier[setHeader] operator[SEP] literal[String] , identifier[otherHttpMethods] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[method] operator[->] identifier[method] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[joining] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[httpMethod] operator[==] identifier[HttpMethod] operator[SEP] identifier[OPTIONS] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[throw] Keyword[new] identifier[MethodNotAllowedException] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[httpMethod] , operator[SEP] identifier[otherHttpMethods] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[?] literal[String] operator[:] literal[String] operator[SEP] , identifier[otherHttpMethods] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[method] operator[->] identifier[method] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[joining] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[NotFoundException] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[httpMethod] operator[SEP] identifier[name] operator[SEP] operator[SEP] , identifier[requestPath] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String get(String key, Object... args) {
return get(BUNDLE_NAME, key, args);
}
|
class class_name[name] begin[{]
method[get, return_type[type[String]], modifier[public static], parameter[key, args]] begin[{]
return[call[.get, parameter[member[.BUNDLE_NAME], member[.key], member[.args]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[get] operator[SEP] identifier[String] identifier[key] , identifier[Object] operator[...] identifier[args] operator[SEP] {
Keyword[return] identifier[get] operator[SEP] identifier[BUNDLE_NAME] , identifier[key] , identifier[args] operator[SEP] operator[SEP]
}
|
public String obtainLoopbackIp4Address() {
final NetworkInterface networkInterface = getLoopBackAndIp4Only();
if (networkInterface != null) {
return networkInterface.getIp4LoopbackOnly().getHostName();
}
final String ipOfIp4LoopBack = getIpOfLoopBackIp4();
if (ipOfIp4LoopBack != null) {
return ipOfIp4LoopBack;
}
if (Platform.getCurrent().is(Platform.UNIX)) {
NetworkInterface linuxLoopback = networkInterfaceProvider.getLoInterface();
if (linuxLoopback != null) {
final InetAddress netAddress = linuxLoopback.getIp4LoopbackOnly();
if (netAddress != null) {
return netAddress.getHostAddress();
}
}
}
throw new WebDriverException(
"Unable to resolve local loopback address, please file an issue with the full message of this error:\n"
+
getNetWorkDiags() + "\n==== End of error message");
}
|
class class_name[name] begin[{]
method[obtainLoopbackIp4Address, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[NetworkInterface], networkInterface]
if[binary_operation[member[.networkInterface], !=, literal[null]]] begin[{]
return[call[networkInterface.getIp4LoopbackOnly, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[String], ipOfIp4LoopBack]
if[binary_operation[member[.ipOfIp4LoopBack], !=, literal[null]]] begin[{]
return[member[.ipOfIp4LoopBack]]
else begin[{]
None
end[}]
if[call[Platform.getCurrent, parameter[]]] begin[{]
local_variable[type[NetworkInterface], linuxLoopback]
if[binary_operation[member[.linuxLoopback], !=, literal[null]]] begin[{]
local_variable[type[InetAddress], netAddress]
if[binary_operation[member[.netAddress], !=, literal[null]]] begin[{]
return[call[netAddress.getHostAddress, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to resolve local loopback address, please file an issue with the full message of this error:\n"), operandr=MethodInvocation(arguments=[], member=getNetWorkDiags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n==== End of error message"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebDriverException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[obtainLoopbackIp4Address] operator[SEP] operator[SEP] {
Keyword[final] identifier[NetworkInterface] identifier[networkInterface] operator[=] identifier[getLoopBackAndIp4Only] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[networkInterface] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[networkInterface] operator[SEP] identifier[getIp4LoopbackOnly] operator[SEP] operator[SEP] operator[SEP] identifier[getHostName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] identifier[String] identifier[ipOfIp4LoopBack] operator[=] identifier[getIpOfLoopBackIp4] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ipOfIp4LoopBack] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[ipOfIp4LoopBack] operator[SEP]
}
Keyword[if] operator[SEP] identifier[Platform] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] identifier[is] operator[SEP] identifier[Platform] operator[SEP] identifier[UNIX] operator[SEP] operator[SEP] {
identifier[NetworkInterface] identifier[linuxLoopback] operator[=] identifier[networkInterfaceProvider] operator[SEP] identifier[getLoInterface] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[linuxLoopback] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[InetAddress] identifier[netAddress] operator[=] identifier[linuxLoopback] operator[SEP] identifier[getIp4LoopbackOnly] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[netAddress] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[netAddress] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[throw] Keyword[new] identifier[WebDriverException] operator[SEP] literal[String] operator[+] identifier[getNetWorkDiags] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
public static boolean startsWith(String string, String prefix) {
return string.regionMatches(true, 0, prefix, 0, prefix.length());
}
|
class class_name[name] begin[{]
method[startsWith, return_type[type[boolean]], modifier[public static], parameter[string, prefix]] begin[{]
return[call[string.regionMatches, parameter[literal[true], literal[0], member[.prefix], literal[0], call[prefix.length, parameter[]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[startsWith] operator[SEP] identifier[String] identifier[string] , identifier[String] identifier[prefix] operator[SEP] {
Keyword[return] identifier[string] operator[SEP] identifier[regionMatches] operator[SEP] literal[boolean] , Other[0] , identifier[prefix] , Other[0] , identifier[prefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Observable<Page<AppServiceEnvironmentResourceInner>> listByResourceGroupAsync(final String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
.map(new Func1<ServiceResponse<Page<AppServiceEnvironmentResourceInner>>, Page<AppServiceEnvironmentResourceInner>>() {
@Override
public Page<AppServiceEnvironmentResourceInner> call(ServiceResponse<Page<AppServiceEnvironmentResourceInner>> response) {
return response.body();
}
});
}
|
class class_name[name] begin[{]
method[listByResourceGroupAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName]] begin[{]
return[call[.listByResourceGroupWithServiceResponseAsync, parameter[member[.resourceGroupName]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[AppServiceEnvironmentResourceInner] operator[>] operator[>] identifier[listByResourceGroupAsync] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] operator[SEP] {
Keyword[return] identifier[listByResourceGroupWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[AppServiceEnvironmentResourceInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[AppServiceEnvironmentResourceInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[AppServiceEnvironmentResourceInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[AppServiceEnvironmentResourceInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
protected Object getValue(Object value, ComparisonType type) {
return type == ComparisonType.NODE_TYPE ? nodeType((Short) value) : value;
}
|
class class_name[name] begin[{]
method[getValue, return_type[type[Object]], modifier[protected], parameter[value, type]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=NODE_TYPE, postfix_operators=[], prefix_operators=[], qualifier=ComparisonType, selectors=[]), operator===), if_false=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Short, sub_type=None))], member=nodeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
END[}]
|
Keyword[protected] identifier[Object] identifier[getValue] operator[SEP] identifier[Object] identifier[value] , identifier[ComparisonType] identifier[type] operator[SEP] {
Keyword[return] identifier[type] operator[==] identifier[ComparisonType] operator[SEP] identifier[NODE_TYPE] operator[?] identifier[nodeType] operator[SEP] operator[SEP] identifier[Short] operator[SEP] identifier[value] operator[SEP] operator[:] identifier[value] operator[SEP]
}
|
public static DataSource initializeTxSimple(DataSource dataSource) {
TxTransactionManager txManager = new TxTransactionManager(dataSource);
return initializeTxCustom(txManager.getTxDataSource(), txManager, txManager);
}
|
class class_name[name] begin[{]
method[initializeTxSimple, return_type[type[DataSource]], modifier[public static], parameter[dataSource]] begin[{]
local_variable[type[TxTransactionManager], txManager]
return[call[.initializeTxCustom, parameter[call[txManager.getTxDataSource, parameter[]], member[.txManager], member[.txManager]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DataSource] identifier[initializeTxSimple] operator[SEP] identifier[DataSource] identifier[dataSource] operator[SEP] {
identifier[TxTransactionManager] identifier[txManager] operator[=] Keyword[new] identifier[TxTransactionManager] operator[SEP] identifier[dataSource] operator[SEP] operator[SEP] Keyword[return] identifier[initializeTxCustom] operator[SEP] identifier[txManager] operator[SEP] identifier[getTxDataSource] operator[SEP] operator[SEP] , identifier[txManager] , identifier[txManager] operator[SEP] operator[SEP]
}
|
private void computeTags() {
if (tag_uids != null && aggregated_tag_uids != null) {
return;
}
if (spans.isEmpty()) {
tag_uids = new ByteMap<byte[]>();
aggregated_tag_uids = new HashSet<byte[]>();
return;
}
// local tag uids
final ByteMap<byte[]> tag_set = new ByteMap<byte[]>();
// value is always null, we just want the set of unique keys
final ByteMap<byte[]> discards = new ByteMap<byte[]>();
final Iterator<Span> it = spans.iterator();
while (it.hasNext()) {
final Span span = it.next();
final ByteMap<byte[]> uids = span.getTagUids();
for (final Map.Entry<byte[], byte[]> tag_pair : uids.entrySet()) {
// we already know it's an aggregated tag
if (discards.containsKey(tag_pair.getKey())) {
continue;
}
final byte[] tag_value = tag_set.get(tag_pair.getKey());
if (tag_value == null) {
tag_set.put(tag_pair.getKey(), tag_pair.getValue());
} else if (Bytes.memcmp(tag_value, tag_pair.getValue()) != 0) {
// bump to aggregated tags
discards.put(tag_pair.getKey(), null);
tag_set.remove(tag_pair.getKey());
}
}
}
aggregated_tag_uids = discards.keySet();
tag_uids = tag_set;
}
|
class class_name[name] begin[{]
method[computeTags, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[binary_operation[member[.tag_uids], !=, literal[null]], &&, binary_operation[member[.aggregated_tag_uids], !=, literal[null]]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[call[spans.isEmpty, parameter[]]] begin[{]
assign[member[.tag_uids], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte))], dimensions=None, name=ByteMap, sub_type=None))]
assign[member[.aggregated_tag_uids], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte))], dimensions=None, name=HashSet, sub_type=None))]
return[None]
else begin[{]
None
end[}]
local_variable[type[ByteMap], tag_set]
local_variable[type[ByteMap], discards]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[Span], span]
local_variable[type[ByteMap], uids]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=tag_pair, selectors=[], type_arguments=None)], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=discards, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=tag_pair, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=tag_set, selectors=[], type_arguments=None), name=tag_value)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tag_value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=tag_value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=tag_pair, selectors=[], type_arguments=None)], member=memcmp, postfix_operators=[], prefix_operators=[], qualifier=Bytes, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=tag_pair, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=put, postfix_operators=[], prefix_operators=[], qualifier=discards, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=tag_pair, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=tag_set, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=tag_pair, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=tag_pair, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=tag_set, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=uids, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tag_pair)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte)), TypeArgument(pattern_type=None, type=BasicType(dimensions=[None], name=byte))], dimensions=None, name=Entry, sub_type=None)))), label=None)
end[}]
assign[member[.aggregated_tag_uids], call[discards.keySet, parameter[]]]
assign[member[.tag_uids], member[.tag_set]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[computeTags] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tag_uids] operator[!=] Other[null] operator[&&] identifier[aggregated_tag_uids] operator[!=] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[spans] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[tag_uids] operator[=] Keyword[new] identifier[ByteMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[aggregated_tag_uids] operator[=] Keyword[new] identifier[HashSet] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[final] identifier[ByteMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[tag_set] operator[=] Keyword[new] identifier[ByteMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ByteMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[discards] operator[=] Keyword[new] identifier[ByteMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Iterator] operator[<] identifier[Span] operator[>] identifier[it] operator[=] identifier[spans] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Span] identifier[span] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ByteMap] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[uids] operator[=] identifier[span] operator[SEP] identifier[getTagUids] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Map] operator[SEP] identifier[Entry] operator[<] Keyword[byte] operator[SEP] operator[SEP] , Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[tag_pair] operator[:] identifier[uids] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[discards] operator[SEP] identifier[containsKey] operator[SEP] identifier[tag_pair] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[tag_value] operator[=] identifier[tag_set] operator[SEP] identifier[get] operator[SEP] identifier[tag_pair] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tag_value] operator[==] Other[null] operator[SEP] {
identifier[tag_set] operator[SEP] identifier[put] operator[SEP] identifier[tag_pair] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[tag_pair] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[Bytes] operator[SEP] identifier[memcmp] operator[SEP] identifier[tag_value] , identifier[tag_pair] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[discards] operator[SEP] identifier[put] operator[SEP] identifier[tag_pair] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[tag_set] operator[SEP] identifier[remove] operator[SEP] identifier[tag_pair] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[aggregated_tag_uids] operator[=] identifier[discards] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[tag_uids] operator[=] identifier[tag_set] operator[SEP]
}
|
public void floodFill(int xx, int yy, Rectangle clip, int replacement)
{
floodFill(xx, yy, clip, (c)->c!=replacement, replacement);
}
|
class class_name[name] begin[{]
method[floodFill, return_type[void], modifier[public], parameter[xx, yy, clip, replacement]] begin[{]
call[.floodFill, parameter[member[.xx], member[.yy], member[.clip], LambdaExpression(body=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=replacement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), parameters=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), member[.replacement]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[floodFill] operator[SEP] Keyword[int] identifier[xx] , Keyword[int] identifier[yy] , identifier[Rectangle] identifier[clip] , Keyword[int] identifier[replacement] operator[SEP] {
identifier[floodFill] operator[SEP] identifier[xx] , identifier[yy] , identifier[clip] , operator[SEP] identifier[c] operator[SEP] operator[->] identifier[c] operator[!=] identifier[replacement] , identifier[replacement] operator[SEP] operator[SEP]
}
|
@Conditioned
@Et("Je prends une capture d'écran[\\.|\\?]")
@And("I take a screenshot[\\.|\\?]")
public void takeScreenshot(List<GherkinStepCondition> conditions) {
logger.debug("I take a screenshot for [{}] scenario.", Context.getCurrentScenario());
screenService.takeScreenshot(Context.getCurrentScenario());
}
|
class class_name[name] begin[{]
method[takeScreenshot, return_type[void], modifier[public], parameter[conditions]] begin[{]
call[logger.debug, parameter[literal["I take a screenshot for [{}] scenario."], call[Context.getCurrentScenario, parameter[]]]]
call[screenService.takeScreenshot, parameter[call[Context.getCurrentScenario, parameter[]]]]
end[}]
END[}]
|
annotation[@] identifier[Conditioned] annotation[@] identifier[Et] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[And] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[takeScreenshot] operator[SEP] identifier[List] operator[<] identifier[GherkinStepCondition] operator[>] identifier[conditions] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[Context] operator[SEP] identifier[getCurrentScenario] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[screenService] operator[SEP] identifier[takeScreenshot] operator[SEP] identifier[Context] operator[SEP] identifier[getCurrentScenario] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.