code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
protected static boolean match(Object ref, Object test) {
if(ref == null) {
return false;
}
// Cheap and fast, may hold for class labels!
if(ref == test) {
return true;
}
if(ref instanceof LabelList && test instanceof LabelList) {
final LabelList lref = (LabelList) ref;
final LabelList ltest = (LabelList) test;
final int s1 = lref.size(), s2 = ltest.size();
if(s1 == 0 || s2 == 0) {
return false;
}
for(int i = 0; i < s1; i++) {
String l1 = lref.get(i);
if(l1 == null) {
continue;
}
for(int j = 0; j < s2; j++) {
if(l1.equals(ltest.get(j))) {
return true;
}
}
}
}
// Fallback to equality, e.g. on class labels
return ref.equals(test);
} | class class_name[name] begin[{]
method[match, return_type[type[boolean]], modifier[static protected], parameter[ref, test]] begin[{]
if[binary_operation[member[.ref], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[member[.ref], ==, member[.test]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.ref], instanceof, type[LabelList]], &&, binary_operation[member[.test], instanceof, type[LabelList]]]] begin[{]
local_variable[type[LabelList], lref]
local_variable[type[LabelList], ltest]
local_variable[type[int], s1]
if[binary_operation[binary_operation[member[.s1], ==, literal[0]], ||, binary_operation[member[.s2], ==, literal[0]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
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=lref, selectors=[], type_arguments=None), name=l1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=l1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=ltest, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=l1, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=s2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=s1, 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)
else begin[{]
None
end[}]
return[call[ref.equals, parameter[member[.test]]]]
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[boolean] identifier[match] operator[SEP] identifier[Object] identifier[ref] , identifier[Object] identifier[test] operator[SEP] {
Keyword[if] operator[SEP] identifier[ref] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ref] operator[==] identifier[test] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ref] Keyword[instanceof] identifier[LabelList] operator[&&] identifier[test] Keyword[instanceof] identifier[LabelList] operator[SEP] {
Keyword[final] identifier[LabelList] identifier[lref] operator[=] operator[SEP] identifier[LabelList] operator[SEP] identifier[ref] operator[SEP] Keyword[final] identifier[LabelList] identifier[ltest] operator[=] operator[SEP] identifier[LabelList] operator[SEP] identifier[test] operator[SEP] Keyword[final] Keyword[int] identifier[s1] operator[=] identifier[lref] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[s2] operator[=] identifier[ltest] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s1] operator[==] Other[0] operator[||] identifier[s2] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[s1] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[l1] operator[=] identifier[lref] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[l1] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[s2] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[l1] operator[SEP] identifier[equals] operator[SEP] identifier[ltest] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
}
}
Keyword[return] identifier[ref] operator[SEP] identifier[equals] operator[SEP] identifier[test] operator[SEP] operator[SEP]
}
|
protected String getVisibilityFlag() {
CmsModule module = OpenCms.getModuleManager().getModule(this.getClass().getPackage().getName());
if (module == null) {
return VISIBILITY_ALL;
}
return module.getParameter(PARAM_VISIBILITY_FLAG, VISIBILITY_ALL);
} | class class_name[name] begin[{]
method[getVisibilityFlag, return_type[type[String]], modifier[protected], parameter[]] begin[{]
local_variable[type[CmsModule], module]
if[binary_operation[member[.module], ==, literal[null]]] begin[{]
return[member[.VISIBILITY_ALL]]
else begin[{]
None
end[}]
return[call[module.getParameter, parameter[member[.PARAM_VISIBILITY_FLAG], member[.VISIBILITY_ALL]]]]
end[}]
END[}] | Keyword[protected] identifier[String] identifier[getVisibilityFlag] operator[SEP] operator[SEP] {
identifier[CmsModule] identifier[module] operator[=] identifier[OpenCms] operator[SEP] identifier[getModuleManager] operator[SEP] operator[SEP] operator[SEP] identifier[getModule] operator[SEP] Keyword[this] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[module] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[VISIBILITY_ALL] operator[SEP]
}
Keyword[return] identifier[module] operator[SEP] identifier[getParameter] operator[SEP] identifier[PARAM_VISIBILITY_FLAG] , identifier[VISIBILITY_ALL] operator[SEP] operator[SEP]
}
|
@Override
public PutComplianceItemsResult putComplianceItems(PutComplianceItemsRequest request) {
request = beforeClientExecution(request);
return executePutComplianceItems(request);
} | class class_name[name] begin[{]
method[putComplianceItems, return_type[type[PutComplianceItemsResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executePutComplianceItems, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[PutComplianceItemsResult] identifier[putComplianceItems] operator[SEP] identifier[PutComplianceItemsRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executePutComplianceItems] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({"unchecked", "rawtypes"})
public static Map<String, String> convertToMap(final Properties properties) {
final Map<String, String> map = new HashMap(properties);
return map;
} | class class_name[name] begin[{]
method[convertToMap, return_type[type[Map]], modifier[public static], parameter[properties]] begin[{]
local_variable[type[Map], map]
return[member[.map]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] Keyword[public] Keyword[static] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[convertToMap] operator[SEP] Keyword[final] identifier[Properties] identifier[properties] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[map] operator[=] Keyword[new] identifier[HashMap] operator[SEP] identifier[properties] operator[SEP] operator[SEP] Keyword[return] identifier[map] operator[SEP]
}
|
public static void featureOf(Feature feature, String type, String name) {
if (name == null || name.length() == 0) {
throw new TurfException(".featureOf() requires a name");
}
if (feature == null || !feature.type().equals("Feature") || feature.geometry() == null) {
throw new TurfException(String.format(
"Invalid input to %s, Feature with geometry required", name));
}
if (feature.geometry() == null || !feature.geometry().type().equals(type)) {
throw new TurfException(String.format(
"Invalid input to %s: must be a %s, given %s", name, type, feature.geometry().type()));
}
} | class class_name[name] begin[{]
method[featureOf, return_type[void], modifier[public static], parameter[feature, type, name]] begin[{]
if[binary_operation[binary_operation[member[.name], ==, literal[null]], ||, binary_operation[call[name.length, parameter[]], ==, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".featureOf() requires a name")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TurfException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.feature], ==, literal[null]], ||, call[feature.type, parameter[]]], ||, binary_operation[call[feature.geometry, parameter[]], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid input to %s, Feature with geometry required"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TurfException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[feature.geometry, parameter[]], ==, literal[null]], ||, call[feature.geometry, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid input to %s: must be a %s, given %s"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=geometry, postfix_operators=[], prefix_operators=[], qualifier=feature, selectors=[MethodInvocation(arguments=[], member=type, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TurfException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[featureOf] operator[SEP] identifier[Feature] identifier[feature] , identifier[String] identifier[type] , identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[||] identifier[name] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TurfException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[feature] operator[==] Other[null] operator[||] operator[!] identifier[feature] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[||] identifier[feature] operator[SEP] identifier[geometry] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TurfException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[feature] operator[SEP] identifier[geometry] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] operator[!] identifier[feature] operator[SEP] identifier[geometry] operator[SEP] operator[SEP] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[type] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TurfException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[name] , identifier[type] , identifier[feature] operator[SEP] identifier[geometry] operator[SEP] operator[SEP] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static Field convertToJavaBeansField(IntrospectedColumn introspectedColumn) {
FullyQualifiedJavaType fqjt = introspectedColumn.getFullyQualifiedJavaType();
String property = introspectedColumn.getJavaProperty();
Field field = new Field();
field.setVisibility(JavaVisibility.PRIVATE);
field.setType(fqjt);
field.setName(property);
return field;
} | class class_name[name] begin[{]
method[convertToJavaBeansField, return_type[type[Field]], modifier[public static], parameter[introspectedColumn]] begin[{]
local_variable[type[FullyQualifiedJavaType], fqjt]
local_variable[type[String], property]
local_variable[type[Field], field]
call[field.setVisibility, parameter[member[JavaVisibility.PRIVATE]]]
call[field.setType, parameter[member[.fqjt]]]
call[field.setName, parameter[member[.property]]]
return[member[.field]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Field] identifier[convertToJavaBeansField] operator[SEP] identifier[IntrospectedColumn] identifier[introspectedColumn] operator[SEP] {
identifier[FullyQualifiedJavaType] identifier[fqjt] operator[=] identifier[introspectedColumn] operator[SEP] identifier[getFullyQualifiedJavaType] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[property] operator[=] identifier[introspectedColumn] operator[SEP] identifier[getJavaProperty] operator[SEP] operator[SEP] operator[SEP] identifier[Field] identifier[field] operator[=] Keyword[new] identifier[Field] operator[SEP] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setVisibility] operator[SEP] identifier[JavaVisibility] operator[SEP] identifier[PRIVATE] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setType] operator[SEP] identifier[fqjt] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setName] operator[SEP] identifier[property] operator[SEP] operator[SEP] Keyword[return] identifier[field] operator[SEP]
}
|
public void start(GVRAccessibilitySpeechListener speechListener) {
mTts.setSpeechListener(speechListener);
mTts.getSpeechRecognizer().startListening(mTts.getSpeechRecognizerIntent());
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[speechListener]] begin[{]
call[mTts.setSpeechListener, parameter[member[.speechListener]]]
call[mTts.getSpeechRecognizer, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[start] operator[SEP] identifier[GVRAccessibilitySpeechListener] identifier[speechListener] operator[SEP] {
identifier[mTts] operator[SEP] identifier[setSpeechListener] operator[SEP] identifier[speechListener] operator[SEP] operator[SEP] identifier[mTts] operator[SEP] identifier[getSpeechRecognizer] operator[SEP] operator[SEP] operator[SEP] identifier[startListening] operator[SEP] identifier[mTts] operator[SEP] identifier[getSpeechRecognizerIntent] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean follows(@NotNull final DayOfTheWeek other) {
Contract.requireArgNotNull("other", other);
if (this == PH || other == PH) {
return false;
}
return this.id == (other.id + 1);
} | class class_name[name] begin[{]
method[follows, return_type[type[boolean]], modifier[public], parameter[other]] begin[{]
call[Contract.requireArgNotNull, parameter[literal["other"], member[.other]]]
if[binary_operation[binary_operation[THIS[], ==, member[.PH]], ||, binary_operation[member[.other], ==, member[.PH]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[THIS[member[None.id]], ==, binary_operation[member[other.id], +, literal[1]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[follows] operator[SEP] annotation[@] identifier[NotNull] Keyword[final] identifier[DayOfTheWeek] identifier[other] operator[SEP] {
identifier[Contract] operator[SEP] identifier[requireArgNotNull] operator[SEP] literal[String] , identifier[other] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[==] identifier[PH] operator[||] identifier[other] operator[==] identifier[PH] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[id] operator[==] operator[SEP] identifier[other] operator[SEP] identifier[id] operator[+] Other[1] operator[SEP] operator[SEP]
}
|
public WyalFile.Name convert(QualifiedName id, String suffix, SyntacticItem context) {
return convert(id.getUnit(), id.getName().get().concat(suffix), context);
} | class class_name[name] begin[{]
method[convert, return_type[type[WyalFile]], modifier[public], parameter[id, suffix, context]] begin[{]
return[call[.convert, parameter[call[id.getUnit, parameter[]], call[id.getName, parameter[]], member[.context]]]]
end[}]
END[}] | Keyword[public] identifier[WyalFile] operator[SEP] identifier[Name] identifier[convert] operator[SEP] identifier[QualifiedName] identifier[id] , identifier[String] identifier[suffix] , identifier[SyntacticItem] identifier[context] operator[SEP] {
Keyword[return] identifier[convert] operator[SEP] identifier[id] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] , identifier[id] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[concat] operator[SEP] identifier[suffix] operator[SEP] , identifier[context] operator[SEP] operator[SEP]
}
|
private void setOnPojo(final Object pojo, final P value, final LoadContext ctx, final Path path) {
if (log.isTraceEnabled())
log.trace(LogUtils.msg(path, "Setting property " + property.getName() + " to " + value));
property.set(pojo, value);
} | class class_name[name] begin[{]
method[setOnPojo, return_type[void], modifier[private], parameter[pojo, value, ctx, path]] begin[{]
if[call[log.isTraceEnabled, parameter[]]] begin[{]
call[log.trace, parameter[call[LogUtils.msg, parameter[member[.path], binary_operation[binary_operation[binary_operation[literal["Setting property "], +, call[property.getName, parameter[]]], +, literal[" to "]], +, member[.value]]]]]]
else begin[{]
None
end[}]
call[property.set, parameter[member[.pojo], member[.value]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setOnPojo] operator[SEP] Keyword[final] identifier[Object] identifier[pojo] , Keyword[final] identifier[P] identifier[value] , Keyword[final] identifier[LoadContext] identifier[ctx] , Keyword[final] identifier[Path] identifier[path] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[trace] operator[SEP] identifier[LogUtils] operator[SEP] identifier[msg] operator[SEP] identifier[path] , literal[String] operator[+] identifier[property] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP] operator[SEP] identifier[property] operator[SEP] identifier[set] operator[SEP] identifier[pojo] , identifier[value] operator[SEP] operator[SEP]
}
|
private void showErrorPage(HttpServletResponse resp, String message) throws IOException {
resp.setStatus(HttpServletResponse.SC_OK);
resp.setContentType(GUIServletStub.CONTENT_TYPE_HTML);
PrintWriter writer = resp.getWriter();
writer
.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
writer.println("<html>");
writer.println("<head>");
writer.println(" <title>Launch Job - Error</title>");
writer.println(" <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />");
writer.println(" <link rel=\"stylesheet\" type=\"text/css\" href=\"css/nephelefrontend.css\" />");
writer.println("</head>");
writer.println("<body>");
writer.println(" <div class=\"mainHeading\">");
writer
.println(" <h1><img src=\"img/StratosphereLogo.png\" width=\"326\" height=\"100\" alt=\"Stratosphere Logo\" align=\"middle\"/>Nephele and PACTs Query Interface</h1>");
writer.println(" </div>");
writer.println(" <div style=\"margin-top: 50px; text-align: center;\">");
writer.println(" <p class=\"error_text\" style=\"font-size: 18px;\">");
writer.println(message);
writer.println(" </p><br/><br/>");
writer.println(" <form action=\"launch.html\" method=\"GET\">");
writer.println(" <input type=\"submit\" value=\"back\">");
writer.println(" </form>");
writer.println(" </div>");
writer.println("</body>");
writer.println("</html>");
} | class class_name[name] begin[{]
method[showErrorPage, return_type[void], modifier[private], parameter[resp, message]] begin[{]
call[resp.setStatus, parameter[member[HttpServletResponse.SC_OK]]]
call[resp.setContentType, parameter[member[GUIServletStub.CONTENT_TYPE_HTML]]]
local_variable[type[PrintWriter], writer]
call[writer.println, parameter[literal["<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"]]]
call[writer.println, parameter[literal["<html>"]]]
call[writer.println, parameter[literal["<head>"]]]
call[writer.println, parameter[literal[" <title>Launch Job - Error</title>"]]]
call[writer.println, parameter[literal[" <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />"]]]
call[writer.println, parameter[literal[" <link rel=\"stylesheet\" type=\"text/css\" href=\"css/nephelefrontend.css\" />"]]]
call[writer.println, parameter[literal["</head>"]]]
call[writer.println, parameter[literal["<body>"]]]
call[writer.println, parameter[literal[" <div class=\"mainHeading\">"]]]
call[writer.println, parameter[literal[" <h1><img src=\"img/StratosphereLogo.png\" width=\"326\" height=\"100\" alt=\"Stratosphere Logo\" align=\"middle\"/>Nephele and PACTs Query Interface</h1>"]]]
call[writer.println, parameter[literal[" </div>"]]]
call[writer.println, parameter[literal[" <div style=\"margin-top: 50px; text-align: center;\">"]]]
call[writer.println, parameter[literal[" <p class=\"error_text\" style=\"font-size: 18px;\">"]]]
call[writer.println, parameter[member[.message]]]
call[writer.println, parameter[literal[" </p><br/><br/>"]]]
call[writer.println, parameter[literal[" <form action=\"launch.html\" method=\"GET\">"]]]
call[writer.println, parameter[literal[" <input type=\"submit\" value=\"back\">"]]]
call[writer.println, parameter[literal[" </form>"]]]
call[writer.println, parameter[literal[" </div>"]]]
call[writer.println, parameter[literal["</body>"]]]
call[writer.println, parameter[literal["</html>"]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[showErrorPage] operator[SEP] identifier[HttpServletResponse] identifier[resp] , identifier[String] identifier[message] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[resp] operator[SEP] identifier[setStatus] operator[SEP] identifier[HttpServletResponse] operator[SEP] identifier[SC_OK] operator[SEP] operator[SEP] identifier[resp] operator[SEP] identifier[setContentType] operator[SEP] identifier[GUIServletStub] operator[SEP] identifier[CONTENT_TYPE_HTML] operator[SEP] operator[SEP] identifier[PrintWriter] identifier[writer] operator[=] identifier[resp] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
private int countNonNewline(char[] cbuf, int off, int len) {
for(int cnt = 0; cnt < len; cnt++) {
final int pos = off + cnt;
if(cbuf[pos] == UNIX_NEWLINE) {
return cnt;
}
if(cbuf[pos] == CARRIAGE_RETURN) {
return cnt;
}
}
return len;
} | class class_name[name] begin[{]
method[countNonNewline, return_type[type[int]], modifier[private], parameter[cbuf, off, len]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=off, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=cnt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), name=pos)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cbuf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=UNIX_NEWLINE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=cnt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cbuf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=CARRIAGE_RETURN, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=cnt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=cnt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, 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=cnt)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=cnt, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.len]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[countNonNewline] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[cbuf] , Keyword[int] identifier[off] , Keyword[int] identifier[len] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[cnt] operator[=] Other[0] operator[SEP] identifier[cnt] operator[<] identifier[len] operator[SEP] identifier[cnt] operator[++] operator[SEP] {
Keyword[final] Keyword[int] identifier[pos] operator[=] identifier[off] operator[+] identifier[cnt] operator[SEP] Keyword[if] operator[SEP] identifier[cbuf] operator[SEP] identifier[pos] operator[SEP] operator[==] identifier[UNIX_NEWLINE] operator[SEP] {
Keyword[return] identifier[cnt] operator[SEP]
}
Keyword[if] operator[SEP] identifier[cbuf] operator[SEP] identifier[pos] operator[SEP] operator[==] identifier[CARRIAGE_RETURN] operator[SEP] {
Keyword[return] identifier[cnt] operator[SEP]
}
}
Keyword[return] identifier[len] operator[SEP]
}
|
public void marshall(UpdateAdmChannelRequest updateAdmChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (updateAdmChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateAdmChannelRequest.getADMChannelRequest(), ADMCHANNELREQUEST_BINDING);
protocolMarshaller.marshall(updateAdmChannelRequest.getApplicationId(), APPLICATIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[updateAdmChannelRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.updateAdmChannelRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getADMChannelRequest, postfix_operators=[], prefix_operators=[], qualifier=updateAdmChannelRequest, selectors=[], type_arguments=None), MemberReference(member=ADMCHANNELREQUEST_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getApplicationId, postfix_operators=[], prefix_operators=[], qualifier=updateAdmChannelRequest, selectors=[], type_arguments=None), MemberReference(member=APPLICATIONID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[UpdateAdmChannelRequest] identifier[updateAdmChannelRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[updateAdmChannelRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[updateAdmChannelRequest] operator[SEP] identifier[getADMChannelRequest] operator[SEP] operator[SEP] , identifier[ADMCHANNELREQUEST_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[updateAdmChannelRequest] operator[SEP] identifier[getApplicationId] operator[SEP] operator[SEP] , identifier[APPLICATIONID_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public int changeDirectory(String strPath) throws IOException
{
int iLastSlash = strPath.lastIndexOf('/');
if (iLastSlash != -1)
strPath = strPath.substring(0, iLastSlash);
else
strPath = "";
String strFTPPath = "";
if (m_strRootFTPDirectory.length() > 0)
{
if (!strFTPPath.startsWith(File.separator))
strFTPPath = File.separator + m_strRootFTPDirectory;
if (strPath.length() > 0)
if (!strFTPPath.endsWith(File.separator))
strFTPPath += File.separator;
}
strFTPPath += strPath;
if (strFTPPath.equals(m_strLastPath))
return FTPReply.COMMAND_OK; // Already in the current directory.
if (DEBUG)
System.out.println("Change working directory to: " + strFTPPath);
int iError = FTPReply.COMMAND_OK;
if (!m_client.changeWorkingDirectory(strFTPPath))
{
if (!m_client.makeDirectory(strFTPPath))
iError = FTPReply.FILE_ACTION_NOT_TAKEN;
else if (!m_client.changeWorkingDirectory(strFTPPath))
iError = FTPReply.FILE_ACTION_NOT_TAKEN;
}
m_strLastPath = strFTPPath;
return iError;
} | class class_name[name] begin[{]
method[changeDirectory, return_type[type[int]], modifier[public], parameter[strPath]] begin[{]
local_variable[type[int], iLastSlash]
if[binary_operation[member[.iLastSlash], !=, literal[1]]] begin[{]
assign[member[.strPath], call[strPath.substring, parameter[literal[0], member[.iLastSlash]]]]
else begin[{]
assign[member[.strPath], literal[""]]
end[}]
local_variable[type[String], strFTPPath]
if[binary_operation[call[m_strRootFTPDirectory.length, parameter[]], >, literal[0]]] begin[{]
if[call[strFTPPath.startsWith, parameter[member[File.separator]]]] begin[{]
assign[member[.strFTPPath], binary_operation[member[File.separator], +, member[.m_strRootFTPDirectory]]]
else begin[{]
None
end[}]
if[binary_operation[call[strPath.length, parameter[]], >, literal[0]]] begin[{]
if[call[strFTPPath.endsWith, parameter[member[File.separator]]]] begin[{]
assign[member[.strFTPPath], member[File.separator]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.strFTPPath], member[.strPath]]
if[call[strFTPPath.equals, parameter[member[.m_strLastPath]]]] begin[{]
return[member[FTPReply.COMMAND_OK]]
else begin[{]
None
end[}]
if[member[.DEBUG]] begin[{]
call[System.out.println, parameter[binary_operation[literal["Change working directory to: "], +, member[.strFTPPath]]]]
else begin[{]
None
end[}]
local_variable[type[int], iError]
if[call[m_client.changeWorkingDirectory, parameter[member[.strFTPPath]]]] begin[{]
if[call[m_client.makeDirectory, parameter[member[.strFTPPath]]]] begin[{]
assign[member[.iError], member[FTPReply.FILE_ACTION_NOT_TAKEN]]
else begin[{]
if[call[m_client.changeWorkingDirectory, parameter[member[.strFTPPath]]]] begin[{]
assign[member[.iError], member[FTPReply.FILE_ACTION_NOT_TAKEN]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
assign[member[.m_strLastPath], member[.strFTPPath]]
return[member[.iError]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[changeDirectory] operator[SEP] identifier[String] identifier[strPath] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[iLastSlash] operator[=] identifier[strPath] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iLastSlash] operator[!=] operator[-] Other[1] operator[SEP] identifier[strPath] operator[=] identifier[strPath] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[iLastSlash] operator[SEP] operator[SEP] Keyword[else] identifier[strPath] operator[=] literal[String] operator[SEP] identifier[String] identifier[strFTPPath] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[m_strRootFTPDirectory] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[strFTPPath] operator[SEP] identifier[startsWith] operator[SEP] identifier[File] operator[SEP] identifier[separator] operator[SEP] operator[SEP] identifier[strFTPPath] operator[=] identifier[File] operator[SEP] identifier[separator] operator[+] identifier[m_strRootFTPDirectory] operator[SEP] Keyword[if] operator[SEP] identifier[strPath] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[strFTPPath] operator[SEP] identifier[endsWith] operator[SEP] identifier[File] operator[SEP] identifier[separator] operator[SEP] operator[SEP] identifier[strFTPPath] operator[+=] identifier[File] operator[SEP] identifier[separator] operator[SEP]
}
identifier[strFTPPath] operator[+=] identifier[strPath] operator[SEP] Keyword[if] operator[SEP] identifier[strFTPPath] operator[SEP] identifier[equals] operator[SEP] identifier[m_strLastPath] operator[SEP] operator[SEP] Keyword[return] identifier[FTPReply] operator[SEP] identifier[COMMAND_OK] operator[SEP] Keyword[if] operator[SEP] identifier[DEBUG] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[strFTPPath] operator[SEP] operator[SEP] Keyword[int] identifier[iError] operator[=] identifier[FTPReply] operator[SEP] identifier[COMMAND_OK] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[m_client] operator[SEP] identifier[changeWorkingDirectory] operator[SEP] identifier[strFTPPath] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[m_client] operator[SEP] identifier[makeDirectory] operator[SEP] identifier[strFTPPath] operator[SEP] operator[SEP] identifier[iError] operator[=] identifier[FTPReply] operator[SEP] identifier[FILE_ACTION_NOT_TAKEN] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[m_client] operator[SEP] identifier[changeWorkingDirectory] operator[SEP] identifier[strFTPPath] operator[SEP] operator[SEP] identifier[iError] operator[=] identifier[FTPReply] operator[SEP] identifier[FILE_ACTION_NOT_TAKEN] operator[SEP]
}
identifier[m_strLastPath] operator[=] identifier[strFTPPath] operator[SEP] Keyword[return] identifier[iError] operator[SEP]
}
|
private static Process openURLinWindowsOS(final String url) throws IOException
{
String cmd = null;
cmd = WINDOWS_PATH + " " + WINDOWS_FLAG + " ";
return Runtime.getRuntime().exec(cmd + url);
} | class class_name[name] begin[{]
method[openURLinWindowsOS, return_type[type[Process]], modifier[private static], parameter[url]] begin[{]
local_variable[type[String], cmd]
assign[member[.cmd], binary_operation[binary_operation[binary_operation[member[.WINDOWS_PATH], +, literal[" "]], +, member[.WINDOWS_FLAG]], +, literal[" "]]]
return[call[Runtime.getRuntime, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Process] identifier[openURLinWindowsOS] operator[SEP] Keyword[final] identifier[String] identifier[url] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[cmd] operator[=] Other[null] operator[SEP] identifier[cmd] operator[=] identifier[WINDOWS_PATH] operator[+] literal[String] operator[+] identifier[WINDOWS_FLAG] operator[+] literal[String] operator[SEP] Keyword[return] identifier[Runtime] operator[SEP] identifier[getRuntime] operator[SEP] operator[SEP] operator[SEP] identifier[exec] operator[SEP] identifier[cmd] operator[+] identifier[url] operator[SEP] operator[SEP]
}
|
public void setCognitoIdentityProviders(java.util.Collection<CognitoIdentityProvider> cognitoIdentityProviders) {
if (cognitoIdentityProviders == null) {
this.cognitoIdentityProviders = null;
return;
}
this.cognitoIdentityProviders = new java.util.ArrayList<CognitoIdentityProvider>(cognitoIdentityProviders);
} | class class_name[name] begin[{]
method[setCognitoIdentityProviders, return_type[void], modifier[public], parameter[cognitoIdentityProviders]] begin[{]
if[binary_operation[member[.cognitoIdentityProviders], ==, literal[null]]] begin[{]
assign[THIS[member[None.cognitoIdentityProviders]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.cognitoIdentityProviders]], ClassCreator(arguments=[MemberReference(member=cognitoIdentityProviders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CognitoIdentityProvider, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setCognitoIdentityProviders] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[CognitoIdentityProvider] operator[>] identifier[cognitoIdentityProviders] operator[SEP] {
Keyword[if] operator[SEP] identifier[cognitoIdentityProviders] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[cognitoIdentityProviders] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[cognitoIdentityProviders] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[CognitoIdentityProvider] operator[>] operator[SEP] identifier[cognitoIdentityProviders] operator[SEP] operator[SEP]
}
|
public static void appendBitStrings(BitVector bv, String[] bs){
for(String s : bs){
if(s.length() != 8) throw new RuntimeException(
"The length of bit string must be 8 while " + s.length());
for(char c : s.toCharArray()){
if(c == '0') bv.append0();
else if(c == '1') bv.append1();
else throw new RuntimeException("invalid char '" + c + "' for bit string.");
}
}
} | class class_name[name] begin[{]
method[appendBitStrings, return_type[void], modifier[public static], parameter[bv, bs]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=!=), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The length of bit string must be 8 while "), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, 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=RuntimeException, sub_type=None)), label=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='1'), operator===), else_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid char '"), operandr=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' for bit string."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=append1, postfix_operators=[], prefix_operators=[], qualifier=bv, selectors=[], type_arguments=None), label=None)), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=append0, postfix_operators=[], prefix_operators=[], qualifier=bv, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=bs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[appendBitStrings] operator[SEP] identifier[BitVector] identifier[bv] , identifier[String] operator[SEP] operator[SEP] identifier[bs] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[s] operator[:] identifier[bs] operator[SEP] {
Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[8] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[char] identifier[c] operator[:] identifier[s] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] identifier[bv] operator[SEP] identifier[append0] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] identifier[bv] operator[SEP] identifier[append1] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[c] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
|
public static GroupTemplate createFileGroupTemplate(String dir, Charset charset) {
return createGroupTemplate(new FileResourceLoader(dir, charset.name()));
} | class class_name[name] begin[{]
method[createFileGroupTemplate, return_type[type[GroupTemplate]], modifier[public static], parameter[dir, charset]] begin[{]
return[call[.createGroupTemplate, parameter[ClassCreator(arguments=[MemberReference(member=dir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=charset, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileResourceLoader, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[GroupTemplate] identifier[createFileGroupTemplate] operator[SEP] identifier[String] identifier[dir] , identifier[Charset] identifier[charset] operator[SEP] {
Keyword[return] identifier[createGroupTemplate] operator[SEP] Keyword[new] identifier[FileResourceLoader] operator[SEP] identifier[dir] , identifier[charset] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void setValue(int attributeIndex, double d) {
int index = locateIndex(attributeIndex);
if (index(index) == attributeIndex) {
this.attributeValues[index] = d;
} else {
// We need to add the value
}
} | class class_name[name] begin[{]
method[setValue, return_type[void], modifier[public], parameter[attributeIndex, d]] begin[{]
local_variable[type[int], index]
if[binary_operation[call[.index, parameter[member[.index]]], ==, member[.attributeIndex]]] begin[{]
assign[THIS[member[None.attributeValues]ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], member[.d]]
else begin[{]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setValue] operator[SEP] Keyword[int] identifier[attributeIndex] , Keyword[double] identifier[d] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[locateIndex] operator[SEP] identifier[attributeIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[SEP] identifier[index] operator[SEP] operator[==] identifier[attributeIndex] operator[SEP] {
Keyword[this] operator[SEP] identifier[attributeValues] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[d] operator[SEP]
}
Keyword[else] {
}
}
|
public int getMaximumParallelism() {
int maxParallelism = -1;
for (JobVertex vertex : taskVertices.values()) {
maxParallelism = Math.max(vertex.getParallelism(), maxParallelism);
}
return maxParallelism;
} | class class_name[name] begin[{]
method[getMaximumParallelism, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[int], maxParallelism]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxParallelism, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParallelism, postfix_operators=[], prefix_operators=[], qualifier=vertex, selectors=[], type_arguments=None), MemberReference(member=maxParallelism, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=max, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=taskVertices, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=vertex)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JobVertex, sub_type=None))), label=None)
return[member[.maxParallelism]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getMaximumParallelism] operator[SEP] operator[SEP] {
Keyword[int] identifier[maxParallelism] operator[=] operator[-] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[JobVertex] identifier[vertex] operator[:] identifier[taskVertices] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[maxParallelism] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[vertex] operator[SEP] identifier[getParallelism] operator[SEP] operator[SEP] , identifier[maxParallelism] operator[SEP] operator[SEP]
}
Keyword[return] identifier[maxParallelism] operator[SEP]
}
|
public static HttpResponseInfo getHttpResponseInfo(HttpRequest httpRequest, HttpHeaders resHeaders, ProxyConfig proxyConfig, NioEventLoopGroup loopGroup)
throws Exception {
HttpResponse httpResponse = null;
if (resHeaders == null) {
httpResponse = getResponse(httpRequest, proxyConfig, loopGroup);
//处理重定向
if ((httpResponse.status().code() + "").indexOf("30") == 0) {
//TODO 302重定向乱码 https://link.gimhoy.com/googledrive/aHR0cHM6Ly9kcml2ZS5nb29nbGUuY29tL29wZW4/aWQ9MThlVmNKeEhwaE40RUpGTUowSk10bWNXOVhCcWJhVE1k.jpg
String redirectUrl = httpResponse.headers().get(HttpHeaderNames.LOCATION);
HttpRequestInfo requestInfo = (HttpRequestInfo) httpRequest;
//重定向cookie设置
List<String> setCookies = httpResponse.headers().getAll(HttpHeaderNames.SET_COOKIE);
if (setCookies != null && setCookies.size() > 0) {
StringBuilder requestCookie = new StringBuilder();
String oldRequestCookie = requestInfo.headers().get(HttpHeaderNames.COOKIE);
if (oldRequestCookie != null) {
requestCookie.append(oldRequestCookie);
}
String split = String.valueOf((char) HttpConstants.SEMICOLON) + String.valueOf(HttpConstants.SP_CHAR);
for (String setCookie : setCookies) {
String cookieNV = setCookie.split(split)[0];
if (requestCookie.length() > 0) {
requestCookie.append(split);
}
requestCookie.append(cookieNV);
}
requestInfo.headers().set(HttpHeaderNames.COOKIE, requestCookie.toString());
}
requestInfo.headers().remove(HttpHeaderNames.HOST);
requestInfo.setUri(redirectUrl);
RequestProto requestProto = ProtoUtil.getRequestProto(requestInfo);
requestInfo.headers().set(HttpHeaderNames.HOST, requestProto.getHost());
requestInfo.setRequestProto(requestProto);
return getHttpResponseInfo(httpRequest, null, proxyConfig, loopGroup);
}
}
if (httpResponse == null) {
httpResponse = getResponse(httpRequest, proxyConfig, loopGroup);
}
if (httpResponse.status().code() != HttpResponseStatus.OK.code()
&& httpResponse.status().code() != HttpResponseStatus.PARTIAL_CONTENT.code()) {
throw new BootstrapResolveException("Status code exception:" + httpResponse.status().code());
}
return parseResponse(httpRequest, httpResponse);
} | class class_name[name] begin[{]
method[getHttpResponseInfo, return_type[type[HttpResponseInfo]], modifier[public static], parameter[httpRequest, resHeaders, proxyConfig, loopGroup]] begin[{]
local_variable[type[HttpResponse], httpResponse]
if[binary_operation[member[.resHeaders], ==, literal[null]]] begin[{]
assign[member[.httpResponse], call[.getResponse, parameter[member[.httpRequest], member[.proxyConfig], member[.loopGroup]]]]
if[binary_operation[binary_operation[call[httpResponse.status, parameter[]], +, literal[""]], ==, literal[0]]] begin[{]
local_variable[type[String], redirectUrl]
local_variable[type[HttpRequestInfo], requestInfo]
local_variable[type[List], setCookies]
if[binary_operation[binary_operation[member[.setCookies], !=, literal[null]], &&, binary_operation[call[setCookies.size, parameter[]], >, literal[0]]]] begin[{]
local_variable[type[StringBuilder], requestCookie]
local_variable[type[String], oldRequestCookie]
if[binary_operation[member[.oldRequestCookie], !=, literal[null]]] begin[{]
call[requestCookie.append, parameter[member[.oldRequestCookie]]]
else begin[{]
None
end[}]
local_variable[type[String], split]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=split, postfix_operators=[], prefix_operators=[], qualifier=setCookie, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], type_arguments=None), name=cookieNV)], 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=requestCookie, 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=[MemberReference(member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=requestCookie, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cookieNV, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=requestCookie, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=setCookies, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=setCookie)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[requestInfo.headers, parameter[]]
else begin[{]
None
end[}]
call[requestInfo.headers, parameter[]]
call[requestInfo.setUri, parameter[member[.redirectUrl]]]
local_variable[type[RequestProto], requestProto]
call[requestInfo.headers, parameter[]]
call[requestInfo.setRequestProto, parameter[member[.requestProto]]]
return[call[.getHttpResponseInfo, parameter[member[.httpRequest], literal[null], member[.proxyConfig], member[.loopGroup]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.httpResponse], ==, literal[null]]] begin[{]
assign[member[.httpResponse], call[.getResponse, parameter[member[.httpRequest], member[.proxyConfig], member[.loopGroup]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[httpResponse.status, parameter[]], !=, call[HttpResponseStatus.OK.code, parameter[]]], &&, binary_operation[call[httpResponse.status, parameter[]], !=, call[HttpResponseStatus.PARTIAL_CONTENT.code, parameter[]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Status code exception:"), operandr=MethodInvocation(arguments=[], member=status, postfix_operators=[], prefix_operators=[], qualifier=httpResponse, selectors=[MethodInvocation(arguments=[], member=code, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BootstrapResolveException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.parseResponse, parameter[member[.httpRequest], member[.httpResponse]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[HttpResponseInfo] identifier[getHttpResponseInfo] operator[SEP] identifier[HttpRequest] identifier[httpRequest] , identifier[HttpHeaders] identifier[resHeaders] , identifier[ProxyConfig] identifier[proxyConfig] , identifier[NioEventLoopGroup] identifier[loopGroup] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[HttpResponse] identifier[httpResponse] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[resHeaders] operator[==] Other[null] operator[SEP] {
identifier[httpResponse] operator[=] identifier[getResponse] operator[SEP] identifier[httpRequest] , identifier[proxyConfig] , identifier[loopGroup] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[httpResponse] operator[SEP] identifier[status] operator[SEP] operator[SEP] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[String] identifier[redirectUrl] operator[=] identifier[httpResponse] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[LOCATION] operator[SEP] operator[SEP] identifier[HttpRequestInfo] identifier[requestInfo] operator[=] operator[SEP] identifier[HttpRequestInfo] operator[SEP] identifier[httpRequest] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[setCookies] operator[=] identifier[httpResponse] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[getAll] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[SET_COOKIE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[setCookies] operator[!=] Other[null] operator[&&] identifier[setCookies] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[StringBuilder] identifier[requestCookie] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[oldRequestCookie] operator[=] identifier[requestInfo] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[COOKIE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[oldRequestCookie] operator[!=] Other[null] operator[SEP] {
identifier[requestCookie] operator[SEP] identifier[append] operator[SEP] identifier[oldRequestCookie] operator[SEP] operator[SEP]
}
identifier[String] identifier[split] operator[=] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[HttpConstants] operator[SEP] identifier[SEMICOLON] operator[SEP] operator[+] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[HttpConstants] operator[SEP] identifier[SP_CHAR] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[setCookie] operator[:] identifier[setCookies] operator[SEP] {
identifier[String] identifier[cookieNV] operator[=] identifier[setCookie] operator[SEP] identifier[split] operator[SEP] identifier[split] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[requestCookie] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[requestCookie] operator[SEP] identifier[append] operator[SEP] identifier[split] operator[SEP] operator[SEP]
}
identifier[requestCookie] operator[SEP] identifier[append] operator[SEP] identifier[cookieNV] operator[SEP] operator[SEP]
}
identifier[requestInfo] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[COOKIE] , identifier[requestCookie] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[requestInfo] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[HOST] operator[SEP] operator[SEP] identifier[requestInfo] operator[SEP] identifier[setUri] operator[SEP] identifier[redirectUrl] operator[SEP] operator[SEP] identifier[RequestProto] identifier[requestProto] operator[=] identifier[ProtoUtil] operator[SEP] identifier[getRequestProto] operator[SEP] identifier[requestInfo] operator[SEP] operator[SEP] identifier[requestInfo] operator[SEP] identifier[headers] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[HttpHeaderNames] operator[SEP] identifier[HOST] , identifier[requestProto] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[requestInfo] operator[SEP] identifier[setRequestProto] operator[SEP] identifier[requestProto] operator[SEP] operator[SEP] Keyword[return] identifier[getHttpResponseInfo] operator[SEP] identifier[httpRequest] , Other[null] , identifier[proxyConfig] , identifier[loopGroup] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[httpResponse] operator[==] Other[null] operator[SEP] {
identifier[httpResponse] operator[=] identifier[getResponse] operator[SEP] identifier[httpRequest] , identifier[proxyConfig] , identifier[loopGroup] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[httpResponse] operator[SEP] identifier[status] operator[SEP] operator[SEP] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[!=] identifier[HttpResponseStatus] operator[SEP] identifier[OK] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[&&] identifier[httpResponse] operator[SEP] identifier[status] operator[SEP] operator[SEP] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[!=] identifier[HttpResponseStatus] operator[SEP] identifier[PARTIAL_CONTENT] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BootstrapResolveException] operator[SEP] literal[String] operator[+] identifier[httpResponse] operator[SEP] identifier[status] operator[SEP] operator[SEP] operator[SEP] identifier[code] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[parseResponse] operator[SEP] identifier[httpRequest] , identifier[httpResponse] operator[SEP] operator[SEP]
}
|
public static boolean checkSubtract(INDArray first, INDArray second, double maxRelativeDifference,
double minAbsDifference) {
RealMatrix rmFirst = convertToApacheMatrix(first);
RealMatrix rmSecond = convertToApacheMatrix(second);
INDArray result = first.sub(second);
RealMatrix rmResult = rmFirst.subtract(rmSecond);
if (!checkShape(rmResult, result))
return false;
boolean ok = checkEntries(rmResult, result, maxRelativeDifference, minAbsDifference);
if (!ok) {
INDArray onCopies = Shape.toOffsetZeroCopy(first).sub(Shape.toOffsetZeroCopy(second));
printFailureDetails(first, second, rmResult, result, onCopies, "sub");
}
return ok;
} | class class_name[name] begin[{]
method[checkSubtract, return_type[type[boolean]], modifier[public static], parameter[first, second, maxRelativeDifference, minAbsDifference]] begin[{]
local_variable[type[RealMatrix], rmFirst]
local_variable[type[RealMatrix], rmSecond]
local_variable[type[INDArray], result]
local_variable[type[RealMatrix], rmResult]
if[call[.checkShape, parameter[member[.rmResult], member[.result]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[boolean], ok]
if[member[.ok]] begin[{]
local_variable[type[INDArray], onCopies]
call[.printFailureDetails, parameter[member[.first], member[.second], member[.rmResult], member[.result], member[.onCopies], literal["sub"]]]
else begin[{]
None
end[}]
return[member[.ok]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[checkSubtract] operator[SEP] identifier[INDArray] identifier[first] , identifier[INDArray] identifier[second] , Keyword[double] identifier[maxRelativeDifference] , Keyword[double] identifier[minAbsDifference] operator[SEP] {
identifier[RealMatrix] identifier[rmFirst] operator[=] identifier[convertToApacheMatrix] operator[SEP] identifier[first] operator[SEP] operator[SEP] identifier[RealMatrix] identifier[rmSecond] operator[=] identifier[convertToApacheMatrix] operator[SEP] identifier[second] operator[SEP] operator[SEP] identifier[INDArray] identifier[result] operator[=] identifier[first] operator[SEP] identifier[sub] operator[SEP] identifier[second] operator[SEP] operator[SEP] identifier[RealMatrix] identifier[rmResult] operator[=] identifier[rmFirst] operator[SEP] identifier[subtract] operator[SEP] identifier[rmSecond] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[checkShape] operator[SEP] identifier[rmResult] , identifier[result] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[boolean] identifier[ok] operator[=] identifier[checkEntries] operator[SEP] identifier[rmResult] , identifier[result] , identifier[maxRelativeDifference] , identifier[minAbsDifference] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[ok] operator[SEP] {
identifier[INDArray] identifier[onCopies] operator[=] identifier[Shape] operator[SEP] identifier[toOffsetZeroCopy] operator[SEP] identifier[first] operator[SEP] operator[SEP] identifier[sub] operator[SEP] identifier[Shape] operator[SEP] identifier[toOffsetZeroCopy] operator[SEP] identifier[second] operator[SEP] operator[SEP] operator[SEP] identifier[printFailureDetails] operator[SEP] identifier[first] , identifier[second] , identifier[rmResult] , identifier[result] , identifier[onCopies] , literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ok] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public void initializeSerializers() {
this.numChannels = this.outputGate.getNumChannels();
this.serializers = new RecordSerializer[numChannels];
for (int i = 0; i < this.numChannels; i++) {
this.serializers[i] = new SpanningRecordSerializer<T>();
}
} | class class_name[name] begin[{]
method[initializeSerializers, return_type[void], modifier[public], parameter[]] begin[{]
assign[THIS[member[None.numChannels]], THIS[member[None.outputGate]call[None.getNumChannels, parameter[]]]]
assign[THIS[member[None.serializers]], ArrayCreator(dimensions=[MemberReference(member=numChannels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RecordSerializer, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=serializers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=SpanningRecordSerializer, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=numChannels, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[initializeSerializers] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[numChannels] operator[=] Keyword[this] operator[SEP] identifier[outputGate] operator[SEP] identifier[getNumChannels] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[serializers] operator[=] Keyword[new] identifier[RecordSerializer] operator[SEP] identifier[numChannels] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Keyword[this] operator[SEP] identifier[numChannels] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[this] operator[SEP] identifier[serializers] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[SpanningRecordSerializer] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static Header of(String name, String value) {
return new Header(requireNonNull(name), requireNonNull(value));
} | class class_name[name] begin[{]
method[of, return_type[type[Header]], modifier[public static], parameter[name, value]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=requireNonNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=requireNonNull, 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=Header, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Header] identifier[of] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[Header] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[name] operator[SEP] , identifier[requireNonNull] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public String encode(long... numbers){
String retval = "";
if(numbers.length == 0) {
return retval;
}
return this._encode(numbers);
} | class class_name[name] begin[{]
method[encode, return_type[type[String]], modifier[public], parameter[numbers]] begin[{]
local_variable[type[String], retval]
if[binary_operation[member[numbers.length], ==, literal[0]]] begin[{]
return[member[.retval]]
else begin[{]
None
end[}]
return[THIS[call[None._encode, parameter[member[.numbers]]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[encode] operator[SEP] Keyword[long] operator[...] identifier[numbers] operator[SEP] {
identifier[String] identifier[retval] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[numbers] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[retval] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[_encode] operator[SEP] identifier[numbers] operator[SEP] operator[SEP]
}
|
public static boolean isStringSet(PrefsProperty property) {
boolean isStringSet = false;
TypeName typeName;
if (property.hasTypeAdapter()) {
typeName = TypeUtility.typeName(property.typeAdapter.dataType);
} else {
typeName = TypeUtility.typeName(property.getElement().asType());
}
// it is parameterized type name for sure
if (typeName instanceof ParameterizedTypeName && TypeUtility.isSet(typeName)) {
ParameterizedTypeName parameterizedTypeName = (ParameterizedTypeName) typeName;
if (TypeUtility.isEquals(parameterizedTypeName.typeArguments.get(0), String.class.getCanonicalName())) {
isStringSet = true;
}
}
return isStringSet;
} | class class_name[name] begin[{]
method[isStringSet, return_type[type[boolean]], modifier[public static], parameter[property]] begin[{]
local_variable[type[boolean], isStringSet]
local_variable[type[TypeName], typeName]
if[call[property.hasTypeAdapter, parameter[]]] begin[{]
assign[member[.typeName], call[TypeUtility.typeName, parameter[member[property.typeAdapter.dataType]]]]
else begin[{]
assign[member[.typeName], call[TypeUtility.typeName, parameter[call[property.getElement, parameter[]]]]]
end[}]
if[binary_operation[binary_operation[member[.typeName], instanceof, type[ParameterizedTypeName]], &&, call[TypeUtility.isSet, parameter[member[.typeName]]]]] begin[{]
local_variable[type[ParameterizedTypeName], parameterizedTypeName]
if[call[TypeUtility.isEquals, parameter[call[parameterizedTypeName.typeArguments.get, parameter[literal[0]]], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getCanonicalName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]] begin[{]
assign[member[.isStringSet], literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.isStringSet]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isStringSet] operator[SEP] identifier[PrefsProperty] identifier[property] operator[SEP] {
Keyword[boolean] identifier[isStringSet] operator[=] literal[boolean] operator[SEP] identifier[TypeName] identifier[typeName] operator[SEP] Keyword[if] operator[SEP] identifier[property] operator[SEP] identifier[hasTypeAdapter] operator[SEP] operator[SEP] operator[SEP] {
identifier[typeName] operator[=] identifier[TypeUtility] operator[SEP] identifier[typeName] operator[SEP] identifier[property] operator[SEP] identifier[typeAdapter] operator[SEP] identifier[dataType] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[typeName] operator[=] identifier[TypeUtility] operator[SEP] identifier[typeName] operator[SEP] identifier[property] operator[SEP] identifier[getElement] operator[SEP] operator[SEP] operator[SEP] identifier[asType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[typeName] Keyword[instanceof] identifier[ParameterizedTypeName] operator[&&] identifier[TypeUtility] operator[SEP] identifier[isSet] operator[SEP] identifier[typeName] operator[SEP] operator[SEP] {
identifier[ParameterizedTypeName] identifier[parameterizedTypeName] operator[=] operator[SEP] identifier[ParameterizedTypeName] operator[SEP] identifier[typeName] operator[SEP] Keyword[if] operator[SEP] identifier[TypeUtility] operator[SEP] identifier[isEquals] operator[SEP] identifier[parameterizedTypeName] operator[SEP] identifier[typeArguments] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] , identifier[String] operator[SEP] Keyword[class] operator[SEP] identifier[getCanonicalName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[isStringSet] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[return] identifier[isStringSet] operator[SEP]
}
|
public static ApacheHttpTransport createApacheHttpTransport(
@Nullable URI proxyUri, @Nullable Credentials proxyCredentials)
throws IOException, GeneralSecurityException {
checkArgument(
proxyUri != null || proxyCredentials == null,
"if proxyUri is null than proxyCredentials should be null too");
ApacheHttpTransport transport =
new ApacheHttpTransport.Builder()
.trustCertificates(GoogleUtils.getCertificateTrustStore())
.setProxy(
proxyUri == null ? null : new HttpHost(proxyUri.getHost(), proxyUri.getPort()))
.build();
if (proxyCredentials != null) {
((DefaultHttpClient) transport.getHttpClient())
.getCredentialsProvider()
.setCredentials(new AuthScope(proxyUri.getHost(), proxyUri.getPort()), proxyCredentials);
}
return transport;
} | class class_name[name] begin[{]
method[createApacheHttpTransport, return_type[type[ApacheHttpTransport]], modifier[public static], parameter[proxyUri, proxyCredentials]] begin[{]
call[.checkArgument, parameter[binary_operation[binary_operation[member[.proxyUri], !=, literal[null]], ||, binary_operation[member[.proxyCredentials], ==, literal[null]]], literal["if proxyUri is null than proxyCredentials should be null too"]]]
local_variable[type[ApacheHttpTransport], transport]
if[binary_operation[member[.proxyCredentials], !=, literal[null]]] begin[{]
Cast(expression=MethodInvocation(arguments=[], member=getHttpClient, postfix_operators=[], prefix_operators=[], qualifier=transport, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=DefaultHttpClient, sub_type=None))
else begin[{]
None
end[}]
return[member[.transport]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ApacheHttpTransport] identifier[createApacheHttpTransport] operator[SEP] annotation[@] identifier[Nullable] identifier[URI] identifier[proxyUri] , annotation[@] identifier[Nullable] identifier[Credentials] identifier[proxyCredentials] operator[SEP] Keyword[throws] identifier[IOException] , identifier[GeneralSecurityException] {
identifier[checkArgument] operator[SEP] identifier[proxyUri] operator[!=] Other[null] operator[||] identifier[proxyCredentials] operator[==] Other[null] , literal[String] operator[SEP] operator[SEP] identifier[ApacheHttpTransport] identifier[transport] operator[=] Keyword[new] identifier[ApacheHttpTransport] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[trustCertificates] operator[SEP] identifier[GoogleUtils] operator[SEP] identifier[getCertificateTrustStore] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setProxy] operator[SEP] identifier[proxyUri] operator[==] Other[null] operator[?] Other[null] operator[:] Keyword[new] identifier[HttpHost] operator[SEP] identifier[proxyUri] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] , identifier[proxyUri] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[proxyCredentials] operator[!=] Other[null] operator[SEP] {
operator[SEP] operator[SEP] identifier[DefaultHttpClient] operator[SEP] identifier[transport] operator[SEP] identifier[getHttpClient] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getCredentialsProvider] operator[SEP] operator[SEP] operator[SEP] identifier[setCredentials] operator[SEP] Keyword[new] identifier[AuthScope] operator[SEP] identifier[proxyUri] operator[SEP] identifier[getHost] operator[SEP] operator[SEP] , identifier[proxyUri] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] , identifier[proxyCredentials] operator[SEP] operator[SEP]
}
Keyword[return] identifier[transport] operator[SEP]
}
|
public ServiceFuture<DscConfigurationInner> getAsync(String resourceGroupName, String automationAccountName, String configurationName, final ServiceCallback<DscConfigurationInner> serviceCallback) {
return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, automationAccountName, configurationName), serviceCallback);
} | class class_name[name] begin[{]
method[getAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, automationAccountName, configurationName, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.getWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.automationAccountName], member[.configurationName]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[DscConfigurationInner] operator[>] identifier[getAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[automationAccountName] , identifier[String] identifier[configurationName] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[DscConfigurationInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[getWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[automationAccountName] , identifier[configurationName] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
@Override
protected File writeFileContent( String fileContent ) throws IOException {
// Load the template
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream in = getClass().getResourceAsStream( "/html.tpl" );
Utils.copyStreamSafely( in, out );
// Create the target directory
File targetFile = new File( this.outputDirectory, "index.html" );
Utils.createDirectory( targetFile.getParentFile());
// Deal with the CSS file
final String css;
final String cssReference = this.options.get( DocConstants.OPTION_HTML_CSS_REFERENCE );
if( cssReference != null ) {
css = cssReference.trim();
} else {
css = "style.css";
writeCssFile();
}
// Write sections
for( Map.Entry<String,StringBuilder> entry : this.sectionNameToContent.entrySet()) {
int index = entry.getKey().lastIndexOf( '/' );
String title = entry.getKey().substring( index + 1 );
String toWrite = out.toString( "UTF-8" )
.replace( TITLE_MARKUP, title )
.replace( CONTENT_MARKUP, entry.getValue().toString())
.replace( MENU_MARKUP, this.menu )
.replace( "href=\"", "href=\"../" )
.replace( "src=\"", "src=\"../" )
.replaceAll( "\n{3,}", "\n\n" );
if( cssReference != null )
toWrite = toWrite.replace( "../" + CSS_MARKUP, css );
else
toWrite = toWrite.replace( CSS_MARKUP, css );
File sectionFile = new File( this.outputDirectory, entry.getKey() + ".html" );
Utils.createDirectory( sectionFile.getParentFile());
Utils.writeStringInto( toWrite, sectionFile );
}
// Write the main file
String toWrite = out.toString( "UTF-8" )
.replace( TITLE_MARKUP, this.applicationTemplate.getName())
.replace( CSS_MARKUP, css )
.replace( CONTENT_MARKUP, fileContent )
.replace( MENU_MARKUP, this.menu )
.replaceAll( "\n{3,}", "\n\n" );
Utils.writeStringInto( toWrite, targetFile );
// And the header image
String imagePath = this.options.get( DocConstants.OPTION_HTML_HEADER_IMAGE_FILE );
try {
File sourceFile = null;
if( imagePath != null )
sourceFile = new File( imagePath );
if( sourceFile != null && sourceFile.exists())
in = new FileInputStream( sourceFile );
else
in = getClass().getResourceAsStream( "/roboconf.jpg" );
File imgFile = new File( this.outputDirectory, "header.jpg" );
Utils.copyStream( in, imgFile );
} finally {
Utils.closeQuietly( in );
}
return targetFile;
} | class class_name[name] begin[{]
method[writeFileContent, return_type[type[File]], modifier[protected], parameter[fileContent]] begin[{]
local_variable[type[ByteArrayOutputStream], out]
local_variable[type[InputStream], in]
call[Utils.copyStreamSafely, parameter[member[.in], member[.out]]]
local_variable[type[File], targetFile]
call[Utils.createDirectory, parameter[call[targetFile.getParentFile, parameter[]]]]
local_variable[type[String], css]
local_variable[type[String], cssReference]
if[binary_operation[member[.cssReference], !=, literal[null]]] begin[{]
assign[member[.css], call[cssReference.trim, parameter[]]]
else begin[{]
assign[member[.css], literal["style.css"]]
call[.writeCssFile, parameter[]]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='/')], member=lastIndexOf, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=title)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=toString, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[MethodInvocation(arguments=[MemberReference(member=TITLE_MARKUP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=title, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CONTENT_MARKUP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=MENU_MARKUP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=menu, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="href=\""), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="href=\"../")], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="src=\""), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="src=\"../")], member=replace, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n{3,}"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n\n")], member=replaceAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=toWrite)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cssReference, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=toWrite, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=CSS_MARKUP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=css, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=replace, postfix_operators=[], prefix_operators=[], qualifier=toWrite, selectors=[], type_arguments=None)), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=toWrite, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="../"), operandr=MemberReference(member=CSS_MARKUP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=css, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=replace, postfix_operators=[], prefix_operators=[], qualifier=toWrite, selectors=[], type_arguments=None)), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=outputDirectory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), BinaryOperation(operandl=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".html"), operator=+)], 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=sectionFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParentFile, postfix_operators=[], prefix_operators=[], qualifier=sectionFile, selectors=[], type_arguments=None)], member=createDirectory, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=toWrite, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sectionFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeStringInto, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=sectionNameToContent, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=entrySet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
local_variable[type[String], toWrite]
call[Utils.writeStringInto, parameter[member[.toWrite], member[.targetFile]]]
local_variable[type[String], imagePath]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=sourceFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=imagePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=sourceFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=imagePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))), label=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=sourceFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=[], qualifier=sourceFile, selectors=[], type_arguments=None), operator=&&), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/roboconf.jpg")], member=getResourceAsStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=sourceFile, 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)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=outputDirectory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="header.jpg")], 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=imgFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=imgFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copyStream, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=closeQuietly, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[member[.targetFile]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[File] identifier[writeFileContent] operator[SEP] identifier[String] identifier[fileContent] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[ByteArrayOutputStream] identifier[out] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[InputStream] identifier[in] operator[=] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getResourceAsStream] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[copyStreamSafely] operator[SEP] identifier[in] , identifier[out] operator[SEP] operator[SEP] identifier[File] identifier[targetFile] operator[=] Keyword[new] identifier[File] operator[SEP] Keyword[this] operator[SEP] identifier[outputDirectory] , literal[String] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[createDirectory] operator[SEP] identifier[targetFile] operator[SEP] identifier[getParentFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[css] operator[SEP] Keyword[final] identifier[String] identifier[cssReference] operator[=] Keyword[this] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[DocConstants] operator[SEP] identifier[OPTION_HTML_CSS_REFERENCE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cssReference] operator[!=] Other[null] operator[SEP] {
identifier[css] operator[=] identifier[cssReference] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[css] operator[=] literal[String] operator[SEP] identifier[writeCssFile] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[StringBuilder] operator[>] identifier[entry] operator[:] Keyword[this] operator[SEP] identifier[sectionNameToContent] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[title] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[substring] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[SEP] identifier[String] identifier[toWrite] operator[=] identifier[out] operator[SEP] identifier[toString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[TITLE_MARKUP] , identifier[title] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[CONTENT_MARKUP] , identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[MENU_MARKUP] , Keyword[this] operator[SEP] identifier[menu] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cssReference] operator[!=] Other[null] operator[SEP] identifier[toWrite] operator[=] identifier[toWrite] operator[SEP] identifier[replace] operator[SEP] literal[String] operator[+] identifier[CSS_MARKUP] , identifier[css] operator[SEP] operator[SEP] Keyword[else] identifier[toWrite] operator[=] identifier[toWrite] operator[SEP] identifier[replace] operator[SEP] identifier[CSS_MARKUP] , identifier[css] operator[SEP] operator[SEP] identifier[File] identifier[sectionFile] operator[=] Keyword[new] identifier[File] operator[SEP] Keyword[this] operator[SEP] identifier[outputDirectory] , identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[createDirectory] operator[SEP] identifier[sectionFile] operator[SEP] identifier[getParentFile] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[writeStringInto] operator[SEP] identifier[toWrite] , identifier[sectionFile] operator[SEP] operator[SEP]
}
identifier[String] identifier[toWrite] operator[=] identifier[out] operator[SEP] identifier[toString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[TITLE_MARKUP] , Keyword[this] operator[SEP] identifier[applicationTemplate] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[CSS_MARKUP] , identifier[css] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[CONTENT_MARKUP] , identifier[fileContent] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[MENU_MARKUP] , Keyword[this] operator[SEP] identifier[menu] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[writeStringInto] operator[SEP] identifier[toWrite] , identifier[targetFile] operator[SEP] operator[SEP] identifier[String] identifier[imagePath] operator[=] Keyword[this] operator[SEP] identifier[options] operator[SEP] identifier[get] operator[SEP] identifier[DocConstants] operator[SEP] identifier[OPTION_HTML_HEADER_IMAGE_FILE] operator[SEP] operator[SEP] Keyword[try] {
identifier[File] identifier[sourceFile] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[imagePath] operator[!=] Other[null] operator[SEP] identifier[sourceFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[imagePath] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sourceFile] operator[!=] Other[null] operator[&&] identifier[sourceFile] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] identifier[in] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[sourceFile] operator[SEP] operator[SEP] Keyword[else] identifier[in] operator[=] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getResourceAsStream] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[File] identifier[imgFile] operator[=] Keyword[new] identifier[File] operator[SEP] Keyword[this] operator[SEP] identifier[outputDirectory] , literal[String] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[copyStream] operator[SEP] identifier[in] , identifier[imgFile] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[Utils] operator[SEP] identifier[closeQuietly] operator[SEP] identifier[in] operator[SEP] operator[SEP]
}
Keyword[return] identifier[targetFile] operator[SEP]
}
|
public static double elementMinAbs( DMatrix2x2 a ) {
double min = Math.abs(a.a11);
double tmp = Math.abs(a.a12); if( tmp < min ) min = tmp;
tmp = Math.abs(a.a21); if( tmp < min ) min = tmp;
tmp = Math.abs(a.a22); if( tmp < min ) min = tmp;
return min;
} | class class_name[name] begin[{]
method[elementMinAbs, return_type[type[double]], modifier[public static], parameter[a]] begin[{]
local_variable[type[double], min]
local_variable[type[double], tmp]
if[binary_operation[member[.tmp], <, member[.min]]] begin[{]
assign[member[.min], member[.tmp]]
else begin[{]
None
end[}]
assign[member[.tmp], call[Math.abs, parameter[member[a.a21]]]]
if[binary_operation[member[.tmp], <, member[.min]]] begin[{]
assign[member[.min], member[.tmp]]
else begin[{]
None
end[}]
assign[member[.tmp], call[Math.abs, parameter[member[a.a22]]]]
if[binary_operation[member[.tmp], <, member[.min]]] begin[{]
assign[member[.min], member[.tmp]]
else begin[{]
None
end[}]
return[member[.min]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[elementMinAbs] operator[SEP] identifier[DMatrix2x2] identifier[a] operator[SEP] {
Keyword[double] identifier[min] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[a] operator[SEP] identifier[a11] operator[SEP] operator[SEP] Keyword[double] identifier[tmp] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[a] operator[SEP] identifier[a12] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tmp] operator[<] identifier[min] operator[SEP] identifier[min] operator[=] identifier[tmp] operator[SEP] identifier[tmp] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[a] operator[SEP] identifier[a21] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tmp] operator[<] identifier[min] operator[SEP] identifier[min] operator[=] identifier[tmp] operator[SEP] identifier[tmp] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[a] operator[SEP] identifier[a22] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tmp] operator[<] identifier[min] operator[SEP] identifier[min] operator[=] identifier[tmp] operator[SEP] Keyword[return] identifier[min] operator[SEP]
}
|
public void init(BaseField field, boolean bChangeDataOnRefresh)
{
super.init(field);
m_objOriginalData = null;
m_bAlwaysEnabled = false;
m_bChangeDataOnRefresh = bChangeDataOnRefresh;
this.setRespondsToMode(DBConstants.SCREEN_MOVE, false);
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[field, bChangeDataOnRefresh]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
assign[member[.m_objOriginalData], literal[null]]
assign[member[.m_bAlwaysEnabled], literal[false]]
assign[member[.m_bChangeDataOnRefresh], member[.bChangeDataOnRefresh]]
THIS[call[None.setRespondsToMode, parameter[member[DBConstants.SCREEN_MOVE], literal[false]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[init] operator[SEP] identifier[BaseField] identifier[field] , Keyword[boolean] identifier[bChangeDataOnRefresh] operator[SEP] {
Keyword[super] operator[SEP] identifier[init] operator[SEP] identifier[field] operator[SEP] operator[SEP] identifier[m_objOriginalData] operator[=] Other[null] operator[SEP] identifier[m_bAlwaysEnabled] operator[=] literal[boolean] operator[SEP] identifier[m_bChangeDataOnRefresh] operator[=] identifier[bChangeDataOnRefresh] operator[SEP] Keyword[this] operator[SEP] identifier[setRespondsToMode] operator[SEP] identifier[DBConstants] operator[SEP] identifier[SCREEN_MOVE] , literal[boolean] operator[SEP] operator[SEP]
}
|
public static String getClassPathElement(final URL anURL, final String encoding) throws IllegalArgumentException {
// Check sanity
Validate.notNull(anURL, "anURL");
final String protocol = anURL.getProtocol();
String toReturn = null;
if (FILE.supports(protocol)) {
final String originalPath = anURL.getPath();
try {
return URLDecoder.decode(anURL.getPath(), encoding);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException("Could not URLDecode path [" + originalPath
+ "] using encoding [" + encoding + "]", e);
}
} else if (JAR.supports(protocol)) {
toReturn = anURL.getPath();
} else if (HTTP.supports(protocol) || HTTPS.supports(protocol)) {
toReturn = anURL.toString();
} else if (BUNDLERESOURCE.supports(protocol)) { // e.g. when used in Eclipse/m2e
toReturn = anURL.toString();
} else {
throw new IllegalArgumentException("Unknown protocol [" + protocol + "]; could not handle URL ["
+ anURL + "]");
}
return toReturn;
} | class class_name[name] begin[{]
method[getClassPathElement, return_type[type[String]], modifier[public static], parameter[anURL, encoding]] begin[{]
call[Validate.notNull, parameter[member[.anURL], literal["anURL"]]]
local_variable[type[String], protocol]
local_variable[type[String], toReturn]
if[call[FILE.supports, parameter[member[.protocol]]]] begin[{]
local_variable[type[String], originalPath]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=anURL, selectors=[], type_arguments=None), MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not URLDecode path ["), operandr=MemberReference(member=originalPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] using encoding ["), operator=+), operandr=MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
else begin[{]
if[call[JAR.supports, parameter[member[.protocol]]]] begin[{]
assign[member[.toReturn], call[anURL.getPath, parameter[]]]
else begin[{]
if[binary_operation[call[HTTP.supports, parameter[member[.protocol]]], ||, call[HTTPS.supports, parameter[member[.protocol]]]]] begin[{]
assign[member[.toReturn], call[anURL.toString, parameter[]]]
else begin[{]
if[call[BUNDLERESOURCE.supports, parameter[member[.protocol]]]] begin[{]
assign[member[.toReturn], call[anURL.toString, parameter[]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown protocol ["), operandr=MemberReference(member=protocol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]; could not handle URL ["), operator=+), operandr=MemberReference(member=anURL, 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)
end[}]
end[}]
end[}]
end[}]
return[member[.toReturn]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getClassPathElement] operator[SEP] Keyword[final] identifier[URL] identifier[anURL] , Keyword[final] identifier[String] identifier[encoding] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[anURL] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[protocol] operator[=] identifier[anURL] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[toReturn] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[FILE] operator[SEP] identifier[supports] operator[SEP] identifier[protocol] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[originalPath] operator[=] identifier[anURL] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[anURL] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , identifier[encoding] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[originalPath] operator[+] literal[String] operator[+] identifier[encoding] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[JAR] operator[SEP] identifier[supports] operator[SEP] identifier[protocol] operator[SEP] operator[SEP] {
identifier[toReturn] operator[=] identifier[anURL] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[HTTP] operator[SEP] identifier[supports] operator[SEP] identifier[protocol] operator[SEP] operator[||] identifier[HTTPS] operator[SEP] identifier[supports] operator[SEP] identifier[protocol] operator[SEP] operator[SEP] {
identifier[toReturn] operator[=] identifier[anURL] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[BUNDLERESOURCE] operator[SEP] identifier[supports] operator[SEP] identifier[protocol] operator[SEP] operator[SEP] {
identifier[toReturn] operator[=] identifier[anURL] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[protocol] operator[+] literal[String] operator[+] identifier[anURL] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[toReturn] operator[SEP]
}
|
private void parseQueryAndVerify(final StorageUri completeUri, final StorageCredentials credentials)
throws StorageException {
Utility.assertNotNull("completeUri", completeUri);
if (!completeUri.isAbsolute()) {
throw new IllegalArgumentException(String.format(SR.RELATIVE_ADDRESS_NOT_PERMITTED, completeUri.toString()));
}
this.storageUri = PathUtility.stripURIQueryAndFragment(completeUri);
final StorageCredentialsSharedAccessSignature parsedCredentials =
SharedAccessSignatureHelper.parseQuery(completeUri);
if (credentials != null && parsedCredentials != null) {
throw new IllegalArgumentException(SR.MULTIPLE_CREDENTIALS_PROVIDED);
}
try {
final boolean usePathStyleUris = Utility.determinePathStyleFromUri(this.storageUri.getPrimaryUri());
this.queueServiceClient = new CloudQueueClient(PathUtility.getServiceClientBaseAddress(
this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials);
this.name = PathUtility.getContainerNameFromUri(storageUri.getPrimaryUri(), usePathStyleUris);
}
catch (final URISyntaxException e) {
throw Utility.generateNewUnexpectedStorageException(e);
}
} | class class_name[name] begin[{]
method[parseQueryAndVerify, return_type[void], modifier[private], parameter[completeUri, credentials]] begin[{]
call[Utility.assertNotNull, parameter[literal["completeUri"], member[.completeUri]]]
if[call[completeUri.isAbsolute, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=RELATIVE_ADDRESS_NOT_PERMITTED, postfix_operators=[], prefix_operators=[], qualifier=SR, selectors=[]), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=completeUri, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[THIS[member[None.storageUri]], call[PathUtility.stripURIQueryAndFragment, parameter[member[.completeUri]]]]
local_variable[type[StorageCredentialsSharedAccessSignature], parsedCredentials]
if[binary_operation[binary_operation[member[.credentials], !=, literal[null]], &&, binary_operation[member[.parsedCredentials], !=, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=MULTIPLE_CREDENTIALS_PROVIDED, postfix_operators=[], prefix_operators=[], qualifier=SR, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=storageUri, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=getPrimaryUri, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], member=determinePathStyleFromUri, postfix_operators=[], prefix_operators=[], qualifier=Utility, selectors=[], type_arguments=None), name=usePathStyleUris)], modifiers={'final'}, type=BasicType(dimensions=[], name=boolean)), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=queueServiceClient, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getStorageUri, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), MemberReference(member=usePathStyleUris, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getServiceClientBaseAddress, postfix_operators=[], prefix_operators=[], qualifier=PathUtility, selectors=[], type_arguments=None), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=credentials, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=parsedCredentials, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=credentials, 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=CloudQueueClient, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPrimaryUri, postfix_operators=[], prefix_operators=[], qualifier=storageUri, selectors=[], type_arguments=None), MemberReference(member=usePathStyleUris, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getContainerNameFromUri, postfix_operators=[], prefix_operators=[], qualifier=PathUtility, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=generateNewUnexpectedStorageException, postfix_operators=[], prefix_operators=[], qualifier=Utility, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[parseQueryAndVerify] operator[SEP] Keyword[final] identifier[StorageUri] identifier[completeUri] , Keyword[final] identifier[StorageCredentials] identifier[credentials] operator[SEP] Keyword[throws] identifier[StorageException] {
identifier[Utility] operator[SEP] identifier[assertNotNull] operator[SEP] literal[String] , identifier[completeUri] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[completeUri] operator[SEP] identifier[isAbsolute] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[SR] operator[SEP] identifier[RELATIVE_ADDRESS_NOT_PERMITTED] , identifier[completeUri] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[storageUri] operator[=] identifier[PathUtility] operator[SEP] identifier[stripURIQueryAndFragment] operator[SEP] identifier[completeUri] operator[SEP] operator[SEP] Keyword[final] identifier[StorageCredentialsSharedAccessSignature] identifier[parsedCredentials] operator[=] identifier[SharedAccessSignatureHelper] operator[SEP] identifier[parseQuery] operator[SEP] identifier[completeUri] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[credentials] operator[!=] Other[null] operator[&&] identifier[parsedCredentials] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[SR] operator[SEP] identifier[MULTIPLE_CREDENTIALS_PROVIDED] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[final] Keyword[boolean] identifier[usePathStyleUris] operator[=] identifier[Utility] operator[SEP] identifier[determinePathStyleFromUri] operator[SEP] Keyword[this] operator[SEP] identifier[storageUri] operator[SEP] identifier[getPrimaryUri] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[queueServiceClient] operator[=] Keyword[new] identifier[CloudQueueClient] operator[SEP] identifier[PathUtility] operator[SEP] identifier[getServiceClientBaseAddress] operator[SEP] Keyword[this] operator[SEP] identifier[getStorageUri] operator[SEP] operator[SEP] , identifier[usePathStyleUris] operator[SEP] , identifier[credentials] operator[!=] Other[null] operator[?] identifier[credentials] operator[:] identifier[parsedCredentials] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[name] operator[=] identifier[PathUtility] operator[SEP] identifier[getContainerNameFromUri] operator[SEP] identifier[storageUri] operator[SEP] identifier[getPrimaryUri] operator[SEP] operator[SEP] , identifier[usePathStyleUris] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[URISyntaxException] identifier[e] operator[SEP] {
Keyword[throw] identifier[Utility] operator[SEP] identifier[generateNewUnexpectedStorageException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public Number getCurrency(int field) throws MPXJException
{
Number result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
try
{
result = m_formats.getCurrencyFormat().parse(m_fields[field]);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse currency", ex);
}
}
else
{
result = null;
}
return (result);
} | class class_name[name] begin[{]
method[getCurrency, return_type[type[Number]], modifier[public], parameter[field]] begin[{]
local_variable[type[Number], result]
if[binary_operation[binary_operation[member[.field], <, member[m_fields.length]], &&, binary_operation[member[.m_fields], !=, literal[0]]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getCurrencyFormat, postfix_operators=[], prefix_operators=[], qualifier=m_formats, selectors=[MethodInvocation(arguments=[MemberReference(member=m_fields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=parse, 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="Failed to parse currency"), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MPXJException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['ParseException']))], finally_block=None, label=None, resources=None)
else begin[{]
assign[member[.result], literal[null]]
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[Number] identifier[getCurrency] operator[SEP] Keyword[int] identifier[field] operator[SEP] Keyword[throws] identifier[MPXJException] {
identifier[Number] identifier[result] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[field] operator[<] identifier[m_fields] operator[SEP] identifier[length] operator[SEP] operator[&&] operator[SEP] identifier[m_fields] operator[SEP] identifier[field] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[!=] Other[0] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[result] operator[=] identifier[m_formats] operator[SEP] identifier[getCurrencyFormat] operator[SEP] operator[SEP] operator[SEP] identifier[parse] operator[SEP] identifier[m_fields] operator[SEP] identifier[field] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ParseException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MPXJException] operator[SEP] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[result] operator[=] Other[null] operator[SEP]
}
Keyword[return] operator[SEP] identifier[result] operator[SEP] operator[SEP]
}
|
@Nonnull
public static Path walkFileTree (@Nonnull final Path aStart,
@Nonnull final Set <FileVisitOption> aOptions,
@Nonnegative final int nMaxDepth,
@Nonnull final FileVisitor <? super Path> aVisitor)
{
try
{
return Files.walkFileTree (aStart, aOptions, nMaxDepth, aVisitor);
}
catch (final IOException ex)
{
throw new UncheckedIOException (ex);
}
} | class class_name[name] begin[{]
method[walkFileTree, return_type[type[Path]], modifier[public static], parameter[aStart, aOptions, nMaxDepth, aVisitor]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=aStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=aOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nMaxDepth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=aVisitor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=walkFileTree, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UncheckedIOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[Path] identifier[walkFileTree] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[Path] identifier[aStart] , annotation[@] identifier[Nonnull] Keyword[final] identifier[Set] operator[<] identifier[FileVisitOption] operator[>] identifier[aOptions] , annotation[@] identifier[Nonnegative] Keyword[final] Keyword[int] identifier[nMaxDepth] , annotation[@] identifier[Nonnull] Keyword[final] identifier[FileVisitor] operator[<] operator[?] Keyword[super] identifier[Path] operator[>] identifier[aVisitor] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[Files] operator[SEP] identifier[walkFileTree] operator[SEP] identifier[aStart] , identifier[aOptions] , identifier[nMaxDepth] , identifier[aVisitor] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UncheckedIOException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
|
public static TypeAnnotationPosition
methodRefTypeArg(final List<TypePathEntry> location,
final JCLambda onLambda,
final int type_index,
final int pos) {
return new TypeAnnotationPosition(TargetType.METHOD_REFERENCE_TYPE_ARGUMENT,
pos, Integer.MIN_VALUE, onLambda,
type_index, Integer.MIN_VALUE,
location);
} | class class_name[name] begin[{]
method[methodRefTypeArg, return_type[type[TypeAnnotationPosition]], modifier[public static], parameter[location, onLambda, type_index, pos]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=METHOD_REFERENCE_TYPE_ARGUMENT, postfix_operators=[], prefix_operators=[], qualifier=TargetType, selectors=[]), MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MIN_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), MemberReference(member=onLambda, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type_index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MIN_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[]), MemberReference(member=location, 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=TypeAnnotationPosition, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TypeAnnotationPosition] identifier[methodRefTypeArg] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[TypePathEntry] operator[>] identifier[location] , Keyword[final] identifier[JCLambda] identifier[onLambda] , Keyword[final] Keyword[int] identifier[type_index] , Keyword[final] Keyword[int] identifier[pos] operator[SEP] {
Keyword[return] Keyword[new] identifier[TypeAnnotationPosition] operator[SEP] identifier[TargetType] operator[SEP] identifier[METHOD_REFERENCE_TYPE_ARGUMENT] , identifier[pos] , identifier[Integer] operator[SEP] identifier[MIN_VALUE] , identifier[onLambda] , identifier[type_index] , identifier[Integer] operator[SEP] identifier[MIN_VALUE] , identifier[location] operator[SEP] operator[SEP]
}
|
public Polygon toPolygon(List<LatLng> latLngs, List<List<LatLng>> holes) {
return toPolygon(latLngs, holes, false, false);
} | class class_name[name] begin[{]
method[toPolygon, return_type[type[Polygon]], modifier[public], parameter[latLngs, holes]] begin[{]
return[call[.toPolygon, parameter[member[.latLngs], member[.holes], literal[false], literal[false]]]]
end[}]
END[}] | Keyword[public] identifier[Polygon] identifier[toPolygon] operator[SEP] identifier[List] operator[<] identifier[LatLng] operator[>] identifier[latLngs] , identifier[List] operator[<] identifier[List] operator[<] identifier[LatLng] operator[>] operator[>] identifier[holes] operator[SEP] {
Keyword[return] identifier[toPolygon] operator[SEP] identifier[latLngs] , identifier[holes] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP]
}
|
@Override
public long dynamicQueryCount(DynamicQuery dynamicQuery,
Projection projection) {
return cpSpecificationOptionPersistence.countWithDynamicQuery(dynamicQuery,
projection);
} | class class_name[name] begin[{]
method[dynamicQueryCount, return_type[type[long]], modifier[public], parameter[dynamicQuery, projection]] begin[{]
return[call[cpSpecificationOptionPersistence.countWithDynamicQuery, parameter[member[.dynamicQuery], member[.projection]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[dynamicQueryCount] operator[SEP] identifier[DynamicQuery] identifier[dynamicQuery] , identifier[Projection] identifier[projection] operator[SEP] {
Keyword[return] identifier[cpSpecificationOptionPersistence] operator[SEP] identifier[countWithDynamicQuery] operator[SEP] identifier[dynamicQuery] , identifier[projection] operator[SEP] operator[SEP]
}
|
protected boolean exists(MessageJobDeclaration msgJobdecl, String procDefKey, String activityId) {
boolean exist = false;
List<JobDeclaration<?, ?>> declarations = jobDeclarations.get(procDefKey);
if (declarations != null) {
for (int i = 0; i < declarations.size() && !exist; i++) {
JobDeclaration<?, ?> decl = declarations.get(i);
if (decl.getActivityId().equals(activityId) &&
decl.getJobConfiguration().equalsIgnoreCase(msgJobdecl.getJobConfiguration())) {
exist = true;
}
}
}
return exist;
} | class class_name[name] begin[{]
method[exists, return_type[type[boolean]], modifier[protected], parameter[msgJobdecl, procDefKey, activityId]] begin[{]
local_variable[type[boolean], exist]
local_variable[type[List], declarations]
if[binary_operation[member[.declarations], !=, literal[null]]] begin[{]
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=declarations, selectors=[], type_arguments=None), name=decl)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=JobDeclaration, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getActivityId, postfix_operators=[], prefix_operators=[], qualifier=decl, selectors=[MethodInvocation(arguments=[MemberReference(member=activityId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getJobConfiguration, postfix_operators=[], prefix_operators=[], qualifier=decl, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getJobConfiguration, postfix_operators=[], prefix_operators=[], qualifier=msgJobdecl, selectors=[], type_arguments=None)], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=exist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=declarations, selectors=[], type_arguments=None), operator=<), operandr=MemberReference(member=exist, 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)
else begin[{]
None
end[}]
return[member[.exist]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[exists] operator[SEP] identifier[MessageJobDeclaration] identifier[msgJobdecl] , identifier[String] identifier[procDefKey] , identifier[String] identifier[activityId] operator[SEP] {
Keyword[boolean] identifier[exist] operator[=] literal[boolean] operator[SEP] identifier[List] operator[<] identifier[JobDeclaration] operator[<] operator[?] , operator[?] operator[>] operator[>] identifier[declarations] operator[=] identifier[jobDeclarations] operator[SEP] identifier[get] operator[SEP] identifier[procDefKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[declarations] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[declarations] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[exist] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[JobDeclaration] operator[<] operator[?] , operator[?] operator[>] identifier[decl] operator[=] identifier[declarations] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[decl] operator[SEP] identifier[getActivityId] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[activityId] operator[SEP] operator[&&] identifier[decl] operator[SEP] identifier[getJobConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[msgJobdecl] operator[SEP] identifier[getJobConfiguration] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[exist] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[return] identifier[exist] operator[SEP]
}
|
public static Flowable<BigInteger> range(
final BigInteger startValue, final BigInteger endValue, final boolean ascending) {
if (startValue.compareTo(BigInteger.ZERO) == -1) {
throw new IllegalArgumentException("Negative start index cannot be used");
} else if (startValue.compareTo(endValue) > 0) {
throw new IllegalArgumentException(
"Negative start index cannot be greater then end index");
}
if (ascending) {
return Flowable.create(subscriber -> {
for (BigInteger i = startValue;
i.compareTo(endValue) < 1
&& !subscriber.isCancelled();
i = i.add(BigInteger.ONE)) {
subscriber.onNext(i);
}
if (!subscriber.isCancelled()) {
subscriber.onComplete();
}
}, BackpressureStrategy.BUFFER);
} else {
return Flowable.create(subscriber -> {
for (BigInteger i = endValue;
i.compareTo(startValue) > -1
&& !subscriber.isCancelled();
i = i.subtract(BigInteger.ONE)) {
subscriber.onNext(i);
}
if (!subscriber.isCancelled()) {
subscriber.onComplete();
}
}, BackpressureStrategy.BUFFER);
}
} | class class_name[name] begin[{]
method[range, return_type[type[Flowable]], modifier[public static], parameter[startValue, endValue, ascending]] begin[{]
if[binary_operation[call[startValue.compareTo, parameter[member[BigInteger.ZERO]]], ==, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Negative start index cannot be used")], 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[{]
if[binary_operation[call[startValue.compareTo, parameter[member[.endValue]]], >, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Negative start index cannot be greater then end index")], 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[}]
end[}]
if[member[.ascending]] begin[{]
return[call[Flowable.create, parameter[LambdaExpression(body=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onNext, postfix_operators=[], prefix_operators=[], qualifier=subscriber, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=endValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareTo, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<), operandr=MethodInvocation(arguments=[], member=isCancelled, postfix_operators=[], prefix_operators=['!'], qualifier=subscriber, selectors=[], type_arguments=None), operator=&&), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=startValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BigInteger, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ONE, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None))]), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isCancelled, postfix_operators=[], prefix_operators=['!'], qualifier=subscriber, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=onComplete, postfix_operators=[], prefix_operators=[], qualifier=subscriber, selectors=[], type_arguments=None), label=None)]))], parameters=[MemberReference(member=subscriber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), member[BackpressureStrategy.BUFFER]]]]
else begin[{]
return[call[Flowable.create, parameter[LambdaExpression(body=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onNext, postfix_operators=[], prefix_operators=[], qualifier=subscriber, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=startValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compareTo, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=>), operandr=MethodInvocation(arguments=[], member=isCancelled, postfix_operators=[], prefix_operators=['!'], qualifier=subscriber, selectors=[], type_arguments=None), operator=&&), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=endValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BigInteger, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=ONE, postfix_operators=[], prefix_operators=[], qualifier=BigInteger, selectors=[])], member=subtract, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None))]), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isCancelled, postfix_operators=[], prefix_operators=['!'], qualifier=subscriber, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=onComplete, postfix_operators=[], prefix_operators=[], qualifier=subscriber, selectors=[], type_arguments=None), label=None)]))], parameters=[MemberReference(member=subscriber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), member[BackpressureStrategy.BUFFER]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Flowable] operator[<] identifier[BigInteger] operator[>] identifier[range] operator[SEP] Keyword[final] identifier[BigInteger] identifier[startValue] , Keyword[final] identifier[BigInteger] identifier[endValue] , Keyword[final] Keyword[boolean] identifier[ascending] operator[SEP] {
Keyword[if] operator[SEP] identifier[startValue] operator[SEP] identifier[compareTo] operator[SEP] identifier[BigInteger] operator[SEP] identifier[ZERO] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[startValue] operator[SEP] identifier[compareTo] operator[SEP] identifier[endValue] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ascending] operator[SEP] {
Keyword[return] identifier[Flowable] operator[SEP] identifier[create] operator[SEP] identifier[subscriber] operator[->] {
Keyword[for] operator[SEP] identifier[BigInteger] identifier[i] operator[=] identifier[startValue] operator[SEP] identifier[i] operator[SEP] identifier[compareTo] operator[SEP] identifier[endValue] operator[SEP] operator[<] Other[1] operator[&&] operator[!] identifier[subscriber] operator[SEP] identifier[isCancelled] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[=] identifier[i] operator[SEP] identifier[add] operator[SEP] identifier[BigInteger] operator[SEP] identifier[ONE] operator[SEP] operator[SEP] {
identifier[subscriber] operator[SEP] identifier[onNext] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[subscriber] operator[SEP] identifier[isCancelled] operator[SEP] operator[SEP] operator[SEP] {
identifier[subscriber] operator[SEP] identifier[onComplete] operator[SEP] operator[SEP] operator[SEP]
}
} , identifier[BackpressureStrategy] operator[SEP] identifier[BUFFER] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Flowable] operator[SEP] identifier[create] operator[SEP] identifier[subscriber] operator[->] {
Keyword[for] operator[SEP] identifier[BigInteger] identifier[i] operator[=] identifier[endValue] operator[SEP] identifier[i] operator[SEP] identifier[compareTo] operator[SEP] identifier[startValue] operator[SEP] operator[>] operator[-] Other[1] operator[&&] operator[!] identifier[subscriber] operator[SEP] identifier[isCancelled] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[=] identifier[i] operator[SEP] identifier[subtract] operator[SEP] identifier[BigInteger] operator[SEP] identifier[ONE] operator[SEP] operator[SEP] {
identifier[subscriber] operator[SEP] identifier[onNext] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[subscriber] operator[SEP] identifier[isCancelled] operator[SEP] operator[SEP] operator[SEP] {
identifier[subscriber] operator[SEP] identifier[onComplete] operator[SEP] operator[SEP] operator[SEP]
}
} , identifier[BackpressureStrategy] operator[SEP] identifier[BUFFER] operator[SEP] operator[SEP]
}
}
|
public String getGroupId() {
if (group == null ) {
return null;
} else {
return group.id == null ? group.nsid : group.id;
}
} | class class_name[name] begin[{]
method[getGroupId, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.group], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[]), if_true=MemberReference(member=nsid, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[]))]
end[}]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getGroupId] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[group] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[group] operator[SEP] identifier[id] operator[==] Other[null] operator[?] identifier[group] operator[SEP] identifier[nsid] operator[:] identifier[group] operator[SEP] identifier[id] operator[SEP]
}
}
|
public PubsubFuture<List<ReceivedMessage>> pull(final String canonicalSubscriptionName,
final boolean returnImmediately) {
return pull(canonicalSubscriptionName, returnImmediately, DEFAULT_PULL_MAX_MESSAGES);
} | class class_name[name] begin[{]
method[pull, return_type[type[PubsubFuture]], modifier[public], parameter[canonicalSubscriptionName, returnImmediately]] begin[{]
return[call[.pull, parameter[member[.canonicalSubscriptionName], member[.returnImmediately], member[.DEFAULT_PULL_MAX_MESSAGES]]]]
end[}]
END[}] | Keyword[public] identifier[PubsubFuture] operator[<] identifier[List] operator[<] identifier[ReceivedMessage] operator[>] operator[>] identifier[pull] operator[SEP] Keyword[final] identifier[String] identifier[canonicalSubscriptionName] , Keyword[final] Keyword[boolean] identifier[returnImmediately] operator[SEP] {
Keyword[return] identifier[pull] operator[SEP] identifier[canonicalSubscriptionName] , identifier[returnImmediately] , identifier[DEFAULT_PULL_MAX_MESSAGES] operator[SEP] operator[SEP]
}
|
@Override public Object transform(Object value) {
if (value == null) {
return value;
} else if (value instanceof Boolean) {
return value;
} else if (value instanceof String) {
return value;
} else if (value instanceof Number) {
return InternalUtils.toBigDecimal((Number)value);
} else if (value instanceof byte[]) {
return value;
} else if (value instanceof ByteBuffer) {
return copyBytesFrom((ByteBuffer)value);
} else if (value instanceof Set) {
@SuppressWarnings("unchecked")
Set<Object> set = (Set<Object>) value;
if (set.size() == 0)
return value;
Object element = set.iterator().next();
if (element instanceof String) {
return value;
} else if (element instanceof BigDecimal) {
return value;
} else if (element instanceof Number) {
@SuppressWarnings("unchecked")
Set<Number> in = (Set<Number>) value;
Set<BigDecimal> out = new LinkedHashSet<BigDecimal>(set.size());
for (Number n : in)
out.add(InternalUtils.toBigDecimal(n));
return out;
} else if (element instanceof byte[]) {
return value;
} else if (element instanceof ByteBuffer) {
@SuppressWarnings("unchecked")
Set<ByteBuffer> bs = (Set<ByteBuffer>) value;
Set<byte[]> out = new LinkedHashSet<byte[]>(bs.size());
for (ByteBuffer bb: bs)
out.add(copyBytesFrom(bb));
return out;
} else {
throw new UnsupportedOperationException("element type: "
+ element.getClass());
}
} else if (value instanceof List) {
@SuppressWarnings("unchecked")
List<Object> in = (List<Object>) value;
if (in.size() == 0)
return in;
List<Object> out = new ArrayList<Object>();
for (Object v : in)
out.add(transform(v));
return out;
} else if (value instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, Object> in = (Map<String, Object>) value;
if (in.size() == 0)
return in;
Map<String, Object> out = new LinkedHashMap<String, Object>(in.size());
for (Map.Entry<String, Object> e : in.entrySet())
out.put(e.getKey(), transform(e.getValue()));
return out;
} else {
throw new UnsupportedOperationException("value type: "
+ value.getClass());
}
} | class class_name[name] begin[{]
method[transform, return_type[type[Object]], modifier[public], parameter[value]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
return[member[.value]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Boolean]]] begin[{]
return[member[.value]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[String]]] begin[{]
return[member[.value]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Number]]] begin[{]
return[call[InternalUtils.toBigDecimal, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[byte]]] begin[{]
return[member[.value]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[ByteBuffer]]] begin[{]
return[call[.copyBytesFrom, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Set]]] begin[{]
local_variable[type[Set], set]
if[binary_operation[call[set.size, parameter[]], ==, literal[0]]] begin[{]
return[member[.value]]
else begin[{]
None
end[}]
local_variable[type[Object], element]
if[binary_operation[member[.element], instanceof, type[String]]] begin[{]
return[member[.value]]
else begin[{]
if[binary_operation[member[.element], instanceof, type[BigDecimal]]] begin[{]
return[member[.value]]
else begin[{]
if[binary_operation[member[.element], instanceof, type[Number]]] begin[{]
local_variable[type[Set], in]
local_variable[type[Set], out]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toBigDecimal, postfix_operators=[], prefix_operators=[], qualifier=InternalUtils, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=n)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None))), label=None)
return[member[.out]]
else begin[{]
if[binary_operation[member[.element], instanceof, type[byte]]] begin[{]
return[member[.value]]
else begin[{]
if[binary_operation[member[.element], instanceof, type[ByteBuffer]]] begin[{]
local_variable[type[Set], bs]
local_variable[type[Set], out]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=bb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copyBytesFrom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=bs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bb)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None))), label=None)
return[member[.out]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="element type: "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=element, 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=UnsupportedOperationException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
else begin[{]
if[binary_operation[member[.value], instanceof, type[List]]] begin[{]
local_variable[type[List], in]
if[binary_operation[call[in.size, parameter[]], ==, literal[0]]] begin[{]
return[member[.in]]
else begin[{]
None
end[}]
local_variable[type[List], out]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=transform, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=v)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[member[.out]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Map]]] begin[{]
local_variable[type[Map], in]
if[binary_operation[call[in.size, parameter[]], ==, literal[0]]] begin[{]
return[member[.in]]
else begin[{]
None
end[}]
local_variable[type[Map], out]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=transform, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=in, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.out]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="value type: "), operandr=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=value, 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=UnsupportedOperationException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[transform] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Boolean] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[String] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Number] operator[SEP] {
Keyword[return] identifier[InternalUtils] operator[SEP] identifier[toBigDecimal] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[ByteBuffer] operator[SEP] {
Keyword[return] identifier[copyBytesFrom] operator[SEP] operator[SEP] identifier[ByteBuffer] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Set] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Set] operator[<] identifier[Object] operator[>] identifier[set] operator[=] operator[SEP] identifier[Set] operator[<] identifier[Object] operator[>] operator[SEP] identifier[value] operator[SEP] Keyword[if] operator[SEP] identifier[set] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] identifier[value] operator[SEP] identifier[Object] identifier[element] operator[=] identifier[set] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[String] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[BigDecimal] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[Number] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Set] operator[<] identifier[Number] operator[>] identifier[in] operator[=] operator[SEP] identifier[Set] operator[<] identifier[Number] operator[>] operator[SEP] identifier[value] operator[SEP] identifier[Set] operator[<] identifier[BigDecimal] operator[>] identifier[out] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] identifier[BigDecimal] operator[>] operator[SEP] identifier[set] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Number] identifier[n] operator[:] identifier[in] operator[SEP] identifier[out] operator[SEP] identifier[add] operator[SEP] identifier[InternalUtils] operator[SEP] identifier[toBigDecimal] operator[SEP] identifier[n] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[out] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[element] Keyword[instanceof] identifier[ByteBuffer] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Set] operator[<] identifier[ByteBuffer] operator[>] identifier[bs] operator[=] operator[SEP] identifier[Set] operator[<] identifier[ByteBuffer] operator[>] operator[SEP] identifier[value] operator[SEP] identifier[Set] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] identifier[out] operator[=] Keyword[new] identifier[LinkedHashSet] operator[<] Keyword[byte] operator[SEP] operator[SEP] operator[>] operator[SEP] identifier[bs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ByteBuffer] identifier[bb] operator[:] identifier[bs] operator[SEP] identifier[out] operator[SEP] identifier[add] operator[SEP] identifier[copyBytesFrom] operator[SEP] identifier[bb] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[out] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[+] identifier[element] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[List] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] identifier[in] operator[=] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] operator[SEP] identifier[value] operator[SEP] Keyword[if] operator[SEP] identifier[in] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] identifier[in] operator[SEP] identifier[List] operator[<] identifier[Object] operator[>] identifier[out] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[v] operator[:] identifier[in] operator[SEP] identifier[out] operator[SEP] identifier[add] operator[SEP] identifier[transform] operator[SEP] identifier[v] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[out] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Map] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[in] operator[=] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] identifier[value] operator[SEP] Keyword[if] operator[SEP] identifier[in] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] Keyword[return] identifier[in] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[out] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] identifier[in] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[e] operator[:] identifier[in] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[put] operator[SEP] identifier[e] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[transform] operator[SEP] identifier[e] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[out] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] literal[String] operator[+] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static final CThreadContext getInstance() {
SoftReference ref = (SoftReference)CThreadContext.contextLocal
.get(Thread.currentThread());
CThreadContext context = null;
if ((ref == null) || (ref.get() == null)) {
context = new CThreadContext();
ref = new SoftReference(context);
CThreadContext.contextLocal.put(Thread.currentThread(), ref);
} else {
context = (CThreadContext)ref.get();
}
return context;
} | class class_name[name] begin[{]
method[getInstance, return_type[type[CThreadContext]], modifier[final public static], parameter[]] begin[{]
local_variable[type[SoftReference], ref]
local_variable[type[CThreadContext], context]
if[binary_operation[binary_operation[member[.ref], ==, literal[null]], ||, binary_operation[call[ref.get, parameter[]], ==, literal[null]]]] begin[{]
assign[member[.context], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CThreadContext, sub_type=None))]
assign[member[.ref], 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=SoftReference, sub_type=None))]
call[CThreadContext.contextLocal.put, parameter[call[Thread.currentThread, parameter[]], member[.ref]]]
else begin[{]
assign[member[.context], Cast(expression=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=ref, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=CThreadContext, sub_type=None))]
end[}]
return[member[.context]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[CThreadContext] identifier[getInstance] operator[SEP] operator[SEP] {
identifier[SoftReference] identifier[ref] operator[=] operator[SEP] identifier[SoftReference] operator[SEP] identifier[CThreadContext] operator[SEP] identifier[contextLocal] operator[SEP] identifier[get] operator[SEP] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[CThreadContext] identifier[context] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[ref] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[ref] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] operator[SEP] {
identifier[context] operator[=] Keyword[new] identifier[CThreadContext] operator[SEP] operator[SEP] operator[SEP] identifier[ref] operator[=] Keyword[new] identifier[SoftReference] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[CThreadContext] operator[SEP] identifier[contextLocal] operator[SEP] identifier[put] operator[SEP] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] , identifier[ref] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[context] operator[=] operator[SEP] identifier[CThreadContext] operator[SEP] identifier[ref] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[context] operator[SEP]
}
|
public IfcRoleEnum createIfcRoleEnumFromString(EDataType eDataType, String initialValue) {
IfcRoleEnum result = IfcRoleEnum.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[createIfcRoleEnumFromString, return_type[type[IfcRoleEnum]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[IfcRoleEnum], 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[IfcRoleEnum] identifier[createIfcRoleEnumFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[IfcRoleEnum] identifier[result] operator[=] identifier[IfcRoleEnum] 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]
}
|
public final static boolean canThrowException(byte opcode) {
switch (opcode) {
default:
return false;
case IALOAD:
case LALOAD:
case FALOAD:
case DALOAD:
case AALOAD:
case BALOAD:
case CALOAD:
case SALOAD:
case IASTORE:
case LASTORE:
case FASTORE:
case DASTORE:
case AASTORE:
case BASTORE:
case CASTORE:
case SASTORE:
case IDIV:
case LDIV:
case IREM:
case LREM:
case GETFIELD:
case PUTFIELD:
case INVOKEVIRTUAL:
case INVOKESPECIAL:
case INVOKESTATIC:
case INVOKEINTERFACE:
case NEWARRAY:
case ANEWARRAY:
case ARRAYLENGTH:
case ATHROW:
case CHECKCAST:
case MONITORENTER:
case MONITOREXIT:
case MULTIANEWARRAY:
return true;
}
} | class class_name[name] begin[{]
method[canThrowException, return_type[type[boolean]], modifier[final public static], parameter[opcode]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]), SwitchStatementCase(case=['IALOAD', 'LALOAD', 'FALOAD', 'DALOAD', 'AALOAD', 'BALOAD', 'CALOAD', 'SALOAD', 'IASTORE', 'LASTORE', 'FASTORE', 'DASTORE', 'AASTORE', 'BASTORE', 'CASTORE', 'SASTORE', 'IDIV', 'LDIV', 'IREM', 'LREM', 'GETFIELD', 'PUTFIELD', 'INVOKEVIRTUAL', 'INVOKESPECIAL', 'INVOKESTATIC', 'INVOKEINTERFACE', 'NEWARRAY', 'ANEWARRAY', 'ARRAYLENGTH', 'ATHROW', 'CHECKCAST', 'MONITORENTER', 'MONITOREXIT', 'MULTIANEWARRAY'], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)])], expression=MemberReference(member=opcode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[static] Keyword[boolean] identifier[canThrowException] operator[SEP] Keyword[byte] identifier[opcode] operator[SEP] {
Keyword[switch] operator[SEP] identifier[opcode] operator[SEP] {
Keyword[default] operator[:] Keyword[return] literal[boolean] operator[SEP] Keyword[case] identifier[IALOAD] operator[:] Keyword[case] identifier[LALOAD] operator[:] Keyword[case] identifier[FALOAD] operator[:] Keyword[case] identifier[DALOAD] operator[:] Keyword[case] identifier[AALOAD] operator[:] Keyword[case] identifier[BALOAD] operator[:] Keyword[case] identifier[CALOAD] operator[:] Keyword[case] identifier[SALOAD] operator[:] Keyword[case] identifier[IASTORE] operator[:] Keyword[case] identifier[LASTORE] operator[:] Keyword[case] identifier[FASTORE] operator[:] Keyword[case] identifier[DASTORE] operator[:] Keyword[case] identifier[AASTORE] operator[:] Keyword[case] identifier[BASTORE] operator[:] Keyword[case] identifier[CASTORE] operator[:] Keyword[case] identifier[SASTORE] operator[:] Keyword[case] identifier[IDIV] operator[:] Keyword[case] identifier[LDIV] operator[:] Keyword[case] identifier[IREM] operator[:] Keyword[case] identifier[LREM] operator[:] Keyword[case] identifier[GETFIELD] operator[:] Keyword[case] identifier[PUTFIELD] operator[:] Keyword[case] identifier[INVOKEVIRTUAL] operator[:] Keyword[case] identifier[INVOKESPECIAL] operator[:] Keyword[case] identifier[INVOKESTATIC] operator[:] Keyword[case] identifier[INVOKEINTERFACE] operator[:] Keyword[case] identifier[NEWARRAY] operator[:] Keyword[case] identifier[ANEWARRAY] operator[:] Keyword[case] identifier[ARRAYLENGTH] operator[:] Keyword[case] identifier[ATHROW] operator[:] Keyword[case] identifier[CHECKCAST] operator[:] Keyword[case] identifier[MONITORENTER] operator[:] Keyword[case] identifier[MONITOREXIT] operator[:] Keyword[case] identifier[MULTIANEWARRAY] operator[:] Keyword[return] literal[boolean] operator[SEP]
}
}
|
public static Runnable closeAsRunnable(Closeable c)
{
return () -> {
try {
c.close();
} catch (IOException e) {
LOG.error("While closing " + c, e);
}
};
} | class class_name[name] begin[{]
method[closeAsRunnable, return_type[type[Runnable]], modifier[public static], parameter[c]] begin[{]
return[LambdaExpression(body=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="While closing "), operandr=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)], parameters=[])]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Runnable] identifier[closeAsRunnable] operator[SEP] identifier[Closeable] identifier[c] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] operator[->] {
Keyword[try] {
identifier[c] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[c] , identifier[e] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public CompletableFuture<UpdateStreamStatus.Status> truncateStream(final String scope, final String stream,
final Map<Long, Long> streamCut,
final OperationContext contextOpt) {
final OperationContext context = contextOpt == null ? streamMetadataStore.createContext(scope, stream) : contextOpt;
final long requestId = requestTracker.getRequestIdFor("truncateStream", scope, stream);
// 1. get stream cut
return startTruncation(scope, stream, streamCut, context, requestId)
// 4. check for truncation to complete
.thenCompose(truncationStarted -> {
if (truncationStarted) {
return checkDone(() -> isTruncated(scope, stream, streamCut, context), 1000L)
.thenApply(y -> UpdateStreamStatus.Status.SUCCESS);
} else {
log.warn(requestId, "Unable to start truncation for {}/{}", scope, stream);
return CompletableFuture.completedFuture(UpdateStreamStatus.Status.FAILURE);
}
})
.exceptionally(ex -> {
log.warn(requestId, "Exception thrown in trying to update stream configuration {}", ex);
return handleUpdateStreamError(ex, requestId);
});
} | class class_name[name] begin[{]
method[truncateStream, return_type[type[CompletableFuture]], modifier[public], parameter[scope, stream, streamCut, contextOpt]] begin[{]
local_variable[type[OperationContext], context]
local_variable[type[long], requestId]
return[call[.startTruncation, parameter[member[.scope], member[.stream], member[.streamCut], member[.context], member[.requestId]]]]
end[}]
END[}] | Keyword[public] identifier[CompletableFuture] operator[<] identifier[UpdateStreamStatus] operator[SEP] identifier[Status] operator[>] identifier[truncateStream] operator[SEP] Keyword[final] identifier[String] identifier[scope] , Keyword[final] identifier[String] identifier[stream] , Keyword[final] identifier[Map] operator[<] identifier[Long] , identifier[Long] operator[>] identifier[streamCut] , Keyword[final] identifier[OperationContext] identifier[contextOpt] operator[SEP] {
Keyword[final] identifier[OperationContext] identifier[context] operator[=] identifier[contextOpt] operator[==] Other[null] operator[?] identifier[streamMetadataStore] operator[SEP] identifier[createContext] operator[SEP] identifier[scope] , identifier[stream] operator[SEP] operator[:] identifier[contextOpt] operator[SEP] Keyword[final] Keyword[long] identifier[requestId] operator[=] identifier[requestTracker] operator[SEP] identifier[getRequestIdFor] operator[SEP] literal[String] , identifier[scope] , identifier[stream] operator[SEP] operator[SEP] Keyword[return] identifier[startTruncation] operator[SEP] identifier[scope] , identifier[stream] , identifier[streamCut] , identifier[context] , identifier[requestId] operator[SEP] operator[SEP] identifier[thenCompose] operator[SEP] identifier[truncationStarted] operator[->] {
Keyword[if] operator[SEP] identifier[truncationStarted] operator[SEP] {
Keyword[return] identifier[checkDone] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[isTruncated] operator[SEP] identifier[scope] , identifier[stream] , identifier[streamCut] , identifier[context] operator[SEP] , Other[1000L] operator[SEP] operator[SEP] identifier[thenApply] operator[SEP] identifier[y] operator[->] identifier[UpdateStreamStatus] operator[SEP] identifier[Status] operator[SEP] identifier[SUCCESS] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] identifier[requestId] , literal[String] , identifier[scope] , identifier[stream] operator[SEP] operator[SEP] Keyword[return] identifier[CompletableFuture] operator[SEP] identifier[completedFuture] operator[SEP] identifier[UpdateStreamStatus] operator[SEP] identifier[Status] operator[SEP] identifier[FAILURE] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[exceptionally] operator[SEP] identifier[ex] operator[->] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] identifier[requestId] , literal[String] , identifier[ex] operator[SEP] operator[SEP] Keyword[return] identifier[handleUpdateStreamError] operator[SEP] identifier[ex] , identifier[requestId] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
public boolean verify() {
this.errors = new LinkedList<>();
try (BufferedReader reader =
new BufferedReader(new InputStreamReader(generator.generate(spaceId, ManifestFormat.TSV)))) {
WriteOnlyStringSet snapshotManifest = ManifestFileHelper.loadManifestSetFromFile(this.md5Manifest);
log.info("loaded manifest set into memory.");
ManifestFormatter formatter = new TsvManifestFormatter();
// skip header
if (formatter.getHeader() != null) {
reader.readLine();
}
String line = null;
int stitchedManifestCount = 0;
while ((line = reader.readLine()) != null) {
ManifestItem item = formatter.parseLine(line);
String contentId = item.getContentId();
if (!contentId.equals(Constants.SNAPSHOT_PROPS_FILENAME)) {
if (!snapshotManifest.contains(ManifestFileHelper.formatManifestSetString(contentId,
item.getContentChecksum()))) {
String message = "Snapshot manifest does not contain content id/checksum combination ("
+ contentId + ", " + item.getContentChecksum();
errors.add(message);
}
stitchedManifestCount++;
}
}
int snapshotCount = snapshotManifest.size();
if (stitchedManifestCount != snapshotCount) {
String message = "Snapshot Manifest size (" + snapshotCount +
") does not equal DuraCloud Manifest (" + stitchedManifestCount + ")";
errors.add(message);
log.error(message);
}
} catch (Exception e) {
String message = "Failed to verify space manifest against snapshot manifest:" + e.getMessage();
errors.add(message);
log.error(message, e);
}
log.info("verification complete. error count = {}", errors.size());
return getResult(errors);
} | class class_name[name] begin[{]
method[verify, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
assign[THIS[member[None.errors]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedList, sub_type=None))]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=md5Manifest, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=loadManifestSetFromFile, postfix_operators=[], prefix_operators=[], qualifier=ManifestFileHelper, selectors=[], type_arguments=None), name=snapshotManifest)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WriteOnlyStringSet, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="loaded manifest set into memory.")], member=info, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=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=TsvManifestFormatter, sub_type=None)), name=formatter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ManifestFormatter, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getHeader, postfix_operators=[], prefix_operators=[], qualifier=formatter, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=stitchedManifestCount)], modifiers=set(), type=BasicType(dimensions=[], name=int)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseLine, postfix_operators=[], prefix_operators=[], qualifier=formatter, selectors=[], type_arguments=None), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ManifestItem, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getContentId, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), name=contentId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=SNAPSHOT_PROPS_FILENAME, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=contentId, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=contentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getContentChecksum, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None)], member=formatManifestSetString, postfix_operators=[], prefix_operators=[], qualifier=ManifestFileHelper, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=snapshotManifest, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Snapshot manifest does not contain content id/checksum combination ("), operandr=MemberReference(member=contentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", "), operator=+), operandr=MethodInvocation(arguments=[], member=getContentChecksum, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), operator=+), name=message)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MemberReference(member=stitchedManifestCount, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=snapshotManifest, selectors=[], type_arguments=None), name=snapshotCount)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=stitchedManifestCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=snapshotCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Snapshot Manifest size ("), operandr=MemberReference(member=snapshotCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=") does not equal DuraCloud Manifest ("), operator=+), operandr=MemberReference(member=stitchedManifestCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+), name=message)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to verify space manifest against snapshot manifest:"), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), name=message)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=errors, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=reader, type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None), value=ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=spaceId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=TSV, postfix_operators=[], prefix_operators=[], qualifier=ManifestFormat, selectors=[])], member=generate, postfix_operators=[], prefix_operators=[], qualifier=generator, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)))])
call[log.info, parameter[literal["verification complete. error count = {}"], call[errors.size, parameter[]]]]
return[call[.getResult, parameter[member[.errors]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[verify] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[errors] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[generator] operator[SEP] identifier[generate] operator[SEP] identifier[spaceId] , identifier[ManifestFormat] operator[SEP] identifier[TSV] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[WriteOnlyStringSet] identifier[snapshotManifest] operator[=] identifier[ManifestFileHelper] operator[SEP] identifier[loadManifestSetFromFile] operator[SEP] Keyword[this] operator[SEP] identifier[md5Manifest] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ManifestFormatter] identifier[formatter] operator[=] Keyword[new] identifier[TsvManifestFormatter] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[formatter] operator[SEP] identifier[getHeader] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[line] operator[=] Other[null] operator[SEP] Keyword[int] identifier[stitchedManifestCount] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[ManifestItem] identifier[item] operator[=] identifier[formatter] operator[SEP] identifier[parseLine] operator[SEP] identifier[line] operator[SEP] operator[SEP] identifier[String] identifier[contentId] operator[=] identifier[item] operator[SEP] identifier[getContentId] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[contentId] operator[SEP] identifier[equals] operator[SEP] identifier[Constants] operator[SEP] identifier[SNAPSHOT_PROPS_FILENAME] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[snapshotManifest] operator[SEP] identifier[contains] operator[SEP] identifier[ManifestFileHelper] operator[SEP] identifier[formatManifestSetString] operator[SEP] identifier[contentId] , identifier[item] operator[SEP] identifier[getContentChecksum] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[message] operator[=] literal[String] operator[+] identifier[contentId] operator[+] literal[String] operator[+] identifier[item] operator[SEP] identifier[getContentChecksum] operator[SEP] operator[SEP] operator[SEP] identifier[errors] operator[SEP] identifier[add] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
identifier[stitchedManifestCount] operator[++] operator[SEP]
}
}
Keyword[int] identifier[snapshotCount] operator[=] identifier[snapshotManifest] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stitchedManifestCount] operator[!=] identifier[snapshotCount] operator[SEP] {
identifier[String] identifier[message] operator[=] literal[String] operator[+] identifier[snapshotCount] operator[+] literal[String] operator[+] identifier[stitchedManifestCount] operator[+] literal[String] operator[SEP] identifier[errors] operator[SEP] identifier[add] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[String] identifier[message] operator[=] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] identifier[errors] operator[SEP] identifier[add] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[error] operator[SEP] identifier[message] , identifier[e] operator[SEP] operator[SEP]
}
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[errors] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[getResult] operator[SEP] identifier[errors] operator[SEP] operator[SEP]
}
|
@Override
public RequestCtx handleResponse(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
DataResponseWrapper res = (DataResponseWrapper) response;
byte[] data = res.getData();
String result = null;
String body = new String(data);
if (body.startsWith("<html>")) {
if (logger.isDebugEnabled()) {
logger.debug("filtering html");
}
result = filterHTML(request, res);
} else if (body.startsWith("<?xml")) {
if (logger.isDebugEnabled()) {
logger.debug("filtering html");
}
result = filterXML(request, res);
} else {
if (logger.isDebugEnabled()) {
logger.debug("not filtering due to unexpected output: " + body);
}
result = body;
}
res.setData(result.getBytes());
return null;
} | class class_name[name] begin[{]
method[handleResponse, return_type[type[RequestCtx]], modifier[public], parameter[request, response]] begin[{]
local_variable[type[DataResponseWrapper], res]
local_variable[type[byte], data]
local_variable[type[String], result]
local_variable[type[String], body]
if[call[body.startsWith, parameter[literal["<html>"]]]] begin[{]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
call[logger.debug, parameter[literal["filtering html"]]]
else begin[{]
None
end[}]
assign[member[.result], call[.filterHTML, parameter[member[.request], member[.res]]]]
else begin[{]
if[call[body.startsWith, parameter[literal["<?xml"]]]] begin[{]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
call[logger.debug, parameter[literal["filtering html"]]]
else begin[{]
None
end[}]
assign[member[.result], call[.filterXML, parameter[member[.request], member[.res]]]]
else begin[{]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
call[logger.debug, parameter[binary_operation[literal["not filtering due to unexpected output: "], +, member[.body]]]]
else begin[{]
None
end[}]
assign[member[.result], member[.body]]
end[}]
end[}]
call[res.setData, parameter[call[result.getBytes, parameter[]]]]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[RequestCtx] identifier[handleResponse] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ServletException] {
identifier[DataResponseWrapper] identifier[res] operator[=] operator[SEP] identifier[DataResponseWrapper] operator[SEP] identifier[response] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[=] identifier[res] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[result] operator[=] Other[null] operator[SEP] identifier[String] identifier[body] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[data] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[body] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[result] operator[=] identifier[filterHTML] operator[SEP] identifier[request] , identifier[res] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[body] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[result] operator[=] identifier[filterXML] operator[SEP] identifier[request] , identifier[res] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[body] operator[SEP] operator[SEP]
}
identifier[result] operator[=] identifier[body] operator[SEP]
}
identifier[res] operator[SEP] identifier[setData] operator[SEP] identifier[result] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
@Override
public Prijzen getModel(InputStream stream) {
Map<String, VervoerderKeuze> vervoerderKeuzes = new HashMap<>();
Xml xml = Xml.getXml(stream, "VervoerderKeuzes");
for (Xml vervoerderKeuze : xml.children("VervoerderKeuze")) {
String vervoerderKeuzeNaam = vervoerderKeuze.attr("naam");
int tariefEenheden = Integer.parseInt(vervoerderKeuze.child("Tariefeenheden").content());
Map<String, ReisType> reisTypes = new HashMap<>();
for (Xml reisTypeXml : vervoerderKeuze.children("ReisType")) {
String reisTypeNaam = reisTypeXml.attr("name");
Map<Integer, ReisKlasse> reisKlassen = new HashMap<>();
for (Xml reisKlasseXml : reisTypeXml.children("ReisKlasse")) {
int klasse = Integer.parseInt(reisKlasseXml.attr("klasse"));
// <Prijsdeel vervoerder="NS" prijs="47.20" naar="GDM" van="RTD"/>
List<Prijsdeel> prijsdelen = new LinkedList<>();
for (Xml prijsdeelXml : reisKlasseXml.children("Prijsdeel")) {
prijsdelen.add(new Prijsdeel(prijsdeelXml.attr("vervoerder"), new BigDecimal(prijsdeelXml.attr("prijs")), prijsdeelXml.attr("van"), prijsdeelXml.attr("naar")));
}
BigDecimal totaal = new BigDecimal(reisKlasseXml.child("Totaal").content());
Map<String, BigDecimal> kortingprijzen = new HashMap<>();
for (Xml kortingsPrijsXml : reisKlasseXml.child("Korting").children("Kortingsprijs")) {
kortingprijzen.put(kortingsPrijsXml.attr("name"), new BigDecimal(kortingsPrijsXml.attr("prijs")));
}
reisKlassen.put(klasse, new ReisKlasse(klasse, prijsdelen, totaal, Collections.unmodifiableMap(kortingprijzen)));
}
reisTypes.put(reisTypeNaam, new ReisType(reisTypeNaam, Collections.unmodifiableMap(reisKlassen)));
}
vervoerderKeuzes.put(vervoerderKeuzeNaam, new VervoerderKeuze(vervoerderKeuzeNaam, tariefEenheden, Collections.unmodifiableMap(reisTypes)));
}
return new Prijzen(Collections.unmodifiableMap(vervoerderKeuzes));
} | class class_name[name] begin[{]
method[getModel, return_type[type[Prijzen]], modifier[public], parameter[stream]] begin[{]
local_variable[type[Map], vervoerderKeuzes]
local_variable[type[Xml], xml]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="naam")], member=attr, postfix_operators=[], prefix_operators=[], qualifier=vervoerderKeuze, selectors=[], type_arguments=None), name=vervoerderKeuzeNaam)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Tariefeenheden")], member=child, postfix_operators=[], prefix_operators=[], qualifier=vervoerderKeuze, selectors=[MethodInvocation(arguments=[], member=content, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=tariefEenheden)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashMap, sub_type=None)), name=reisTypes)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ReisType, sub_type=None))], dimensions=[], name=Map, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name")], member=attr, postfix_operators=[], prefix_operators=[], qualifier=reisTypeXml, selectors=[], type_arguments=None), name=reisTypeNaam)], 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=[], dimensions=None, name=HashMap, sub_type=None)), name=reisKlassen)], 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=ReisKlasse, sub_type=None))], dimensions=[], name=Map, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="klasse")], member=attr, postfix_operators=[], prefix_operators=[], qualifier=reisKlasseXml, selectors=[], type_arguments=None)], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=klasse)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=LinkedList, sub_type=None)), name=prijsdelen)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Prijsdeel, sub_type=None))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="vervoerder")], member=attr, postfix_operators=[], prefix_operators=[], qualifier=prijsdeelXml, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="prijs")], member=attr, postfix_operators=[], prefix_operators=[], qualifier=prijsdeelXml, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BigDecimal, sub_type=None)), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="van")], member=attr, postfix_operators=[], prefix_operators=[], qualifier=prijsdeelXml, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="naar")], member=attr, postfix_operators=[], prefix_operators=[], qualifier=prijsdeelXml, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Prijsdeel, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=prijsdelen, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Prijsdeel")], member=children, postfix_operators=[], prefix_operators=[], qualifier=reisKlasseXml, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=prijsdeelXml)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Xml, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Totaal")], member=child, postfix_operators=[], prefix_operators=[], qualifier=reisKlasseXml, selectors=[MethodInvocation(arguments=[], member=content, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BigDecimal, sub_type=None)), name=totaal)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BigDecimal, 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=[], dimensions=None, name=HashMap, sub_type=None)), name=kortingprijzen)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BigDecimal, sub_type=None))], dimensions=[], name=Map, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name")], member=attr, postfix_operators=[], prefix_operators=[], qualifier=kortingsPrijsXml, selectors=[], type_arguments=None), ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="prijs")], member=attr, postfix_operators=[], prefix_operators=[], qualifier=kortingsPrijsXml, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BigDecimal, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=kortingprijzen, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Korting")], member=child, postfix_operators=[], prefix_operators=[], qualifier=reisKlasseXml, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Kortingsprijs")], member=children, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=kortingsPrijsXml)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Xml, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=klasse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=klasse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=prijsdelen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=totaal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=kortingprijzen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmodifiableMap, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ReisKlasse, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=reisKlassen, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ReisKlasse")], member=children, postfix_operators=[], prefix_operators=[], qualifier=reisTypeXml, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=reisKlasseXml)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Xml, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=reisTypeNaam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=reisTypeNaam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=reisKlassen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmodifiableMap, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ReisType, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=reisTypes, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ReisType")], member=children, postfix_operators=[], prefix_operators=[], qualifier=vervoerderKeuze, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=reisTypeXml)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Xml, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=vervoerderKeuzeNaam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=vervoerderKeuzeNaam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tariefEenheden, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=reisTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmodifiableMap, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VervoerderKeuze, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=vervoerderKeuzes, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="VervoerderKeuze")], member=children, postfix_operators=[], prefix_operators=[], qualifier=xml, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=vervoerderKeuze)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Xml, sub_type=None))), label=None)
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=vervoerderKeuzes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unmodifiableMap, postfix_operators=[], prefix_operators=[], qualifier=Collections, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Prijzen, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Prijzen] identifier[getModel] operator[SEP] identifier[InputStream] identifier[stream] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[VervoerderKeuze] operator[>] identifier[vervoerderKeuzes] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Xml] identifier[xml] operator[=] identifier[Xml] operator[SEP] identifier[getXml] operator[SEP] identifier[stream] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Xml] identifier[vervoerderKeuze] operator[:] identifier[xml] operator[SEP] identifier[children] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[vervoerderKeuzeNaam] operator[=] identifier[vervoerderKeuze] operator[SEP] identifier[attr] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[tariefEenheden] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[vervoerderKeuze] operator[SEP] identifier[child] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[content] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[ReisType] operator[>] identifier[reisTypes] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Xml] identifier[reisTypeXml] operator[:] identifier[vervoerderKeuze] operator[SEP] identifier[children] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] identifier[reisTypeNaam] operator[=] identifier[reisTypeXml] operator[SEP] identifier[attr] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[Integer] , identifier[ReisKlasse] operator[>] identifier[reisKlassen] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Xml] identifier[reisKlasseXml] operator[:] identifier[reisTypeXml] operator[SEP] identifier[children] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[int] identifier[klasse] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[reisKlasseXml] operator[SEP] identifier[attr] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Prijsdeel] operator[>] identifier[prijsdelen] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Xml] identifier[prijsdeelXml] operator[:] identifier[reisKlasseXml] operator[SEP] identifier[children] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[prijsdelen] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Prijsdeel] operator[SEP] identifier[prijsdeelXml] operator[SEP] identifier[attr] operator[SEP] literal[String] operator[SEP] , Keyword[new] identifier[BigDecimal] operator[SEP] identifier[prijsdeelXml] operator[SEP] identifier[attr] operator[SEP] literal[String] operator[SEP] operator[SEP] , identifier[prijsdeelXml] operator[SEP] identifier[attr] operator[SEP] literal[String] operator[SEP] , identifier[prijsdeelXml] operator[SEP] identifier[attr] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[BigDecimal] identifier[totaal] operator[=] Keyword[new] identifier[BigDecimal] operator[SEP] identifier[reisKlasseXml] operator[SEP] identifier[child] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[content] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[BigDecimal] operator[>] identifier[kortingprijzen] operator[=] Keyword[new] identifier[HashMap] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Xml] identifier[kortingsPrijsXml] operator[:] identifier[reisKlasseXml] operator[SEP] identifier[child] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[children] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[kortingprijzen] operator[SEP] identifier[put] operator[SEP] identifier[kortingsPrijsXml] operator[SEP] identifier[attr] operator[SEP] literal[String] operator[SEP] , Keyword[new] identifier[BigDecimal] operator[SEP] identifier[kortingsPrijsXml] operator[SEP] identifier[attr] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[reisKlassen] operator[SEP] identifier[put] operator[SEP] identifier[klasse] , Keyword[new] identifier[ReisKlasse] operator[SEP] identifier[klasse] , identifier[prijsdelen] , identifier[totaal] , identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] identifier[kortingprijzen] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[reisTypes] operator[SEP] identifier[put] operator[SEP] identifier[reisTypeNaam] , Keyword[new] identifier[ReisType] operator[SEP] identifier[reisTypeNaam] , identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] identifier[reisKlassen] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[vervoerderKeuzes] operator[SEP] identifier[put] operator[SEP] identifier[vervoerderKeuzeNaam] , Keyword[new] identifier[VervoerderKeuze] operator[SEP] identifier[vervoerderKeuzeNaam] , identifier[tariefEenheden] , identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] identifier[reisTypes] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Prijzen] operator[SEP] identifier[Collections] operator[SEP] identifier[unmodifiableMap] operator[SEP] identifier[vervoerderKeuzes] operator[SEP] operator[SEP] operator[SEP]
}
|
public static ReturnValueBuilder forPlugin(final String name, final ThresholdsEvaluator thr) {
if (thr != null) {
return new ReturnValueBuilder(name, thr);
}
return new ReturnValueBuilder(name, new ThresholdsEvaluatorBuilder().create());
} | class class_name[name] begin[{]
method[forPlugin, return_type[type[ReturnValueBuilder]], modifier[public static], parameter[name, thr]] begin[{]
if[binary_operation[member[.thr], !=, literal[null]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=thr, 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=ReturnValueBuilder, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=create, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ThresholdsEvaluatorBuilder, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ReturnValueBuilder, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ReturnValueBuilder] identifier[forPlugin] operator[SEP] Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[ThresholdsEvaluator] identifier[thr] operator[SEP] {
Keyword[if] operator[SEP] identifier[thr] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[ReturnValueBuilder] operator[SEP] identifier[name] , identifier[thr] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[ReturnValueBuilder] operator[SEP] identifier[name] , Keyword[new] identifier[ThresholdsEvaluatorBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Nonnull
public static char [] decodeBytesToChars (@Nonnull final byte [] aByteArray, @Nonnull final Charset aCharset)
{
return decodeBytesToChars (aByteArray, 0, aByteArray.length, aCharset);
} | class class_name[name] begin[{]
method[decodeBytesToChars, return_type[type[char]], modifier[public static], parameter[aByteArray, aCharset]] begin[{]
return[call[.decodeBytesToChars, parameter[member[.aByteArray], literal[0], member[aByteArray.length], member[.aCharset]]]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] Keyword[char] operator[SEP] operator[SEP] identifier[decodeBytesToChars] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[aByteArray] , annotation[@] identifier[Nonnull] Keyword[final] identifier[Charset] identifier[aCharset] operator[SEP] {
Keyword[return] identifier[decodeBytesToChars] operator[SEP] identifier[aByteArray] , Other[0] , identifier[aByteArray] operator[SEP] identifier[length] , identifier[aCharset] operator[SEP] operator[SEP]
}
|
public double subtract(int[] indices, double val) {
checkIndices(indices);
int c = getConfigIdx(indices);
double prev = values[c];
values[c] = s.minus(values[c], val);
return prev;
} | class class_name[name] begin[{]
method[subtract, return_type[type[double]], modifier[public], parameter[indices, val]] begin[{]
call[.checkIndices, parameter[member[.indices]]]
local_variable[type[int], c]
local_variable[type[double], prev]
assign[member[.values], call[s.minus, parameter[member[.values], member[.val]]]]
return[member[.prev]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[subtract] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[indices] , Keyword[double] identifier[val] operator[SEP] {
identifier[checkIndices] operator[SEP] identifier[indices] operator[SEP] operator[SEP] Keyword[int] identifier[c] operator[=] identifier[getConfigIdx] operator[SEP] identifier[indices] operator[SEP] operator[SEP] Keyword[double] identifier[prev] operator[=] identifier[values] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[c] operator[SEP] operator[=] identifier[s] operator[SEP] identifier[minus] operator[SEP] identifier[values] operator[SEP] identifier[c] operator[SEP] , identifier[val] operator[SEP] operator[SEP] Keyword[return] identifier[prev] operator[SEP]
}
|
public Observable<Page<BuildStepInner>> listAsync(final String resourceGroupName, final String registryName, final String buildTaskName) {
return listWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName)
.map(new Func1<ServiceResponse<Page<BuildStepInner>>, Page<BuildStepInner>>() {
@Override
public Page<BuildStepInner> call(ServiceResponse<Page<BuildStepInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, registryName, buildTaskName]] begin[{]
return[call[.listWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.registryName], member[.buildTaskName]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[BuildStepInner] operator[>] operator[>] identifier[listAsync] operator[SEP] Keyword[final] identifier[String] identifier[resourceGroupName] , Keyword[final] identifier[String] identifier[registryName] , Keyword[final] identifier[String] identifier[buildTaskName] operator[SEP] {
Keyword[return] identifier[listWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[registryName] , identifier[buildTaskName] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[BuildStepInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[BuildStepInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[BuildStepInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[BuildStepInner] 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 <T> T[] convert(Object[] datas, Class<T> clazz) {
if (null == datas) { return null; }
@SuppressWarnings("unchecked")
T[] newDatas = (T[]) Array.newInstance(clazz, datas.length);
for (int i = 0; i < datas.length; i++) {
newDatas[i] = convert(datas[i], clazz);
}
return newDatas;
} | class class_name[name] begin[{]
method[convert, return_type[type[T]], modifier[public], parameter[datas, clazz]] begin[{]
if[binary_operation[literal[null], ==, member[.datas]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[T], newDatas]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newDatas, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=datas, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=convert, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=datas, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.newDatas]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[T] operator[SEP] operator[SEP] identifier[convert] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[datas] , identifier[Class] operator[<] identifier[T] operator[>] identifier[clazz] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[datas] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
} annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[newDatas] operator[=] operator[SEP] identifier[T] operator[SEP] operator[SEP] operator[SEP] identifier[Array] operator[SEP] identifier[newInstance] operator[SEP] identifier[clazz] , identifier[datas] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[datas] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[newDatas] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[convert] operator[SEP] identifier[datas] operator[SEP] identifier[i] operator[SEP] , identifier[clazz] operator[SEP] operator[SEP]
}
Keyword[return] identifier[newDatas] operator[SEP]
}
|
public static void transformDocumentToXml(DomDocument document, StreamResult result) {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
try {
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
synchronized(document) {
transformer.transform(document.getDomSource(), result);
}
} catch (TransformerConfigurationException e) {
throw new ModelIoException("Unable to create a transformer for the model", e);
} catch (TransformerException e) {
throw new ModelIoException("Unable to transform model to xml", e);
}
} | class class_name[name] begin[{]
method[transformDocumentToXml, return_type[void], modifier[public static], parameter[document, result]] begin[{]
local_variable[type[TransformerFactory], transformerFactory]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newTransformer, postfix_operators=[], prefix_operators=[], qualifier=transformerFactory, selectors=[], type_arguments=None), name=transformer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Transformer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ENCODING, postfix_operators=[], prefix_operators=[], qualifier=OutputKeys, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=setOutputProperty, postfix_operators=[], prefix_operators=[], qualifier=transformer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=INDENT, postfix_operators=[], prefix_operators=[], qualifier=OutputKeys, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="yes")], member=setOutputProperty, postfix_operators=[], prefix_operators=[], qualifier=transformer, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="{http://xml.apache.org/xslt}indent-amount"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="2")], member=setOutputProperty, postfix_operators=[], prefix_operators=[], qualifier=transformer, selectors=[], type_arguments=None), label=None), SynchronizedStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDomSource, postfix_operators=[], prefix_operators=[], qualifier=document, selectors=[], type_arguments=None), MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=transform, postfix_operators=[], prefix_operators=[], qualifier=transformer, selectors=[], type_arguments=None), label=None)], label=None, lock=MemberReference(member=document, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to create a transformer for the model"), 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=ModelIoException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TransformerConfigurationException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to transform model to xml"), 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=ModelIoException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TransformerException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[transformDocumentToXml] operator[SEP] identifier[DomDocument] identifier[document] , identifier[StreamResult] identifier[result] operator[SEP] {
identifier[TransformerFactory] identifier[transformerFactory] operator[=] identifier[TransformerFactory] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Transformer] identifier[transformer] operator[=] identifier[transformerFactory] operator[SEP] identifier[newTransformer] operator[SEP] operator[SEP] operator[SEP] identifier[transformer] operator[SEP] identifier[setOutputProperty] operator[SEP] identifier[OutputKeys] operator[SEP] identifier[ENCODING] , literal[String] operator[SEP] operator[SEP] identifier[transformer] operator[SEP] identifier[setOutputProperty] operator[SEP] identifier[OutputKeys] operator[SEP] identifier[INDENT] , literal[String] operator[SEP] operator[SEP] identifier[transformer] operator[SEP] identifier[setOutputProperty] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[document] operator[SEP] {
identifier[transformer] operator[SEP] identifier[transform] operator[SEP] identifier[document] operator[SEP] identifier[getDomSource] operator[SEP] operator[SEP] , identifier[result] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[TransformerConfigurationException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ModelIoException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TransformerException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ModelIoException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static String before(String text, String before) {
if (!text.contains(before)) {
return null;
}
return text.substring(0, text.indexOf(before));
} | class class_name[name] begin[{]
method[before, return_type[type[String]], modifier[public static], parameter[text, before]] begin[{]
if[call[text.contains, parameter[member[.before]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[text.substring, parameter[literal[0], call[text.indexOf, parameter[member[.before]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[before] operator[SEP] identifier[String] identifier[text] , identifier[String] identifier[before] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[text] operator[SEP] identifier[contains] operator[SEP] identifier[before] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[text] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[text] operator[SEP] identifier[indexOf] operator[SEP] identifier[before] operator[SEP] operator[SEP] operator[SEP]
}
|
public PartialResponseInsertType<PartialResponseChangesType<T>> getOrCreateInsert()
{
List<Node> nodeList = childNode.get("insert");
if (nodeList != null && nodeList.size() > 0)
{
return new PartialResponseInsertTypeImpl<PartialResponseChangesType<T>>(this, "insert", childNode, nodeList.get(0));
}
return createInsert();
} | class class_name[name] begin[{]
method[getOrCreateInsert, return_type[type[PartialResponseInsertType]], modifier[public], parameter[]] begin[{]
local_variable[type[List], nodeList]
if[binary_operation[binary_operation[member[.nodeList], !=, literal[null]], &&, binary_operation[call[nodeList.size, parameter[]], >, literal[0]]]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="insert"), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=nodeList, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=PartialResponseChangesType, sub_type=None))], dimensions=None, name=PartialResponseInsertTypeImpl, sub_type=None))]
else begin[{]
None
end[}]
return[call[.createInsert, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[PartialResponseInsertType] operator[<] identifier[PartialResponseChangesType] operator[<] identifier[T] operator[>] operator[>] identifier[getOrCreateInsert] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodeList] operator[!=] Other[null] operator[&&] identifier[nodeList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[PartialResponseInsertTypeImpl] operator[<] identifier[PartialResponseChangesType] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[nodeList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createInsert] operator[SEP] operator[SEP] operator[SEP]
}
|
public static QName getServiceQName(ClassInfo classInfo, String seiClassName, String targetNamespace) {
AnnotationInfo annotationInfo = getAnnotationInfoFromClass(classInfo, "Service QName");
if (annotationInfo == null) {
return null;
}
//serviceName can only be defined in implementation bean, targetNamespace should be the implemented one.
return getQName(classInfo, targetNamespace, annotationInfo.getValue(JaxWsConstants.SERVICENAME_ATTRIBUTE).getStringValue(),
JaxWsConstants.SERVICENAME_ATTRIBUTE_SUFFIX);
} | class class_name[name] begin[{]
method[getServiceQName, return_type[type[QName]], modifier[public static], parameter[classInfo, seiClassName, targetNamespace]] begin[{]
local_variable[type[AnnotationInfo], annotationInfo]
if[binary_operation[member[.annotationInfo], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[.getQName, parameter[member[.classInfo], member[.targetNamespace], call[annotationInfo.getValue, parameter[member[JaxWsConstants.SERVICENAME_ATTRIBUTE]]], member[JaxWsConstants.SERVICENAME_ATTRIBUTE_SUFFIX]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[QName] identifier[getServiceQName] operator[SEP] identifier[ClassInfo] identifier[classInfo] , identifier[String] identifier[seiClassName] , identifier[String] identifier[targetNamespace] operator[SEP] {
identifier[AnnotationInfo] identifier[annotationInfo] operator[=] identifier[getAnnotationInfoFromClass] operator[SEP] identifier[classInfo] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[annotationInfo] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[getQName] operator[SEP] identifier[classInfo] , identifier[targetNamespace] , identifier[annotationInfo] operator[SEP] identifier[getValue] operator[SEP] identifier[JaxWsConstants] operator[SEP] identifier[SERVICENAME_ATTRIBUTE] operator[SEP] operator[SEP] identifier[getStringValue] operator[SEP] operator[SEP] , identifier[JaxWsConstants] operator[SEP] identifier[SERVICENAME_ATTRIBUTE_SUFFIX] operator[SEP] operator[SEP]
}
|
private boolean canCleanStagingData(JobState jobState)
throws IOException {
return this.jobContext.getSemantics() != DeliverySemantics.EXACTLY_ONCE || !this.jobContext.getCommitSequenceStore()
.get().exists(jobState.getJobName());
} | class class_name[name] begin[{]
method[canCleanStagingData, return_type[type[boolean]], modifier[private], parameter[jobState]] begin[{]
return[binary_operation[binary_operation[THIS[member[None.jobContext]call[None.getSemantics, parameter[]]], !=, member[DeliverySemantics.EXACTLY_ONCE]], ||, THIS[member[None.jobContext]call[None.getCommitSequenceStore, parameter[]]call[None.get, parameter[]]call[None.exists, parameter[call[jobState.getJobName, parameter[]]]]]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[canCleanStagingData] operator[SEP] identifier[JobState] identifier[jobState] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] Keyword[this] operator[SEP] identifier[jobContext] operator[SEP] identifier[getSemantics] operator[SEP] operator[SEP] operator[!=] identifier[DeliverySemantics] operator[SEP] identifier[EXACTLY_ONCE] operator[||] operator[!] Keyword[this] operator[SEP] identifier[jobContext] operator[SEP] identifier[getCommitSequenceStore] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[exists] operator[SEP] identifier[jobState] operator[SEP] identifier[getJobName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void stop() {
setLedOn(false);
if (null != blinkFuture) { blinkFuture.cancel(true); }
if (null != blinkService) { blinkService.shutdownNow(); }
} | class class_name[name] begin[{]
method[stop, return_type[void], modifier[public], parameter[]] begin[{]
call[.setLedOn, parameter[literal[false]]]
if[binary_operation[literal[null], !=, member[.blinkFuture]]] begin[{]
call[blinkFuture.cancel, parameter[literal[true]]]
else begin[{]
None
end[}]
if[binary_operation[literal[null], !=, member[.blinkService]]] begin[{]
call[blinkService.shutdownNow, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[stop] operator[SEP] operator[SEP] {
identifier[setLedOn] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] identifier[blinkFuture] operator[SEP] {
identifier[blinkFuture] operator[SEP] identifier[cancel] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[blinkService] operator[SEP] {
identifier[blinkService] operator[SEP] identifier[shutdownNow] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void marshall(PublicEndpoint publicEndpoint, ProtocolMarshaller protocolMarshaller) {
if (publicEndpoint == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(publicEndpoint.getAddress(), ADDRESS_BINDING);
protocolMarshaller.marshall(publicEndpoint.getAttributes(), ATTRIBUTES_BINDING);
protocolMarshaller.marshall(publicEndpoint.getChannelType(), CHANNELTYPE_BINDING);
protocolMarshaller.marshall(publicEndpoint.getDemographic(), DEMOGRAPHIC_BINDING);
protocolMarshaller.marshall(publicEndpoint.getEffectiveDate(), EFFECTIVEDATE_BINDING);
protocolMarshaller.marshall(publicEndpoint.getEndpointStatus(), ENDPOINTSTATUS_BINDING);
protocolMarshaller.marshall(publicEndpoint.getLocation(), LOCATION_BINDING);
protocolMarshaller.marshall(publicEndpoint.getMetrics(), METRICS_BINDING);
protocolMarshaller.marshall(publicEndpoint.getOptOut(), OPTOUT_BINDING);
protocolMarshaller.marshall(publicEndpoint.getRequestId(), REQUESTID_BINDING);
protocolMarshaller.marshall(publicEndpoint.getUser(), USER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[publicEndpoint, protocolMarshaller]] begin[{]
if[binary_operation[member[.publicEndpoint], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAddress, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=ADDRESS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAttributes, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=ATTRIBUTES_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getChannelType, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=CHANNELTYPE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDemographic, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=DEMOGRAPHIC_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEffectiveDate, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=EFFECTIVEDATE_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEndpointStatus, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=ENDPOINTSTATUS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=LOCATION_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMetrics, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=METRICS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOptOut, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=OPTOUT_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRequestId, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=REQUESTID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getUser, postfix_operators=[], prefix_operators=[], qualifier=publicEndpoint, selectors=[], type_arguments=None), MemberReference(member=USER_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[PublicEndpoint] identifier[publicEndpoint] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[publicEndpoint] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] , identifier[ADDRESS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] , identifier[ATTRIBUTES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getChannelType] operator[SEP] operator[SEP] , identifier[CHANNELTYPE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getDemographic] operator[SEP] operator[SEP] , identifier[DEMOGRAPHIC_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getEffectiveDate] operator[SEP] operator[SEP] , identifier[EFFECTIVEDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getEndpointStatus] operator[SEP] operator[SEP] , identifier[ENDPOINTSTATUS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] , identifier[LOCATION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getMetrics] operator[SEP] operator[SEP] , identifier[METRICS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getOptOut] operator[SEP] operator[SEP] , identifier[OPTOUT_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getRequestId] operator[SEP] operator[SEP] , identifier[REQUESTID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[publicEndpoint] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] , identifier[USER_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Override
public ObservableList<PropertySheet.Item> getPropertySheetItems() {
ObservableList<PropertySheet.Item> items = super.getPropertySheetItems();
items.add(new PropertySheet.Item() {
@Override
public Optional<ObservableValue<?>> getObservableValue() {
return Optional.of(displayModeProperty());
}
@Override
public void setValue(Object value) {
setDisplayMode((DisplayMode) value);
}
@Override
public Object getValue() {
return getDisplayMode();
}
@Override
public Class<?> getType() {
return DisplayMode.class;
}
@Override
public String getName() {
return "Display Mode"; //$NON-NLS-1$
}
@Override
public String getDescription() {
return "Grid or Column Layout"; //$NON-NLS-1$
}
@Override
public String getCategory() {
return YEAR_PAGE_CATEGORY;
}
});
return items;
} | class class_name[name] begin[{]
method[getPropertySheetItems, return_type[type[ObservableList]], modifier[public], parameter[]] begin[{]
local_variable[type[ObservableList], items]
call[items.add, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=displayModeProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=of, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=getObservableValue, parameters=[], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=ObservableValue, sub_type=None))], dimensions=[], name=Optional, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DisplayMode, sub_type=None))], member=setDisplayMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=setValue, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getDisplayMode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=getValue, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DisplayMode, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=getType, parameters=[], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Display Mode"), label=None)], documentation=None, modifiers={'public'}, name=getName, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Grid or Column Layout"), label=None)], documentation=None, modifiers={'public'}, name=getDescription, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=YEAR_PAGE_CATEGORY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getCategory, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PropertySheet, sub_type=ReferenceType(arguments=None, dimensions=None, name=Item, sub_type=None)))]]
return[member[.items]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ObservableList] operator[<] identifier[PropertySheet] operator[SEP] identifier[Item] operator[>] identifier[getPropertySheetItems] operator[SEP] operator[SEP] {
identifier[ObservableList] operator[<] identifier[PropertySheet] operator[SEP] identifier[Item] operator[>] identifier[items] operator[=] Keyword[super] operator[SEP] identifier[getPropertySheetItems] operator[SEP] operator[SEP] operator[SEP] identifier[items] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[PropertySheet] operator[SEP] identifier[Item] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Optional] operator[<] identifier[ObservableValue] operator[<] operator[?] operator[>] operator[>] identifier[getObservableValue] operator[SEP] operator[SEP] {
Keyword[return] identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[displayModeProperty] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setValue] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
identifier[setDisplayMode] operator[SEP] operator[SEP] identifier[DisplayMode] operator[SEP] identifier[value] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[getValue] operator[SEP] operator[SEP] {
Keyword[return] identifier[getDisplayMode] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[Class] operator[<] operator[?] operator[>] identifier[getType] operator[SEP] operator[SEP] {
Keyword[return] identifier[DisplayMode] operator[SEP] Keyword[class] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getName] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getDescription] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getCategory] operator[SEP] operator[SEP] {
Keyword[return] identifier[YEAR_PAGE_CATEGORY] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[return] identifier[items] operator[SEP]
}
|
protected Content getNavLinkPrevious() {
if (prev == null) {
return getNavLinkPrevious(null);
} else {
DocPath path = DocPath.relativePath(packagedoc, prev);
return getNavLinkPrevious(path.resolve(DocPaths.PACKAGE_TREE));
}
} | class class_name[name] begin[{]
method[getNavLinkPrevious, return_type[type[Content]], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.prev], ==, literal[null]]] begin[{]
return[call[.getNavLinkPrevious, parameter[literal[null]]]]
else begin[{]
local_variable[type[DocPath], path]
return[call[.getNavLinkPrevious, parameter[call[path.resolve, parameter[member[DocPaths.PACKAGE_TREE]]]]]]
end[}]
end[}]
END[}] | Keyword[protected] identifier[Content] identifier[getNavLinkPrevious] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[prev] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[getNavLinkPrevious] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[DocPath] identifier[path] operator[=] identifier[DocPath] operator[SEP] identifier[relativePath] operator[SEP] identifier[packagedoc] , identifier[prev] operator[SEP] operator[SEP] Keyword[return] identifier[getNavLinkPrevious] operator[SEP] identifier[path] operator[SEP] identifier[resolve] operator[SEP] identifier[DocPaths] operator[SEP] identifier[PACKAGE_TREE] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void putIntBE(final byte[] array, final int offset, final int value) {
array[offset + 3] = (byte) (value );
array[offset + 2] = (byte) (value >>> 8);
array[offset + 1] = (byte) (value >>> 16);
array[offset ] = (byte) (value >>> 24);
} | class class_name[name] begin[{]
method[putIntBE, return_type[void], modifier[public static], parameter[array, offset, value]] begin[{]
assign[member[.array], Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=byte))]
assign[member[.array], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>>), type=BasicType(dimensions=[], name=byte))]
assign[member[.array], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=>>>), type=BasicType(dimensions=[], name=byte))]
assign[member[.array], Cast(expression=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=24), operator=>>>), type=BasicType(dimensions=[], name=byte))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[putIntBE] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[array] , Keyword[final] Keyword[int] identifier[offset] , Keyword[final] Keyword[int] identifier[value] operator[SEP] {
identifier[array] operator[SEP] identifier[offset] operator[+] Other[3] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[array] operator[SEP] identifier[offset] operator[+] Other[2] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[8] operator[SEP] operator[SEP] identifier[array] operator[SEP] identifier[offset] operator[+] Other[1] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[16] operator[SEP] operator[SEP] identifier[array] operator[SEP] identifier[offset] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] operator[>] operator[>] operator[>] Other[24] operator[SEP] operator[SEP]
}
|
public static JedisCluster newJedisCluster(String hostsAndPorts, String password) {
return newJedisCluster(hostsAndPorts, password, Protocol.DEFAULT_TIMEOUT);
} | class class_name[name] begin[{]
method[newJedisCluster, return_type[type[JedisCluster]], modifier[public static], parameter[hostsAndPorts, password]] begin[{]
return[call[.newJedisCluster, parameter[member[.hostsAndPorts], member[.password], member[Protocol.DEFAULT_TIMEOUT]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JedisCluster] identifier[newJedisCluster] operator[SEP] identifier[String] identifier[hostsAndPorts] , identifier[String] identifier[password] operator[SEP] {
Keyword[return] identifier[newJedisCluster] operator[SEP] identifier[hostsAndPorts] , identifier[password] , identifier[Protocol] operator[SEP] identifier[DEFAULT_TIMEOUT] operator[SEP] operator[SEP]
}
|
@SuppressLint("MissingPermission") @RequiresPermission(allOf = {
ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, CHANGE_WIFI_STATE, ACCESS_WIFI_STATE
}) public static Observable<List<ScanResult>> observeWifiAccessPoints(final Context context) {
@SuppressLint("WifiManagerPotentialLeak") final WifiManager wifiManager =
(WifiManager) context.getSystemService(Context.WIFI_SERVICE);
if (wifiManager != null) {
wifiManager.startScan(); // without starting scan, we may never receive any scan results
} else {
Log.w(LOG_TAG, "WifiManager was null, so WiFi scan was not started");
}
final IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.RSSI_CHANGED_ACTION);
filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
return Observable.create(new ObservableOnSubscribe<List<ScanResult>>() {
@Override public void subscribe(final ObservableEmitter<List<ScanResult>> emitter)
throws Exception {
final BroadcastReceiver receiver = createWifiScanResultsReceiver(emitter, wifiManager);
if (wifiManager != null) {
context.registerReceiver(receiver, filter);
} else {
emitter.onError(new RuntimeException(
"WifiManager was null, so BroadcastReceiver for Wifi scan results "
+ "cannot be registered"));
}
Disposable disposable = disposeInUiThread(new Action() {
@Override public void run() {
tryToUnregisterReceiver(context, receiver);
}
});
emitter.setDisposable(disposable);
}
});
} | class class_name[name] begin[{]
method[observeWifiAccessPoints, return_type[type[Observable]], modifier[public static], parameter[context]] begin[{]
local_variable[type[WifiManager], wifiManager]
if[binary_operation[member[.wifiManager], !=, literal[null]]] begin[{]
call[wifiManager.startScan, parameter[]]
else begin[{]
call[Log.w, parameter[member[.LOG_TAG], literal["WifiManager was null, so WiFi scan was not started"]]]
end[}]
local_variable[type[IntentFilter], filter]
call[filter.addAction, parameter[member[WifiManager.RSSI_CHANGED_ACTION]]]
call[filter.addAction, parameter[member[WifiManager.SCAN_RESULTS_AVAILABLE_ACTION]]]
return[call[Observable.create, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=emitter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=wifiManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createWifiScanResultsReceiver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=receiver)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=BroadcastReceiver, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=wifiManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="WifiManager was null, so BroadcastReceiver for Wifi scan results "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="cannot be registered"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None))], member=onError, postfix_operators=[], prefix_operators=[], qualifier=emitter, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=receiver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=registerReceiver, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=receiver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=tryToUnregisterReceiver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Action, sub_type=None))], member=disposeInUiThread, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=disposable)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Disposable, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=disposable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDisposable, postfix_operators=[], prefix_operators=[], qualifier=emitter, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=subscribe, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=emitter, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ScanResult, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=ObservableEmitter, sub_type=None), varargs=False)], return_type=None, throws=['Exception'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ScanResult, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=None, name=ObservableOnSubscribe, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[SuppressLint] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[RequiresPermission] operator[SEP] identifier[allOf] operator[=] {
identifier[ACCESS_COARSE_LOCATION] , identifier[ACCESS_FINE_LOCATION] , identifier[CHANGE_WIFI_STATE] , identifier[ACCESS_WIFI_STATE]
} operator[SEP] Keyword[public] Keyword[static] identifier[Observable] operator[<] identifier[List] operator[<] identifier[ScanResult] operator[>] operator[>] identifier[observeWifiAccessPoints] operator[SEP] Keyword[final] identifier[Context] identifier[context] operator[SEP] {
annotation[@] identifier[SuppressLint] operator[SEP] literal[String] operator[SEP] Keyword[final] identifier[WifiManager] identifier[wifiManager] operator[=] operator[SEP] identifier[WifiManager] operator[SEP] identifier[context] operator[SEP] identifier[getSystemService] operator[SEP] identifier[Context] operator[SEP] identifier[WIFI_SERVICE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[wifiManager] operator[!=] Other[null] operator[SEP] {
identifier[wifiManager] operator[SEP] identifier[startScan] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Log] operator[SEP] identifier[w] operator[SEP] identifier[LOG_TAG] , literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[IntentFilter] identifier[filter] operator[=] Keyword[new] identifier[IntentFilter] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[addAction] operator[SEP] identifier[WifiManager] operator[SEP] identifier[RSSI_CHANGED_ACTION] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[addAction] operator[SEP] identifier[WifiManager] operator[SEP] identifier[SCAN_RESULTS_AVAILABLE_ACTION] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[create] operator[SEP] Keyword[new] identifier[ObservableOnSubscribe] operator[<] identifier[List] operator[<] identifier[ScanResult] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[subscribe] operator[SEP] Keyword[final] identifier[ObservableEmitter] operator[<] identifier[List] operator[<] identifier[ScanResult] operator[>] operator[>] identifier[emitter] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[BroadcastReceiver] identifier[receiver] operator[=] identifier[createWifiScanResultsReceiver] operator[SEP] identifier[emitter] , identifier[wifiManager] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[wifiManager] operator[!=] Other[null] operator[SEP] {
identifier[context] operator[SEP] identifier[registerReceiver] operator[SEP] identifier[receiver] , identifier[filter] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[emitter] operator[SEP] identifier[onError] operator[SEP] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Disposable] identifier[disposable] operator[=] identifier[disposeInUiThread] operator[SEP] Keyword[new] identifier[Action] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
identifier[tryToUnregisterReceiver] operator[SEP] identifier[context] , identifier[receiver] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[emitter] operator[SEP] identifier[setDisposable] operator[SEP] identifier[disposable] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Override
public void modifyAttributes(Name name, int modOp, Attributes attrs)
throws NamingException {
throw new UnsupportedOperationException(NOT_IMPLEMENTED);
} | class class_name[name] begin[{]
method[modifyAttributes, return_type[void], modifier[public], parameter[name, modOp, attrs]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=NOT_IMPLEMENTED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedOperationException, sub_type=None)), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[modifyAttributes] operator[SEP] identifier[Name] identifier[name] , Keyword[int] identifier[modOp] , identifier[Attributes] identifier[attrs] operator[SEP] Keyword[throws] identifier[NamingException] {
Keyword[throw] Keyword[new] identifier[UnsupportedOperationException] operator[SEP] identifier[NOT_IMPLEMENTED] operator[SEP] operator[SEP]
}
|
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfWaterObject() {
if (_GenericApplicationPropertyOfWaterObject == null) {
_GenericApplicationPropertyOfWaterObject = new ArrayList<JAXBElement<Object>>();
}
return this._GenericApplicationPropertyOfWaterObject;
} | class class_name[name] begin[{]
method[get_GenericApplicationPropertyOfWaterObject, return_type[type[List]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[._GenericApplicationPropertyOfWaterObject], ==, literal[null]]] begin[{]
assign[member[._GenericApplicationPropertyOfWaterObject], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=JAXBElement, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
return[THIS[member[None._GenericApplicationPropertyOfWaterObject]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[JAXBElement] operator[<] identifier[Object] operator[>] operator[>] identifier[get_GenericApplicationPropertyOfWaterObject] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[_GenericApplicationPropertyOfWaterObject] operator[==] Other[null] operator[SEP] {
identifier[_GenericApplicationPropertyOfWaterObject] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[JAXBElement] operator[<] identifier[Object] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[_GenericApplicationPropertyOfWaterObject] operator[SEP]
}
|
public ApiResponse<Void> putFleetsFleetIdWithHttpInfo(Long fleetId, String datasource, String token,
FleetNewSettings fleetNewSettings) throws ApiException {
com.squareup.okhttp.Call call = putFleetsFleetIdValidateBeforeCall(fleetId, datasource, token,
fleetNewSettings, null);
return apiClient.execute(call);
} | class class_name[name] begin[{]
method[putFleetsFleetIdWithHttpInfo, return_type[type[ApiResponse]], modifier[public], parameter[fleetId, datasource, token, fleetNewSettings]] begin[{]
local_variable[type[com], call]
return[call[apiClient.execute, parameter[member[.call]]]]
end[}]
END[}] | Keyword[public] identifier[ApiResponse] operator[<] identifier[Void] operator[>] identifier[putFleetsFleetIdWithHttpInfo] operator[SEP] identifier[Long] identifier[fleetId] , identifier[String] identifier[datasource] , identifier[String] identifier[token] , identifier[FleetNewSettings] identifier[fleetNewSettings] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[putFleetsFleetIdValidateBeforeCall] operator[SEP] identifier[fleetId] , identifier[datasource] , identifier[token] , identifier[fleetNewSettings] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[execute] operator[SEP] identifier[call] operator[SEP] operator[SEP]
}
|
final public TregexPattern Root() throws ParseException {
TregexPattern node;
node = SubNode(Relation.ROOT);
jj_consume_token(11);
{if (true) return node;}
throw new Error("Missing return statement in function");
} | class class_name[name] begin[{]
method[Root, return_type[type[TregexPattern]], modifier[final public], parameter[]] begin[{]
local_variable[type[TregexPattern], node]
assign[member[.node], call[.SubNode, parameter[member[Relation.ROOT]]]]
call[.jj_consume_token, parameter[literal[11]]]
if[literal[true]] begin[{]
return[member[.node]]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Missing return statement in function")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Error, sub_type=None)), label=None)
end[}]
END[}] | Keyword[final] Keyword[public] identifier[TregexPattern] identifier[Root] operator[SEP] operator[SEP] Keyword[throws] identifier[ParseException] {
identifier[TregexPattern] identifier[node] operator[SEP] identifier[node] operator[=] identifier[SubNode] operator[SEP] identifier[Relation] operator[SEP] identifier[ROOT] operator[SEP] operator[SEP] identifier[jj_consume_token] operator[SEP] Other[11] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] literal[boolean] operator[SEP] Keyword[return] identifier[node] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[Error] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
protected static PatchElement createPatchElement(final PatchEntry entry, String patchId, final List<ContentModification> modifications) {
final PatchElement patchElement = entry.element;
final PatchElementImpl element = new PatchElementImpl(patchId);
element.setProvider(patchElement.getProvider());
// Add all the rollback actions
element.getModifications().addAll(modifications);
element.setDescription(patchElement.getDescription());
return element;
} | class class_name[name] begin[{]
method[createPatchElement, return_type[type[PatchElement]], modifier[static protected], parameter[entry, patchId, modifications]] begin[{]
local_variable[type[PatchElement], patchElement]
local_variable[type[PatchElementImpl], element]
call[element.setProvider, parameter[call[patchElement.getProvider, parameter[]]]]
call[element.getModifications, parameter[]]
call[element.setDescription, parameter[call[patchElement.getDescription, parameter[]]]]
return[member[.element]]
end[}]
END[}] | Keyword[protected] Keyword[static] identifier[PatchElement] identifier[createPatchElement] operator[SEP] Keyword[final] identifier[PatchEntry] identifier[entry] , identifier[String] identifier[patchId] , Keyword[final] identifier[List] operator[<] identifier[ContentModification] operator[>] identifier[modifications] operator[SEP] {
Keyword[final] identifier[PatchElement] identifier[patchElement] operator[=] identifier[entry] operator[SEP] identifier[element] operator[SEP] Keyword[final] identifier[PatchElementImpl] identifier[element] operator[=] Keyword[new] identifier[PatchElementImpl] operator[SEP] identifier[patchId] operator[SEP] operator[SEP] identifier[element] operator[SEP] identifier[setProvider] operator[SEP] identifier[patchElement] operator[SEP] identifier[getProvider] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[element] operator[SEP] identifier[getModifications] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[modifications] operator[SEP] operator[SEP] identifier[element] operator[SEP] identifier[setDescription] operator[SEP] identifier[patchElement] operator[SEP] identifier[getDescription] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[element] operator[SEP]
}
|
public CompletableFuture<CloseableResource<T>> getResource() {
CompletableFuture<CloseableResource<T>> future;
boolean tryCreateNewResource = false;
synchronized (lock) {
T t = idleResources.poll();
if (t != null) {
// return the object from the queue
future = CompletableFuture.completedFuture(new CloseableResource<>(t, this));
} else {
future = new CompletableFuture<>();
WaitingRequest<T> request = new WaitingRequest<>(future);
waitQueue.add(request);
tryCreateNewResource = true;
}
}
if (tryCreateNewResource) {
tryCreateNewResource();
}
return future;
} | class class_name[name] begin[{]
method[getResource, return_type[type[CompletableFuture]], modifier[public], parameter[]] begin[{]
local_variable[type[CompletableFuture], future]
local_variable[type[boolean], tryCreateNewResource]
SYNCHRONIZED[member[.lock]] BEGIN[{]
local_variable[type[T], t]
if[binary_operation[member[.t], !=, literal[null]]] begin[{]
assign[member[.future], call[CompletableFuture.completedFuture, parameter[ClassCreator(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=CloseableResource, sub_type=None))]]]
else begin[{]
assign[member[.future], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=CompletableFuture, sub_type=None))]
local_variable[type[WaitingRequest], request]
call[waitQueue.add, parameter[member[.request]]]
assign[member[.tryCreateNewResource], literal[true]]
end[}]
END[}]
if[member[.tryCreateNewResource]] begin[{]
call[.tryCreateNewResource, parameter[]]
else begin[{]
None
end[}]
return[member[.future]]
end[}]
END[}] | Keyword[public] identifier[CompletableFuture] operator[<] identifier[CloseableResource] operator[<] identifier[T] operator[>] operator[>] identifier[getResource] operator[SEP] operator[SEP] {
identifier[CompletableFuture] operator[<] identifier[CloseableResource] operator[<] identifier[T] operator[>] operator[>] identifier[future] operator[SEP] Keyword[boolean] identifier[tryCreateNewResource] operator[=] literal[boolean] operator[SEP] Keyword[synchronized] operator[SEP] identifier[lock] operator[SEP] {
identifier[T] identifier[t] operator[=] identifier[idleResources] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] {
identifier[future] operator[=] identifier[CompletableFuture] operator[SEP] identifier[completedFuture] operator[SEP] Keyword[new] identifier[CloseableResource] operator[<] operator[>] operator[SEP] identifier[t] , Keyword[this] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[future] operator[=] Keyword[new] identifier[CompletableFuture] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[WaitingRequest] operator[<] identifier[T] operator[>] identifier[request] operator[=] Keyword[new] identifier[WaitingRequest] operator[<] operator[>] operator[SEP] identifier[future] operator[SEP] operator[SEP] identifier[waitQueue] operator[SEP] identifier[add] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[tryCreateNewResource] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[tryCreateNewResource] operator[SEP] {
identifier[tryCreateNewResource] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[future] operator[SEP]
}
|
public static com.liferay.commerce.product.model.CPAttachmentFileEntry addCPAttachmentFileEntry(
com.liferay.commerce.product.model.CPAttachmentFileEntry cpAttachmentFileEntry) {
return getService().addCPAttachmentFileEntry(cpAttachmentFileEntry);
} | class class_name[name] begin[{]
method[addCPAttachmentFileEntry, return_type[type[com]], modifier[public static], parameter[cpAttachmentFileEntry]] begin[{]
return[call[.getService, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[product] operator[SEP] identifier[model] operator[SEP] identifier[CPAttachmentFileEntry] identifier[addCPAttachmentFileEntry] operator[SEP] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[product] operator[SEP] identifier[model] operator[SEP] identifier[CPAttachmentFileEntry] identifier[cpAttachmentFileEntry] operator[SEP] {
Keyword[return] identifier[getService] operator[SEP] operator[SEP] operator[SEP] identifier[addCPAttachmentFileEntry] operator[SEP] identifier[cpAttachmentFileEntry] operator[SEP] operator[SEP]
}
|
@Override
public EClass getIfcBuildingElementProxyType() {
if (ifcBuildingElementProxyTypeEClass == null) {
ifcBuildingElementProxyTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(62);
}
return ifcBuildingElementProxyTypeEClass;
} | class class_name[name] begin[{]
method[getIfcBuildingElementProxyType, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcBuildingElementProxyTypeEClass], ==, literal[null]]] begin[{]
assign[member[.ifcBuildingElementProxyTypeEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=62)], 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[.ifcBuildingElementProxyTypeEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcBuildingElementProxyType] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcBuildingElementProxyTypeEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcBuildingElementProxyTypeEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[62] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcBuildingElementProxyTypeEClass] operator[SEP]
}
|
@Override
public final Object read(final Map<String, Object> pAddParam,
final Reader pReader) throws Exception {
Map<String, String> attributesMap = readAttributes(pAddParam, pReader);
if (attributesMap.get("class") == null) {
throw new ExceptionWithCode(ExceptionWithCode
.CONFIGURATION_MISTAKE, "There is no class attribute for entity!");
}
Class entityClass = Class.forName(attributesMap.get("class"));
@SuppressWarnings("unchecked")
Constructor constructor = entityClass.getDeclaredConstructor();
Object entity = constructor.newInstance();
Map<String, Map<String, String>> fieldsSettingsMap =
getMngSettings().lazFldsSts(entityClass);
for (Map.Entry<String, Map<String, String>> entry
: fieldsSettingsMap.entrySet()) {
if ("true".equals(entry.getValue().get("isEnabled"))
&& attributesMap.get(entry.getKey()) != null) {
ISrvEntityFieldFiller srvEntityFieldFiller = getFieldsFillersMap()
.get(entry.getValue().get("ISrvEntityFieldFiller"));
if (srvEntityFieldFiller == null) {
throw new ExceptionWithCode(ExceptionWithCode
.CONFIGURATION_MISTAKE, "There is no ISrvEntityFieldFiller "
+ entry.getValue().get("ISrvEntityFieldFiller") + " for "
+ entityClass + " / " + entry.getKey());
}
srvEntityFieldFiller.fill(pAddParam, entity, entry.getKey(),
attributesMap.get(entry.getKey()));
}
}
return entity;
} | class class_name[name] begin[{]
method[read, return_type[type[Object]], modifier[final public], parameter[pAddParam, pReader]] begin[{]
local_variable[type[Map], attributesMap]
if[binary_operation[call[attributesMap.get, parameter[literal["class"]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=CONFIGURATION_MISTAKE, postfix_operators=[], prefix_operators=[], qualifier=ExceptionWithCode, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="There is no class attribute for entity!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExceptionWithCode, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Class], entityClass]
local_variable[type[Constructor], constructor]
local_variable[type[Object], entity]
local_variable[type[Map], fieldsSettingsMap]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="isEnabled")], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="true"), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=attributesMap, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getFieldsFillersMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ISrvEntityFieldFiller")], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=srvEntityFieldFiller)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ISrvEntityFieldFiller, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=srvEntityFieldFiller, 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=[MemberReference(member=CONFIGURATION_MISTAKE, postfix_operators=[], prefix_operators=[], qualifier=ExceptionWithCode, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="There is no ISrvEntityFieldFiller "), operandr=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ISrvEntityFieldFiller")], member=get, 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=" for "), operator=+), operandr=MemberReference(member=entityClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" / "), operator=+), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, 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=ExceptionWithCode, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pAddParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=attributesMap, selectors=[], type_arguments=None)], member=fill, postfix_operators=[], prefix_operators=[], qualifier=srvEntityFieldFiller, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=fieldsSettingsMap, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
return[member[.entity]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] identifier[Object] identifier[read] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[pAddParam] , Keyword[final] identifier[Reader] identifier[pReader] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[attributesMap] operator[=] identifier[readAttributes] operator[SEP] identifier[pAddParam] , identifier[pReader] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attributesMap] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ExceptionWithCode] operator[SEP] identifier[ExceptionWithCode] operator[SEP] identifier[CONFIGURATION_MISTAKE] , literal[String] operator[SEP] operator[SEP]
}
identifier[Class] identifier[entityClass] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[attributesMap] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Constructor] identifier[constructor] operator[=] identifier[entityClass] operator[SEP] identifier[getDeclaredConstructor] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[entity] operator[=] identifier[constructor] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[fieldsSettingsMap] operator[=] identifier[getMngSettings] operator[SEP] operator[SEP] operator[SEP] identifier[lazFldsSts] operator[SEP] identifier[entityClass] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] operator[>] identifier[entry] operator[:] identifier[fieldsSettingsMap] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[&&] identifier[attributesMap] operator[SEP] identifier[get] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[ISrvEntityFieldFiller] identifier[srvEntityFieldFiller] operator[=] identifier[getFieldsFillersMap] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[srvEntityFieldFiller] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ExceptionWithCode] operator[SEP] identifier[ExceptionWithCode] operator[SEP] identifier[CONFIGURATION_MISTAKE] , literal[String] operator[+] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[+] literal[String] operator[+] identifier[entityClass] operator[+] literal[String] operator[+] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[srvEntityFieldFiller] operator[SEP] identifier[fill] operator[SEP] identifier[pAddParam] , identifier[entity] , identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[attributesMap] operator[SEP] identifier[get] operator[SEP] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[entity] operator[SEP]
}
|
public static base_responses update(nitro_service client, appqoeaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
appqoeaction updateresources[] = new appqoeaction[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new appqoeaction();
updateresources[i].name = resources[i].name;
updateresources[i].priority = resources[i].priority;
updateresources[i].altcontentsvcname = resources[i].altcontentsvcname;
updateresources[i].altcontentpath = resources[i].altcontentpath;
updateresources[i].polqdepth = resources[i].polqdepth;
updateresources[i].priqdepth = resources[i].priqdepth;
updateresources[i].maxconn = resources[i].maxconn;
updateresources[i].delay = resources[i].delay;
updateresources[i].dostrigexpression = resources[i].dostrigexpression;
updateresources[i].dosaction = resources[i].dosaction;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | class class_name[name] begin[{]
method[update, return_type[type[base_responses]], modifier[public static], parameter[client, resources]] begin[{]
local_variable[type[base_responses], result]
if[binary_operation[binary_operation[member[.resources], !=, literal[null]], &&, binary_operation[member[resources.length], >, literal[0]]]] begin[{]
local_variable[type[appqoeaction], updateresources]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=appqoeaction, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=name, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=priority, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=priority, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=altcontentsvcname, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=altcontentsvcname, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=altcontentpath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=altcontentpath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=polqdepth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=polqdepth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=priqdepth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=priqdepth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=maxconn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=maxconn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=delay, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=delay, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=dostrigexpression, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=dostrigexpression, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=updateresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=dosaction, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=resources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=dosaction, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=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=resources, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.result], call[.update_bulk_request, parameter[member[.client], member[.updateresources]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_responses] identifier[update] operator[SEP] identifier[nitro_service] identifier[client] , identifier[appqoeaction] identifier[resources] operator[SEP] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[base_responses] identifier[result] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[resources] operator[!=] Other[null] operator[&&] identifier[resources] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[appqoeaction] identifier[updateresources] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[appqoeaction] operator[SEP] identifier[resources] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[resources] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[appqoeaction] operator[SEP] operator[SEP] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[name] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[name] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[priority] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[priority] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[altcontentsvcname] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[altcontentsvcname] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[altcontentpath] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[altcontentpath] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[polqdepth] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[polqdepth] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[priqdepth] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[priqdepth] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[maxconn] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[maxconn] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[delay] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[delay] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[dostrigexpression] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[dostrigexpression] operator[SEP] identifier[updateresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[dosaction] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[dosaction] operator[SEP]
}
identifier[result] operator[=] identifier[update_bulk_request] operator[SEP] identifier[client] , identifier[updateresources] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public StringType addProgramNameElement() {//2
StringType t = new StringType();
if (this.programName == null)
this.programName = new ArrayList<StringType>();
this.programName.add(t);
return t;
} | class class_name[name] begin[{]
method[addProgramNameElement, return_type[type[StringType]], modifier[public], parameter[]] begin[{]
local_variable[type[StringType], t]
if[binary_operation[THIS[member[None.programName]], ==, literal[null]]] begin[{]
assign[THIS[member[None.programName]], 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=StringType, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.programName]call[None.add, parameter[member[.t]]]]
return[member[.t]]
end[}]
END[}] | Keyword[public] identifier[StringType] identifier[addProgramNameElement] operator[SEP] operator[SEP] {
identifier[StringType] identifier[t] operator[=] Keyword[new] identifier[StringType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[programName] operator[==] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[programName] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[StringType] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[programName] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[return] identifier[t] operator[SEP]
}
|
@GET
@Path("{typeName}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response getDefinition(@Context HttpServletRequest request, @PathParam("typeName") String typeName) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> TypesResource.getDefinition({})", typeName);
}
AtlasPerfTracer perf = null;
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TypesResource.getDefinition(" + typeName + ")");
}
JSONObject response = new JSONObject();
try {
TypesDef typesDef = TypeConverterUtil.toTypesDef(typeRegistry.getType(typeName), typeRegistry);;
String typeDefinition = TypesSerialization.toJson(typesDef);
response.put(AtlasClient.TYPENAME, typeName);
response.put(AtlasClient.DEFINITION, new JSONObject(typeDefinition));
response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId());
return Response.ok(response).build();
} catch (AtlasBaseException e) {
LOG.error("Unable to get type definition for type {}", typeName, e);
throw new WebApplicationException(Servlets.getErrorResponse(e));
} catch (JSONException | IllegalArgumentException e) {
LOG.error("Unable to get type definition for type {}", typeName, e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (WebApplicationException e) {
LOG.error("Unable to get type definition for type {}", typeName, e);
throw e;
} catch (Throwable e) {
LOG.error("Unable to get type definition for type {}", typeName, e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
} finally {
AtlasPerfTracer.log(perf);
if (LOG.isDebugEnabled()) {
LOG.debug("<== TypesResource.getDefinition({})", typeName);
}
}
} | class class_name[name] begin[{]
method[getDefinition, return_type[type[Response]], modifier[public], parameter[request, typeName]] begin[{]
if[call[LOG.isDebugEnabled, parameter[]]] begin[{]
call[LOG.debug, parameter[literal["==> TypesResource.getDefinition({})"], member[.typeName]]]
else begin[{]
None
end[}]
local_variable[type[AtlasPerfTracer], perf]
if[call[AtlasPerfTracer.isPerfTraceEnabled, parameter[member[.PERF_LOG]]]] begin[{]
assign[member[.perf], call[AtlasPerfTracer.getPerfTracer, parameter[member[.PERF_LOG], binary_operation[binary_operation[literal["TypesResource.getDefinition("], +, member[.typeName]], +, literal[")"]]]]]
else begin[{]
None
end[}]
local_variable[type[JSONObject], response]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getType, postfix_operators=[], prefix_operators=[], qualifier=typeRegistry, selectors=[], type_arguments=None), MemberReference(member=typeRegistry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toTypesDef, postfix_operators=[], prefix_operators=[], qualifier=TypeConverterUtil, selectors=[], type_arguments=None), name=typesDef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TypesDef, sub_type=None)), Statement(label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=typesDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toJson, postfix_operators=[], prefix_operators=[], qualifier=TypesSerialization, selectors=[], type_arguments=None), name=typeDefinition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TYPENAME, postfix_operators=[], prefix_operators=[], qualifier=AtlasClient, selectors=[]), MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DEFINITION, postfix_operators=[], prefix_operators=[], qualifier=AtlasClient, selectors=[]), ClassCreator(arguments=[MemberReference(member=typeDefinition, 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=JSONObject, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=REQUEST_ID, postfix_operators=[], prefix_operators=[], qualifier=AtlasClient, selectors=[]), MethodInvocation(arguments=[], member=getRequestId, postfix_operators=[], prefix_operators=[], qualifier=Servlets, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ok, postfix_operators=[], prefix_operators=[], qualifier=Response, selectors=[MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to get type definition for type {}"), MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getErrorResponse, postfix_operators=[], prefix_operators=[], qualifier=Servlets, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebApplicationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['AtlasBaseException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to get type definition for type {}"), MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=BAD_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=Response.Status, selectors=[])], member=getErrorResponse, postfix_operators=[], prefix_operators=[], qualifier=Servlets, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebApplicationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JSONException', 'IllegalArgumentException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to get type definition for type {}"), MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['WebApplicationException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to get type definition for type {}"), MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=INTERNAL_SERVER_ERROR, postfix_operators=[], prefix_operators=[], qualifier=Response.Status, selectors=[])], member=getErrorResponse, postfix_operators=[], prefix_operators=[], qualifier=Servlets, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebApplicationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=perf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=AtlasPerfTracer, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<== TypesResource.getDefinition({})"), MemberReference(member=typeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[GET] annotation[@] identifier[Path] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Produces] operator[SEP] identifier[Servlets] operator[SEP] identifier[JSON_MEDIA_TYPE] operator[SEP] Keyword[public] identifier[Response] identifier[getDefinition] operator[SEP] annotation[@] identifier[Context] identifier[HttpServletRequest] identifier[request] , annotation[@] identifier[PathParam] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[typeName] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[typeName] operator[SEP] operator[SEP]
}
identifier[AtlasPerfTracer] identifier[perf] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[AtlasPerfTracer] operator[SEP] identifier[isPerfTraceEnabled] operator[SEP] identifier[PERF_LOG] operator[SEP] operator[SEP] {
identifier[perf] operator[=] identifier[AtlasPerfTracer] operator[SEP] identifier[getPerfTracer] operator[SEP] identifier[PERF_LOG] , literal[String] operator[+] identifier[typeName] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[JSONObject] identifier[response] operator[=] Keyword[new] identifier[JSONObject] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[TypesDef] identifier[typesDef] operator[=] identifier[TypeConverterUtil] operator[SEP] identifier[toTypesDef] operator[SEP] identifier[typeRegistry] operator[SEP] identifier[getType] operator[SEP] identifier[typeName] operator[SEP] , identifier[typeRegistry] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[typeDefinition] operator[=] identifier[TypesSerialization] operator[SEP] identifier[toJson] operator[SEP] identifier[typesDef] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[put] operator[SEP] identifier[AtlasClient] operator[SEP] identifier[TYPENAME] , identifier[typeName] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[put] operator[SEP] identifier[AtlasClient] operator[SEP] identifier[DEFINITION] , Keyword[new] identifier[JSONObject] operator[SEP] identifier[typeDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[put] operator[SEP] identifier[AtlasClient] operator[SEP] identifier[REQUEST_ID] , identifier[Servlets] operator[SEP] identifier[getRequestId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[Response] operator[SEP] identifier[ok] operator[SEP] identifier[response] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AtlasBaseException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[typeName] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[WebApplicationException] operator[SEP] identifier[Servlets] operator[SEP] identifier[getErrorResponse] operator[SEP] identifier[e] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JSONException] operator[|] identifier[IllegalArgumentException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[typeName] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[WebApplicationException] operator[SEP] identifier[Servlets] operator[SEP] identifier[getErrorResponse] operator[SEP] identifier[e] , identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[BAD_REQUEST] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[WebApplicationException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[typeName] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[typeName] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[WebApplicationException] operator[SEP] identifier[Servlets] operator[SEP] identifier[getErrorResponse] operator[SEP] identifier[e] , identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[INTERNAL_SERVER_ERROR] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[AtlasPerfTracer] operator[SEP] identifier[log] operator[SEP] identifier[perf] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[typeName] operator[SEP] operator[SEP]
}
}
}
|
private void locateNode(final String address, final Iterator<String> nodes, final Handler<AsyncResult<String>> doneHandler) {
if (nodes.hasNext()) {
final String node = nodes.next();
vertx.eventBus().sendWithTimeout(node, new JsonObject().putString("action", "ping"), 1000, new Handler<AsyncResult<Message<JsonObject>>>() {
@Override
public void handle(AsyncResult<Message<JsonObject>> result) {
if (result.failed() || result.result().body().getString("status", "ok").equals("error")) {
removeNode(address, node);
locateNode(address, nodes, doneHandler);
} else {
new DefaultFutureResult<String>(node).setHandler(doneHandler);
}
}
});
} else {
new DefaultFutureResult<String>(new IllegalStateException("No local nodes found")).setHandler(doneHandler);
}
} | class class_name[name] begin[{]
method[locateNode, return_type[void], modifier[private], parameter[address, nodes, doneHandler]] begin[{]
if[call[nodes.hasNext, parameter[]]] begin[{]
local_variable[type[String], node]
call[vertx.eventBus, parameter[]]
else begin[{]
ClassCreator(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No local nodes found")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=doneHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setHandler, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=DefaultFutureResult, sub_type=None))
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[locateNode] operator[SEP] Keyword[final] identifier[String] identifier[address] , Keyword[final] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[nodes] , Keyword[final] identifier[Handler] operator[<] identifier[AsyncResult] operator[<] identifier[String] operator[>] operator[>] identifier[doneHandler] operator[SEP] {
Keyword[if] operator[SEP] identifier[nodes] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[node] operator[=] identifier[nodes] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[vertx] operator[SEP] identifier[eventBus] operator[SEP] operator[SEP] operator[SEP] identifier[sendWithTimeout] operator[SEP] identifier[node] , Keyword[new] identifier[JsonObject] operator[SEP] operator[SEP] operator[SEP] identifier[putString] operator[SEP] literal[String] , literal[String] operator[SEP] , Other[1000] , Keyword[new] identifier[Handler] operator[<] identifier[AsyncResult] operator[<] identifier[Message] operator[<] identifier[JsonObject] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handle] operator[SEP] identifier[AsyncResult] operator[<] identifier[Message] operator[<] identifier[JsonObject] operator[>] operator[>] identifier[result] operator[SEP] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[failed] operator[SEP] operator[SEP] operator[||] identifier[result] operator[SEP] identifier[result] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP] identifier[getString] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[removeNode] operator[SEP] identifier[address] , identifier[node] operator[SEP] operator[SEP] identifier[locateNode] operator[SEP] identifier[address] , identifier[nodes] , identifier[doneHandler] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[new] identifier[DefaultFutureResult] operator[<] identifier[String] operator[>] operator[SEP] identifier[node] operator[SEP] operator[SEP] identifier[setHandler] operator[SEP] identifier[doneHandler] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[new] identifier[DefaultFutureResult] operator[<] identifier[String] operator[>] operator[SEP] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[setHandler] operator[SEP] identifier[doneHandler] operator[SEP] operator[SEP]
}
}
|
public static String findIpAddress( String networkInterface ) {
String ipAddress = null;
Logger logger = Logger.getLogger( AgentUtils.class.getName());
try {
// Try the network interface
NetworkInterface nif;
if( networkInterface != null
&& ! AgentConstants.DEFAULT_NETWORK_INTERFACE.equalsIgnoreCase( networkInterface )
&& (nif = NetworkInterface.getByName( networkInterface )) != null ) {
Enumeration<InetAddress> addrs = nif.getInetAddresses();
while( addrs.hasMoreElements()
&& (ipAddress == null || ipAddress.startsWith( "127.0" ))) {
Object obj = addrs.nextElement();
if( !( obj instanceof Inet4Address ))
continue;
ipAddress = obj.toString();
if( ipAddress.startsWith( "/" ))
ipAddress = ipAddress.substring( 1 );
}
} else if( ! AgentConstants.DEFAULT_NETWORK_INTERFACE.equalsIgnoreCase( networkInterface )) {
logger.severe( "Network interface " + networkInterface + " does not exists. The host's default IP will be picked up." );
}
// Otherwise, use the default address
if( ipAddress == null ) {
logger.fine( "Picking up the host's default IP address." );
ipAddress = InetAddress.getLocalHost().getHostAddress();
}
} catch( Exception e ) {
ipAddress = "127.0.0.1";
logger.warning( "The IP address could not be found. " + e.getMessage());
Utils.logException( logger, e );
}
logger.info( "The agent's address was resolved to " + ipAddress );
return ipAddress;
} | class class_name[name] begin[{]
method[findIpAddress, return_type[type[String]], modifier[public static], parameter[networkInterface]] begin[{]
local_variable[type[String], ipAddress]
local_variable[type[Logger], logger]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=nif)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NetworkInterface, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=networkInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=networkInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=['!'], qualifier=AgentConstants.DEFAULT_NETWORK_INTERFACE, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=nif, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=networkInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getByName, postfix_operators=[], prefix_operators=[], qualifier=NetworkInterface, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=networkInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=['!'], qualifier=AgentConstants.DEFAULT_NETWORK_INTERFACE, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Network interface "), operandr=MemberReference(member=networkInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" does not exists. The host's default IP will be picked up."), operator=+)], member=severe, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInetAddresses, postfix_operators=[], prefix_operators=[], qualifier=nif, selectors=[], type_arguments=None), name=addrs)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InetAddress, sub_type=None))], dimensions=[], name=Enumeration, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=addrs, selectors=[], type_arguments=None), name=obj)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Inet4Address, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=obj, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=ipAddress, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=ipAddress, selectors=[], type_arguments=None)), label=None))]), condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=addrs, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="127.0")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=ipAddress, selectors=[], type_arguments=None), operator=||), operator=&&), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Picking up the host's default IP address.")], member=fine, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getLocalHost, postfix_operators=[], prefix_operators=[], qualifier=InetAddress, selectors=[MethodInvocation(arguments=[], member=getHostAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ipAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="127.0.0.1")), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The IP address could not be found. "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], member=warning, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=logger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=logException, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
call[logger.info, parameter[binary_operation[literal["The agent's address was resolved to "], +, member[.ipAddress]]]]
return[member[.ipAddress]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[findIpAddress] operator[SEP] identifier[String] identifier[networkInterface] operator[SEP] {
identifier[String] identifier[ipAddress] operator[=] Other[null] operator[SEP] identifier[Logger] identifier[logger] operator[=] identifier[Logger] operator[SEP] identifier[getLogger] operator[SEP] identifier[AgentUtils] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[NetworkInterface] identifier[nif] operator[SEP] Keyword[if] operator[SEP] identifier[networkInterface] operator[!=] Other[null] operator[&&] operator[!] identifier[AgentConstants] operator[SEP] identifier[DEFAULT_NETWORK_INTERFACE] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[networkInterface] operator[SEP] operator[&&] operator[SEP] identifier[nif] operator[=] identifier[NetworkInterface] operator[SEP] identifier[getByName] operator[SEP] identifier[networkInterface] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[Enumeration] operator[<] identifier[InetAddress] operator[>] identifier[addrs] operator[=] identifier[nif] operator[SEP] identifier[getInetAddresses] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[addrs] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[ipAddress] operator[==] Other[null] operator[||] identifier[ipAddress] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[obj] operator[=] identifier[addrs] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[obj] Keyword[instanceof] identifier[Inet4Address] operator[SEP] operator[SEP] Keyword[continue] operator[SEP] identifier[ipAddress] operator[=] identifier[obj] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ipAddress] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ipAddress] operator[=] identifier[ipAddress] operator[SEP] identifier[substring] operator[SEP] Other[1] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[AgentConstants] operator[SEP] identifier[DEFAULT_NETWORK_INTERFACE] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[networkInterface] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[severe] operator[SEP] literal[String] operator[+] identifier[networkInterface] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ipAddress] operator[==] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ipAddress] operator[=] identifier[InetAddress] operator[SEP] identifier[getLocalHost] operator[SEP] operator[SEP] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[ipAddress] operator[=] literal[String] operator[SEP] identifier[logger] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[logException] operator[SEP] identifier[logger] , identifier[e] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[ipAddress] operator[SEP] operator[SEP] Keyword[return] identifier[ipAddress] operator[SEP]
}
|
public boolean isContractive(QualifiedName nid, Type type) {
HashSet<QualifiedName> visited = new HashSet<>();
return isContractive(nid, type, visited);
} | class class_name[name] begin[{]
method[isContractive, return_type[type[boolean]], modifier[public], parameter[nid, type]] begin[{]
local_variable[type[HashSet], visited]
return[call[.isContractive, parameter[member[.nid], member[.type], member[.visited]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isContractive] operator[SEP] identifier[QualifiedName] identifier[nid] , identifier[Type] identifier[type] operator[SEP] {
identifier[HashSet] operator[<] identifier[QualifiedName] operator[>] identifier[visited] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[isContractive] operator[SEP] identifier[nid] , identifier[type] , identifier[visited] operator[SEP] operator[SEP]
}
|
@Deprecated
public boolean addCircleToField(ProfileField<?> field, String circle, SPFPersona persona) {
return mProfileTable.addCircleToFields(circle, field, persona);
} | class class_name[name] begin[{]
method[addCircleToField, return_type[type[boolean]], modifier[public], parameter[field, circle, persona]] begin[{]
return[call[mProfileTable.addCircleToFields, parameter[member[.circle], member[.field], member[.persona]]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[boolean] identifier[addCircleToField] operator[SEP] identifier[ProfileField] operator[<] operator[?] operator[>] identifier[field] , identifier[String] identifier[circle] , identifier[SPFPersona] identifier[persona] operator[SEP] {
Keyword[return] identifier[mProfileTable] operator[SEP] identifier[addCircleToFields] operator[SEP] identifier[circle] , identifier[field] , identifier[persona] operator[SEP] operator[SEP]
}
|
public void replaceChildOutputSchemaNames(AbstractPlanNode child) {
NodeSchema childSchema = child.getTrueOutputSchema(false);
NodeSchema mySchema = getOutputSchema();
assert(childSchema.size() == mySchema.size());
for (int idx = 0; idx < childSchema.size(); idx += 1) {
SchemaColumn cCol = childSchema.getColumn(idx);
SchemaColumn myCol = mySchema.getColumn(idx);
assert(cCol.getValueType() == myCol.getValueType());
assert(cCol.getExpression() instanceof TupleValueExpression);
assert(myCol.getExpression() instanceof TupleValueExpression);
cCol.reset(myCol.getTableName(),
myCol.getTableAlias(),
myCol.getColumnName(),
myCol.getColumnAlias());
}
} | class class_name[name] begin[{]
method[replaceChildOutputSchemaNames, return_type[void], modifier[public], parameter[child]] begin[{]
local_variable[type[NodeSchema], childSchema]
local_variable[type[NodeSchema], mySchema]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=childSchema, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=mySchema, selectors=[], type_arguments=None), operator===), label=None, value=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=childSchema, selectors=[], type_arguments=None), name=cCol)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SchemaColumn, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumn, postfix_operators=[], prefix_operators=[], qualifier=mySchema, selectors=[], type_arguments=None), name=myCol)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SchemaColumn, sub_type=None)), AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValueType, postfix_operators=[], prefix_operators=[], qualifier=cCol, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getValueType, postfix_operators=[], prefix_operators=[], qualifier=myCol, selectors=[], type_arguments=None), operator===), label=None, value=None), AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getExpression, postfix_operators=[], prefix_operators=[], qualifier=cCol, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=TupleValueExpression, sub_type=None), operator=instanceof), label=None, value=None), AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getExpression, postfix_operators=[], prefix_operators=[], qualifier=myCol, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=TupleValueExpression, sub_type=None), operator=instanceof), label=None, value=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=myCol, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getTableAlias, postfix_operators=[], prefix_operators=[], qualifier=myCol, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=myCol, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getColumnAlias, postfix_operators=[], prefix_operators=[], qualifier=myCol, selectors=[], type_arguments=None)], member=reset, postfix_operators=[], prefix_operators=[], qualifier=cCol, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=childSchema, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=idx)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[Assignment(expressionl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[replaceChildOutputSchemaNames] operator[SEP] identifier[AbstractPlanNode] identifier[child] operator[SEP] {
identifier[NodeSchema] identifier[childSchema] operator[=] identifier[child] operator[SEP] identifier[getTrueOutputSchema] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[NodeSchema] identifier[mySchema] operator[=] identifier[getOutputSchema] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[childSchema] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] identifier[mySchema] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[idx] operator[=] Other[0] operator[SEP] identifier[idx] operator[<] identifier[childSchema] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[idx] operator[+=] Other[1] operator[SEP] {
identifier[SchemaColumn] identifier[cCol] operator[=] identifier[childSchema] operator[SEP] identifier[getColumn] operator[SEP] identifier[idx] operator[SEP] operator[SEP] identifier[SchemaColumn] identifier[myCol] operator[=] identifier[mySchema] operator[SEP] identifier[getColumn] operator[SEP] identifier[idx] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[cCol] operator[SEP] identifier[getValueType] operator[SEP] operator[SEP] operator[==] identifier[myCol] operator[SEP] identifier[getValueType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[cCol] operator[SEP] identifier[getExpression] operator[SEP] operator[SEP] Keyword[instanceof] identifier[TupleValueExpression] operator[SEP] operator[SEP] Keyword[assert] operator[SEP] identifier[myCol] operator[SEP] identifier[getExpression] operator[SEP] operator[SEP] Keyword[instanceof] identifier[TupleValueExpression] operator[SEP] operator[SEP] identifier[cCol] operator[SEP] identifier[reset] operator[SEP] identifier[myCol] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] , identifier[myCol] operator[SEP] identifier[getTableAlias] operator[SEP] operator[SEP] , identifier[myCol] operator[SEP] identifier[getColumnName] operator[SEP] operator[SEP] , identifier[myCol] operator[SEP] identifier[getColumnAlias] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static HttpURLConnection deleteShare(final URI uri, final FileRequestOptions fileOptions,
final OperationContext opContext, final AccessCondition accessCondition, String snapshotVersion, DeleteShareSnapshotsOption deleteSnapshotsOption)
throws IOException, URISyntaxException, StorageException {
final UriQueryBuilder shareBuilder = getShareUriQueryBuilder();
FileRequest.addShareSnapshot(shareBuilder, snapshotVersion);
HttpURLConnection request = BaseRequest.delete(uri, fileOptions, shareBuilder, opContext);
if (accessCondition != null) {
accessCondition.applyConditionToRequest(request);
}
switch (deleteSnapshotsOption) {
case NONE:
// nop
break;
case INCLUDE_SNAPSHOTS:
request.setRequestProperty(Constants.HeaderConstants.DELETE_SNAPSHOT_HEADER,
Constants.HeaderConstants.INCLUDE_SNAPSHOTS_VALUE);
break;
default:
break;
}
return request;
} | class class_name[name] begin[{]
method[deleteShare, return_type[type[HttpURLConnection]], modifier[public static], parameter[uri, fileOptions, opContext, accessCondition, snapshotVersion, deleteSnapshotsOption]] begin[{]
local_variable[type[UriQueryBuilder], shareBuilder]
call[FileRequest.addShareSnapshot, parameter[member[.shareBuilder], member[.snapshotVersion]]]
local_variable[type[HttpURLConnection], request]
if[binary_operation[member[.accessCondition], !=, literal[null]]] begin[{]
call[accessCondition.applyConditionToRequest, parameter[member[.request]]]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=['NONE'], statements=[BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['INCLUDE_SNAPSHOTS'], statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=DELETE_SNAPSHOT_HEADER, postfix_operators=[], prefix_operators=[], qualifier=Constants.HeaderConstants, selectors=[]), MemberReference(member=INCLUDE_SNAPSHOTS_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Constants.HeaderConstants, selectors=[])], member=setRequestProperty, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[BreakStatement(goto=None, label=None)])], expression=MemberReference(member=deleteSnapshotsOption, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[member[.request]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[HttpURLConnection] identifier[deleteShare] operator[SEP] Keyword[final] identifier[URI] identifier[uri] , Keyword[final] identifier[FileRequestOptions] identifier[fileOptions] , Keyword[final] identifier[OperationContext] identifier[opContext] , Keyword[final] identifier[AccessCondition] identifier[accessCondition] , identifier[String] identifier[snapshotVersion] , identifier[DeleteShareSnapshotsOption] identifier[deleteSnapshotsOption] operator[SEP] Keyword[throws] identifier[IOException] , identifier[URISyntaxException] , identifier[StorageException] {
Keyword[final] identifier[UriQueryBuilder] identifier[shareBuilder] operator[=] identifier[getShareUriQueryBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[FileRequest] operator[SEP] identifier[addShareSnapshot] operator[SEP] identifier[shareBuilder] , identifier[snapshotVersion] operator[SEP] operator[SEP] identifier[HttpURLConnection] identifier[request] operator[=] identifier[BaseRequest] operator[SEP] identifier[delete] operator[SEP] identifier[uri] , identifier[fileOptions] , identifier[shareBuilder] , identifier[opContext] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[accessCondition] operator[!=] Other[null] operator[SEP] {
identifier[accessCondition] operator[SEP] identifier[applyConditionToRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[deleteSnapshotsOption] operator[SEP] {
Keyword[case] identifier[NONE] operator[:] Keyword[break] operator[SEP] Keyword[case] identifier[INCLUDE_SNAPSHOTS] operator[:] identifier[request] operator[SEP] identifier[setRequestProperty] operator[SEP] identifier[Constants] operator[SEP] identifier[HeaderConstants] operator[SEP] identifier[DELETE_SNAPSHOT_HEADER] , identifier[Constants] operator[SEP] identifier[HeaderConstants] operator[SEP] identifier[INCLUDE_SNAPSHOTS_VALUE] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[break] operator[SEP]
}
Keyword[return] identifier[request] operator[SEP]
}
|
public TableRow nextRow(final Table table, final TableAppender appender) throws IOException {
return this.getRowSecure(table, appender, this.curRowIndex + 1, true);
} | class class_name[name] begin[{]
method[nextRow, return_type[type[TableRow]], modifier[public], parameter[table, appender]] begin[{]
return[THIS[call[None.getRowSecure, parameter[member[.table], member[.appender], binary_operation[THIS[member[None.curRowIndex]], +, literal[1]], literal[true]]]]]
end[}]
END[}] | Keyword[public] identifier[TableRow] identifier[nextRow] operator[SEP] Keyword[final] identifier[Table] identifier[table] , Keyword[final] identifier[TableAppender] identifier[appender] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] Keyword[this] operator[SEP] identifier[getRowSecure] operator[SEP] identifier[table] , identifier[appender] , Keyword[this] operator[SEP] identifier[curRowIndex] operator[+] Other[1] , literal[boolean] operator[SEP] operator[SEP]
}
|
public int getSourceOffset() {
StaticSourceFile file = getStaticSourceFile();
if (file == null) {
return -1;
}
int lineno = getLineno();
if (lineno == -1) {
return -1;
}
return file.getLineOffset(lineno) + getCharno();
} | class class_name[name] begin[{]
method[getSourceOffset, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[StaticSourceFile], file]
if[binary_operation[member[.file], ==, literal[null]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
local_variable[type[int], lineno]
if[binary_operation[member[.lineno], ==, literal[1]]] begin[{]
return[literal[1]]
else begin[{]
None
end[}]
return[binary_operation[call[file.getLineOffset, parameter[member[.lineno]]], +, call[.getCharno, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getSourceOffset] operator[SEP] operator[SEP] {
identifier[StaticSourceFile] identifier[file] operator[=] identifier[getStaticSourceFile] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[file] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[int] identifier[lineno] operator[=] identifier[getLineno] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lineno] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[return] identifier[file] operator[SEP] identifier[getLineOffset] operator[SEP] identifier[lineno] operator[SEP] operator[+] identifier[getCharno] operator[SEP] operator[SEP] operator[SEP]
}
|
protected final StringBuilder getBaseUrl(final HttpServletRequest httpServletRequest) {
StringBuilder baseURL = new StringBuilder();
if (httpServletRequest.getContextPath() != null && !httpServletRequest.getContextPath().isEmpty()) {
baseURL.append(httpServletRequest.getContextPath());
}
if (httpServletRequest.getServletPath() != null && !httpServletRequest.getServletPath().isEmpty()) {
baseURL.append(httpServletRequest.getServletPath());
}
return baseURL;
} | class class_name[name] begin[{]
method[getBaseUrl, return_type[type[StringBuilder]], modifier[final protected], parameter[httpServletRequest]] begin[{]
local_variable[type[StringBuilder], baseURL]
if[binary_operation[binary_operation[call[httpServletRequest.getContextPath, parameter[]], !=, literal[null]], &&, call[httpServletRequest.getContextPath, parameter[]]]] begin[{]
call[baseURL.append, parameter[call[httpServletRequest.getContextPath, parameter[]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[httpServletRequest.getServletPath, parameter[]], !=, literal[null]], &&, call[httpServletRequest.getServletPath, parameter[]]]] begin[{]
call[baseURL.append, parameter[call[httpServletRequest.getServletPath, parameter[]]]]
else begin[{]
None
end[}]
return[member[.baseURL]]
end[}]
END[}] | Keyword[protected] Keyword[final] identifier[StringBuilder] identifier[getBaseUrl] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[httpServletRequest] operator[SEP] {
identifier[StringBuilder] identifier[baseURL] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[httpServletRequest] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] identifier[httpServletRequest] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[baseURL] operator[SEP] identifier[append] operator[SEP] identifier[httpServletRequest] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[httpServletRequest] operator[SEP] identifier[getServletPath] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] identifier[httpServletRequest] operator[SEP] identifier[getServletPath] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[baseURL] operator[SEP] identifier[append] operator[SEP] identifier[httpServletRequest] operator[SEP] identifier[getServletPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[baseURL] operator[SEP]
}
|
protected static void launchNow(final Class<? extends Application> appClass, final String... args) {
Application.launch(appClass, args);
} | class class_name[name] begin[{]
method[launchNow, return_type[void], modifier[static protected], parameter[appClass, args]] begin[{]
call[Application.launch, parameter[member[.appClass], member[.args]]]
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[void] identifier[launchNow] operator[SEP] Keyword[final] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Application] operator[>] identifier[appClass] , Keyword[final] identifier[String] operator[...] identifier[args] operator[SEP] {
identifier[Application] operator[SEP] identifier[launch] operator[SEP] identifier[appClass] , identifier[args] operator[SEP] operator[SEP]
}
|
public CreateIdentityPoolResult withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) {
setIdentityPoolTags(identityPoolTags);
return this;
} | class class_name[name] begin[{]
method[withIdentityPoolTags, return_type[type[CreateIdentityPoolResult]], modifier[public], parameter[identityPoolTags]] begin[{]
call[.setIdentityPoolTags, parameter[member[.identityPoolTags]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CreateIdentityPoolResult] identifier[withIdentityPoolTags] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[identityPoolTags] operator[SEP] {
identifier[setIdentityPoolTags] operator[SEP] identifier[identityPoolTags] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public JSONObject element( String key, Map value ) {
return element( key, value, new JsonConfig() );
} | class class_name[name] begin[{]
method[element, return_type[type[JSONObject]], modifier[public], parameter[key, value]] begin[{]
return[call[.element, parameter[member[.key], member[.value], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JsonConfig, sub_type=None))]]]
end[}]
END[}] | Keyword[public] identifier[JSONObject] identifier[element] operator[SEP] identifier[String] identifier[key] , identifier[Map] identifier[value] operator[SEP] {
Keyword[return] identifier[element] operator[SEP] identifier[key] , identifier[value] , Keyword[new] identifier[JsonConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected int getSelectedTextColor(Context ctx) {
return ColorHolder.color(getSelectedTextColor(), ctx, R.attr.material_drawer_selected_text, R.color.material_drawer_selected_text);
} | class class_name[name] begin[{]
method[getSelectedTextColor, return_type[type[int]], modifier[protected], parameter[ctx]] begin[{]
return[call[ColorHolder.color, parameter[call[.getSelectedTextColor, parameter[]], member[.ctx], member[R.attr.material_drawer_selected_text], member[R.color.material_drawer_selected_text]]]]
end[}]
END[}] | Keyword[protected] Keyword[int] identifier[getSelectedTextColor] operator[SEP] identifier[Context] identifier[ctx] operator[SEP] {
Keyword[return] identifier[ColorHolder] operator[SEP] identifier[color] operator[SEP] identifier[getSelectedTextColor] operator[SEP] operator[SEP] , identifier[ctx] , identifier[R] operator[SEP] identifier[attr] operator[SEP] identifier[material_drawer_selected_text] , identifier[R] operator[SEP] identifier[color] operator[SEP] identifier[material_drawer_selected_text] operator[SEP] operator[SEP]
}
|
public static Instant ofEpochSecond(long epochSecond, long nanoAdjustment) {
long secs = Math.addExact(epochSecond, Math.floorDiv(nanoAdjustment, NANOS_PER_SECOND));
int nos = (int)Math.floorMod(nanoAdjustment, NANOS_PER_SECOND);
return create(secs, nos);
} | class class_name[name] begin[{]
method[ofEpochSecond, return_type[type[Instant]], modifier[public static], parameter[epochSecond, nanoAdjustment]] begin[{]
local_variable[type[long], secs]
local_variable[type[int], nos]
return[call[.create, parameter[member[.secs], member[.nos]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Instant] identifier[ofEpochSecond] operator[SEP] Keyword[long] identifier[epochSecond] , Keyword[long] identifier[nanoAdjustment] operator[SEP] {
Keyword[long] identifier[secs] operator[=] identifier[Math] operator[SEP] identifier[addExact] operator[SEP] identifier[epochSecond] , identifier[Math] operator[SEP] identifier[floorDiv] operator[SEP] identifier[nanoAdjustment] , identifier[NANOS_PER_SECOND] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[nos] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[floorMod] operator[SEP] identifier[nanoAdjustment] , identifier[NANOS_PER_SECOND] operator[SEP] operator[SEP] Keyword[return] identifier[create] operator[SEP] identifier[secs] , identifier[nos] operator[SEP] operator[SEP]
}
|
public static String unescape(String string) {
int length = string.length();
StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; ++i) {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < length) {
int d = JSONTokener.dehexchar(string.charAt(i + 1));
int e = JSONTokener.dehexchar(string.charAt(i + 2));
if (d >= 0 && e >= 0) {
c = (char)(d * 16 + e);
i += 2;
}
}
sb.append(c);
}
return sb.toString();
} | class class_name[name] begin[{]
method[unescape, return_type[type[String]], modifier[public static], parameter[string]] begin[{]
local_variable[type[int], length]
local_variable[type[StringBuilder], sb]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=string, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='+'), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='%'), operator===), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=+), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=string, selectors=[], type_arguments=None)], member=dehexchar, postfix_operators=[], prefix_operators=[], qualifier=JSONTokener, selectors=[], type_arguments=None), name=d)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=+)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=string, selectors=[], type_arguments=None)], member=dehexchar, postfix_operators=[], prefix_operators=[], qualifier=JSONTokener, selectors=[], type_arguments=None), name=e)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=*), operandr=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), type=BasicType(dimensions=[], name=char))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' ')), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, 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[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[unescape] operator[SEP] identifier[String] identifier[string] operator[SEP] {
Keyword[int] identifier[length] operator[=] identifier[string] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[string] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[c] operator[=] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[&&] identifier[i] operator[+] Other[2] operator[<] identifier[length] operator[SEP] {
Keyword[int] identifier[d] operator[=] identifier[JSONTokener] operator[SEP] identifier[dehexchar] operator[SEP] identifier[string] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[e] operator[=] identifier[JSONTokener] operator[SEP] identifier[dehexchar] operator[SEP] identifier[string] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[+] Other[2] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[d] operator[>=] Other[0] operator[&&] identifier[e] operator[>=] Other[0] operator[SEP] {
identifier[c] operator[=] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[d] operator[*] Other[16] operator[+] identifier[e] operator[SEP] operator[SEP] identifier[i] operator[+=] Other[2] operator[SEP]
}
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static ProctorLoadResult verifyWithoutSpecification(@Nonnull final TestMatrixArtifact testMatrix,
final String matrixSource) {
final ProctorLoadResult.Builder resultBuilder = ProctorLoadResult.newBuilder();
for (final Entry<String, ConsumableTestDefinition> entry : testMatrix.getTests().entrySet()) {
final String testName = entry.getKey();
final ConsumableTestDefinition testDefinition = entry.getValue();
try {
verifyInternallyConsistentDefinition(testName, matrixSource, testDefinition);
} catch (IncompatibleTestMatrixException e) {
LOGGER.info(String.format("Unable to load test matrix for %s", testName), e);
resultBuilder.recordError(testName, e);
}
}
return resultBuilder.build();
} | class class_name[name] begin[{]
method[verifyWithoutSpecification, return_type[type[ProctorLoadResult]], modifier[public static], parameter[testMatrix, matrixSource]] begin[{]
local_variable[type[ProctorLoadResult], resultBuilder]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=testName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=testDefinition)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ConsumableTestDefinition, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=testName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=matrixSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=testDefinition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=verifyInternallyConsistentDefinition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to load test matrix for %s"), MemberReference(member=testName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=testName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recordError, postfix_operators=[], prefix_operators=[], qualifier=resultBuilder, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IncompatibleTestMatrixException']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getTests, postfix_operators=[], prefix_operators=[], qualifier=testMatrix, selectors=[MethodInvocation(arguments=[], member=entrySet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ConsumableTestDefinition, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
return[call[resultBuilder.build, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ProctorLoadResult] identifier[verifyWithoutSpecification] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[TestMatrixArtifact] identifier[testMatrix] , Keyword[final] identifier[String] identifier[matrixSource] operator[SEP] {
Keyword[final] identifier[ProctorLoadResult] operator[SEP] identifier[Builder] identifier[resultBuilder] operator[=] identifier[ProctorLoadResult] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Entry] operator[<] identifier[String] , identifier[ConsumableTestDefinition] operator[>] identifier[entry] operator[:] identifier[testMatrix] operator[SEP] identifier[getTests] operator[SEP] operator[SEP] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[testName] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[ConsumableTestDefinition] identifier[testDefinition] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[verifyInternallyConsistentDefinition] operator[SEP] identifier[testName] , identifier[matrixSource] , identifier[testDefinition] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IncompatibleTestMatrixException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[testName] operator[SEP] , identifier[e] operator[SEP] operator[SEP] identifier[resultBuilder] operator[SEP] identifier[recordError] operator[SEP] identifier[testName] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[resultBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void log (@Nonnull final Class <?> aLoggingClass,
@Nonnull final IErrorLevel aErrorLevel,
@Nonnull final String sMsg,
@Nullable final Throwable t)
{
log (LoggerFactory.getLogger (aLoggingClass), aErrorLevel, sMsg, t);
} | class class_name[name] begin[{]
method[log, return_type[void], modifier[public static], parameter[aLoggingClass, aErrorLevel, sMsg, t]] begin[{]
call[.log, parameter[call[LoggerFactory.getLogger, parameter[member[.aLoggingClass]]], member[.aErrorLevel], member[.sMsg], member[.t]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[log] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[aLoggingClass] , annotation[@] identifier[Nonnull] Keyword[final] identifier[IErrorLevel] identifier[aErrorLevel] , annotation[@] identifier[Nonnull] Keyword[final] identifier[String] identifier[sMsg] , annotation[@] identifier[Nullable] Keyword[final] identifier[Throwable] identifier[t] operator[SEP] {
identifier[log] operator[SEP] identifier[LoggerFactory] operator[SEP] identifier[getLogger] operator[SEP] identifier[aLoggingClass] operator[SEP] , identifier[aErrorLevel] , identifier[sMsg] , identifier[t] operator[SEP] operator[SEP]
}
|
public Object createMarshallableObject()
{
wsdlFactory = new org.xmlsoap.schemas.wsdl.ObjectFactory();
// create a wsdl object
TDefinitions TDefinitions = wsdlFactory.createTDefinitions();
JAXBElement<TDefinitions> root = wsdlFactory.createDefinitions(TDefinitions);
String targetNamespace = this.getNamespace(); // Location of this document
TDefinitions.setTargetNamespace(targetNamespace);
// Create the service type
this.addService(TDefinitions);
// Create the bindings type
this.addBindingsType(TDefinitions);
// Create the service type
this.addPort(TDefinitions);
// Create the service type
this.addMessageTypes(TDefinitions);
// Create the interface type
this.addTypeTypes(TDefinitions);
return root;
} | class class_name[name] begin[{]
method[createMarshallableObject, return_type[type[Object]], modifier[public], parameter[]] begin[{]
assign[member[.wsdlFactory], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=org, sub_type=ReferenceType(arguments=None, dimensions=None, name=xmlsoap, sub_type=ReferenceType(arguments=None, dimensions=None, name=schemas, sub_type=ReferenceType(arguments=None, dimensions=None, name=wsdl, sub_type=ReferenceType(arguments=None, dimensions=None, name=ObjectFactory, sub_type=None))))))]
local_variable[type[TDefinitions], TDefinitions]
local_variable[type[JAXBElement], root]
local_variable[type[String], targetNamespace]
call[TDefinitions.setTargetNamespace, parameter[member[.targetNamespace]]]
THIS[call[None.addService, parameter[member[.TDefinitions]]]]
THIS[call[None.addBindingsType, parameter[member[.TDefinitions]]]]
THIS[call[None.addPort, parameter[member[.TDefinitions]]]]
THIS[call[None.addMessageTypes, parameter[member[.TDefinitions]]]]
THIS[call[None.addTypeTypes, parameter[member[.TDefinitions]]]]
return[member[.root]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[createMarshallableObject] operator[SEP] operator[SEP] {
identifier[wsdlFactory] operator[=] Keyword[new] identifier[org] operator[SEP] identifier[xmlsoap] operator[SEP] identifier[schemas] operator[SEP] identifier[wsdl] operator[SEP] identifier[ObjectFactory] operator[SEP] operator[SEP] operator[SEP] identifier[TDefinitions] identifier[TDefinitions] operator[=] identifier[wsdlFactory] operator[SEP] identifier[createTDefinitions] operator[SEP] operator[SEP] operator[SEP] identifier[JAXBElement] operator[<] identifier[TDefinitions] operator[>] identifier[root] operator[=] identifier[wsdlFactory] operator[SEP] identifier[createDefinitions] operator[SEP] identifier[TDefinitions] operator[SEP] operator[SEP] identifier[String] identifier[targetNamespace] operator[=] Keyword[this] operator[SEP] identifier[getNamespace] operator[SEP] operator[SEP] operator[SEP] identifier[TDefinitions] operator[SEP] identifier[setTargetNamespace] operator[SEP] identifier[targetNamespace] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[addService] operator[SEP] identifier[TDefinitions] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[addBindingsType] operator[SEP] identifier[TDefinitions] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[addPort] operator[SEP] identifier[TDefinitions] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[addMessageTypes] operator[SEP] identifier[TDefinitions] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[addTypeTypes] operator[SEP] identifier[TDefinitions] operator[SEP] operator[SEP] Keyword[return] identifier[root] operator[SEP]
}
|
private void paintBackground(SynthContext ctx, Graphics g, int x, int y, int w, int h, int orientation) {
Component c = ctx.getComponent();
boolean ltr = c.getComponentOrientation().isLeftToRight();
// Don't RTL flip JSpliders as they handle it internaly
if (ctx.getComponent() instanceof JSlider)
ltr = true;
if (orientation == SwingConstants.VERTICAL && ltr) {
AffineTransform transform = new AffineTransform();
transform.scale(-1, 1);
transform.rotate(Math.toRadians(90));
paintBackground(ctx, g, y, x, h, w, transform);
} else if (orientation == SwingConstants.VERTICAL) {
AffineTransform transform = new AffineTransform();
transform.rotate(Math.toRadians(90));
transform.translate(0, -(x + w));
paintBackground(ctx, g, y, x, h, w, transform);
} else if (orientation == SwingConstants.HORIZONTAL && ltr) {
paintBackground(ctx, g, x, y, w, h, null);
} else {
// horizontal and right-to-left orientation
AffineTransform transform = new AffineTransform();
transform.translate(x, y);
transform.scale(-1, 1);
transform.translate(-w, 0);
paintBackground(ctx, g, 0, 0, w, h, transform);
}
} | class class_name[name] begin[{]
method[paintBackground, return_type[void], modifier[private], parameter[ctx, g, x, y, w, h, orientation]] begin[{]
local_variable[type[Component], c]
local_variable[type[boolean], ltr]
if[binary_operation[call[ctx.getComponent, parameter[]], instanceof, type[JSlider]]] begin[{]
assign[member[.ltr], literal[true]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.orientation], ==, member[SwingConstants.VERTICAL]], &&, member[.ltr]]] begin[{]
local_variable[type[AffineTransform], transform]
call[transform.scale, parameter[literal[1], literal[1]]]
call[transform.rotate, parameter[call[Math.toRadians, parameter[literal[90]]]]]
call[.paintBackground, parameter[member[.ctx], member[.g], member[.y], member[.x], member[.h], member[.w], member[.transform]]]
else begin[{]
if[binary_operation[member[.orientation], ==, member[SwingConstants.VERTICAL]]] begin[{]
local_variable[type[AffineTransform], transform]
call[transform.rotate, parameter[call[Math.toRadians, parameter[literal[90]]]]]
call[transform.translate, parameter[literal[0], binary_operation[member[.x], +, member[.w]]]]
call[.paintBackground, parameter[member[.ctx], member[.g], member[.y], member[.x], member[.h], member[.w], member[.transform]]]
else begin[{]
if[binary_operation[binary_operation[member[.orientation], ==, member[SwingConstants.HORIZONTAL]], &&, member[.ltr]]] begin[{]
call[.paintBackground, parameter[member[.ctx], member[.g], member[.x], member[.y], member[.w], member[.h], literal[null]]]
else begin[{]
local_variable[type[AffineTransform], transform]
call[transform.translate, parameter[member[.x], member[.y]]]
call[transform.scale, parameter[literal[1], literal[1]]]
call[transform.translate, parameter[member[.w], literal[0]]]
call[.paintBackground, parameter[member[.ctx], member[.g], literal[0], literal[0], member[.w], member[.h], member[.transform]]]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[paintBackground] operator[SEP] identifier[SynthContext] identifier[ctx] , identifier[Graphics] identifier[g] , Keyword[int] identifier[x] , Keyword[int] identifier[y] , Keyword[int] identifier[w] , Keyword[int] identifier[h] , Keyword[int] identifier[orientation] operator[SEP] {
identifier[Component] identifier[c] operator[=] identifier[ctx] operator[SEP] identifier[getComponent] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[ltr] operator[=] identifier[c] operator[SEP] identifier[getComponentOrientation] operator[SEP] operator[SEP] operator[SEP] identifier[isLeftToRight] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ctx] operator[SEP] identifier[getComponent] operator[SEP] operator[SEP] Keyword[instanceof] identifier[JSlider] operator[SEP] identifier[ltr] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[orientation] operator[==] identifier[SwingConstants] operator[SEP] identifier[VERTICAL] operator[&&] identifier[ltr] operator[SEP] {
identifier[AffineTransform] identifier[transform] operator[=] Keyword[new] identifier[AffineTransform] operator[SEP] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[scale] operator[SEP] operator[-] Other[1] , Other[1] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[rotate] operator[SEP] identifier[Math] operator[SEP] identifier[toRadians] operator[SEP] Other[90] operator[SEP] operator[SEP] operator[SEP] identifier[paintBackground] operator[SEP] identifier[ctx] , identifier[g] , identifier[y] , identifier[x] , identifier[h] , identifier[w] , identifier[transform] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[orientation] operator[==] identifier[SwingConstants] operator[SEP] identifier[VERTICAL] operator[SEP] {
identifier[AffineTransform] identifier[transform] operator[=] Keyword[new] identifier[AffineTransform] operator[SEP] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[rotate] operator[SEP] identifier[Math] operator[SEP] identifier[toRadians] operator[SEP] Other[90] operator[SEP] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[translate] operator[SEP] Other[0] , operator[-] operator[SEP] identifier[x] operator[+] identifier[w] operator[SEP] operator[SEP] operator[SEP] identifier[paintBackground] operator[SEP] identifier[ctx] , identifier[g] , identifier[y] , identifier[x] , identifier[h] , identifier[w] , identifier[transform] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[orientation] operator[==] identifier[SwingConstants] operator[SEP] identifier[HORIZONTAL] operator[&&] identifier[ltr] operator[SEP] {
identifier[paintBackground] operator[SEP] identifier[ctx] , identifier[g] , identifier[x] , identifier[y] , identifier[w] , identifier[h] , Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[AffineTransform] identifier[transform] operator[=] Keyword[new] identifier[AffineTransform] operator[SEP] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[translate] operator[SEP] identifier[x] , identifier[y] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[scale] operator[SEP] operator[-] Other[1] , Other[1] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[translate] operator[SEP] operator[-] identifier[w] , Other[0] operator[SEP] operator[SEP] identifier[paintBackground] operator[SEP] identifier[ctx] , identifier[g] , Other[0] , Other[0] , identifier[w] , identifier[h] , identifier[transform] operator[SEP] operator[SEP]
}
}
|
private int runScan(String reportDirectory, String outputFormat, String applicationName, String[] files,
String[] excludes, int symLinkDepth, int cvssFailScore) throws DatabaseException,
ExceptionCollection, ReportException {
Engine engine = null;
try {
final List<String> antStylePaths = getPaths(files);
final Set<File> paths = scanAntStylePaths(antStylePaths, symLinkDepth, excludes);
engine = new Engine(settings);
engine.scan(paths);
ExceptionCollection exCol = null;
try {
engine.analyzeDependencies();
} catch (ExceptionCollection ex) {
if (ex.isFatal()) {
throw ex;
}
exCol = ex;
}
try {
engine.writeReports(applicationName, new File(reportDirectory), outputFormat);
} catch (ReportException ex) {
if (exCol != null) {
exCol.addException(ex);
throw exCol;
} else {
throw ex;
}
}
if (exCol != null && !exCol.getExceptions().isEmpty()) {
throw exCol;
}
return determineReturnCode(engine, cvssFailScore);
} finally {
if (engine != null) {
engine.close();
}
}
} | class class_name[name] begin[{]
method[runScan, return_type[type[int]], modifier[private], parameter[reportDirectory, outputFormat, applicationName, files, excludes, symLinkDepth, cvssFailScore]] begin[{]
local_variable[type[Engine], engine]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=files, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPaths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=antStylePaths)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=antStylePaths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=symLinkDepth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=excludes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=scanAntStylePaths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=paths)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))], dimensions=[], name=Set, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=settings, 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=Engine, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=paths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=scan, postfix_operators=[], prefix_operators=[], qualifier=engine, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=exCol)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ExceptionCollection, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=analyzeDependencies, postfix_operators=[], prefix_operators=[], qualifier=engine, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isFatal, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=exCol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['ExceptionCollection']))], finally_block=None, label=None, resources=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=applicationName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=reportDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), MemberReference(member=outputFormat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeReports, postfix_operators=[], prefix_operators=[], qualifier=engine, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=exCol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addException, postfix_operators=[], prefix_operators=[], qualifier=exCol, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=exCol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['ReportException']))], finally_block=None, label=None, resources=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=exCol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=getExceptions, postfix_operators=[], prefix_operators=['!'], qualifier=exCol, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=exCol, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cvssFailScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=determineReturnCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=engine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=engine, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[int] identifier[runScan] operator[SEP] identifier[String] identifier[reportDirectory] , identifier[String] identifier[outputFormat] , identifier[String] identifier[applicationName] , identifier[String] operator[SEP] operator[SEP] identifier[files] , identifier[String] operator[SEP] operator[SEP] identifier[excludes] , Keyword[int] identifier[symLinkDepth] , Keyword[int] identifier[cvssFailScore] operator[SEP] Keyword[throws] identifier[DatabaseException] , identifier[ExceptionCollection] , identifier[ReportException] {
identifier[Engine] identifier[engine] operator[=] Other[null] operator[SEP] Keyword[try] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[antStylePaths] operator[=] identifier[getPaths] operator[SEP] identifier[files] operator[SEP] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[File] operator[>] identifier[paths] operator[=] identifier[scanAntStylePaths] operator[SEP] identifier[antStylePaths] , identifier[symLinkDepth] , identifier[excludes] operator[SEP] operator[SEP] identifier[engine] operator[=] Keyword[new] identifier[Engine] operator[SEP] identifier[settings] operator[SEP] operator[SEP] identifier[engine] operator[SEP] identifier[scan] operator[SEP] identifier[paths] operator[SEP] operator[SEP] identifier[ExceptionCollection] identifier[exCol] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[engine] operator[SEP] identifier[analyzeDependencies] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ExceptionCollection] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] identifier[ex] operator[SEP] identifier[isFatal] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] identifier[ex] operator[SEP]
}
identifier[exCol] operator[=] identifier[ex] operator[SEP]
}
Keyword[try] {
identifier[engine] operator[SEP] identifier[writeReports] operator[SEP] identifier[applicationName] , Keyword[new] identifier[File] operator[SEP] identifier[reportDirectory] operator[SEP] , identifier[outputFormat] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ReportException] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] identifier[exCol] operator[!=] Other[null] operator[SEP] {
identifier[exCol] operator[SEP] identifier[addException] operator[SEP] identifier[ex] operator[SEP] operator[SEP] Keyword[throw] identifier[exCol] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[ex] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[exCol] operator[!=] Other[null] operator[&&] operator[!] identifier[exCol] operator[SEP] identifier[getExceptions] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] identifier[exCol] operator[SEP]
}
Keyword[return] identifier[determineReturnCode] operator[SEP] identifier[engine] , identifier[cvssFailScore] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[engine] operator[!=] Other[null] operator[SEP] {
identifier[engine] operator[SEP] identifier[close] 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.