code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static TranslatecontentResult translatecontent(String accessToken, String lfrom, String lto, File content, String charsetName) {
HttpPost httpPost = new HttpPost(BASE_URI + "/cgi-bin/media/voice/translatecontent");
byte[] data;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(content), charsetName))) {
String line;
StringBuilder sb = new StringBuilder();
while ((line = reader.readLine()) != null) {
sb.append(line);
}
data = sb.toString().getBytes("UTF-8");
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addBinaryBody("media", data, ContentType.DEFAULT_BINARY, "temp.txt")
.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(accessToken))
.addTextBody("lfrom", lfrom)
.addTextBody("lto", lto)
.build();
httpPost.setEntity(reqEntity);
return LocalHttpClient.executeJsonResult(httpPost, TranslatecontentResult.class);
} | class class_name[name] begin[{]
method[translatecontent, return_type[type[TranslatecontentResult]], modifier[public static], parameter[accessToken, lfrom, lto, content, charsetName]] begin[{]
local_variable[type[HttpPost], httpPost]
local_variable[type[byte], data]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), name=sb)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), 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), StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=getBytes, 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=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=reader, type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None), value=ClassCreator(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=content, 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)), MemberReference(member=charsetName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)))])
local_variable[type[HttpEntity], reqEntity]
call[httpPost.setEntity, parameter[member[.reqEntity]]]
return[call[LocalHttpClient.executeJsonResult, parameter[member[.httpPost], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TranslatecontentResult, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TranslatecontentResult] identifier[translatecontent] operator[SEP] identifier[String] identifier[accessToken] , identifier[String] identifier[lfrom] , identifier[String] identifier[lto] , identifier[File] identifier[content] , identifier[String] identifier[charsetName] operator[SEP] {
identifier[HttpPost] identifier[httpPost] operator[=] Keyword[new] identifier[HttpPost] operator[SEP] identifier[BASE_URI] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[data] operator[SEP] Keyword[try] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[content] operator[SEP] , identifier[charsetName] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[line] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] 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[sb] operator[SEP] identifier[append] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
identifier[data] operator[=] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
identifier[HttpEntity] identifier[reqEntity] operator[=] identifier[MultipartEntityBuilder] operator[SEP] identifier[create] operator[SEP] operator[SEP] operator[SEP] identifier[addBinaryBody] operator[SEP] literal[String] , identifier[data] , identifier[ContentType] operator[SEP] identifier[DEFAULT_BINARY] , literal[String] operator[SEP] operator[SEP] identifier[addTextBody] operator[SEP] identifier[PARAM_ACCESS_TOKEN] , identifier[API] operator[SEP] identifier[accessToken] operator[SEP] identifier[accessToken] operator[SEP] operator[SEP] operator[SEP] identifier[addTextBody] operator[SEP] literal[String] , identifier[lfrom] operator[SEP] operator[SEP] identifier[addTextBody] operator[SEP] literal[String] , identifier[lto] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[httpPost] operator[SEP] identifier[setEntity] operator[SEP] identifier[reqEntity] operator[SEP] operator[SEP] Keyword[return] identifier[LocalHttpClient] operator[SEP] identifier[executeJsonResult] operator[SEP] identifier[httpPost] , identifier[TranslatecontentResult] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
private void updateEnabledItems() {
PickerSpinnerAdapter adapter = (PickerSpinnerAdapter) getAdapter();
// if the current item is out of range, we have no choice but to reset it
if(!isInDateRange(getSelectedDate())) {
final Calendar today = Calendar.getInstance();
if(isInDateRange(today))
setSelectedDate(today);
else
// if today itself is not a valid date, we will just use the minimum date (which is always set here)
setSelectedDate(minDate);
}
for(int position = getLastItemPosition(); position >= 0; position--) {
DateItem item = (DateItem) adapter.getItem(position);
if(isInDateRange(item.getDate()))
item.setEnabled(true);
else
item.setEnabled(false);
}
} | class class_name[name] begin[{]
method[updateEnabledItems, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[PickerSpinnerAdapter], adapter]
if[call[.isInDateRange, parameter[call[.getSelectedDate, parameter[]]]]] begin[{]
local_variable[type[Calendar], today]
if[call[.isInDateRange, parameter[member[.today]]]] begin[{]
call[.setSelectedDate, parameter[member[.today]]]
else begin[{]
call[.setSelectedDate, parameter[member[.minDate]]]
end[}]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getItem, postfix_operators=[], prefix_operators=[], qualifier=adapter, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=DateItem, sub_type=None)), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DateItem, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDate, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None)], member=isInDateRange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=setEnabled, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setEnabled, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[], type_arguments=None), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=getLastItemPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=position)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=position, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[updateEnabledItems] operator[SEP] operator[SEP] {
identifier[PickerSpinnerAdapter] identifier[adapter] operator[=] operator[SEP] identifier[PickerSpinnerAdapter] operator[SEP] identifier[getAdapter] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isInDateRange] operator[SEP] identifier[getSelectedDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Calendar] identifier[today] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isInDateRange] operator[SEP] identifier[today] operator[SEP] operator[SEP] identifier[setSelectedDate] operator[SEP] identifier[today] operator[SEP] operator[SEP] Keyword[else] identifier[setSelectedDate] operator[SEP] identifier[minDate] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[position] operator[=] identifier[getLastItemPosition] operator[SEP] operator[SEP] operator[SEP] identifier[position] operator[>=] Other[0] operator[SEP] identifier[position] operator[--] operator[SEP] {
identifier[DateItem] identifier[item] operator[=] operator[SEP] identifier[DateItem] operator[SEP] identifier[adapter] operator[SEP] identifier[getItem] operator[SEP] identifier[position] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isInDateRange] operator[SEP] identifier[item] operator[SEP] identifier[getDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[item] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[else] identifier[item] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
|
public static final String foldCase(String str, int options) {
if (str.length() <= 100) {
if (str.isEmpty()) {
return str;
}
// Collect and apply only changes.
// Good if no or few changes. Bad (slow) if many changes.
Edits edits = new Edits();
StringBuilder replacementChars = CaseMapImpl.fold(
options | CaseMapImpl.OMIT_UNCHANGED_TEXT, str, new StringBuilder(), edits);
return applyEdits(str, replacementChars, edits);
} else {
return CaseMapImpl.fold(options, str, new StringBuilder(str.length()), null).toString();
}
} | class class_name[name] begin[{]
method[foldCase, return_type[type[String]], modifier[final public static], parameter[str, options]] begin[{]
if[binary_operation[call[str.length, parameter[]], <=, literal[100]]] begin[{]
if[call[str.isEmpty, parameter[]]] begin[{]
return[member[.str]]
else begin[{]
None
end[}]
local_variable[type[Edits], edits]
local_variable[type[StringBuilder], replacementChars]
return[call[.applyEdits, parameter[member[.str], member[.replacementChars], member[.edits]]]]
else begin[{]
return[call[CaseMapImpl.fold, parameter[member[.options], member[.str], ClassCreator(arguments=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), literal[null]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[String] identifier[foldCase] operator[SEP] identifier[String] identifier[str] , Keyword[int] identifier[options] operator[SEP] {
Keyword[if] operator[SEP] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<=] Other[100] operator[SEP] {
Keyword[if] operator[SEP] identifier[str] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[str] operator[SEP]
}
identifier[Edits] identifier[edits] operator[=] Keyword[new] identifier[Edits] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[replacementChars] operator[=] identifier[CaseMapImpl] operator[SEP] identifier[fold] operator[SEP] identifier[options] operator[|] identifier[CaseMapImpl] operator[SEP] identifier[OMIT_UNCHANGED_TEXT] , identifier[str] , Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] , identifier[edits] operator[SEP] operator[SEP] Keyword[return] identifier[applyEdits] operator[SEP] identifier[str] , identifier[replacementChars] , identifier[edits] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[CaseMapImpl] operator[SEP] identifier[fold] operator[SEP] identifier[options] , identifier[str] , Keyword[new] identifier[StringBuilder] operator[SEP] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private Node buildFromPoints(int lower, int upper) {
if (upper == lower) {
return null;
}
final Node node = new Node();
node.index = lower;
if (upper - lower > 1) {
// choose an arbitrary vantage point and move it to the start
int i = random.nextInt(upper - lower - 1) + lower;
listSwap(items, lower, i);
listSwap(indexes, lower, i);
int median = (upper + lower + 1) / 2;
// partition around the median distance
// TODO: use the QuickSelect class?
nthElement(lower + 1, upper, median, items[lower]);
// what was the median?
node.threshold = distance(items[lower], items[median]);
node.index = lower;
node.left = buildFromPoints(lower + 1, median);
node.right = buildFromPoints(median, upper);
}
return node;
} | class class_name[name] begin[{]
method[buildFromPoints, return_type[type[Node]], modifier[private], parameter[lower, upper]] begin[{]
if[binary_operation[member[.upper], ==, member[.lower]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Node], node]
assign[member[node.index], member[.lower]]
if[binary_operation[binary_operation[member[.upper], -, member[.lower]], >, literal[1]]] begin[{]
local_variable[type[int], i]
call[.listSwap, parameter[member[.items], member[.lower], member[.i]]]
call[.listSwap, parameter[member[.indexes], member[.lower], member[.i]]]
local_variable[type[int], median]
call[.nthElement, parameter[binary_operation[member[.lower], +, literal[1]], member[.upper], member[.median], member[.items]]]
assign[member[node.threshold], call[.distance, parameter[member[.items], member[.items]]]]
assign[member[node.index], member[.lower]]
assign[member[node.left], call[.buildFromPoints, parameter[binary_operation[member[.lower], +, literal[1]], member[.median]]]]
assign[member[node.right], call[.buildFromPoints, parameter[member[.median], member[.upper]]]]
else begin[{]
None
end[}]
return[member[.node]]
end[}]
END[}] | Keyword[private] identifier[Node] identifier[buildFromPoints] operator[SEP] Keyword[int] identifier[lower] , Keyword[int] identifier[upper] operator[SEP] {
Keyword[if] operator[SEP] identifier[upper] operator[==] identifier[lower] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[final] identifier[Node] identifier[node] operator[=] Keyword[new] identifier[Node] operator[SEP] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[index] operator[=] identifier[lower] operator[SEP] Keyword[if] operator[SEP] identifier[upper] operator[-] identifier[lower] operator[>] Other[1] operator[SEP] {
Keyword[int] identifier[i] operator[=] identifier[random] operator[SEP] identifier[nextInt] operator[SEP] identifier[upper] operator[-] identifier[lower] operator[-] Other[1] operator[SEP] operator[+] identifier[lower] operator[SEP] identifier[listSwap] operator[SEP] identifier[items] , identifier[lower] , identifier[i] operator[SEP] operator[SEP] identifier[listSwap] operator[SEP] identifier[indexes] , identifier[lower] , identifier[i] operator[SEP] operator[SEP] Keyword[int] identifier[median] operator[=] operator[SEP] identifier[upper] operator[+] identifier[lower] operator[+] Other[1] operator[SEP] operator[/] Other[2] operator[SEP] identifier[nthElement] operator[SEP] identifier[lower] operator[+] Other[1] , identifier[upper] , identifier[median] , identifier[items] operator[SEP] identifier[lower] operator[SEP] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[threshold] operator[=] identifier[distance] operator[SEP] identifier[items] operator[SEP] identifier[lower] operator[SEP] , identifier[items] operator[SEP] identifier[median] operator[SEP] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[index] operator[=] identifier[lower] operator[SEP] identifier[node] operator[SEP] identifier[left] operator[=] identifier[buildFromPoints] operator[SEP] identifier[lower] operator[+] Other[1] , identifier[median] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[right] operator[=] identifier[buildFromPoints] operator[SEP] identifier[median] , identifier[upper] operator[SEP] operator[SEP]
}
Keyword[return] identifier[node] operator[SEP]
}
|
public PutOperation<K, V> applyOperation(K key, PutOperation<K, V> existing, Operation<K, V> operation) {
final Result<K, V> newValue = operation.apply(existing);
if (newValue == null) {
return null;
} else {
return newValue.asOperationExpiringAt(Long.MAX_VALUE);
}
} | class class_name[name] begin[{]
method[applyOperation, return_type[type[PutOperation]], modifier[public], parameter[key, existing, operation]] begin[{]
local_variable[type[Result], newValue]
if[binary_operation[member[.newValue], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
return[call[newValue.asOperationExpiringAt, parameter[member[Long.MAX_VALUE]]]]
end[}]
end[}]
END[}] | Keyword[public] identifier[PutOperation] operator[<] identifier[K] , identifier[V] operator[>] identifier[applyOperation] operator[SEP] identifier[K] identifier[key] , identifier[PutOperation] operator[<] identifier[K] , identifier[V] operator[>] identifier[existing] , identifier[Operation] operator[<] identifier[K] , identifier[V] operator[>] identifier[operation] operator[SEP] {
Keyword[final] identifier[Result] operator[<] identifier[K] , identifier[V] operator[>] identifier[newValue] operator[=] identifier[operation] operator[SEP] identifier[apply] operator[SEP] identifier[existing] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newValue] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[newValue] operator[SEP] identifier[asOperationExpiringAt] operator[SEP] identifier[Long] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP]
}
}
|
boolean isSkipped(String path) {
Mapping mapping = mappings.get(path);
return mapping != null && mapping.isSkipped();
} | class class_name[name] begin[{]
method[isSkipped, return_type[type[boolean]], modifier[default], parameter[path]] begin[{]
local_variable[type[Mapping], mapping]
return[binary_operation[binary_operation[member[.mapping], !=, literal[null]], &&, call[mapping.isSkipped, parameter[]]]]
end[}]
END[}] | Keyword[boolean] identifier[isSkipped] operator[SEP] identifier[String] identifier[path] operator[SEP] {
identifier[Mapping] identifier[mapping] operator[=] identifier[mappings] operator[SEP] identifier[get] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[return] identifier[mapping] operator[!=] Other[null] operator[&&] identifier[mapping] operator[SEP] identifier[isSkipped] operator[SEP] operator[SEP] operator[SEP]
}
|
private static boolean isScrollable(AccessibilityNodeInfoCompat node) {
if (node.isScrollable()) {
return true;
}
return supportsAnyAction(node,
AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD,
AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD);
} | class class_name[name] begin[{]
method[isScrollable, return_type[type[boolean]], modifier[private static], parameter[node]] begin[{]
if[call[node.isScrollable, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
return[call[.supportsAnyAction, parameter[member[.node], member[AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD], member[AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[isScrollable] operator[SEP] identifier[AccessibilityNodeInfoCompat] identifier[node] operator[SEP] {
Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[isScrollable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[supportsAnyAction] operator[SEP] identifier[node] , identifier[AccessibilityNodeInfoCompat] operator[SEP] identifier[ACTION_SCROLL_FORWARD] , identifier[AccessibilityNodeInfoCompat] operator[SEP] identifier[ACTION_SCROLL_BACKWARD] operator[SEP] operator[SEP]
}
|
public static ConicGeneral_F64 convert(DMatrix3x3 src , ConicGeneral_F64 dst ) {
if( dst == null )
dst = new ConicGeneral_F64();
dst.A = src.a11; dst.B = 2*src.a12; dst.D = 2*src.a13;
dst.C = src.a22; dst.E = 2*src.a23;
dst.F = src.a33;
return dst;
} | class class_name[name] begin[{]
method[convert, return_type[type[ConicGeneral_F64]], modifier[public static], parameter[src, dst]] begin[{]
if[binary_operation[member[.dst], ==, literal[null]]] begin[{]
assign[member[.dst], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConicGeneral_F64, sub_type=None))]
else begin[{]
None
end[}]
assign[member[dst.A], member[src.a11]]
assign[member[dst.B], binary_operation[literal[2], *, member[src.a12]]]
assign[member[dst.D], binary_operation[literal[2], *, member[src.a13]]]
assign[member[dst.C], member[src.a22]]
assign[member[dst.E], binary_operation[literal[2], *, member[src.a23]]]
assign[member[dst.F], member[src.a33]]
return[member[.dst]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ConicGeneral_F64] identifier[convert] operator[SEP] identifier[DMatrix3x3] identifier[src] , identifier[ConicGeneral_F64] identifier[dst] operator[SEP] {
Keyword[if] operator[SEP] identifier[dst] operator[==] Other[null] operator[SEP] identifier[dst] operator[=] Keyword[new] identifier[ConicGeneral_F64] operator[SEP] operator[SEP] operator[SEP] identifier[dst] operator[SEP] identifier[A] operator[=] identifier[src] operator[SEP] identifier[a11] operator[SEP] identifier[dst] operator[SEP] identifier[B] operator[=] Other[2] operator[*] identifier[src] operator[SEP] identifier[a12] operator[SEP] identifier[dst] operator[SEP] identifier[D] operator[=] Other[2] operator[*] identifier[src] operator[SEP] identifier[a13] operator[SEP] identifier[dst] operator[SEP] identifier[C] operator[=] identifier[src] operator[SEP] identifier[a22] operator[SEP] identifier[dst] operator[SEP] identifier[E] operator[=] Other[2] operator[*] identifier[src] operator[SEP] identifier[a23] operator[SEP] identifier[dst] operator[SEP] identifier[F] operator[=] identifier[src] operator[SEP] identifier[a33] operator[SEP] Keyword[return] identifier[dst] operator[SEP]
}
|
@Nullable
protected byte [] getBoundary (@Nonnull final String sContentType)
{
// Parameter parser can handle null input
final ICommonsMap <String, String> aParams = new ParameterParser ().setLowerCaseNames (true)
.parse (sContentType, new char [] { ';', ',' });
final String sBoundaryStr = aParams.get ("boundary");
if (sBoundaryStr == null)
return null;
return sBoundaryStr.getBytes (StandardCharsets.ISO_8859_1);
} | class class_name[name] begin[{]
method[getBoundary, return_type[type[byte]], modifier[protected], parameter[sContentType]] begin[{]
local_variable[type[ICommonsMap], aParams]
local_variable[type[String], sBoundaryStr]
if[binary_operation[member[.sBoundaryStr], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[sBoundaryStr.getBytes, parameter[member[StandardCharsets.ISO_8859_1]]]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[protected] Keyword[byte] operator[SEP] operator[SEP] identifier[getBoundary] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[String] identifier[sContentType] operator[SEP] {
Keyword[final] identifier[ICommonsMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[aParams] operator[=] Keyword[new] identifier[ParameterParser] operator[SEP] operator[SEP] operator[SEP] identifier[setLowerCaseNames] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[parse] operator[SEP] identifier[sContentType] , Keyword[new] Keyword[char] operator[SEP] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[sBoundaryStr] operator[=] identifier[aParams] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sBoundaryStr] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] identifier[sBoundaryStr] operator[SEP] identifier[getBytes] operator[SEP] identifier[StandardCharsets] operator[SEP] identifier[ISO_8859_1] operator[SEP] operator[SEP]
}
|
public static Class[] getParameters(String signature) throws FacesException
{
ArrayList<Class> params = new ArrayList<Class>();
// Signature is of the form
// <return-type> S <method-name S? '('
// < <arg-type> ( ',' <arg-type> )* )? ')'
int start = signature.indexOf('(') + 1;
boolean lastArg = false;
while (true)
{
int p = signature.indexOf(',', start);
if (p < 0)
{
p = signature.indexOf(')', start);
if (p < 0)
{
throw new FacesException("Invalid method signature:" + signature);
}
lastArg = true;
}
String arg = signature.substring(start, p).trim();
if (!"".equals(arg))
{
try
{
params.add(ClassUtils.javaDefaultTypeToClass(arg));
}
catch (ClassNotFoundException e)
{
throw new FacesException("Invalid method signature:" + signature);
}
}
if (lastArg)
{
break;
}
start = p + 1;
}
return params.toArray(new Class[params.size()]);
} | class class_name[name] begin[{]
method[getParameters, return_type[type[Class]], modifier[public static], parameter[signature]] begin[{]
local_variable[type[ArrayList], params]
local_variable[type[int], start]
local_variable[type[boolean], lastArg]
while[literal[true]] begin[{]
local_variable[type[int], p]
if[binary_operation[member[.p], <, literal[0]]] begin[{]
assign[member[.p], call[signature.indexOf, parameter[literal[')'], member[.start]]]]
if[binary_operation[member[.p], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid method signature:"), operandr=MemberReference(member=signature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FacesException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.lastArg], literal[true]]
else begin[{]
None
end[}]
local_variable[type[String], arg]
if[literal[""]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=arg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=javaDefaultTypeToClass, postfix_operators=[], prefix_operators=[], qualifier=ClassUtils, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid method signature:"), operandr=MemberReference(member=signature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FacesException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[member[.lastArg]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
assign[member[.start], binary_operation[member[.p], +, literal[1]]]
end[}]
return[call[params.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Class, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Class] operator[SEP] operator[SEP] identifier[getParameters] operator[SEP] identifier[String] identifier[signature] operator[SEP] Keyword[throws] identifier[FacesException] {
identifier[ArrayList] operator[<] identifier[Class] operator[>] identifier[params] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Class] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[start] operator[=] identifier[signature] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] operator[SEP] Keyword[boolean] identifier[lastArg] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[int] identifier[p] operator[=] identifier[signature] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[start] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[<] Other[0] operator[SEP] {
identifier[p] operator[=] identifier[signature] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[start] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FacesException] operator[SEP] literal[String] operator[+] identifier[signature] operator[SEP] operator[SEP]
}
identifier[lastArg] operator[=] literal[boolean] operator[SEP]
}
identifier[String] identifier[arg] operator[=] identifier[signature] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[p] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[arg] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[params] operator[SEP] identifier[add] operator[SEP] identifier[ClassUtils] operator[SEP] identifier[javaDefaultTypeToClass] operator[SEP] identifier[arg] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FacesException] operator[SEP] literal[String] operator[+] identifier[signature] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[lastArg] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[start] operator[=] identifier[p] operator[+] Other[1] operator[SEP]
}
Keyword[return] identifier[params] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[Class] operator[SEP] identifier[params] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static long getLong(final String name, final long defaultValue) {
String value = get(name);
if (value == null) {
return defaultValue;
}
value = value.trim().toLowerCase();
try {
return Long.parseLong(value);
}
catch (NumberFormatException nfex) {
return defaultValue;
}
} | class class_name[name] begin[{]
method[getLong, return_type[type[long]], modifier[public static], parameter[name, defaultValue]] begin[{]
local_variable[type[String], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
return[member[.defaultValue]]
else begin[{]
None
end[}]
assign[member[.value], call[value.trim, parameter[]]]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseLong, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MemberReference(member=defaultValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=nfex, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[long] identifier[getLong] operator[SEP] Keyword[final] identifier[String] identifier[name] , Keyword[final] Keyword[long] identifier[defaultValue] operator[SEP] {
identifier[String] identifier[value] operator[=] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[defaultValue] operator[SEP]
}
identifier[value] operator[=] identifier[value] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[nfex] operator[SEP] {
Keyword[return] identifier[defaultValue] operator[SEP]
}
}
|
public void disableJdbcLogging(WSRdbManagedConnectionImpl mc) throws ResourceException {
mc.mcf.reallySetLogWriter(null);
mc.mcf.loggingEnabled = false;
} | class class_name[name] begin[{]
method[disableJdbcLogging, return_type[void], modifier[public], parameter[mc]] begin[{]
call[mc.mcf.reallySetLogWriter, parameter[literal[null]]]
assign[member[mc.mcf.loggingEnabled], literal[false]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[disableJdbcLogging] operator[SEP] identifier[WSRdbManagedConnectionImpl] identifier[mc] operator[SEP] Keyword[throws] identifier[ResourceException] {
identifier[mc] operator[SEP] identifier[mcf] operator[SEP] identifier[reallySetLogWriter] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[mc] operator[SEP] identifier[mcf] operator[SEP] identifier[loggingEnabled] operator[=] literal[boolean] operator[SEP]
}
|
protected void connect(final InetSocketAddress localEP, final InetSocketAddress serverCtrlEP,
final CRI cri, final boolean useNAT) throws KNXException, InterruptedException
{
if (state != CLOSED)
throw new IllegalStateException("open connection");
ctrlEndpt = serverCtrlEP;
if (ctrlEndpt.isUnresolved())
throw new KNXException("server control endpoint is unresolved: " + serverCtrlEP);
if (ctrlEndpt.getAddress().isMulticastAddress())
throw new KNXIllegalArgumentException("server control endpoint cannot be a multicast address ("
+ ctrlEndpt.getAddress().getHostAddress() + ")");
useNat = useNAT;
logger = LogService.getLogger("calimero.knxnetip." + getName());
// if we allow localEP to be null, we would create an unbound socket
if (localEP == null)
throw new KNXIllegalArgumentException("no local endpoint specified");
InetSocketAddress local = localEP;
try {
if (local.isUnresolved())
throw new KNXIllegalArgumentException("unresolved address " + local);
if (local.getAddress().isAnyLocalAddress()) {
final InetAddress addr = useNAT ? null
: Optional.ofNullable(serverCtrlEP.getAddress()).flatMap(this::onSameSubnet)
.orElse(InetAddress.getLocalHost());
local = new InetSocketAddress(addr, localEP.getPort());
}
socket = new DatagramSocket(local);
ctrlSocket = socket;
logger.info("establish connection from " + socket.getLocalSocketAddress() + " to " + ctrlEndpt);
// HPAI throws if wildcard local address (0.0.0.0) is supplied
final HPAI hpai = new HPAI(HPAI.IPV4_UDP,
useNat ? null : (InetSocketAddress) socket.getLocalSocketAddress());
final byte[] buf = PacketHelper.toPacket(new ConnectRequest(cri, hpai, hpai));
send(buf, ctrlEndpt);
}
catch (final UnknownHostException e) {
throw new KNXException("no local host address available", e);
}
catch (IOException | SecurityException e) {
if (socket != null)
socket.close();
logger.error("communication failure on connect", e);
if (local.getAddress().isLoopbackAddress())
logger.warn("local endpoint uses loopback address ({}), try with a different IP address",
local.getAddress());
throw new KNXException("connecting from " + local + " to " + serverCtrlEP + ": " + e.getMessage());
}
logger.debug("wait for connect response from " + ctrlEndpt + " ...");
startReceiver();
try {
final boolean changed = waitForStateChange(CLOSED, CONNECT_REQ_TIMEOUT);
if (state == OK) {
heartbeat = new HeartbeatMonitor();
heartbeat.start();
String optionalConnectionInfo = "";
if (tunnelingAddress != null)
optionalConnectionInfo = ", tunneling address " + tunnelingAddress;
logger.info("connection established (data endpoint {}:{}, channel {}{})",
dataEndpt.getAddress().getHostAddress(), dataEndpt.getPort(), channelId,
optionalConnectionInfo);
return;
}
final KNXException e;
if (!changed)
e = new KNXTimeoutException("timeout connecting to control endpoint " + ctrlEndpt);
else if (state == ACK_ERROR)
e = new KNXRemoteException("error response from control endpoint " + ctrlEndpt + ": " + status);
else
e = new KNXInvalidResponseException("invalid connect response from " + ctrlEndpt);
// quit, cleanup and notify user
connectCleanup(e);
throw e;
}
catch (final InterruptedException e) {
connectCleanup(e);
throw e;
}
} | class class_name[name] begin[{]
method[connect, return_type[void], modifier[protected], parameter[localEP, serverCtrlEP, cri, useNAT]] begin[{]
if[binary_operation[member[.state], !=, member[.CLOSED]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="open connection")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.ctrlEndpt], member[.serverCtrlEP]]
if[call[ctrlEndpt.isUnresolved, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="server control endpoint is unresolved: "), operandr=MemberReference(member=serverCtrlEP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KNXException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[ctrlEndpt.getAddress, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="server control endpoint cannot be a multicast address ("), operandr=MethodInvocation(arguments=[], member=getAddress, postfix_operators=[], prefix_operators=[], qualifier=ctrlEndpt, selectors=[MethodInvocation(arguments=[], member=getHostAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KNXIllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.useNat], member[.useNAT]]
assign[member[.logger], call[LogService.getLogger, parameter[binary_operation[literal["calimero.knxnetip."], +, call[.getName, parameter[]]]]]]
if[binary_operation[member[.localEP], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="no local endpoint specified")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KNXIllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[InetSocketAddress], local]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isUnresolved, postfix_operators=[], prefix_operators=[], qualifier=local, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unresolved address "), operandr=MemberReference(member=local, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KNXIllegalArgumentException, sub_type=None)), label=None)), IfStatement(condition=MethodInvocation(arguments=[], member=getAddress, postfix_operators=[], prefix_operators=[], qualifier=local, selectors=[MethodInvocation(arguments=[], member=isAnyLocalAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MemberReference(member=useNAT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAddress, postfix_operators=[], prefix_operators=[], qualifier=serverCtrlEP, selectors=[], type_arguments=None)], member=ofNullable, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[MethodInvocation(arguments=[MethodReference(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), method=MemberReference(member=onSameSubnet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])], member=flatMap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocalHost, postfix_operators=[], prefix_operators=[], qualifier=InetAddress, selectors=[], type_arguments=None)], member=orElse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), name=addr)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=InetAddress, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=local, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=addr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getPort, postfix_operators=[], prefix_operators=[], qualifier=localEP, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InetSocketAddress, sub_type=None))), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=socket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=local, 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=DatagramSocket, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ctrlSocket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=socket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="establish connection from "), operandr=MethodInvocation(arguments=[], member=getLocalSocketAddress, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" to "), operator=+), operandr=MemberReference(member=ctrlEndpt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=IPV4_UDP, postfix_operators=[], prefix_operators=[], qualifier=HPAI, selectors=[]), TernaryExpression(condition=MemberReference(member=useNat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Cast(expression=MethodInvocation(arguments=[], member=getLocalSocketAddress, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=InetSocketAddress, sub_type=None)), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HPAI, sub_type=None)), name=hpai)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=HPAI, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=cri, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hpai, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=hpai, 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=ConnectRequest, sub_type=None))], member=toPacket, postfix_operators=[], prefix_operators=[], qualifier=PacketHelper, selectors=[], type_arguments=None), name=buf)], modifiers={'final'}, type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ctrlEndpt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=send, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="no local host address available"), 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=KNXException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnknownHostException'])), CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=socket, 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=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None), label=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="communication failure on connect"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=getAddress, postfix_operators=[], prefix_operators=[], qualifier=local, selectors=[MethodInvocation(arguments=[], member=isLoopbackAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="local endpoint uses loopback address ({}), try with a different IP address"), MethodInvocation(arguments=[], member=getAddress, postfix_operators=[], prefix_operators=[], qualifier=local, selectors=[], type_arguments=None)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="connecting from "), operandr=MemberReference(member=local, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" to "), operator=+), operandr=MemberReference(member=serverCtrlEP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, 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=KNXException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException', 'SecurityException']))], finally_block=None, label=None, resources=None)
call[logger.debug, parameter[binary_operation[binary_operation[literal["wait for connect response from "], +, member[.ctrlEndpt]], +, literal[" ..."]]]]
call[.startReceiver, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=CLOSED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CONNECT_REQ_TIMEOUT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=waitForStateChange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=changed)], modifiers={'final'}, type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=OK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=heartbeat, 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=HeartbeatMonitor, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=start, postfix_operators=[], prefix_operators=[], qualifier=heartbeat, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), name=optionalConnectionInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tunnelingAddress, 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=optionalConnectionInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", tunneling address "), operandr=MemberReference(member=tunnelingAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="connection established (data endpoint {}:{}, channel {}{})"), MethodInvocation(arguments=[], member=getAddress, postfix_operators=[], prefix_operators=[], qualifier=dataEndpt, selectors=[MethodInvocation(arguments=[], member=getHostAddress, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getPort, postfix_operators=[], prefix_operators=[], qualifier=dataEndpt, selectors=[], type_arguments=None), MemberReference(member=channelId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=optionalConnectionInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=e)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=KNXException, sub_type=None)), IfStatement(condition=MemberReference(member=changed, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ACK_ERROR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="invalid connect response from "), operandr=MemberReference(member=ctrlEndpt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KNXInvalidResponseException, sub_type=None))), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="error response from control endpoint "), operandr=MemberReference(member=ctrlEndpt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": "), operator=+), operandr=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KNXRemoteException, sub_type=None))), label=None)), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="timeout connecting to control endpoint "), operandr=MemberReference(member=ctrlEndpt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=KNXTimeoutException, sub_type=None))), label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=connectCleanup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=connectCleanup, postfix_operators=[], prefix_operators=[], qualifier=, 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=['InterruptedException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[connect] operator[SEP] Keyword[final] identifier[InetSocketAddress] identifier[localEP] , Keyword[final] identifier[InetSocketAddress] identifier[serverCtrlEP] , Keyword[final] identifier[CRI] identifier[cri] , Keyword[final] Keyword[boolean] identifier[useNAT] operator[SEP] Keyword[throws] identifier[KNXException] , identifier[InterruptedException] {
Keyword[if] operator[SEP] identifier[state] operator[!=] identifier[CLOSED] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[ctrlEndpt] operator[=] identifier[serverCtrlEP] operator[SEP] Keyword[if] operator[SEP] identifier[ctrlEndpt] operator[SEP] identifier[isUnresolved] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[KNXException] operator[SEP] literal[String] operator[+] identifier[serverCtrlEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ctrlEndpt] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[isMulticastAddress] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[KNXIllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[ctrlEndpt] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[useNat] operator[=] identifier[useNAT] operator[SEP] identifier[logger] operator[=] identifier[LogService] operator[SEP] identifier[getLogger] operator[SEP] literal[String] operator[+] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[localEP] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[KNXIllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[InetSocketAddress] identifier[local] operator[=] identifier[localEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[local] operator[SEP] identifier[isUnresolved] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[KNXIllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[local] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[local] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[isAnyLocalAddress] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[InetAddress] identifier[addr] operator[=] identifier[useNAT] operator[?] Other[null] operator[:] identifier[Optional] operator[SEP] identifier[ofNullable] operator[SEP] identifier[serverCtrlEP] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[this] operator[::] identifier[onSameSubnet] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] identifier[InetAddress] operator[SEP] identifier[getLocalHost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[local] operator[=] Keyword[new] identifier[InetSocketAddress] operator[SEP] identifier[addr] , identifier[localEP] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[socket] operator[=] Keyword[new] identifier[DatagramSocket] operator[SEP] identifier[local] operator[SEP] operator[SEP] identifier[ctrlSocket] operator[=] identifier[socket] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[socket] operator[SEP] identifier[getLocalSocketAddress] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[ctrlEndpt] operator[SEP] operator[SEP] Keyword[final] identifier[HPAI] identifier[hpai] operator[=] Keyword[new] identifier[HPAI] operator[SEP] identifier[HPAI] operator[SEP] identifier[IPV4_UDP] , identifier[useNat] operator[?] Other[null] operator[:] operator[SEP] identifier[InetSocketAddress] operator[SEP] identifier[socket] operator[SEP] identifier[getLocalSocketAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[buf] operator[=] identifier[PacketHelper] operator[SEP] identifier[toPacket] operator[SEP] Keyword[new] identifier[ConnectRequest] operator[SEP] identifier[cri] , identifier[hpai] , identifier[hpai] operator[SEP] operator[SEP] operator[SEP] identifier[send] operator[SEP] identifier[buf] , identifier[ctrlEndpt] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[UnknownHostException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[KNXException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] operator[|] identifier[SecurityException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[socket] operator[!=] Other[null] operator[SEP] identifier[socket] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[local] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[isLoopbackAddress] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[local] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[KNXException] operator[SEP] literal[String] operator[+] identifier[local] operator[+] literal[String] operator[+] identifier[serverCtrlEP] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[ctrlEndpt] operator[+] literal[String] operator[SEP] operator[SEP] identifier[startReceiver] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[final] Keyword[boolean] identifier[changed] operator[=] identifier[waitForStateChange] operator[SEP] identifier[CLOSED] , identifier[CONNECT_REQ_TIMEOUT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[==] identifier[OK] operator[SEP] {
identifier[heartbeat] operator[=] Keyword[new] identifier[HeartbeatMonitor] operator[SEP] operator[SEP] operator[SEP] identifier[heartbeat] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[optionalConnectionInfo] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[tunnelingAddress] operator[!=] Other[null] operator[SEP] identifier[optionalConnectionInfo] operator[=] literal[String] operator[+] identifier[tunnelingAddress] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[dataEndpt] operator[SEP] identifier[getAddress] operator[SEP] operator[SEP] operator[SEP] identifier[getHostAddress] operator[SEP] operator[SEP] , identifier[dataEndpt] operator[SEP] identifier[getPort] operator[SEP] operator[SEP] , identifier[channelId] , identifier[optionalConnectionInfo] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[final] identifier[KNXException] identifier[e] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[changed] operator[SEP] identifier[e] operator[=] Keyword[new] identifier[KNXTimeoutException] operator[SEP] literal[String] operator[+] identifier[ctrlEndpt] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[state] operator[==] identifier[ACK_ERROR] operator[SEP] identifier[e] operator[=] Keyword[new] identifier[KNXRemoteException] operator[SEP] literal[String] operator[+] identifier[ctrlEndpt] operator[+] literal[String] operator[+] identifier[status] operator[SEP] operator[SEP] Keyword[else] identifier[e] operator[=] Keyword[new] identifier[KNXInvalidResponseException] operator[SEP] literal[String] operator[+] identifier[ctrlEndpt] operator[SEP] operator[SEP] identifier[connectCleanup] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[InterruptedException] identifier[e] operator[SEP] {
identifier[connectCleanup] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
|
protected boolean writeSpaceship(int type, boolean simulate) {
if (type != COMPARE_TO) return false;
/*
we will actually do
(x < y) ? -1 : ((x == y) ? 0 : 1)
which is the essence of what the call with Integers would do
this compiles to something along
<x>
<y>
IF_ICMPGE L1
ICONST_M1
GOTO L2
L1
<x>
<y>
IF_ICMPNE L3
ICONST_0
GOTO L2
L3
ICONST_1
L2
since the operators are already on the stack and we don't want
to load them again, we will instead duplicate them. This will
require some pop actions in the branches!
DUP2 (operands: IIII)
IF_ICMPGE L1 (operands: II)
ICONST_M1 (operands: III)
GOTO L2
L1
----- (operands: II)
IF_ICMPNE L3 (operands: -)
ICONST_0 (operands: I)
GOTO L2
L3
- jump from L1 branch to here (operands: -)
ICONST_1 (operands: I)
L2
- if jump from GOTO L2 we have III, but need only I
- if from L3 branch we get only I
this means we have to pop of II before loading -1
*/
if (!simulate) {
MethodVisitor mv = getController().getMethodVisitor();
// duplicate int arguments
mv.visitInsn(DUP2);
Label l1 = new Label();
mv.visitJumpInsn(IF_ICMPGE,l1);
// no jump, so -1, need to pop off surplus II
mv.visitInsn(POP2);
mv.visitInsn(ICONST_M1);
Label l2 = new Label();
mv.visitJumpInsn(GOTO, l2);
mv.visitLabel(l1);
Label l3 = new Label();
mv.visitJumpInsn(IF_ICMPNE,l3);
mv.visitInsn(ICONST_0);
mv.visitJumpInsn(GOTO,l2);
mv.visitLabel(l3);
mv.visitInsn(ICONST_1);
getController().getOperandStack().replace(ClassHelper.int_TYPE, 2);
}
return true;
} | class class_name[name] begin[{]
method[writeSpaceship, return_type[type[boolean]], modifier[protected], parameter[type, simulate]] begin[{]
if[binary_operation[member[.type], !=, member[.COMPARE_TO]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[member[.simulate]] begin[{]
local_variable[type[MethodVisitor], mv]
call[mv.visitInsn, parameter[member[.DUP2]]]
local_variable[type[Label], l1]
call[mv.visitJumpInsn, parameter[member[.IF_ICMPGE], member[.l1]]]
call[mv.visitInsn, parameter[member[.POP2]]]
call[mv.visitInsn, parameter[member[.ICONST_M1]]]
local_variable[type[Label], l2]
call[mv.visitJumpInsn, parameter[member[.GOTO], member[.l2]]]
call[mv.visitLabel, parameter[member[.l1]]]
local_variable[type[Label], l3]
call[mv.visitJumpInsn, parameter[member[.IF_ICMPNE], member[.l3]]]
call[mv.visitInsn, parameter[member[.ICONST_0]]]
call[mv.visitJumpInsn, parameter[member[.GOTO], member[.l2]]]
call[mv.visitLabel, parameter[member[.l3]]]
call[mv.visitInsn, parameter[member[.ICONST_1]]]
call[.getController, parameter[]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[writeSpaceship] operator[SEP] Keyword[int] identifier[type] , Keyword[boolean] identifier[simulate] operator[SEP] {
Keyword[if] operator[SEP] identifier[type] operator[!=] identifier[COMPARE_TO] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[simulate] operator[SEP] {
identifier[MethodVisitor] identifier[mv] operator[=] identifier[getController] operator[SEP] operator[SEP] operator[SEP] identifier[getMethodVisitor] operator[SEP] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitInsn] operator[SEP] identifier[DUP2] operator[SEP] operator[SEP] identifier[Label] identifier[l1] operator[=] Keyword[new] identifier[Label] operator[SEP] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitJumpInsn] operator[SEP] identifier[IF_ICMPGE] , identifier[l1] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitInsn] operator[SEP] identifier[POP2] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitInsn] operator[SEP] identifier[ICONST_M1] operator[SEP] operator[SEP] identifier[Label] identifier[l2] operator[=] Keyword[new] identifier[Label] operator[SEP] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitJumpInsn] operator[SEP] identifier[GOTO] , identifier[l2] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitLabel] operator[SEP] identifier[l1] operator[SEP] operator[SEP] identifier[Label] identifier[l3] operator[=] Keyword[new] identifier[Label] operator[SEP] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitJumpInsn] operator[SEP] identifier[IF_ICMPNE] , identifier[l3] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitInsn] operator[SEP] identifier[ICONST_0] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitJumpInsn] operator[SEP] identifier[GOTO] , identifier[l2] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitLabel] operator[SEP] identifier[l3] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitInsn] operator[SEP] identifier[ICONST_1] operator[SEP] operator[SEP] identifier[getController] operator[SEP] operator[SEP] operator[SEP] identifier[getOperandStack] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[ClassHelper] operator[SEP] identifier[int_TYPE] , Other[2] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static void register(ObjectName objectName, Object mbean) {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
try {
if (!server.isRegistered(objectName)) {
server.registerMBean(mbean, objectName);
}
} catch (InstanceAlreadyExistsException
| MBeanRegistrationException | NotCompliantMBeanException e) {
throw new CacheException("Error registering " + objectName, e);
}
} | class class_name[name] begin[{]
method[register, return_type[void], modifier[private static], parameter[objectName, mbean]] begin[{]
local_variable[type[MBeanServer], server]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=objectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isRegistered, postfix_operators=[], prefix_operators=['!'], qualifier=server, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mbean, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=objectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=registerMBean, postfix_operators=[], prefix_operators=[], qualifier=server, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error registering "), operandr=MemberReference(member=objectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CacheException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InstanceAlreadyExistsException', 'MBeanRegistrationException', 'NotCompliantMBeanException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[register] operator[SEP] identifier[ObjectName] identifier[objectName] , identifier[Object] identifier[mbean] operator[SEP] {
identifier[MBeanServer] identifier[server] operator[=] identifier[ManagementFactory] operator[SEP] identifier[getPlatformMBeanServer] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[server] operator[SEP] identifier[isRegistered] operator[SEP] identifier[objectName] operator[SEP] operator[SEP] {
identifier[server] operator[SEP] identifier[registerMBean] operator[SEP] identifier[mbean] , identifier[objectName] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[InstanceAlreadyExistsException] operator[|] identifier[MBeanRegistrationException] operator[|] identifier[NotCompliantMBeanException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CacheException] operator[SEP] literal[String] operator[+] identifier[objectName] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public final int getCodePointValue(int ch)
{
int offset;
// fastpath for U+0000..U+D7FF
if(0 <= ch && ch < UTF16.LEAD_SURROGATE_MIN_VALUE) {
// copy of getRawOffset()
offset = (m_index_[ch >> INDEX_STAGE_1_SHIFT_] << INDEX_STAGE_2_SHIFT_)
+ (ch & INDEX_STAGE_3_MASK_);
return m_data_[offset];
}
// handle U+D800..U+10FFFF
offset = getCodePointOffset(ch);
return (offset >= 0) ? m_data_[offset] : m_initialValue_;
} | class class_name[name] begin[{]
method[getCodePointValue, return_type[type[int]], modifier[final public], parameter[ch]] begin[{]
local_variable[type[int], offset]
if[binary_operation[binary_operation[literal[0], <=, member[.ch]], &&, binary_operation[member[.ch], <, member[UTF16.LEAD_SURROGATE_MIN_VALUE]]]] begin[{]
assign[member[.offset], binary_operation[binary_operation[member[.m_index_], <<, member[.INDEX_STAGE_2_SHIFT_]], +, binary_operation[member[.ch], &, member[.INDEX_STAGE_3_MASK_]]]]
return[member[.m_data_]]
else begin[{]
None
end[}]
assign[member[.offset], call[.getCodePointOffset, parameter[member[.ch]]]]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>=), if_false=MemberReference(member=m_initialValue_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=m_data_, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=offset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]))]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[int] identifier[getCodePointValue] operator[SEP] Keyword[int] identifier[ch] operator[SEP] {
Keyword[int] identifier[offset] operator[SEP] Keyword[if] operator[SEP] Other[0] operator[<=] identifier[ch] operator[&&] identifier[ch] operator[<] identifier[UTF16] operator[SEP] identifier[LEAD_SURROGATE_MIN_VALUE] operator[SEP] {
identifier[offset] operator[=] operator[SEP] identifier[m_index_] operator[SEP] identifier[ch] operator[>] operator[>] identifier[INDEX_STAGE_1_SHIFT_] operator[SEP] operator[<<] identifier[INDEX_STAGE_2_SHIFT_] operator[SEP] operator[+] operator[SEP] identifier[ch] operator[&] identifier[INDEX_STAGE_3_MASK_] operator[SEP] operator[SEP] Keyword[return] identifier[m_data_] operator[SEP] identifier[offset] operator[SEP] operator[SEP]
}
identifier[offset] operator[=] identifier[getCodePointOffset] operator[SEP] identifier[ch] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[offset] operator[>=] Other[0] operator[SEP] operator[?] identifier[m_data_] operator[SEP] identifier[offset] operator[SEP] operator[:] identifier[m_initialValue_] operator[SEP]
}
|
public static void delete(@NotNull String path, @NotNull Handler handler) {
staticInstance().delete(prefixPath(path), handler);
} | class class_name[name] begin[{]
method[delete, return_type[void], modifier[public static], parameter[path, handler]] begin[{]
call[.staticInstance, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[delete] operator[SEP] annotation[@] identifier[NotNull] identifier[String] identifier[path] , annotation[@] identifier[NotNull] identifier[Handler] identifier[handler] operator[SEP] {
identifier[staticInstance] operator[SEP] operator[SEP] operator[SEP] identifier[delete] operator[SEP] identifier[prefixPath] operator[SEP] identifier[path] operator[SEP] , identifier[handler] operator[SEP] operator[SEP]
}
|
void openBuffer() {
if(buffer == null) {
try {
buffer = input.map(MapMode.READ_ONLY, 0, input.size());
}
catch(IOException e) {
throw new AbortException("Cannot map input bundle.", e);
}
}
} | class class_name[name] begin[{]
method[openBuffer, return_type[void], modifier[default], parameter[]] begin[{]
if[binary_operation[member[.buffer], ==, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=READ_ONLY, postfix_operators=[], prefix_operators=[], qualifier=MapMode, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)], member=map, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot map input bundle."), 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=AbortException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[openBuffer] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[buffer] operator[==] Other[null] operator[SEP] {
Keyword[try] {
identifier[buffer] operator[=] identifier[input] operator[SEP] identifier[map] operator[SEP] identifier[MapMode] operator[SEP] identifier[READ_ONLY] , Other[0] , identifier[input] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AbortException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
protected boolean isZero( int index ) {
double bottom = Math.abs(diag[index])+Math.abs(diag[index+1]);
return( Math.abs(off[index]) <= bottom*UtilEjml.EPS);
} | class class_name[name] begin[{]
method[isZero, return_type[type[boolean]], modifier[protected], parameter[index]] begin[{]
local_variable[type[double], bottom]
return[binary_operation[call[Math.abs, parameter[member[.off]]], <=, binary_operation[member[.bottom], *, member[UtilEjml.EPS]]]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[isZero] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
Keyword[double] identifier[bottom] operator[=] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[diag] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[+] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[diag] operator[SEP] identifier[index] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[off] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[<=] identifier[bottom] operator[*] identifier[UtilEjml] operator[SEP] identifier[EPS] operator[SEP] operator[SEP]
}
|
public void Time_Normalization()
{
norm_setyear();
norm_setmonth();
norm_setday();
norm_sethour();
norm_setminute();
norm_setsecond();
norm_setTotal();
norm_setBaseRelated();
norm_setCurRelated();
modifyTimeBase();
_tp_origin.tunit = _tp.tunit.clone();
String [] time_grid=new String[6];
time_grid=normalizer.getTimeBase().split("-");
int tunitpointer=5;
while (tunitpointer>=0 && _tp.tunit[tunitpointer]<0)
{
tunitpointer--;
}
for (int i=0;i<tunitpointer;i++)
{
if (_tp.tunit[i]<0)
_tp.tunit[i]=Integer.parseInt(time_grid[i]);
}
String[] _result_tmp=new String[6];
_result_tmp[0]=String.valueOf(_tp.tunit[0]);
if (_tp.tunit[0]>=10 &&_tp.tunit[0]<100)
{
_result_tmp[0]="19"+String.valueOf(_tp.tunit[0]);
}
if (_tp.tunit[0]>0 &&_tp.tunit[0]<10)
{
_result_tmp[0]="200"+String.valueOf(_tp.tunit[0]);
}
for (int i = 1; i < 6; i++) {
_result_tmp[i] = String.valueOf(_tp.tunit[i]);
}
Calendar cale = Calendar.getInstance(); //leverage a calendar object to figure out the final time
cale.clear();
if (Integer.parseInt(_result_tmp[0]) != -1) {
Time_Norm += _result_tmp[0] + "年";
cale.set(Calendar.YEAR, Integer.valueOf(_result_tmp[0]));
if (Integer.parseInt(_result_tmp[1]) != -1) {
Time_Norm += _result_tmp[1] + "月";
cale.set(Calendar.MONTH, Integer.valueOf(_result_tmp[1]) - 1);
if (Integer.parseInt(_result_tmp[2]) != -1) {
Time_Norm += _result_tmp[2] + "日";
cale.set(Calendar.DAY_OF_MONTH, Integer.valueOf(_result_tmp[2]));
if (Integer.parseInt(_result_tmp[3]) != -1) {
Time_Norm += _result_tmp[3] + "时";
cale.set(Calendar.HOUR_OF_DAY, Integer.valueOf(_result_tmp[3]));
if (Integer.parseInt(_result_tmp[4]) != -1) {
Time_Norm += _result_tmp[4] + "分";
cale.set(Calendar.MINUTE, Integer.valueOf(_result_tmp[4]));
if (Integer.parseInt(_result_tmp[5]) != -1) {
Time_Norm += _result_tmp[5] + "秒";
cale.set(Calendar.SECOND, Integer.valueOf(_result_tmp[5]));
}
}
}
}
}
}
time = cale.getTime();
time_full = _tp.tunit.clone();
time_origin = _tp_origin.tunit.clone();
} | class class_name[name] begin[{]
method[Time_Normalization, return_type[void], modifier[public], parameter[]] begin[{]
call[.norm_setyear, parameter[]]
call[.norm_setmonth, parameter[]]
call[.norm_setday, parameter[]]
call[.norm_sethour, parameter[]]
call[.norm_setminute, parameter[]]
call[.norm_setsecond, parameter[]]
call[.norm_setTotal, parameter[]]
call[.norm_setBaseRelated, parameter[]]
call[.norm_setCurRelated, parameter[]]
call[.modifyTimeBase, parameter[]]
assign[member[_tp_origin.tunit], call[_tp.tunit.clone, parameter[]]]
local_variable[type[String], time_grid]
assign[member[.time_grid], call[normalizer.getTimeBase, parameter[]]]
local_variable[type[int], tunitpointer]
while[binary_operation[binary_operation[member[.tunitpointer], >=, literal[0]], &&, binary_operation[member[_tp.tunit], <, literal[0]]]] begin[{]
member[.tunitpointer]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=tunit, postfix_operators=[], prefix_operators=[], qualifier=_tp, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=tunit, postfix_operators=[], prefix_operators=[], qualifier=_tp, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=time_grid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)), label=None))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=tunitpointer, 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)
local_variable[type[String], _result_tmp]
assign[member[._result_tmp], call[String.valueOf, parameter[member[_tp.tunit]]]]
if[binary_operation[binary_operation[member[_tp.tunit], >=, literal[10]], &&, binary_operation[member[_tp.tunit], <, literal[100]]]] begin[{]
assign[member[._result_tmp], binary_operation[literal["19"], +, call[String.valueOf, parameter[member[_tp.tunit]]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[_tp.tunit], >, literal[0]], &&, binary_operation[member[_tp.tunit], <, literal[10]]]] begin[{]
assign[member[._result_tmp], binary_operation[literal["200"], +, call[String.valueOf, parameter[member[_tp.tunit]]]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=_result_tmp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=tunit, postfix_operators=[], prefix_operators=[], qualifier=_tp, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[Calendar], cale]
call[cale.clear, parameter[]]
if[binary_operation[call[Integer.parseInt, parameter[member[._result_tmp]]], !=, literal[1]]] begin[{]
assign[member[.Time_Norm], binary_operation[member[._result_tmp], +, literal["年"]]]
call[cale.set, parameter[member[Calendar.YEAR], call[Integer.valueOf, parameter[member[._result_tmp]]]]]
if[binary_operation[call[Integer.parseInt, parameter[member[._result_tmp]]], !=, literal[1]]] begin[{]
assign[member[.Time_Norm], binary_operation[member[._result_tmp], +, literal["月"]]]
call[cale.set, parameter[member[Calendar.MONTH], binary_operation[call[Integer.valueOf, parameter[member[._result_tmp]]], -, literal[1]]]]
if[binary_operation[call[Integer.parseInt, parameter[member[._result_tmp]]], !=, literal[1]]] begin[{]
assign[member[.Time_Norm], binary_operation[member[._result_tmp], +, literal["日"]]]
call[cale.set, parameter[member[Calendar.DAY_OF_MONTH], call[Integer.valueOf, parameter[member[._result_tmp]]]]]
if[binary_operation[call[Integer.parseInt, parameter[member[._result_tmp]]], !=, literal[1]]] begin[{]
assign[member[.Time_Norm], binary_operation[member[._result_tmp], +, literal["时"]]]
call[cale.set, parameter[member[Calendar.HOUR_OF_DAY], call[Integer.valueOf, parameter[member[._result_tmp]]]]]
if[binary_operation[call[Integer.parseInt, parameter[member[._result_tmp]]], !=, literal[1]]] begin[{]
assign[member[.Time_Norm], binary_operation[member[._result_tmp], +, literal["分"]]]
call[cale.set, parameter[member[Calendar.MINUTE], call[Integer.valueOf, parameter[member[._result_tmp]]]]]
if[binary_operation[call[Integer.parseInt, parameter[member[._result_tmp]]], !=, literal[1]]] begin[{]
assign[member[.Time_Norm], binary_operation[member[._result_tmp], +, literal["秒"]]]
call[cale.set, parameter[member[Calendar.SECOND], call[Integer.valueOf, parameter[member[._result_tmp]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.time], call[cale.getTime, parameter[]]]
assign[member[.time_full], call[_tp.tunit.clone, parameter[]]]
assign[member[.time_origin], call[_tp_origin.tunit.clone, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[Time_Normalization] operator[SEP] operator[SEP] {
identifier[norm_setyear] operator[SEP] operator[SEP] operator[SEP] identifier[norm_setmonth] operator[SEP] operator[SEP] operator[SEP] identifier[norm_setday] operator[SEP] operator[SEP] operator[SEP] identifier[norm_sethour] operator[SEP] operator[SEP] operator[SEP] identifier[norm_setminute] operator[SEP] operator[SEP] operator[SEP] identifier[norm_setsecond] operator[SEP] operator[SEP] operator[SEP] identifier[norm_setTotal] operator[SEP] operator[SEP] operator[SEP] identifier[norm_setBaseRelated] operator[SEP] operator[SEP] operator[SEP] identifier[norm_setCurRelated] operator[SEP] operator[SEP] operator[SEP] identifier[modifyTimeBase] operator[SEP] operator[SEP] operator[SEP] identifier[_tp_origin] operator[SEP] identifier[tunit] operator[=] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[time_grid] operator[=] Keyword[new] identifier[String] operator[SEP] Other[6] operator[SEP] operator[SEP] identifier[time_grid] operator[=] identifier[normalizer] operator[SEP] identifier[getTimeBase] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[tunitpointer] operator[=] Other[5] operator[SEP] Keyword[while] operator[SEP] identifier[tunitpointer] operator[>=] Other[0] operator[&&] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] identifier[tunitpointer] operator[SEP] operator[<] Other[0] operator[SEP] {
identifier[tunitpointer] operator[--] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[tunitpointer] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] identifier[i] operator[SEP] operator[<] Other[0] operator[SEP] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[time_grid] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[_result_tmp] operator[=] Keyword[new] identifier[String] operator[SEP] Other[6] operator[SEP] operator[SEP] identifier[_result_tmp] operator[SEP] Other[0] operator[SEP] operator[=] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] Other[0] operator[SEP] operator[>=] Other[10] operator[&&] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] Other[0] operator[SEP] operator[<] Other[100] operator[SEP] {
identifier[_result_tmp] operator[SEP] Other[0] operator[SEP] operator[=] literal[String] operator[+] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] Other[0] operator[SEP] operator[>] Other[0] operator[&&] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] Other[0] operator[SEP] operator[<] Other[10] operator[SEP] {
identifier[_result_tmp] operator[SEP] Other[0] operator[SEP] operator[=] literal[String] operator[+] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] Other[6] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[_result_tmp] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Calendar] identifier[cale] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[cale] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[_result_tmp] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[Time_Norm] operator[+=] identifier[_result_tmp] operator[SEP] Other[0] operator[SEP] operator[+] literal[String] operator[SEP] identifier[cale] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[YEAR] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[_result_tmp] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[_result_tmp] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[Time_Norm] operator[+=] identifier[_result_tmp] operator[SEP] Other[1] operator[SEP] operator[+] literal[String] operator[SEP] identifier[cale] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MONTH] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[_result_tmp] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[_result_tmp] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[Time_Norm] operator[+=] identifier[_result_tmp] operator[SEP] Other[2] operator[SEP] operator[+] literal[String] operator[SEP] identifier[cale] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[DAY_OF_MONTH] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[_result_tmp] operator[SEP] Other[2] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[_result_tmp] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[Time_Norm] operator[+=] identifier[_result_tmp] operator[SEP] Other[3] operator[SEP] operator[+] literal[String] operator[SEP] identifier[cale] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[HOUR_OF_DAY] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[_result_tmp] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[_result_tmp] operator[SEP] Other[4] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[Time_Norm] operator[+=] identifier[_result_tmp] operator[SEP] Other[4] operator[SEP] operator[+] literal[String] operator[SEP] identifier[cale] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[MINUTE] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[_result_tmp] operator[SEP] Other[4] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[_result_tmp] operator[SEP] Other[5] operator[SEP] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[Time_Norm] operator[+=] identifier[_result_tmp] operator[SEP] Other[5] operator[SEP] operator[+] literal[String] operator[SEP] identifier[cale] operator[SEP] identifier[set] operator[SEP] identifier[Calendar] operator[SEP] identifier[SECOND] , identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[_result_tmp] operator[SEP] Other[5] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
}
identifier[time] operator[=] identifier[cale] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] identifier[time_full] operator[=] identifier[_tp] operator[SEP] identifier[tunit] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[time_origin] operator[=] identifier[_tp_origin] operator[SEP] identifier[tunit] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP]
}
|
protected BufferedImage create_FOREGROUND_Image(final int WIDTH, final boolean WITH_CENTER_KNOB, final ForegroundType TYPE) {
return create_FOREGROUND_Image(WIDTH, WITH_CENTER_KNOB, TYPE, null);
} | class class_name[name] begin[{]
method[create_FOREGROUND_Image, return_type[type[BufferedImage]], modifier[protected], parameter[WIDTH, WITH_CENTER_KNOB, TYPE]] begin[{]
return[call[.create_FOREGROUND_Image, parameter[member[.WIDTH], member[.WITH_CENTER_KNOB], member[.TYPE], literal[null]]]]
end[}]
END[}] | Keyword[protected] identifier[BufferedImage] identifier[create_FOREGROUND_Image] operator[SEP] Keyword[final] Keyword[int] identifier[WIDTH] , Keyword[final] Keyword[boolean] identifier[WITH_CENTER_KNOB] , Keyword[final] identifier[ForegroundType] identifier[TYPE] operator[SEP] {
Keyword[return] identifier[create_FOREGROUND_Image] operator[SEP] identifier[WIDTH] , identifier[WITH_CENTER_KNOB] , identifier[TYPE] , Other[null] operator[SEP] operator[SEP]
}
|
@Override
public synchronized void update(Map<String, Object> config) {
// Update called by TrConfigurator and FFDCConfigurator
super.update(config);
ivLog.updateLoggingAttributes();
ivTrace.updateLoggingAttributes();
// ivText.ivEnabled = config.containsKey(HpelConstants.TEXT_LOG);
} | class class_name[name] begin[{]
method[update, return_type[void], modifier[synchronized public], parameter[config]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=config, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=update, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[ivLog.updateLoggingAttributes, parameter[]]
call[ivTrace.updateLoggingAttributes, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] Keyword[void] identifier[update] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[config] operator[SEP] {
Keyword[super] operator[SEP] identifier[update] operator[SEP] identifier[config] operator[SEP] operator[SEP] identifier[ivLog] operator[SEP] identifier[updateLoggingAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[ivTrace] operator[SEP] identifier[updateLoggingAttributes] operator[SEP] operator[SEP] operator[SEP]
}
|
public String getFullPath(String path) {
if (StringUtils.isEmpty(pathPrefix)) {
return path;
}
return PathNormalizer.asPath(pathPrefix + path);
} | class class_name[name] begin[{]
method[getFullPath, return_type[type[String]], modifier[public], parameter[path]] begin[{]
if[call[StringUtils.isEmpty, parameter[member[.pathPrefix]]]] begin[{]
return[member[.path]]
else begin[{]
None
end[}]
return[call[PathNormalizer.asPath, parameter[binary_operation[member[.pathPrefix], +, member[.path]]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getFullPath] operator[SEP] identifier[String] identifier[path] operator[SEP] {
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[pathPrefix] operator[SEP] operator[SEP] {
Keyword[return] identifier[path] operator[SEP]
}
Keyword[return] identifier[PathNormalizer] operator[SEP] identifier[asPath] operator[SEP] identifier[pathPrefix] operator[+] identifier[path] operator[SEP] operator[SEP]
}
|
public QualifiedJobId getQualifiedJobIdFromResult(Result result)
throws RowKeyParseException {
if (result == null) {
throw new RowKeyParseException(
"Cannot parse empty row key from result in HBase table: "
+ Constants.HISTORY_RAW_TABLE);
}
return idConv.fromBytes(result.getRow());
} | class class_name[name] begin[{]
method[getQualifiedJobIdFromResult, return_type[type[QualifiedJobId]], modifier[public], parameter[result]] begin[{]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot parse empty row key from result in HBase table: "), operandr=MemberReference(member=HISTORY_RAW_TABLE, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RowKeyParseException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[idConv.fromBytes, parameter[call[result.getRow, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[QualifiedJobId] identifier[getQualifiedJobIdFromResult] operator[SEP] identifier[Result] identifier[result] operator[SEP] Keyword[throws] identifier[RowKeyParseException] {
Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RowKeyParseException] operator[SEP] literal[String] operator[+] identifier[Constants] operator[SEP] identifier[HISTORY_RAW_TABLE] operator[SEP] operator[SEP]
}
Keyword[return] identifier[idConv] operator[SEP] identifier[fromBytes] operator[SEP] identifier[result] operator[SEP] identifier[getRow] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void write(InputStream is, File f) {
OutputStream os = null;
try {
os = new FileOutputStream(f);
int read = 0;
byte[] buffer = new byte[8096];
while ((read = is.read(buffer)) > 0) {
os.write(buffer, 0, read);
}
} catch (IOException e) {
throw new UnexpectedException(e);
} finally {
try {
is.close();
} catch (Exception e) {
//
}
try {
if (os != null) os.close();
} catch (Exception e) {
//
}
}
} | class class_name[name] begin[{]
method[write, return_type[void], modifier[public static], parameter[is, f]] begin[{]
local_variable[type[OutputStream], os]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=os, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileOutputStream, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=read)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8096)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte)), name=buffer)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=read, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=read, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnexpectedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=os, 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=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[write] operator[SEP] identifier[InputStream] identifier[is] , identifier[File] identifier[f] operator[SEP] {
identifier[OutputStream] identifier[os] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[os] operator[=] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[f] operator[SEP] operator[SEP] Keyword[int] identifier[read] operator[=] Other[0] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[8096] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[read] operator[=] identifier[is] operator[SEP] identifier[read] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[os] operator[SEP] identifier[write] operator[SEP] identifier[buffer] , Other[0] , identifier[read] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnexpectedException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[try] {
identifier[is] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
Keyword[try] {
Keyword[if] operator[SEP] identifier[os] operator[!=] Other[null] operator[SEP] identifier[os] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
}
}
}
|
static String stringLiteralWithDoubleQuotes(String value, String indent) {
StringBuilder result = new StringBuilder(value.length() + 2);
result.append('"');
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
// trivial case: single quote must not be escaped
if (c == '\'') {
result.append("'");
continue;
}
// trivial case: double quotes must be escaped
if (c == '\"') {
result.append("\\\"");
continue;
}
// default case: just let character literal do its work
result.append(characterLiteralWithoutSingleQuotes(c));
// need to append indent after linefeed?
if (c == '\n' && i + 1 < value.length()) {
result.append("\"\n").append(indent).append(indent).append("+ \"");
}
}
result.append('"');
return result.toString();
} | class class_name[name] begin[{]
method[stringLiteralWithDoubleQuotes, return_type[type[String]], modifier[static], parameter[value, indent]] begin[{]
local_variable[type[StringBuilder], result]
call[result.append, parameter[literal['"']]]
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=value, 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=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'")], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), 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=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\\"")], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=characterLiteralWithoutSingleQuotes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), 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='\n'), 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=1), operator=+), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), operator=<), 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="\"\n")], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[MethodInvocation(arguments=[MemberReference(member=indent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=indent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="+ \"")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[result.append, parameter[literal['"']]]
return[call[result.toString, parameter[]]]
end[}]
END[}] | Keyword[static] identifier[String] identifier[stringLiteralWithDoubleQuotes] operator[SEP] identifier[String] identifier[value] , identifier[String] identifier[indent] operator[SEP] {
identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[+] Other[2] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[value] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[characterLiteralWithoutSingleQuotes] operator[SEP] identifier[c] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[&&] identifier[i] operator[+] Other[1] operator[<] identifier[value] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[indent] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[indent] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[result] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void invoke(BurlapInput in, BurlapOutput out)
throws Exception
{
invoke(_service, in, out);
} | class class_name[name] begin[{]
method[invoke, return_type[void], modifier[public], parameter[in, out]] begin[{]
call[.invoke, parameter[member[._service], member[.in], member[.out]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[invoke] operator[SEP] identifier[BurlapInput] identifier[in] , identifier[BurlapOutput] identifier[out] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[invoke] operator[SEP] identifier[_service] , identifier[in] , identifier[out] operator[SEP] operator[SEP]
}
|
public boolean addVertex(Vertex<T> v)
{
if( verticies.containsValue(v) == false )
{
verticies.put(v.getName(), v);
return true;
}
return false;
} | class class_name[name] begin[{]
method[addVertex, return_type[type[boolean]], modifier[public], parameter[v]] begin[{]
if[binary_operation[call[verticies.containsValue, parameter[member[.v]]], ==, literal[false]]] begin[{]
call[verticies.put, parameter[call[v.getName, parameter[]], member[.v]]]
return[literal[true]]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[addVertex] operator[SEP] identifier[Vertex] operator[<] identifier[T] operator[>] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[verticies] operator[SEP] identifier[containsValue] operator[SEP] identifier[v] operator[SEP] operator[==] literal[boolean] operator[SEP] {
identifier[verticies] operator[SEP] identifier[put] operator[SEP] identifier[v] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[v] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static Intent mailto(List<String> to, List<String> cc, List<String> bcc, String subject,
String body) {
return new Intent(ACTION_SENDTO, Uris.mailto(to, cc, bcc, subject, body));
} | class class_name[name] begin[{]
method[mailto, return_type[type[Intent]], modifier[public static], parameter[to, cc, bcc, subject, body]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=ACTION_SENDTO, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=to, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bcc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=subject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mailto, postfix_operators=[], prefix_operators=[], qualifier=Uris, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Intent, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Intent] identifier[mailto] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[to] , identifier[List] operator[<] identifier[String] operator[>] identifier[cc] , identifier[List] operator[<] identifier[String] operator[>] identifier[bcc] , identifier[String] identifier[subject] , identifier[String] identifier[body] operator[SEP] {
Keyword[return] Keyword[new] identifier[Intent] operator[SEP] identifier[ACTION_SENDTO] , identifier[Uris] operator[SEP] identifier[mailto] operator[SEP] identifier[to] , identifier[cc] , identifier[bcc] , identifier[subject] , identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
private List<BBContainer> getOutputBuffers(Collection<SnapshotTableTask> tableTasks, boolean noSchedule)
{
final int desired = tableTasks.size();
while (true) {
int available = m_availableSnapshotBuffers.get();
//Limit the number of buffers used concurrently
if (desired > available) {
return null;
}
if (m_availableSnapshotBuffers.compareAndSet(available, available - desired)) break;
}
List<BBContainer> outputBuffers = new ArrayList<BBContainer>(tableTasks.size());
for (int ii = 0; ii < tableTasks.size(); ii++) {
final BBContainer origin = DBBPool.allocateDirectAndPool(m_snapshotBufferLength);
outputBuffers.add(createNewBuffer(origin, noSchedule));
}
return outputBuffers;
} | class class_name[name] begin[{]
method[getOutputBuffers, return_type[type[List]], modifier[private], parameter[tableTasks, noSchedule]] begin[{]
local_variable[type[int], desired]
while[literal[true]] begin[{]
local_variable[type[int], available]
if[binary_operation[member[.desired], >, member[.available]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[call[m_availableSnapshotBuffers.compareAndSet, parameter[member[.available], binary_operation[member[.available], -, member[.desired]]]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
local_variable[type[List], outputBuffers]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=m_snapshotBufferLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=allocateDirectAndPool, postfix_operators=[], prefix_operators=[], qualifier=DBBPool, selectors=[], type_arguments=None), name=origin)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=BBContainer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=origin, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=noSchedule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createNewBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=outputBuffers, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=tableTasks, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=ii)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ii, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.outputBuffers]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[BBContainer] operator[>] identifier[getOutputBuffers] operator[SEP] identifier[Collection] operator[<] identifier[SnapshotTableTask] operator[>] identifier[tableTasks] , Keyword[boolean] identifier[noSchedule] operator[SEP] {
Keyword[final] Keyword[int] identifier[desired] operator[=] identifier[tableTasks] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[int] identifier[available] operator[=] identifier[m_availableSnapshotBuffers] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[desired] operator[>] identifier[available] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_availableSnapshotBuffers] operator[SEP] identifier[compareAndSet] operator[SEP] identifier[available] , identifier[available] operator[-] identifier[desired] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
identifier[List] operator[<] identifier[BBContainer] operator[>] identifier[outputBuffers] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[BBContainer] operator[>] operator[SEP] identifier[tableTasks] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ii] operator[=] Other[0] operator[SEP] identifier[ii] operator[<] identifier[tableTasks] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[ii] operator[++] operator[SEP] {
Keyword[final] identifier[BBContainer] identifier[origin] operator[=] identifier[DBBPool] operator[SEP] identifier[allocateDirectAndPool] operator[SEP] identifier[m_snapshotBufferLength] operator[SEP] operator[SEP] identifier[outputBuffers] operator[SEP] identifier[add] operator[SEP] identifier[createNewBuffer] operator[SEP] identifier[origin] , identifier[noSchedule] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[outputBuffers] operator[SEP]
}
|
public static base_responses delete(nitro_service client, appfwlearningdata resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
appfwlearningdata deleteresources[] = new appfwlearningdata[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new appfwlearningdata();
deleteresources[i].profilename = resources[i].profilename;
deleteresources[i].starturl = resources[i].starturl;
deleteresources[i].cookieconsistency = resources[i].cookieconsistency;
deleteresources[i].fieldconsistency = resources[i].fieldconsistency;
deleteresources[i].formactionurl_ffc = resources[i].formactionurl_ffc;
deleteresources[i].crosssitescripting = resources[i].crosssitescripting;
deleteresources[i].formactionurl_xss = resources[i].formactionurl_xss;
deleteresources[i].sqlinjection = resources[i].sqlinjection;
deleteresources[i].formactionurl_sql = resources[i].formactionurl_sql;
deleteresources[i].fieldformat = resources[i].fieldformat;
deleteresources[i].formactionurl_ff = resources[i].formactionurl_ff;
deleteresources[i].csrftag = resources[i].csrftag;
deleteresources[i].csrfformoriginurl = resources[i].csrfformoriginurl;
deleteresources[i].xmldoscheck = resources[i].xmldoscheck;
deleteresources[i].xmlwsicheck = resources[i].xmlwsicheck;
deleteresources[i].xmlattachmentcheck = resources[i].xmlattachmentcheck;
deleteresources[i].totalxmlrequests = resources[i].totalxmlrequests;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | class class_name[name] begin[{]
method[delete, 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[appfwlearningdata], deleteresources]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, 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=appfwlearningdata, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=profilename, 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=profilename, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=starturl, 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=starturl, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=cookieconsistency, 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=cookieconsistency, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=fieldconsistency, 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=fieldconsistency, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=formactionurl_ffc, 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=formactionurl_ffc, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=crosssitescripting, 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=crosssitescripting, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=formactionurl_xss, 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=formactionurl_xss, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=sqlinjection, 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=sqlinjection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=formactionurl_sql, 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=formactionurl_sql, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=fieldformat, 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=fieldformat, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=formactionurl_ff, 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=formactionurl_ff, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=csrftag, 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=csrftag, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=csrfformoriginurl, 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=csrfformoriginurl, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=xmldoscheck, 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=xmldoscheck, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=xmlwsicheck, 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=xmlwsicheck, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=xmlattachmentcheck, 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=xmlattachmentcheck, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=deleteresources, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MemberReference(member=totalxmlrequests, 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=totalxmlrequests, 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[.delete_bulk_request, parameter[member[.client], member[.deleteresources]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_responses] identifier[delete] operator[SEP] identifier[nitro_service] identifier[client] , identifier[appfwlearningdata] 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[appfwlearningdata] identifier[deleteresources] operator[SEP] operator[SEP] operator[=] Keyword[new] identifier[appfwlearningdata] 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[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[=] Keyword[new] identifier[appfwlearningdata] operator[SEP] operator[SEP] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[profilename] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[profilename] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[starturl] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[starturl] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[cookieconsistency] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[cookieconsistency] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[fieldconsistency] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[fieldconsistency] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[formactionurl_ffc] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[formactionurl_ffc] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[crosssitescripting] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[crosssitescripting] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[formactionurl_xss] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[formactionurl_xss] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[sqlinjection] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[sqlinjection] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[formactionurl_sql] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[formactionurl_sql] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[fieldformat] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[fieldformat] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[formactionurl_ff] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[formactionurl_ff] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[csrftag] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[csrftag] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[csrfformoriginurl] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[csrfformoriginurl] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[xmldoscheck] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[xmldoscheck] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[xmlwsicheck] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[xmlwsicheck] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[xmlattachmentcheck] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[xmlattachmentcheck] operator[SEP] identifier[deleteresources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[totalxmlrequests] operator[=] identifier[resources] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[totalxmlrequests] operator[SEP]
}
identifier[result] operator[=] identifier[delete_bulk_request] operator[SEP] identifier[client] , identifier[deleteresources] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public void showIndeterminate(final int id, int status) {
final BaseNotificationItem notification = get(id);
if (notification == null) {
return;
}
notification.updateStatus(status);
notification.show(false);
} | class class_name[name] begin[{]
method[showIndeterminate, return_type[void], modifier[public], parameter[id, status]] begin[{]
local_variable[type[BaseNotificationItem], notification]
if[binary_operation[member[.notification], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[notification.updateStatus, parameter[member[.status]]]
call[notification.show, parameter[literal[false]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[showIndeterminate] operator[SEP] Keyword[final] Keyword[int] identifier[id] , Keyword[int] identifier[status] operator[SEP] {
Keyword[final] identifier[BaseNotificationItem] identifier[notification] operator[=] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[notification] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[notification] operator[SEP] identifier[updateStatus] operator[SEP] identifier[status] operator[SEP] operator[SEP] identifier[notification] operator[SEP] identifier[show] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
private static void writeZonePropsByTime(Writer writer, boolean isDst, String tzname,
int fromOffset, int toOffset, long time, boolean withRDATE) throws IOException {
beginZoneProps(writer, isDst, tzname, fromOffset, toOffset, time);
if (withRDATE) {
writer.write(ICAL_RDATE);
writer.write(COLON);
writer.write(getDateTimeString(time + fromOffset));
writer.write(NEWLINE);
}
endZoneProps(writer, isDst);
} | class class_name[name] begin[{]
method[writeZonePropsByTime, return_type[void], modifier[private static], parameter[writer, isDst, tzname, fromOffset, toOffset, time, withRDATE]] begin[{]
call[.beginZoneProps, parameter[member[.writer], member[.isDst], member[.tzname], member[.fromOffset], member[.toOffset], member[.time]]]
if[member[.withRDATE]] begin[{]
call[writer.write, parameter[member[.ICAL_RDATE]]]
call[writer.write, parameter[member[.COLON]]]
call[writer.write, parameter[call[.getDateTimeString, parameter[binary_operation[member[.time], +, member[.fromOffset]]]]]]
call[writer.write, parameter[member[.NEWLINE]]]
else begin[{]
None
end[}]
call[.endZoneProps, parameter[member[.writer], member[.isDst]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[writeZonePropsByTime] operator[SEP] identifier[Writer] identifier[writer] , Keyword[boolean] identifier[isDst] , identifier[String] identifier[tzname] , Keyword[int] identifier[fromOffset] , Keyword[int] identifier[toOffset] , Keyword[long] identifier[time] , Keyword[boolean] identifier[withRDATE] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[beginZoneProps] operator[SEP] identifier[writer] , identifier[isDst] , identifier[tzname] , identifier[fromOffset] , identifier[toOffset] , identifier[time] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[withRDATE] operator[SEP] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[ICAL_RDATE] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[COLON] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[getDateTimeString] operator[SEP] identifier[time] operator[+] identifier[fromOffset] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[NEWLINE] operator[SEP] operator[SEP]
}
identifier[endZoneProps] operator[SEP] identifier[writer] , identifier[isDst] operator[SEP] operator[SEP]
}
|
public boolean detectRootManagementApps(String[] additionalRootManagementApps) {
// Create a list of package names to iterate over from constants any others provided
ArrayList<String> packages = new ArrayList<>(Arrays.asList(Const.knownRootAppsPackages));
if (additionalRootManagementApps!=null && additionalRootManagementApps.length>0){
packages.addAll(Arrays.asList(additionalRootManagementApps));
}
return isAnyPackageFromListInstalled(packages);
} | class class_name[name] begin[{]
method[detectRootManagementApps, return_type[type[boolean]], modifier[public], parameter[additionalRootManagementApps]] begin[{]
local_variable[type[ArrayList], packages]
if[binary_operation[binary_operation[member[.additionalRootManagementApps], !=, literal[null]], &&, binary_operation[member[additionalRootManagementApps.length], >, literal[0]]]] begin[{]
call[packages.addAll, parameter[call[Arrays.asList, parameter[member[.additionalRootManagementApps]]]]]
else begin[{]
None
end[}]
return[call[.isAnyPackageFromListInstalled, parameter[member[.packages]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[detectRootManagementApps] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[additionalRootManagementApps] operator[SEP] {
identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[packages] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[Const] operator[SEP] identifier[knownRootAppsPackages] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[additionalRootManagementApps] operator[!=] Other[null] operator[&&] identifier[additionalRootManagementApps] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
identifier[packages] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[additionalRootManagementApps] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[isAnyPackageFromListInstalled] operator[SEP] identifier[packages] operator[SEP] operator[SEP]
}
|
public void destroy(long disconnectRequestTimeout) throws WorkspaceApiException {
try {
if (this.workspaceInitialized) {
notifications.disconnect(disconnectRequestTimeout);
sessionApi.logout();
}
} catch (Exception e) {
throw new WorkspaceApiException("destroy failed.", e);
} finally {
this.workspaceInitialized = false;
}
} | class class_name[name] begin[{]
method[destroy, return_type[void], modifier[public], parameter[disconnectRequestTimeout]] begin[{]
TryStatement(block=[IfStatement(condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=workspaceInitialized, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=disconnectRequestTimeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=disconnect, postfix_operators=[], prefix_operators=[], qualifier=notifications, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=logout, postfix_operators=[], prefix_operators=[], qualifier=sessionApi, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="destroy failed."), 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=WorkspaceApiException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=workspaceInitialized, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[destroy] operator[SEP] Keyword[long] identifier[disconnectRequestTimeout] operator[SEP] Keyword[throws] identifier[WorkspaceApiException] {
Keyword[try] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[workspaceInitialized] operator[SEP] {
identifier[notifications] operator[SEP] identifier[disconnect] operator[SEP] identifier[disconnectRequestTimeout] operator[SEP] operator[SEP] identifier[sessionApi] operator[SEP] identifier[logout] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[WorkspaceApiException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[this] operator[SEP] identifier[workspaceInitialized] operator[=] literal[boolean] operator[SEP]
}
}
|
public ValueList getValues(PExp exp, ObjectContext ctxt)
{
try
{
return exp.apply(af.getExpressionValueCollector(), ctxt);// FIXME: should we handle exceptions like this
} catch (AnalysisException e)
{
return null; // Most have none
}
} | class class_name[name] begin[{]
method[getValues, return_type[type[ValueList]], modifier[public], parameter[exp, ctxt]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getExpressionValueCollector, postfix_operators=[], prefix_operators=[], qualifier=af, selectors=[], type_arguments=None), MemberReference(member=ctxt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=exp, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['AnalysisException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[ValueList] identifier[getValues] operator[SEP] identifier[PExp] identifier[exp] , identifier[ObjectContext] identifier[ctxt] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[exp] operator[SEP] identifier[apply] operator[SEP] identifier[af] operator[SEP] identifier[getExpressionValueCollector] operator[SEP] operator[SEP] , identifier[ctxt] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AnalysisException] identifier[e] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
}
|
public static int dp2px(Context context, float dpVal) {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
dpVal, context.getResources().getDisplayMetrics());
} | class class_name[name] begin[{]
method[dp2px, return_type[type[int]], modifier[public static], parameter[context, dpVal]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=COMPLEX_UNIT_DIP, postfix_operators=[], prefix_operators=[], qualifier=TypedValue, selectors=[]), MemberReference(member=dpVal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResources, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[MethodInvocation(arguments=[], member=getDisplayMetrics, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=applyDimension, postfix_operators=[], prefix_operators=[], qualifier=TypedValue, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[dp2px] operator[SEP] identifier[Context] identifier[context] , Keyword[float] identifier[dpVal] operator[SEP] {
Keyword[return] operator[SEP] Keyword[int] operator[SEP] identifier[TypedValue] operator[SEP] identifier[applyDimension] operator[SEP] identifier[TypedValue] operator[SEP] identifier[COMPLEX_UNIT_DIP] , identifier[dpVal] , identifier[context] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[getDisplayMetrics] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static <T> T[] remove(T[] array, int index) throws IllegalArgumentException {
return (T[]) remove((Object) array, index);
} | class class_name[name] begin[{]
method[remove, return_type[type[T]], modifier[public static], parameter[array, index]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=T, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[T] operator[SEP] operator[SEP] identifier[array] , Keyword[int] identifier[index] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
Keyword[return] operator[SEP] identifier[T] operator[SEP] operator[SEP] operator[SEP] identifier[remove] operator[SEP] operator[SEP] identifier[Object] operator[SEP] identifier[array] , identifier[index] operator[SEP] operator[SEP]
}
|
public boolean isPathAvailable(Path path) {
try {
Configuration conf = HadoopUtils.newConfiguration();
FileSystem fs = FileSystem.get(this.getFsURI(), conf);
if (fs.exists(path)) {
return true;
} else {
log.warn("The data path [" + path + "] is not available on FileSystem: " + this.getFsURI());
return false;
}
} catch (IOException ioe) {
log.warn("Errors occurred while checking path [" + path + "] existence " + this.getFsURI(), ioe);
return false;
}
} | class class_name[name] begin[{]
method[isPathAvailable, return_type[type[boolean]], modifier[public], parameter[path]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newConfiguration, postfix_operators=[], prefix_operators=[], qualifier=HadoopUtils, selectors=[], type_arguments=None), name=conf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Configuration, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getFsURI, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), MemberReference(member=conf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=FileSystem, selectors=[], type_arguments=None), name=fs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileSystem, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exists, postfix_operators=[], prefix_operators=[], qualifier=fs, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The data path ["), operandr=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] is not available on FileSystem: "), operator=+), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getFsURI, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Errors occurred while checking path ["), operandr=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] existence "), operator=+), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getFsURI, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+), MemberReference(member=ioe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ioe, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isPathAvailable] operator[SEP] identifier[Path] identifier[path] operator[SEP] {
Keyword[try] {
identifier[Configuration] identifier[conf] operator[=] identifier[HadoopUtils] operator[SEP] identifier[newConfiguration] operator[SEP] operator[SEP] operator[SEP] identifier[FileSystem] identifier[fs] operator[=] identifier[FileSystem] operator[SEP] identifier[get] operator[SEP] Keyword[this] operator[SEP] identifier[getFsURI] operator[SEP] operator[SEP] , identifier[conf] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fs] operator[SEP] identifier[exists] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[path] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[getFsURI] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ioe] operator[SEP] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[path] operator[+] literal[String] operator[+] Keyword[this] operator[SEP] identifier[getFsURI] operator[SEP] operator[SEP] , identifier[ioe] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
|
public static boolean isAncestor(Path possibleAncestor, Path fullPath) {
return !relativizePath(fullPath, possibleAncestor).equals(getPathWithoutSchemeAndAuthority(fullPath));
} | class class_name[name] begin[{]
method[isAncestor, return_type[type[boolean]], modifier[public static], parameter[possibleAncestor, fullPath]] begin[{]
return[call[.relativizePath, parameter[member[.fullPath], member[.possibleAncestor]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isAncestor] operator[SEP] identifier[Path] identifier[possibleAncestor] , identifier[Path] identifier[fullPath] operator[SEP] {
Keyword[return] operator[!] identifier[relativizePath] operator[SEP] identifier[fullPath] , identifier[possibleAncestor] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[getPathWithoutSchemeAndAuthority] operator[SEP] identifier[fullPath] operator[SEP] operator[SEP] operator[SEP]
}
|
public static DataBuffer readShapeFromDisk(File readFrom) throws IOException {
try (FileInputStream os = new FileInputStream(readFrom)) {
FileChannel channel = os.getChannel();
// we read shapeinfo up to max_rank value, which is 32
int len = (int) Math.min((32 * 2 + 3) * 8, readFrom.length());
ByteBuffer buffer = ByteBuffer.allocateDirect(len);
channel.read(buffer);
ByteBuffer byteBuffer = buffer == null ? ByteBuffer.allocateDirect(buffer.array().length)
.put(buffer.array()).order(ByteOrder.nativeOrder()) : buffer.order(ByteOrder.nativeOrder());
buffer.position(0);
int rank = byteBuffer.getInt();
val result = new long[Shape.shapeInfoLength(rank)];
// filling DataBuffer with shape info
result[0] = rank;
// skipping two next values (dtype and rank again)
// please , that this time rank has dtype of LONG, so takes 8 bytes.
byteBuffer.position(16);
// filling shape information
for (int e = 1; e < Shape.shapeInfoLength(rank); e++) {
result[e] = byteBuffer.getLong();
}
// creating nd4j databuffer now
DataBuffer dataBuffer = Nd4j.getDataBufferFactory().createLong(result);
return dataBuffer;
}
} | class class_name[name] begin[{]
method[readShapeFromDisk, return_type[type[DataBuffer]], modifier[public static], parameter[readFrom]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getChannel, postfix_operators=[], prefix_operators=[], qualifier=os, selectors=[], type_arguments=None), name=channel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FileChannel, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=32), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=*), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=*), MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=readFrom, selectors=[], type_arguments=None)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int)), name=len)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=allocateDirect, postfix_operators=[], prefix_operators=[], qualifier=ByteBuffer, selectors=[], type_arguments=None), name=buffer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read, postfix_operators=[], prefix_operators=[], qualifier=channel, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nativeOrder, postfix_operators=[], prefix_operators=[], qualifier=ByteOrder, selectors=[], type_arguments=None)], member=order, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=array, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None)], member=allocateDirect, postfix_operators=[], prefix_operators=[], qualifier=ByteBuffer, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=array, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None)], member=put, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=nativeOrder, postfix_operators=[], prefix_operators=[], qualifier=ByteOrder, selectors=[], type_arguments=None)], member=order, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), name=byteBuffer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=position, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=byteBuffer, selectors=[], type_arguments=None), name=rank)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MethodInvocation(arguments=[MemberReference(member=rank, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=shapeInfoLength, postfix_operators=[], prefix_operators=[], qualifier=Shape, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=long)), name=result)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=val, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), type==, value=MemberReference(member=rank, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16)], member=position, postfix_operators=[], prefix_operators=[], qualifier=byteBuffer, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=byteBuffer, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=rank, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=shapeInfoLength, postfix_operators=[], prefix_operators=[], qualifier=Shape, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=e)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=e, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getDataBufferFactory, postfix_operators=[], prefix_operators=[], qualifier=Nd4j, selectors=[MethodInvocation(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createLong, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=dataBuffer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DataBuffer, sub_type=None)), ReturnStatement(expression=MemberReference(member=dataBuffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=os, type=ReferenceType(arguments=None, dimensions=[], name=FileInputStream, sub_type=None), value=ClassCreator(arguments=[MemberReference(member=readFrom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None)))])
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DataBuffer] identifier[readShapeFromDisk] operator[SEP] identifier[File] identifier[readFrom] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] operator[SEP] identifier[FileInputStream] identifier[os] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[readFrom] operator[SEP] operator[SEP] {
identifier[FileChannel] identifier[channel] operator[=] identifier[os] operator[SEP] identifier[getChannel] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[min] operator[SEP] operator[SEP] Other[32] operator[*] Other[2] operator[+] Other[3] operator[SEP] operator[*] Other[8] , identifier[readFrom] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ByteBuffer] identifier[buffer] operator[=] identifier[ByteBuffer] operator[SEP] identifier[allocateDirect] operator[SEP] identifier[len] operator[SEP] operator[SEP] identifier[channel] operator[SEP] identifier[read] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] identifier[ByteBuffer] identifier[byteBuffer] operator[=] identifier[buffer] operator[==] Other[null] operator[?] identifier[ByteBuffer] operator[SEP] identifier[allocateDirect] operator[SEP] identifier[buffer] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[buffer] operator[SEP] identifier[array] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[order] operator[SEP] identifier[ByteOrder] operator[SEP] identifier[nativeOrder] operator[SEP] operator[SEP] operator[SEP] operator[:] identifier[buffer] operator[SEP] identifier[order] operator[SEP] identifier[ByteOrder] operator[SEP] identifier[nativeOrder] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[buffer] operator[SEP] identifier[position] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[int] identifier[rank] operator[=] identifier[byteBuffer] operator[SEP] identifier[getInt] operator[SEP] operator[SEP] operator[SEP] identifier[val] identifier[result] operator[=] Keyword[new] Keyword[long] operator[SEP] identifier[Shape] operator[SEP] identifier[shapeInfoLength] operator[SEP] identifier[rank] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] Other[0] operator[SEP] operator[=] identifier[rank] operator[SEP] identifier[byteBuffer] operator[SEP] identifier[position] operator[SEP] Other[16] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[e] operator[=] Other[1] operator[SEP] identifier[e] operator[<] identifier[Shape] operator[SEP] identifier[shapeInfoLength] operator[SEP] identifier[rank] operator[SEP] operator[SEP] identifier[e] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[e] operator[SEP] operator[=] identifier[byteBuffer] operator[SEP] identifier[getLong] operator[SEP] operator[SEP] operator[SEP]
}
identifier[DataBuffer] identifier[dataBuffer] operator[=] identifier[Nd4j] operator[SEP] identifier[getDataBufferFactory] operator[SEP] operator[SEP] operator[SEP] identifier[createLong] operator[SEP] identifier[result] operator[SEP] operator[SEP] Keyword[return] identifier[dataBuffer] operator[SEP]
}
}
|
public Properties getPropertiesFromDynamicSelectionInfo(Map<String, Object> connectionInfo) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "getPropertiesFromDynamicSelectionInfo", new Object[] { connectionInfo });
if (connectionInfo == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "No connection information provided.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getPropertiesFromDynamicSelectionInfo");
return null; // this allows it to move forward with other precedence.
}
if (dynamicSelections.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "There are no dynamic outbound selections configured.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getPropertiesFromDynamicSelectionInfo");
return null;
}
/***
* First look for a cached MISS in case it has already been looked
* up from this particular connection info data.
***/
synchronized (dynamicLookupMisses) {
if (dynamicLookupMisses.contains(connectionInfo)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "This connectionInfo was checked before, found in the lookup misses cache.");
if (tc.isEntryEnabled())
Tr.exit(tc, "getPropertiesFromDynamicSelectionInfo");
return null;
}
}
/***
* Next look for a cache HIT in case it has already been looked up from this
* particular connection info data.
***/
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Dynamic outbound lookup cache size is " + dynamicLookupCache.size());
SSLConfig cachedConfig = dynamicLookupCache.get(connectionInfo);
if (cachedConfig != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Found in cache.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getPropertiesFromDynamicSelectionInfo", cachedConfig);
return cachedConfig;
}
String direction = (String) connectionInfo.get(Constants.CONNECTION_INFO_DIRECTION);
if (direction != null && direction.equals(Constants.DIRECTION_INBOUND)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Connection information is for an inbound connection return null.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getPropertiesFromDynamicSelectionInfo");
return null;
}
String connInfoRemoteHost = (String) connectionInfo.get(Constants.CONNECTION_INFO_REMOTE_HOST);
String connInfoRemotePort = (String) connectionInfo.get(Constants.CONNECTION_INFO_REMOTE_PORT);
Tr.debug(tc, "Host from connectionInfo is " + connInfoRemoteHost + " and port from connectionInfo is " + connInfoRemotePort);
/***
* Look through all of the SSLConfigs in this list which all contain a
* property with values for com.ibm.ssl.dynamicSelectionInfo.
***/
if (connInfoRemoteHost != null) {
SSLConfig sslCfg = lookForMatchInList(dynamicHostPortSelections, connInfoRemoteHost, connInfoRemotePort);
if (sslCfg != null) {
dynamicLookupCache.put(connectionInfo, sslCfg);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Found in the host and port list.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getPropertiesFromDynamicSelectionInfo", sslCfg);
return sslCfg;
}
sslCfg = lookForMatchInList(dynamicHostSelections, connInfoRemoteHost, connInfoRemotePort);
if (sslCfg != null) {
dynamicLookupCache.put(connectionInfo, sslCfg);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Found in the host list.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getPropertiesFromDynamicSelectionInfo", sslCfg);
return sslCfg;
}
}
synchronized (dynamicLookupMisses) {
if (dynamicLookupMisses.size() > 50) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Cache miss tree set size is > 50, clearing the TreeSet.");
dynamicLookupMisses.clear();
}
dynamicLookupMisses.add(connectionInfo);
if (tc.isDebugEnabled())
Tr.debug(tc, "Cache miss tree set size is " + dynamicLookupMisses.size() + " entries.");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "No match found in host or host and port list.");
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getPropertiesFromDynamicSelectionInfo");
return null;
} | class class_name[name] begin[{]
method[getPropertiesFromDynamicSelectionInfo, return_type[type[Properties]], modifier[public], parameter[connectionInfo]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[member[.tc], literal["getPropertiesFromDynamicSelectionInfo"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=connectionInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[member[.connectionInfo], ==, literal[null]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["No connection information provided."]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getPropertiesFromDynamicSelectionInfo"]]]
else begin[{]
None
end[}]
return[literal[null]]
else begin[{]
None
end[}]
if[call[dynamicSelections.isEmpty, parameter[]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["There are no dynamic outbound selections configured."]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getPropertiesFromDynamicSelectionInfo"]]]
else begin[{]
None
end[}]
return[literal[null]]
else begin[{]
None
end[}]
SYNCHRONIZED[member[.dynamicLookupMisses]] BEGIN[{]
if[call[dynamicLookupMisses.contains, parameter[member[.connectionInfo]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["This connectionInfo was checked before, found in the lookup misses cache."]]]
else begin[{]
None
end[}]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getPropertiesFromDynamicSelectionInfo"]]]
else begin[{]
None
end[}]
return[literal[null]]
else begin[{]
None
end[}]
END[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[literal["Dynamic outbound lookup cache size is "], +, call[dynamicLookupCache.size, parameter[]]]]]
else begin[{]
None
end[}]
local_variable[type[SSLConfig], cachedConfig]
if[binary_operation[member[.cachedConfig], !=, literal[null]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["Found in cache."]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getPropertiesFromDynamicSelectionInfo"], member[.cachedConfig]]]
else begin[{]
None
end[}]
return[member[.cachedConfig]]
else begin[{]
None
end[}]
local_variable[type[String], direction]
if[binary_operation[binary_operation[member[.direction], !=, literal[null]], &&, call[direction.equals, parameter[member[Constants.DIRECTION_INBOUND]]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["Connection information is for an inbound connection return null."]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getPropertiesFromDynamicSelectionInfo"]]]
else begin[{]
None
end[}]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], connInfoRemoteHost]
local_variable[type[String], connInfoRemotePort]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[binary_operation[literal["Host from connectionInfo is "], +, member[.connInfoRemoteHost]], +, literal[" and port from connectionInfo is "]], +, member[.connInfoRemotePort]]]]
if[binary_operation[member[.connInfoRemoteHost], !=, literal[null]]] begin[{]
local_variable[type[SSLConfig], sslCfg]
if[binary_operation[member[.sslCfg], !=, literal[null]]] begin[{]
call[dynamicLookupCache.put, parameter[member[.connectionInfo], member[.sslCfg]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["Found in the host and port list."]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getPropertiesFromDynamicSelectionInfo"], member[.sslCfg]]]
else begin[{]
None
end[}]
return[member[.sslCfg]]
else begin[{]
None
end[}]
assign[member[.sslCfg], call[.lookForMatchInList, parameter[member[.dynamicHostSelections], member[.connInfoRemoteHost], member[.connInfoRemotePort]]]]
if[binary_operation[member[.sslCfg], !=, literal[null]]] begin[{]
call[dynamicLookupCache.put, parameter[member[.connectionInfo], member[.sslCfg]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["Found in the host list."]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getPropertiesFromDynamicSelectionInfo"], member[.sslCfg]]]
else begin[{]
None
end[}]
return[member[.sslCfg]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
SYNCHRONIZED[member[.dynamicLookupMisses]] BEGIN[{]
if[binary_operation[call[dynamicLookupMisses.size, parameter[]], >, literal[50]]] begin[{]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["Cache miss tree set size is > 50, clearing the TreeSet."]]]
else begin[{]
None
end[}]
call[dynamicLookupMisses.clear, parameter[]]
else begin[{]
None
end[}]
call[dynamicLookupMisses.add, parameter[member[.connectionInfo]]]
if[call[tc.isDebugEnabled, parameter[]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[binary_operation[literal["Cache miss tree set size is "], +, call[dynamicLookupMisses.size, parameter[]]], +, literal[" entries."]]]]
else begin[{]
None
end[}]
END[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["No match found in host or host and port list."]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], literal["getPropertiesFromDynamicSelectionInfo"]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[Properties] identifier[getPropertiesFromDynamicSelectionInfo] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[connectionInfo] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[connectionInfo]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[connectionInfo] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[dynamicSelections] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[dynamicLookupMisses] operator[SEP] {
Keyword[if] operator[SEP] identifier[dynamicLookupMisses] operator[SEP] identifier[contains] operator[SEP] identifier[connectionInfo] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[dynamicLookupCache] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[SSLConfig] identifier[cachedConfig] operator[=] identifier[dynamicLookupCache] operator[SEP] identifier[get] operator[SEP] identifier[connectionInfo] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cachedConfig] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[cachedConfig] operator[SEP] operator[SEP] Keyword[return] identifier[cachedConfig] operator[SEP]
}
identifier[String] identifier[direction] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[connectionInfo] operator[SEP] identifier[get] operator[SEP] identifier[Constants] operator[SEP] identifier[CONNECTION_INFO_DIRECTION] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[direction] operator[!=] Other[null] operator[&&] identifier[direction] operator[SEP] identifier[equals] operator[SEP] identifier[Constants] operator[SEP] identifier[DIRECTION_INBOUND] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[connInfoRemoteHost] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[connectionInfo] operator[SEP] identifier[get] operator[SEP] identifier[Constants] operator[SEP] identifier[CONNECTION_INFO_REMOTE_HOST] operator[SEP] operator[SEP] identifier[String] identifier[connInfoRemotePort] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[connectionInfo] operator[SEP] identifier[get] operator[SEP] identifier[Constants] operator[SEP] identifier[CONNECTION_INFO_REMOTE_PORT] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[connInfoRemoteHost] operator[+] literal[String] operator[+] identifier[connInfoRemotePort] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[connInfoRemoteHost] operator[!=] Other[null] operator[SEP] {
identifier[SSLConfig] identifier[sslCfg] operator[=] identifier[lookForMatchInList] operator[SEP] identifier[dynamicHostPortSelections] , identifier[connInfoRemoteHost] , identifier[connInfoRemotePort] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sslCfg] operator[!=] Other[null] operator[SEP] {
identifier[dynamicLookupCache] operator[SEP] identifier[put] operator[SEP] identifier[connectionInfo] , identifier[sslCfg] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[sslCfg] operator[SEP] operator[SEP] Keyword[return] identifier[sslCfg] operator[SEP]
}
identifier[sslCfg] operator[=] identifier[lookForMatchInList] operator[SEP] identifier[dynamicHostSelections] , identifier[connInfoRemoteHost] , identifier[connInfoRemotePort] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sslCfg] operator[!=] Other[null] operator[SEP] {
identifier[dynamicLookupCache] operator[SEP] identifier[put] operator[SEP] identifier[connectionInfo] , identifier[sslCfg] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[sslCfg] operator[SEP] operator[SEP] Keyword[return] identifier[sslCfg] operator[SEP]
}
}
Keyword[synchronized] operator[SEP] identifier[dynamicLookupMisses] operator[SEP] {
Keyword[if] operator[SEP] identifier[dynamicLookupMisses] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[50] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[dynamicLookupMisses] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP]
}
identifier[dynamicLookupMisses] operator[SEP] identifier[add] operator[SEP] identifier[connectionInfo] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[dynamicLookupMisses] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
private Map<CtClass, Set<CtMethod>> find(final CtMethod declaredMethod, final int level, final Map<CtClass, Set<CtMethod>> dict) {
if (level < 0) {
throw new IllegalArgumentException("level < 0");
}
addToMap(declaredMethod.getDeclaringClass(), declaredMethod, dict);
if (level > 0) {
try {
declaredMethod.instrument(new ExprEditor() {
@Override
public void edit(final MethodCall m) throws CannotCompileException {
try {
CtMethod method = m.getMethod();
LOG.info(method.getLongName() + " / " + level);
find(method, level - 1, dict);
} catch (NotFoundException e) {
e.printStackTrace(); // should not happen
}
super.edit(m);
}
});
} catch (CannotCompileException e) {
// cannot possibly be thrown due to the fact that we don't change anything here
e.printStackTrace();
}
}
return dict;
} | class class_name[name] begin[{]
method[find, return_type[type[Map]], modifier[private], parameter[declaredMethod, level, dict]] begin[{]
if[binary_operation[member[.level], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="level < 0")], 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[}]
call[.addToMap, parameter[call[declaredMethod.getDeclaringClass, parameter[]], member[.declaredMethod], member[.dict]]]
if[binary_operation[member[.level], >, literal[0]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getMethod, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CtMethod, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getLongName, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" / "), operator=+), operandr=MemberReference(member=level, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=method, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=level, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), MemberReference(member=dict, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=find, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NotFoundException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=SuperMethodInvocation(arguments=[MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=edit, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=edit, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=m, type=ReferenceType(arguments=None, dimensions=[], name=MethodCall, sub_type=None), varargs=False)], return_type=None, throws=['CannotCompileException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExprEditor, sub_type=None))], member=instrument, postfix_operators=[], prefix_operators=[], qualifier=declaredMethod, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CannotCompileException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.dict]]
end[}]
END[}] | Keyword[private] identifier[Map] operator[<] identifier[CtClass] , identifier[Set] operator[<] identifier[CtMethod] operator[>] operator[>] identifier[find] operator[SEP] Keyword[final] identifier[CtMethod] identifier[declaredMethod] , Keyword[final] Keyword[int] identifier[level] , Keyword[final] identifier[Map] operator[<] identifier[CtClass] , identifier[Set] operator[<] identifier[CtMethod] operator[>] operator[>] identifier[dict] operator[SEP] {
Keyword[if] operator[SEP] identifier[level] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[addToMap] operator[SEP] identifier[declaredMethod] operator[SEP] identifier[getDeclaringClass] operator[SEP] operator[SEP] , identifier[declaredMethod] , identifier[dict] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[level] operator[>] Other[0] operator[SEP] {
Keyword[try] {
identifier[declaredMethod] operator[SEP] identifier[instrument] operator[SEP] Keyword[new] identifier[ExprEditor] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[edit] operator[SEP] Keyword[final] identifier[MethodCall] identifier[m] operator[SEP] Keyword[throws] identifier[CannotCompileException] {
Keyword[try] {
identifier[CtMethod] identifier[method] operator[=] identifier[m] operator[SEP] identifier[getMethod] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] identifier[method] operator[SEP] identifier[getLongName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[level] operator[SEP] operator[SEP] identifier[find] operator[SEP] identifier[method] , identifier[level] operator[-] Other[1] , identifier[dict] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NotFoundException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[edit] operator[SEP] identifier[m] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CannotCompileException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[dict] operator[SEP]
}
|
public int set(int index, int element)
{
boundsCheck(index);
int prev = array[index];
array[index] = element;
return prev;
} | class class_name[name] begin[{]
method[set, return_type[type[int]], modifier[public], parameter[index, element]] begin[{]
call[.boundsCheck, parameter[member[.index]]]
local_variable[type[int], prev]
assign[member[.array], member[.element]]
return[member[.prev]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[set] operator[SEP] Keyword[int] identifier[index] , Keyword[int] identifier[element] operator[SEP] {
identifier[boundsCheck] operator[SEP] identifier[index] operator[SEP] operator[SEP] Keyword[int] identifier[prev] operator[=] identifier[array] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[array] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[element] operator[SEP] Keyword[return] identifier[prev] operator[SEP]
}
|
public OAuth2StoreBuilder addAdditionalParameter(String key, String value) {
oAuth2Store.getAdditionalParameters().put(key, value);
return this;
} | class class_name[name] begin[{]
method[addAdditionalParameter, return_type[type[OAuth2StoreBuilder]], modifier[public], parameter[key, value]] begin[{]
call[oAuth2Store.getAdditionalParameters, parameter[]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[OAuth2StoreBuilder] identifier[addAdditionalParameter] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] {
identifier[oAuth2Store] operator[SEP] identifier[getAdditionalParameters] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
static Set<PathMatcher> createPathMatcherSet(final String[] targets) {
return Arrays.stream(targets)
.map(inclusion -> FileSystems.getDefault().getPathMatcher("glob:" + inclusion))
.collect(Collectors.toSet());
} | class class_name[name] begin[{]
method[createPathMatcherSet, return_type[type[Set]], modifier[static], parameter[targets]] begin[{]
return[call[Arrays.stream, parameter[member[.targets]]]]
end[}]
END[}] | Keyword[static] identifier[Set] operator[<] identifier[PathMatcher] operator[>] identifier[createPathMatcherSet] operator[SEP] Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[targets] operator[SEP] {
Keyword[return] identifier[Arrays] operator[SEP] identifier[stream] operator[SEP] identifier[targets] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[inclusion] operator[->] identifier[FileSystems] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP] identifier[getPathMatcher] operator[SEP] literal[String] operator[+] identifier[inclusion] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toSet] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void getProxyInfos(Collection<ProxyInfo> result) {
for (Map.Entry<String, DistributedObjectFuture> entry : proxies.entrySet()) {
DistributedObjectFuture future = entry.getValue();
if (future.isSetAndInitialized()) {
String proxyName = entry.getKey();
result.add(new ProxyInfo(serviceName, proxyName));
}
}
} | class class_name[name] begin[{]
method[getProxyInfos, return_type[void], modifier[public], parameter[result]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=future)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DistributedObjectFuture, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isSetAndInitialized, postfix_operators=[], prefix_operators=[], qualifier=future, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=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=proxyName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=serviceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=proxyName, 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=ProxyInfo, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=proxies, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DistributedObjectFuture, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[getProxyInfos] operator[SEP] identifier[Collection] operator[<] identifier[ProxyInfo] operator[>] identifier[result] operator[SEP] {
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[DistributedObjectFuture] operator[>] identifier[entry] operator[:] identifier[proxies] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[DistributedObjectFuture] identifier[future] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[future] operator[SEP] identifier[isSetAndInitialized] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[proxyName] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ProxyInfo] operator[SEP] identifier[serviceName] , identifier[proxyName] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <U> Flowable<T> delay(final Function<? super T, ? extends Publisher<U>> itemDelayIndicator) {
ObjectHelper.requireNonNull(itemDelayIndicator, "itemDelayIndicator is null");
return flatMap(FlowableInternalHelper.itemDelay(itemDelayIndicator));
} | class class_name[name] begin[{]
method[delay, return_type[type[Flowable]], modifier[final public], parameter[itemDelayIndicator]] begin[{]
call[ObjectHelper.requireNonNull, parameter[member[.itemDelayIndicator], literal["itemDelayIndicator is null"]]]
return[call[.flatMap, parameter[call[FlowableInternalHelper.itemDelay, parameter[member[.itemDelayIndicator]]]]]]
end[}]
END[}] | annotation[@] identifier[CheckReturnValue] annotation[@] identifier[BackpressureSupport] operator[SEP] identifier[BackpressureKind] operator[SEP] identifier[FULL] operator[SEP] annotation[@] identifier[SchedulerSupport] operator[SEP] identifier[SchedulerSupport] operator[SEP] identifier[NONE] operator[SEP] Keyword[public] Keyword[final] operator[<] identifier[U] operator[>] identifier[Flowable] operator[<] identifier[T] operator[>] identifier[delay] operator[SEP] Keyword[final] identifier[Function] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[Publisher] operator[<] identifier[U] operator[>] operator[>] identifier[itemDelayIndicator] operator[SEP] {
identifier[ObjectHelper] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[itemDelayIndicator] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[flatMap] operator[SEP] identifier[FlowableInternalHelper] operator[SEP] identifier[itemDelay] operator[SEP] identifier[itemDelayIndicator] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setDeptype(String v) {
if (Dependency_Type.featOkTst && ((Dependency_Type)jcasType).casFeat_deptype == null)
jcasType.jcas.throwFeatMissing("deptype", "com.digitalpebble.rasp.Dependency");
jcasType.ll_cas.ll_setStringValue(addr, ((Dependency_Type)jcasType).casFeatCode_deptype, v);} | class class_name[name] begin[{]
method[setDeptype, return_type[void], modifier[public], parameter[v]] begin[{]
if[binary_operation[member[Dependency_Type.featOkTst], &&, binary_operation[Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Dependency_Type, sub_type=None)), ==, literal[null]]]] begin[{]
call[jcasType.jcas.throwFeatMissing, parameter[literal["deptype"], literal["com.digitalpebble.rasp.Dependency"]]]
else begin[{]
None
end[}]
call[jcasType.ll_cas.ll_setStringValue, parameter[member[.addr], Cast(expression=MemberReference(member=jcasType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Dependency_Type, sub_type=None)), member[.v]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setDeptype] operator[SEP] identifier[String] identifier[v] operator[SEP] {
Keyword[if] operator[SEP] identifier[Dependency_Type] operator[SEP] identifier[featOkTst] operator[&&] operator[SEP] operator[SEP] identifier[Dependency_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeat_deptype] operator[==] Other[null] operator[SEP] identifier[jcasType] operator[SEP] identifier[jcas] operator[SEP] identifier[throwFeatMissing] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[jcasType] operator[SEP] identifier[ll_cas] operator[SEP] identifier[ll_setStringValue] operator[SEP] identifier[addr] , operator[SEP] operator[SEP] identifier[Dependency_Type] operator[SEP] identifier[jcasType] operator[SEP] operator[SEP] identifier[casFeatCode_deptype] , identifier[v] operator[SEP] operator[SEP]
}
|
public int unmapClass(int clazz) {
Col c = _c[_c.length-1];
if (c._isByte)
return clazz;
else {
// OK, this is not fully correct bad handle corner-cases like for example dataset uses classes only
// with 0 and 3. Our API reports that there are 4 classes but in fact there are only 2 classes.
if (clazz >= c._binned2raw.length) clazz = c._binned2raw.length - 1;
return (int) (c.raw(clazz) - c._min);
}
} | class class_name[name] begin[{]
method[unmapClass, return_type[type[int]], modifier[public], parameter[clazz]] begin[{]
local_variable[type[Col], c]
if[member[c._isByte]] begin[{]
return[member[.clazz]]
else begin[{]
if[binary_operation[member[.clazz], >=, member[c._binned2raw.length]]] begin[{]
assign[member[.clazz], binary_operation[member[c._binned2raw.length], -, literal[1]]]
else begin[{]
None
end[}]
return[Cast(expression=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=raw, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), operandr=MemberReference(member=_min, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[]), operator=-), type=BasicType(dimensions=[], name=int))]
end[}]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[unmapClass] operator[SEP] Keyword[int] identifier[clazz] operator[SEP] {
identifier[Col] identifier[c] operator[=] identifier[_c] operator[SEP] identifier[_c] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[_isByte] operator[SEP] Keyword[return] identifier[clazz] operator[SEP] Keyword[else] {
Keyword[if] operator[SEP] identifier[clazz] operator[>=] identifier[c] operator[SEP] identifier[_binned2raw] operator[SEP] identifier[length] operator[SEP] identifier[clazz] operator[=] identifier[c] operator[SEP] identifier[_binned2raw] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] Keyword[return] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[c] operator[SEP] identifier[raw] operator[SEP] identifier[clazz] operator[SEP] operator[-] identifier[c] operator[SEP] identifier[_min] operator[SEP] operator[SEP]
}
}
|
public static Set<Bugsnag> uncaughtExceptionClients() {
UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler();
if (handler instanceof ExceptionHandler) {
ExceptionHandler bugsnagHandler = (ExceptionHandler) handler;
return Collections.unmodifiableSet(bugsnagHandler.uncaughtExceptionClients());
}
return Collections.emptySet();
} | class class_name[name] begin[{]
method[uncaughtExceptionClients, return_type[type[Set]], modifier[public static], parameter[]] begin[{]
local_variable[type[UncaughtExceptionHandler], handler]
if[binary_operation[member[.handler], instanceof, type[ExceptionHandler]]] begin[{]
local_variable[type[ExceptionHandler], bugsnagHandler]
return[call[Collections.unmodifiableSet, parameter[call[bugsnagHandler.uncaughtExceptionClients, parameter[]]]]]
else begin[{]
None
end[}]
return[call[Collections.emptySet, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[Bugsnag] operator[>] identifier[uncaughtExceptionClients] operator[SEP] operator[SEP] {
identifier[UncaughtExceptionHandler] identifier[handler] operator[=] identifier[Thread] operator[SEP] identifier[getDefaultUncaughtExceptionHandler] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[handler] Keyword[instanceof] identifier[ExceptionHandler] operator[SEP] {
identifier[ExceptionHandler] identifier[bugsnagHandler] operator[=] operator[SEP] identifier[ExceptionHandler] operator[SEP] identifier[handler] operator[SEP] Keyword[return] identifier[Collections] operator[SEP] identifier[unmodifiableSet] operator[SEP] identifier[bugsnagHandler] operator[SEP] identifier[uncaughtExceptionClients] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP]
}
|
public String getString(String name)
{
InputStream in = null;
if(name == null)
throw new NullPointerException("name is null");
try
{
if((in = loader.getResourceAsStream(prefix + name))==null)
throw new ResourceException("Unable to find resource for " + name);
return IOUtils.toString(in);
}
catch(IOException e)
{
throw new ResourceException("IOException reading resource " + name, e);
}
finally
{
Closer.close(in,logger,"resource InputStream for " + name);
}
} | class class_name[name] begin[{]
method[getString, return_type[type[String]], modifier[public], parameter[name]] begin[{]
local_variable[type[InputStream], in]
if[binary_operation[member[.name], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name is null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=Assignment(expressionl=MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=getResourceAsStream, postfix_operators=[], prefix_operators=[], qualifier=loader, selectors=[], type_arguments=None)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to find resource for "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResourceException, sub_type=None)), label=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=IOUtils, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="IOException reading resource "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResourceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=in, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=logger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="resource InputStream for "), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=close, postfix_operators=[], prefix_operators=[], qualifier=Closer, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[String] identifier[getString] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[InputStream] identifier[in] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[SEP] identifier[in] operator[=] identifier[loader] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[prefix] operator[+] identifier[name] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[ResourceException] operator[SEP] literal[String] operator[+] identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[IOUtils] operator[SEP] identifier[toString] operator[SEP] identifier[in] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ResourceException] operator[SEP] literal[String] operator[+] identifier[name] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[Closer] operator[SEP] identifier[close] operator[SEP] identifier[in] , identifier[logger] , literal[String] operator[+] identifier[name] operator[SEP] operator[SEP]
}
}
|
public static void setAutoIncreamentIdValue(Object po,String autoGeneratedId,Object idValue) throws Exception, NoSuchMethodException{
String setterName = "set" + StringUtils.capitalize(autoGeneratedId);
Method setter = po.getClass().getDeclaredMethod(setterName, idValue.getClass());
setter.invoke(po, idValue);
} | class class_name[name] begin[{]
method[setAutoIncreamentIdValue, return_type[void], modifier[public static], parameter[po, autoGeneratedId, idValue]] begin[{]
local_variable[type[String], setterName]
local_variable[type[Method], setter]
call[setter.invoke, parameter[member[.po], member[.idValue]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setAutoIncreamentIdValue] operator[SEP] identifier[Object] identifier[po] , identifier[String] identifier[autoGeneratedId] , identifier[Object] identifier[idValue] operator[SEP] Keyword[throws] identifier[Exception] , identifier[NoSuchMethodException] {
identifier[String] identifier[setterName] operator[=] literal[String] operator[+] identifier[StringUtils] operator[SEP] identifier[capitalize] operator[SEP] identifier[autoGeneratedId] operator[SEP] operator[SEP] identifier[Method] identifier[setter] operator[=] identifier[po] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getDeclaredMethod] operator[SEP] identifier[setterName] , identifier[idValue] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setter] operator[SEP] identifier[invoke] operator[SEP] identifier[po] , identifier[idValue] operator[SEP] operator[SEP]
}
|
public static <A, B> Generator<PMatrix4x4D<A, B>> create()
{
return new PMatrix4x4DGenerator<>(PrimitiveGenerators.doubles(
GeneratorConstants.BOUND_LARGE_DOUBLE_LOWER,
GeneratorConstants.BOUND_LARGE_DOUBLE_UPPER
));
} | class class_name[name] begin[{]
method[create, return_type[type[Generator]], modifier[public static], parameter[]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=BOUND_LARGE_DOUBLE_LOWER, postfix_operators=[], prefix_operators=[], qualifier=GeneratorConstants, selectors=[]), MemberReference(member=BOUND_LARGE_DOUBLE_UPPER, postfix_operators=[], prefix_operators=[], qualifier=GeneratorConstants, selectors=[])], member=doubles, postfix_operators=[], prefix_operators=[], qualifier=PrimitiveGenerators, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=PMatrix4x4DGenerator, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[A] , identifier[B] operator[>] identifier[Generator] operator[<] identifier[PMatrix4x4D] operator[<] identifier[A] , identifier[B] operator[>] operator[>] identifier[create] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[PMatrix4x4DGenerator] operator[<] operator[>] operator[SEP] identifier[PrimitiveGenerators] operator[SEP] identifier[doubles] operator[SEP] identifier[GeneratorConstants] operator[SEP] identifier[BOUND_LARGE_DOUBLE_LOWER] , identifier[GeneratorConstants] operator[SEP] identifier[BOUND_LARGE_DOUBLE_UPPER] operator[SEP] operator[SEP] operator[SEP]
}
|
public void registerFileResource(final String file) {
try {
_resourceMap.put(file, new File(file).toURI().toURL());
} catch (Exception e) {
throw new RuntimeException(e);
}
} | class class_name[name] begin[{]
method[registerFileResource, return_type[void], modifier[public], parameter[file]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=toURI, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toURL, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))], member=put, postfix_operators=[], prefix_operators=[], qualifier=_resourceMap, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[registerFileResource] operator[SEP] Keyword[final] identifier[String] identifier[file] operator[SEP] {
Keyword[try] {
identifier[_resourceMap] operator[SEP] identifier[put] operator[SEP] identifier[file] , Keyword[new] identifier[File] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] identifier[toURL] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
protected void extendRealmClasspath()
throws MojoExecutionException {
List<URL> urls = new ArrayList<>();
for (String fileName : compileClasspathElements) {
File pathElem = new File(fileName);
try {
URL url = pathElem.toURI().toURL();
urls.add(url);
getLog().debug("Added classpathElement URL " + url);
} catch (MalformedURLException e) {
throw new MojoExecutionException("Error in adding the classpath " + pathElem, e);
}
}
ClassLoader jpaRealm =
new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader());
// set the new ClassLoader as default for this Thread
// will be reverted in the caller method.
Thread.currentThread().setContextClassLoader(jpaRealm);
} | class class_name[name] begin[{]
method[extendRealmClasspath, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[List], urls]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=fileName, 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)), name=pathElem)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=toURI, postfix_operators=[], prefix_operators=[], qualifier=pathElem, selectors=[MethodInvocation(arguments=[], member=toURL, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=url)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=urls, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getLog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Added classpathElement URL "), operandr=MemberReference(member=url, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error in adding the classpath "), operandr=MemberReference(member=pathElem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MojoExecutionException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MalformedURLException']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=compileClasspathElements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fileName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
local_variable[type[ClassLoader], jpaRealm]
call[Thread.currentThread, parameter[]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[extendRealmClasspath] operator[SEP] operator[SEP] Keyword[throws] identifier[MojoExecutionException] {
identifier[List] operator[<] identifier[URL] operator[>] identifier[urls] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[fileName] operator[:] identifier[compileClasspathElements] operator[SEP] {
identifier[File] identifier[pathElem] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[fileName] operator[SEP] operator[SEP] Keyword[try] {
identifier[URL] identifier[url] operator[=] identifier[pathElem] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] identifier[toURL] operator[SEP] operator[SEP] operator[SEP] identifier[urls] operator[SEP] identifier[add] operator[SEP] identifier[url] operator[SEP] operator[SEP] identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[url] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MalformedURLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MojoExecutionException] operator[SEP] literal[String] operator[+] identifier[pathElem] , identifier[e] operator[SEP] operator[SEP]
}
}
identifier[ClassLoader] identifier[jpaRealm] operator[=] Keyword[new] identifier[URLClassLoader] operator[SEP] identifier[urls] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[URL] operator[SEP] identifier[urls] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] , identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[setContextClassLoader] operator[SEP] identifier[jpaRealm] operator[SEP] operator[SEP]
}
|
private synchronized void doAddRoot(final WatchedDirectory pWatchedDirectory) {
final Object key = requireNonNull(pWatchedDirectory.getKey(), KEY_IS_NULL);
final Path directory = requireNonNull(pWatchedDirectory.getDirectory(), DIRECTORY_IS_NULL);
if (!isDirectory(directory)) {
throw new IllegalArgumentException(format("[%s]: %s is not a directory!", key, directory));
}
// Insure that the directory-key is unique
if (watchedDirectories.containsKey(key)) {
throw new IllegalArgumentException(format("Key %s already used by %s", key, watchedDirectories.get(key)));
}
watchedDirectories.put(key, pWatchedDirectory);
try {
children.computeIfAbsent(directory.getFileSystem(),
this::newDedicatedFileSystem).registerRootDirectory(pWatchedDirectory);
pWatchedDirectory.addObserver(this);
LOG.info("Added [{}:{}]", key, directory);
} catch (final IOException | UncheckedIOException e) {
LOG.warn(e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[doAddRoot, return_type[void], modifier[synchronized private], parameter[pWatchedDirectory]] begin[{]
local_variable[type[Object], key]
local_variable[type[Path], directory]
if[call[.isDirectory, parameter[member[.directory]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[%s]: %s is not a directory!"), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=directory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[watchedDirectories.containsKey, parameter[member[.key]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Key %s already used by %s"), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=watchedDirectories, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[watchedDirectories.put, parameter[member[.key], member[.pWatchedDirectory]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFileSystem, postfix_operators=[], prefix_operators=[], qualifier=directory, selectors=[], type_arguments=None), MethodReference(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), method=MemberReference(member=newDedicatedFileSystem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])], member=computeIfAbsent, postfix_operators=[], prefix_operators=[], qualifier=children, selectors=[MethodInvocation(arguments=[MemberReference(member=pWatchedDirectory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=registerRootDirectory, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=addObserver, postfix_operators=[], prefix_operators=[], qualifier=pWatchedDirectory, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Added [{}:{}]"), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=directory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException', 'UncheckedIOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[synchronized] Keyword[void] identifier[doAddRoot] operator[SEP] Keyword[final] identifier[WatchedDirectory] identifier[pWatchedDirectory] operator[SEP] {
Keyword[final] identifier[Object] identifier[key] operator[=] identifier[requireNonNull] operator[SEP] identifier[pWatchedDirectory] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[KEY_IS_NULL] operator[SEP] operator[SEP] Keyword[final] identifier[Path] identifier[directory] operator[=] identifier[requireNonNull] operator[SEP] identifier[pWatchedDirectory] operator[SEP] identifier[getDirectory] operator[SEP] operator[SEP] , identifier[DIRECTORY_IS_NULL] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isDirectory] operator[SEP] identifier[directory] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[key] , identifier[directory] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[watchedDirectories] operator[SEP] identifier[containsKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[key] , identifier[watchedDirectories] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[watchedDirectories] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[pWatchedDirectory] operator[SEP] operator[SEP] Keyword[try] {
identifier[children] operator[SEP] identifier[computeIfAbsent] operator[SEP] identifier[directory] operator[SEP] identifier[getFileSystem] operator[SEP] operator[SEP] , Keyword[this] operator[::] identifier[newDedicatedFileSystem] operator[SEP] operator[SEP] identifier[registerRootDirectory] operator[SEP] identifier[pWatchedDirectory] operator[SEP] operator[SEP] identifier[pWatchedDirectory] operator[SEP] identifier[addObserver] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[key] , identifier[directory] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[IOException] operator[|] identifier[UncheckedIOException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public static void draw_tkp_K()
{
Tortoise.setAngle(180);
Tortoise.setX(MakeALogo.XValue + 150);
Tortoise.setY(MakeALogo.YValue + 15);
Tortoise.turn(180);
Tortoise.move(200);
Tortoise.turn(90);
Tortoise.move(30);
Tortoise.turn(90);
Tortoise.move(128);
Tortoise.turn(-150);
Tortoise.move(70);
Tortoise.turn(90);
Tortoise.move(30);
Tortoise.turn(90);
Tortoise.move(70);
Tortoise.turn(-80);
Tortoise.move(80);
Tortoise.turn(140);
Tortoise.move(40);
Tortoise.turn(40);
Tortoise.move(60);
Tortoise.turn(-130);
Tortoise.move(45);
Tortoise.turn(90);
Tortoise.move(30);
Tortoise.turn(2);
} | class class_name[name] begin[{]
method[draw_tkp_K, return_type[void], modifier[public static], parameter[]] begin[{]
call[Tortoise.setAngle, parameter[literal[180]]]
call[Tortoise.setX, parameter[binary_operation[member[MakeALogo.XValue], +, literal[150]]]]
call[Tortoise.setY, parameter[binary_operation[member[MakeALogo.YValue], +, literal[15]]]]
call[Tortoise.turn, parameter[literal[180]]]
call[Tortoise.move, parameter[literal[200]]]
call[Tortoise.turn, parameter[literal[90]]]
call[Tortoise.move, parameter[literal[30]]]
call[Tortoise.turn, parameter[literal[90]]]
call[Tortoise.move, parameter[literal[128]]]
call[Tortoise.turn, parameter[literal[150]]]
call[Tortoise.move, parameter[literal[70]]]
call[Tortoise.turn, parameter[literal[90]]]
call[Tortoise.move, parameter[literal[30]]]
call[Tortoise.turn, parameter[literal[90]]]
call[Tortoise.move, parameter[literal[70]]]
call[Tortoise.turn, parameter[literal[80]]]
call[Tortoise.move, parameter[literal[80]]]
call[Tortoise.turn, parameter[literal[140]]]
call[Tortoise.move, parameter[literal[40]]]
call[Tortoise.turn, parameter[literal[40]]]
call[Tortoise.move, parameter[literal[60]]]
call[Tortoise.turn, parameter[literal[130]]]
call[Tortoise.move, parameter[literal[45]]]
call[Tortoise.turn, parameter[literal[90]]]
call[Tortoise.move, parameter[literal[30]]]
call[Tortoise.turn, parameter[literal[2]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[draw_tkp_K] operator[SEP] operator[SEP] {
identifier[Tortoise] operator[SEP] identifier[setAngle] operator[SEP] Other[180] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[setX] operator[SEP] identifier[MakeALogo] operator[SEP] identifier[XValue] operator[+] Other[150] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[setY] operator[SEP] identifier[MakeALogo] operator[SEP] identifier[YValue] operator[+] Other[15] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] Other[180] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[200] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] Other[90] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[30] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] Other[90] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[128] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] operator[-] Other[150] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[70] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] Other[90] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[30] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] Other[90] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[70] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] operator[-] Other[80] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[80] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] Other[140] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[40] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] Other[40] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[60] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] operator[-] Other[130] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[45] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] Other[90] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[move] operator[SEP] Other[30] operator[SEP] operator[SEP] identifier[Tortoise] operator[SEP] identifier[turn] operator[SEP] Other[2] operator[SEP] operator[SEP]
}
|
public boolean removeTransactionAware(TransactionAware txAware) {
Preconditions.checkState(currentTx == null, "Cannot remove TransactionAware while there is an active transaction.");
return txAwares.remove(txAware);
} | class class_name[name] begin[{]
method[removeTransactionAware, return_type[type[boolean]], modifier[public], parameter[txAware]] begin[{]
call[Preconditions.checkState, parameter[binary_operation[member[.currentTx], ==, literal[null]], literal["Cannot remove TransactionAware while there is an active transaction."]]]
return[call[txAwares.remove, parameter[member[.txAware]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[removeTransactionAware] operator[SEP] identifier[TransactionAware] identifier[txAware] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[currentTx] operator[==] Other[null] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[txAwares] operator[SEP] identifier[remove] operator[SEP] identifier[txAware] operator[SEP] operator[SEP]
}
|
@Override public int compare(Row o1, Row o2)
{
Integer parent1 = o1.getInteger("parent_wbs_id");
Integer parent2 = o2.getInteger("parent_wbs_id");
int result = NumberHelper.compare(parent1, parent2);
if (result == 0)
{
Integer seq1 = o1.getInteger("seq_num");
Integer seq2 = o2.getInteger("seq_num");
result = NumberHelper.compare(seq1, seq2);
}
return result;
} | class class_name[name] begin[{]
method[compare, return_type[type[int]], modifier[public], parameter[o1, o2]] begin[{]
local_variable[type[Integer], parent1]
local_variable[type[Integer], parent2]
local_variable[type[int], result]
if[binary_operation[member[.result], ==, literal[0]]] begin[{]
local_variable[type[Integer], seq1]
local_variable[type[Integer], seq2]
assign[member[.result], call[NumberHelper.compare, parameter[member[.seq1], member[.seq2]]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[compare] operator[SEP] identifier[Row] identifier[o1] , identifier[Row] identifier[o2] operator[SEP] {
identifier[Integer] identifier[parent1] operator[=] identifier[o1] operator[SEP] identifier[getInteger] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Integer] identifier[parent2] operator[=] identifier[o2] operator[SEP] identifier[getInteger] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[result] operator[=] identifier[NumberHelper] operator[SEP] identifier[compare] operator[SEP] identifier[parent1] , identifier[parent2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[0] operator[SEP] {
identifier[Integer] identifier[seq1] operator[=] identifier[o1] operator[SEP] identifier[getInteger] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Integer] identifier[seq2] operator[=] identifier[o2] operator[SEP] identifier[getInteger] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[NumberHelper] operator[SEP] identifier[compare] operator[SEP] identifier[seq1] , identifier[seq2] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static TableBuilder configureKeyValueRendering(TableBuilder builder, String delimiter) {
return builder.on(CellMatchers.ofType(Map.class))
.addFormatter(new MapFormatter(delimiter))
.addAligner(new KeyValueHorizontalAligner(delimiter.trim()))
.addSizer(new KeyValueSizeConstraints(delimiter))
.addWrapper(new KeyValueTextWrapper(delimiter)).and();
} | class class_name[name] begin[{]
method[configureKeyValueRendering, return_type[type[TableBuilder]], modifier[public static], parameter[builder, delimiter]] begin[{]
return[call[builder.on, parameter[call[CellMatchers.ofType, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Map, sub_type=None))]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[TableBuilder] identifier[configureKeyValueRendering] operator[SEP] identifier[TableBuilder] identifier[builder] , identifier[String] identifier[delimiter] operator[SEP] {
Keyword[return] identifier[builder] operator[SEP] identifier[on] operator[SEP] identifier[CellMatchers] operator[SEP] identifier[ofType] operator[SEP] identifier[Map] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[addFormatter] operator[SEP] Keyword[new] identifier[MapFormatter] operator[SEP] identifier[delimiter] operator[SEP] operator[SEP] operator[SEP] identifier[addAligner] operator[SEP] Keyword[new] identifier[KeyValueHorizontalAligner] operator[SEP] identifier[delimiter] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[addSizer] operator[SEP] Keyword[new] identifier[KeyValueSizeConstraints] operator[SEP] identifier[delimiter] operator[SEP] operator[SEP] operator[SEP] identifier[addWrapper] operator[SEP] Keyword[new] identifier[KeyValueTextWrapper] operator[SEP] identifier[delimiter] operator[SEP] operator[SEP] operator[SEP] identifier[and] operator[SEP] operator[SEP] operator[SEP]
}
|
private void markst(Subre t) {
assert t != null;
t.flags |= Subre.INUSE;
if (t.left != null) {
markst(t.left);
}
if (t.right != null) {
markst(t.right);
}
} | class class_name[name] begin[{]
method[markst, return_type[void], modifier[private], parameter[t]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
assign[member[t.flags], member[Subre.INUSE]]
if[binary_operation[member[t.left], !=, literal[null]]] begin[{]
call[.markst, parameter[member[t.left]]]
else begin[{]
None
end[}]
if[binary_operation[member[t.right], !=, literal[null]]] begin[{]
call[.markst, parameter[member[t.right]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[markst] operator[SEP] identifier[Subre] identifier[t] operator[SEP] {
Keyword[assert] identifier[t] operator[!=] Other[null] operator[SEP] identifier[t] operator[SEP] identifier[flags] operator[|=] identifier[Subre] operator[SEP] identifier[INUSE] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[left] operator[!=] Other[null] operator[SEP] {
identifier[markst] operator[SEP] identifier[t] operator[SEP] identifier[left] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[t] operator[SEP] identifier[right] operator[!=] Other[null] operator[SEP] {
identifier[markst] operator[SEP] identifier[t] operator[SEP] identifier[right] operator[SEP] operator[SEP]
}
}
|
@Override
public V get(K key) {
return !isEmpty() ? get(key, hash(key)) : null;
} | class class_name[name] begin[{]
method[get, return_type[type[V]], modifier[public], parameter[key]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[V] identifier[get] operator[SEP] identifier[K] identifier[key] operator[SEP] {
Keyword[return] operator[!] identifier[isEmpty] operator[SEP] operator[SEP] operator[?] identifier[get] operator[SEP] identifier[key] , identifier[hash] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException {
throw new java.sql.SQLFeatureNotSupportedException();
} | class class_name[name] begin[{]
method[getParentLogger, return_type[type[java]], modifier[public], parameter[]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=sql, sub_type=ReferenceType(arguments=None, dimensions=None, name=SQLFeatureNotSupportedException, sub_type=None)))), label=None)
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[logging] operator[SEP] identifier[Logger] identifier[getParentLogger] operator[SEP] operator[SEP] Keyword[throws] identifier[java] operator[SEP] identifier[sql] operator[SEP] identifier[SQLFeatureNotSupportedException] {
Keyword[throw] Keyword[new] identifier[java] operator[SEP] identifier[sql] operator[SEP] identifier[SQLFeatureNotSupportedException] operator[SEP] operator[SEP] operator[SEP]
}
|
private NameID buildNameId(final RequestAbstractType authnRequest,
final Object assertion,
final SamlRegisteredService service,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
final MessageContext messageContext) throws SamlException {
val supportedNameFormats = getSupportedNameIdFormats(service, adaptor);
val requiredNameFormat = getRequiredNameIdFormatIfAny(authnRequest);
validateRequiredNameIdFormatIfAny(authnRequest, adaptor, supportedNameFormats, requiredNameFormat);
val nameid = determineNameId(authnRequest, assertion, supportedNameFormats, service, adaptor);
return finalizeNameId(nameid, authnRequest, assertion, supportedNameFormats, service, adaptor);
} | class class_name[name] begin[{]
method[buildNameId, return_type[type[NameID]], modifier[private], parameter[authnRequest, assertion, service, adaptor, messageContext]] begin[{]
local_variable[type[val], supportedNameFormats]
local_variable[type[val], requiredNameFormat]
call[.validateRequiredNameIdFormatIfAny, parameter[member[.authnRequest], member[.adaptor], member[.supportedNameFormats], member[.requiredNameFormat]]]
local_variable[type[val], nameid]
return[call[.finalizeNameId, parameter[member[.nameid], member[.authnRequest], member[.assertion], member[.supportedNameFormats], member[.service], member[.adaptor]]]]
end[}]
END[}] | Keyword[private] identifier[NameID] identifier[buildNameId] operator[SEP] Keyword[final] identifier[RequestAbstractType] identifier[authnRequest] , Keyword[final] identifier[Object] identifier[assertion] , Keyword[final] identifier[SamlRegisteredService] identifier[service] , Keyword[final] identifier[SamlRegisteredServiceServiceProviderMetadataFacade] identifier[adaptor] , Keyword[final] identifier[MessageContext] identifier[messageContext] operator[SEP] Keyword[throws] identifier[SamlException] {
identifier[val] identifier[supportedNameFormats] operator[=] identifier[getSupportedNameIdFormats] operator[SEP] identifier[service] , identifier[adaptor] operator[SEP] operator[SEP] identifier[val] identifier[requiredNameFormat] operator[=] identifier[getRequiredNameIdFormatIfAny] operator[SEP] identifier[authnRequest] operator[SEP] operator[SEP] identifier[validateRequiredNameIdFormatIfAny] operator[SEP] identifier[authnRequest] , identifier[adaptor] , identifier[supportedNameFormats] , identifier[requiredNameFormat] operator[SEP] operator[SEP] identifier[val] identifier[nameid] operator[=] identifier[determineNameId] operator[SEP] identifier[authnRequest] , identifier[assertion] , identifier[supportedNameFormats] , identifier[service] , identifier[adaptor] operator[SEP] operator[SEP] Keyword[return] identifier[finalizeNameId] operator[SEP] identifier[nameid] , identifier[authnRequest] , identifier[assertion] , identifier[supportedNameFormats] , identifier[service] , identifier[adaptor] operator[SEP] operator[SEP]
}
|
public final void synpred172_Java_fragment() throws RecognitionException {
Token y=null;
ParserRuleReturnScope z =null;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:787:6: (y= 'else' ( 'if' parExpression )? z= statement )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:787:6: y= 'else' ( 'if' parExpression )? z= statement
{
y=(Token)match(input,78,FOLLOW_78_in_synpred172_Java3290); if (state.failed) return;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:787:16: ( 'if' parExpression )?
int alt215=2;
int LA215_0 = input.LA(1);
if ( (LA215_0==87) ) {
int LA215_1 = input.LA(2);
if ( (LA215_1==36) ) {
int LA215_43 = input.LA(3);
if ( (synpred171_Java()) ) {
alt215=1;
}
}
}
switch (alt215) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:787:17: 'if' parExpression
{
match(input,87,FOLLOW_87_in_synpred172_Java3294); if (state.failed) return;
pushFollow(FOLLOW_parExpression_in_synpred172_Java3296);
parExpression();
state._fsp--;
if (state.failed) return;
}
break;
}
pushFollow(FOLLOW_statement_in_synpred172_Java3327);
z=statement();
state._fsp--;
if (state.failed) return;
}
} | class class_name[name] begin[{]
method[synpred172_Java_fragment, return_type[void], modifier[final public], parameter[]] begin[{]
local_variable[type[Token], y]
local_variable[type[ParserRuleReturnScope], z]
assign[member[.y], Cast(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=78), MemberReference(member=FOLLOW_78_in_synpred172_Java3290, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Token, sub_type=None))]
if[member[state.failed]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[int], alt215]
local_variable[type[int], LA215_0]
if[binary_operation[member[.LA215_0], ==, literal[87]]] begin[{]
local_variable[type[int], LA215_1]
if[binary_operation[member[.LA215_1], ==, literal[36]]] begin[{]
local_variable[type[int], LA215_43]
if[call[.synpred171_Java, parameter[]]] begin[{]
assign[member[.alt215], literal[1]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=87), MemberReference(member=FOLLOW_87_in_synpred172_Java3294, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_parExpression_in_synpred172_Java3296, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=parExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None))]), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=alt215, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
call[.pushFollow, parameter[member[.FOLLOW_statement_in_synpred172_Java3327]]]
assign[member[.z], call[.statement, parameter[]]]
member[state._fsp]
if[member[state.failed]] begin[{]
return[None]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[synpred172_Java_fragment] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
identifier[Token] identifier[y] operator[=] Other[null] operator[SEP] identifier[ParserRuleReturnScope] identifier[z] operator[=] Other[null] operator[SEP] {
identifier[y] operator[=] operator[SEP] identifier[Token] operator[SEP] identifier[match] operator[SEP] identifier[input] , Other[78] , identifier[FOLLOW_78_in_synpred172_Java3290] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP] Keyword[int] identifier[alt215] operator[=] Other[2] operator[SEP] Keyword[int] identifier[LA215_0] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[LA215_0] operator[==] Other[87] operator[SEP] operator[SEP] {
Keyword[int] identifier[LA215_1] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[LA215_1] operator[==] Other[36] operator[SEP] operator[SEP] {
Keyword[int] identifier[LA215_43] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[3] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[synpred171_Java] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[alt215] operator[=] Other[1] operator[SEP]
}
}
}
Keyword[switch] operator[SEP] identifier[alt215] operator[SEP] {
Keyword[case] Other[1] operator[:] {
identifier[match] operator[SEP] identifier[input] , Other[87] , identifier[FOLLOW_87_in_synpred172_Java3294] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP] identifier[pushFollow] operator[SEP] identifier[FOLLOW_parExpression_in_synpred172_Java3296] operator[SEP] operator[SEP] identifier[parExpression] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[break] operator[SEP]
}
identifier[pushFollow] operator[SEP] identifier[FOLLOW_statement_in_synpred172_Java3327] operator[SEP] operator[SEP] identifier[z] operator[=] identifier[statement] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
}
|
@Nullable
@OverrideOnDemand
protected ICommonsSet <String> onShowSelectedObjectCustomAttrs (@Nonnull final WPECTYPE aWPEC,
@Nonnull final DATATYPE aSelectedObject,
@Nonnull final Map <String, String> aCustomAttrs,
@Nonnull final BootstrapViewForm aViewForm)
{
return null;
} | class class_name[name] begin[{]
method[onShowSelectedObjectCustomAttrs, return_type[type[ICommonsSet]], modifier[protected], parameter[aWPEC, aSelectedObject, aCustomAttrs, aViewForm]] begin[{]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Nullable] annotation[@] identifier[OverrideOnDemand] Keyword[protected] identifier[ICommonsSet] operator[<] identifier[String] operator[>] identifier[onShowSelectedObjectCustomAttrs] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[WPECTYPE] identifier[aWPEC] , annotation[@] identifier[Nonnull] Keyword[final] identifier[DATATYPE] identifier[aSelectedObject] , annotation[@] identifier[Nonnull] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[aCustomAttrs] , annotation[@] identifier[Nonnull] Keyword[final] identifier[BootstrapViewForm] identifier[aViewForm] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
|
void append(T logItem) throws IOException {
Exceptions.checkNotClosed(this.closed.get(), this);
long seqNo = logItem.getSequenceNumber();
Exceptions.checkArgument(this.lastSerializedSequenceNumber < seqNo, "logItem",
"Invalid sequence number. Expected: greater than %d, given: %d.", this.lastSerializedSequenceNumber, seqNo);
// Remember the last Started SeqNo, in case of failure.
long previousLastStartedSequenceNumber = this.lastStartedSequenceNumber;
try {
// Indicate to the output stream that are about to write a new record.
this.outputStream.startNewRecord();
// Completely serialize the entry. Note that this may span more than one Data Frame.
this.lastStartedSequenceNumber = seqNo;
this.serializer.serialize(this.outputStream, logItem);
// Indicate to the output stream that have finished writing the record.
this.outputStream.endRecord();
this.lastSerializedSequenceNumber = seqNo;
} catch (Exception ex) {
if (this.closed.get()) {
// It's possible that an async callback resulted in an error and this object got closed after the check
// at the beginning of this method (which could result in all sorts of errors. If that's the case, we need
// to indicate that we are closed by throwing ObjectClosedException.
throw new ObjectClosedException(this, ex);
} else if (ex instanceof ObjectClosedException) {
// TargetLog has closed. We need to close too.
close();
} else {
// Discard any information that we have about this record (pretty much revert back to where startNewEntry()
// would have begun writing).
this.outputStream.discardRecord();
this.lastStartedSequenceNumber = previousLastStartedSequenceNumber;
}
throw ex;
}
} | class class_name[name] begin[{]
method[append, return_type[void], modifier[default], parameter[logItem]] begin[{]
call[Exceptions.checkNotClosed, parameter[THIS[member[None.closed]call[None.get, parameter[]]], THIS[]]]
local_variable[type[long], seqNo]
call[Exceptions.checkArgument, parameter[binary_operation[THIS[member[None.lastSerializedSequenceNumber]], <, member[.seqNo]], literal["logItem"], literal["Invalid sequence number. Expected: greater than %d, given: %d."], THIS[member[None.lastSerializedSequenceNumber]], member[.seqNo]]]
local_variable[type[long], previousLastStartedSequenceNumber]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=outputStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=startNewRecord, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=lastStartedSequenceNumber, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=seqNo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=serializer, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=outputStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), MemberReference(member=logItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serialize, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=outputStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=endRecord, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=lastSerializedSequenceNumber, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=seqNo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], catches=[CatchClause(block=[IfStatement(condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=closed, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ObjectClosedException, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=outputStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=discardRecord, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=lastStartedSequenceNumber, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=previousLastStartedSequenceNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), 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=ObjectClosedException, sub_type=None)), label=None)])), ThrowStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[void] identifier[append] operator[SEP] identifier[T] identifier[logItem] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Exceptions] operator[SEP] identifier[checkNotClosed] operator[SEP] Keyword[this] operator[SEP] identifier[closed] operator[SEP] identifier[get] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] operator[SEP] Keyword[long] identifier[seqNo] operator[=] identifier[logItem] operator[SEP] identifier[getSequenceNumber] operator[SEP] operator[SEP] operator[SEP] identifier[Exceptions] operator[SEP] identifier[checkArgument] operator[SEP] Keyword[this] operator[SEP] identifier[lastSerializedSequenceNumber] operator[<] identifier[seqNo] , literal[String] , literal[String] , Keyword[this] operator[SEP] identifier[lastSerializedSequenceNumber] , identifier[seqNo] operator[SEP] operator[SEP] Keyword[long] identifier[previousLastStartedSequenceNumber] operator[=] Keyword[this] operator[SEP] identifier[lastStartedSequenceNumber] operator[SEP] Keyword[try] {
Keyword[this] operator[SEP] identifier[outputStream] operator[SEP] identifier[startNewRecord] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[lastStartedSequenceNumber] operator[=] identifier[seqNo] operator[SEP] Keyword[this] operator[SEP] identifier[serializer] operator[SEP] identifier[serialize] operator[SEP] Keyword[this] operator[SEP] identifier[outputStream] , identifier[logItem] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[outputStream] operator[SEP] identifier[endRecord] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[lastSerializedSequenceNumber] operator[=] identifier[seqNo] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[closed] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ObjectClosedException] operator[SEP] Keyword[this] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ex] Keyword[instanceof] identifier[ObjectClosedException] operator[SEP] {
identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[outputStream] operator[SEP] identifier[discardRecord] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[lastStartedSequenceNumber] operator[=] identifier[previousLastStartedSequenceNumber] operator[SEP]
}
Keyword[throw] identifier[ex] operator[SEP]
}
}
|
public void logout(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) {
Assert.notNull(request, "HttpServletRequest required");
if (invalidateHttpSession) {
HttpSession session = request.getSession(false);
if (session != null) {
logger.debug("Invalidating session: " + session.getId());
session.invalidate();
}
}
if (clearAuthentication) {
SecurityContext context = SecurityContextHolder.getContext();
context.setAuthentication(null);
}
SecurityContextHolder.clearContext();
} | class class_name[name] begin[{]
method[logout, return_type[void], modifier[public], parameter[request, response, authentication]] begin[{]
call[Assert.notNull, parameter[member[.request], literal["HttpServletRequest required"]]]
if[member[.invalidateHttpSession]] begin[{]
local_variable[type[HttpSession], session]
if[binary_operation[member[.session], !=, literal[null]]] begin[{]
call[logger.debug, parameter[binary_operation[literal["Invalidating session: "], +, call[session.getId, parameter[]]]]]
call[session.invalidate, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[member[.clearAuthentication]] begin[{]
local_variable[type[SecurityContext], context]
call[context.setAuthentication, parameter[literal[null]]]
else begin[{]
None
end[}]
call[SecurityContextHolder.clearContext, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[logout] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] , identifier[Authentication] identifier[authentication] operator[SEP] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[request] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[invalidateHttpSession] operator[SEP] {
identifier[HttpSession] identifier[session] operator[=] identifier[request] operator[SEP] identifier[getSession] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[session] operator[!=] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[session] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[session] operator[SEP] identifier[invalidate] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[clearAuthentication] operator[SEP] {
identifier[SecurityContext] identifier[context] operator[=] identifier[SecurityContextHolder] operator[SEP] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[setAuthentication] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
identifier[SecurityContextHolder] operator[SEP] identifier[clearContext] operator[SEP] operator[SEP] operator[SEP]
}
|
protected boolean editorErrorMatches(final EditorError perror) {
return perror != null && perror.getEditor() != null
&& (equals(perror.getEditor()) || perror.getEditor().equals(asEditor()));
} | class class_name[name] begin[{]
method[editorErrorMatches, return_type[type[boolean]], modifier[protected], parameter[perror]] begin[{]
return[binary_operation[binary_operation[binary_operation[member[.perror], !=, literal[null]], &&, binary_operation[call[perror.getEditor, parameter[]], !=, literal[null]]], &&, binary_operation[call[.equals, parameter[call[perror.getEditor, parameter[]]]], ||, call[perror.getEditor, parameter[]]]]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[editorErrorMatches] operator[SEP] Keyword[final] identifier[EditorError] identifier[perror] operator[SEP] {
Keyword[return] identifier[perror] operator[!=] Other[null] operator[&&] identifier[perror] operator[SEP] identifier[getEditor] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[SEP] identifier[equals] operator[SEP] identifier[perror] operator[SEP] identifier[getEditor] operator[SEP] operator[SEP] operator[SEP] operator[||] identifier[perror] operator[SEP] identifier[getEditor] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[asEditor] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public int getIntegerBelief(String name){
Object belief = introspector.getBeliefBase(this).get(name);
int count = 0;
if (belief!=null) {
count = (Integer) belief;
}
return (Integer) count;
} | class class_name[name] begin[{]
method[getIntegerBelief, return_type[type[int]], modifier[public], parameter[name]] begin[{]
local_variable[type[Object], belief]
local_variable[type[int], count]
if[binary_operation[member[.belief], !=, literal[null]]] begin[{]
assign[member[.count], Cast(expression=MemberReference(member=belief, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))]
else begin[{]
None
end[}]
return[Cast(expression=MemberReference(member=count, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getIntegerBelief] operator[SEP] identifier[String] identifier[name] operator[SEP] {
identifier[Object] identifier[belief] operator[=] identifier[introspector] operator[SEP] identifier[getBeliefBase] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[belief] operator[!=] Other[null] operator[SEP] {
identifier[count] operator[=] operator[SEP] identifier[Integer] operator[SEP] identifier[belief] operator[SEP]
}
Keyword[return] operator[SEP] identifier[Integer] operator[SEP] identifier[count] operator[SEP]
}
|
public void reset() {
if (getListViewWrapper() == null) {
throw new IllegalStateException("Call setAbsListView() on this AnimationAdapter first!");
}
assert mViewAnimator != null;
mViewAnimator.reset();
mGridViewPossiblyMeasuring = true;
mGridViewMeasuringPosition = -1;
if (getDecoratedBaseAdapter() instanceof AnimationAdapter) {
((AnimationAdapter) getDecoratedBaseAdapter()).reset();
}
} | class class_name[name] begin[{]
method[reset, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[call[.getListViewWrapper, parameter[]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Call setAbsListView() on this AnimationAdapter first!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=mViewAnimator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
call[mViewAnimator.reset, parameter[]]
assign[member[.mGridViewPossiblyMeasuring], literal[true]]
assign[member[.mGridViewMeasuringPosition], literal[1]]
if[binary_operation[call[.getDecoratedBaseAdapter, parameter[]], instanceof, type[AnimationAdapter]]] begin[{]
Cast(expression=MethodInvocation(arguments=[], member=getDecoratedBaseAdapter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=AnimationAdapter, sub_type=None))
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[reset] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[getListViewWrapper] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[assert] identifier[mViewAnimator] operator[!=] Other[null] operator[SEP] identifier[mViewAnimator] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[mGridViewPossiblyMeasuring] operator[=] literal[boolean] operator[SEP] identifier[mGridViewMeasuringPosition] operator[=] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[getDecoratedBaseAdapter] operator[SEP] operator[SEP] Keyword[instanceof] identifier[AnimationAdapter] operator[SEP] {
operator[SEP] operator[SEP] identifier[AnimationAdapter] operator[SEP] identifier[getDecoratedBaseAdapter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void check()
{
for (AnnotationTypeDeclaration atd : _atds)
{
Collection<Declaration> decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith(atd);
for (Declaration decl : decls)
{
check(decl);
}
}
} | class class_name[name] begin[{]
method[check, return_type[void], modifier[public], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getAnnotationProcessorEnvironment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=atd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDeclarationsAnnotatedWith, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=decls)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Declaration, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=decl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=check, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=decls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=decl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Declaration, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=_atds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=atd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AnnotationTypeDeclaration, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[check] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[AnnotationTypeDeclaration] identifier[atd] operator[:] identifier[_atds] operator[SEP] {
identifier[Collection] operator[<] identifier[Declaration] operator[>] identifier[decls] operator[=] identifier[getAnnotationProcessorEnvironment] operator[SEP] operator[SEP] operator[SEP] identifier[getDeclarationsAnnotatedWith] operator[SEP] identifier[atd] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Declaration] identifier[decl] operator[:] identifier[decls] operator[SEP] {
identifier[check] operator[SEP] identifier[decl] operator[SEP] operator[SEP]
}
}
}
|
private static final boolean checkInt(String s)
{
try {
//Coverity[FB.DLS_DEAD_LOCAL_STORE]
int val = Integer.parseInt(s);
if(DebugValueChecking) {
DAPNode.log.debug("Attribute.checkInt() - string: '" + s + "' value: " + val);
}
return true;
} catch (NumberFormatException e) {
return false;
}
} | class class_name[name] begin[{]
method[checkInt, return_type[type[boolean]], modifier[final private static], parameter[s]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), name=val)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=MemberReference(member=DebugValueChecking, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Attribute.checkInt() - string: '"), operandr=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' value: "), operator=+), operandr=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=DAPNode.log, selectors=[], type_arguments=None), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NumberFormatException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[final] Keyword[boolean] identifier[checkInt] operator[SEP] identifier[String] identifier[s] operator[SEP] {
Keyword[try] {
Keyword[int] identifier[val] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[s] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DebugValueChecking] operator[SEP] {
identifier[DAPNode] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[s] operator[+] literal[String] operator[+] identifier[val] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NumberFormatException] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public IConceptMap<IConceptSet> getAffectedSubsumptions() {
int size = 0;
for (Context ctx : affectedContexts) {
if (ctx.hasNewSubsumptions()) {
size++;
}
}
IConceptMap<IConceptSet> res = new DenseConceptMap<IConceptSet>(size);
// Collect subsumptions from affected contexts
for (IntIterator it = contextIndex.keyIterator(); it.hasNext();) {
int key = it.next();
Context ctx = contextIndex.get(key);
if (ctx.hasNewSubsumptions()) {
res.put(key, ctx.getS());
}
}
return res;
} | class class_name[name] begin[{]
method[getAffectedSubsumptions, return_type[type[IConceptMap]], modifier[public], parameter[]] begin[{]
local_variable[type[int], size]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=hasNewSubsumptions, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=size, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=affectedContexts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ctx)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Context, sub_type=None))), label=None)
local_variable[type[IConceptMap], res]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), name=key)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=contextIndex, selectors=[], type_arguments=None), name=ctx)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Context, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=hasNewSubsumptions, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getS, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=keyIterator, postfix_operators=[], prefix_operators=[], qualifier=contextIndex, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IntIterator, sub_type=None)), update=None), label=None)
return[member[.res]]
end[}]
END[}] | Keyword[public] identifier[IConceptMap] operator[<] identifier[IConceptSet] operator[>] identifier[getAffectedSubsumptions] operator[SEP] operator[SEP] {
Keyword[int] identifier[size] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Context] identifier[ctx] operator[:] identifier[affectedContexts] operator[SEP] {
Keyword[if] operator[SEP] identifier[ctx] operator[SEP] identifier[hasNewSubsumptions] operator[SEP] operator[SEP] operator[SEP] {
identifier[size] operator[++] operator[SEP]
}
}
identifier[IConceptMap] operator[<] identifier[IConceptSet] operator[>] identifier[res] operator[=] Keyword[new] identifier[DenseConceptMap] operator[<] identifier[IConceptSet] operator[>] operator[SEP] identifier[size] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[IntIterator] identifier[it] operator[=] identifier[contextIndex] operator[SEP] identifier[keyIterator] operator[SEP] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[key] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[Context] identifier[ctx] operator[=] identifier[contextIndex] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ctx] operator[SEP] identifier[hasNewSubsumptions] operator[SEP] operator[SEP] operator[SEP] {
identifier[res] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[ctx] operator[SEP] identifier[getS] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[res] operator[SEP]
}
|
public GetTagsResult withTags(String... tags) {
if (this.tags == null) {
setTags(new java.util.ArrayList<String>(tags.length));
}
for (String ele : tags) {
this.tags.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withTags, return_type[type[GetTagsResult]], modifier[public], parameter[tags]] begin[{]
if[binary_operation[THIS[member[None.tags]], ==, literal[null]]] begin[{]
call[.setTags, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=tags, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=tags, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=tags, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[GetTagsResult] identifier[withTags] operator[SEP] identifier[String] operator[...] identifier[tags] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[tags] operator[==] Other[null] operator[SEP] {
identifier[setTags] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[tags] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[tags] operator[SEP] {
Keyword[this] operator[SEP] identifier[tags] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public Collection<String> getSubKeys() {
WINBASE.FILETIME lpftLastWriteTime;
TreeSet<String> subKeys = new TreeSet<>();
char[] lpName = new char[256];
IntByReference lpcName = new IntByReference(256);
lpftLastWriteTime = new WINBASE.FILETIME();
int dwIndex = 0;
while (Advapi32.INSTANCE.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null,
null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS) {
subKeys.add(new String(lpName, 0, lpcName.getValue()));
lpcName.setValue(256);
dwIndex++;
}
return subKeys;
} | class class_name[name] begin[{]
method[getSubKeys, return_type[type[Collection]], modifier[public], parameter[]] begin[{]
local_variable[type[WINBASE], lpftLastWriteTime]
local_variable[type[TreeSet], subKeys]
local_variable[type[char], lpName]
local_variable[type[IntByReference], lpcName]
assign[member[.lpftLastWriteTime], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WINBASE, sub_type=ReferenceType(arguments=None, dimensions=None, name=FILETIME, sub_type=None)))]
local_variable[type[int], dwIndex]
while[binary_operation[call[Advapi32.INSTANCE.RegEnumKeyEx, parameter[member[.handle], member[.dwIndex], member[.lpName], member[.lpcName], literal[null], literal[null], literal[null], member[.lpftLastWriteTime]]], ==, member[WINERROR.ERROR_SUCCESS]]] begin[{]
call[subKeys.add, parameter[ClassCreator(arguments=[MemberReference(member=lpName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=lpcName, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]]
call[lpcName.setValue, parameter[literal[256]]]
member[.dwIndex]
end[}]
return[member[.subKeys]]
end[}]
END[}] | Keyword[public] identifier[Collection] operator[<] identifier[String] operator[>] identifier[getSubKeys] operator[SEP] operator[SEP] {
identifier[WINBASE] operator[SEP] identifier[FILETIME] identifier[lpftLastWriteTime] operator[SEP] identifier[TreeSet] operator[<] identifier[String] operator[>] identifier[subKeys] operator[=] Keyword[new] identifier[TreeSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[lpName] operator[=] Keyword[new] Keyword[char] operator[SEP] Other[256] operator[SEP] operator[SEP] identifier[IntByReference] identifier[lpcName] operator[=] Keyword[new] identifier[IntByReference] operator[SEP] Other[256] operator[SEP] operator[SEP] identifier[lpftLastWriteTime] operator[=] Keyword[new] identifier[WINBASE] operator[SEP] identifier[FILETIME] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[dwIndex] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[Advapi32] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[RegEnumKeyEx] operator[SEP] identifier[handle] , identifier[dwIndex] , identifier[lpName] , identifier[lpcName] , Other[null] , Other[null] , Other[null] , identifier[lpftLastWriteTime] operator[SEP] operator[==] identifier[WINERROR] operator[SEP] identifier[ERROR_SUCCESS] operator[SEP] {
identifier[subKeys] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[String] operator[SEP] identifier[lpName] , Other[0] , identifier[lpcName] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[lpcName] operator[SEP] identifier[setValue] operator[SEP] Other[256] operator[SEP] operator[SEP] identifier[dwIndex] operator[++] operator[SEP]
}
Keyword[return] identifier[subKeys] operator[SEP]
}
|
public static void install() {
synchronized (log()) {
if (!cInstalled) {
cInstalled = true;
cOriginalOut = System.out;
cOriginalErr = System.err;
cSystemOut = new LogEventParsingOutputStream
(log(), LogEvent.INFO_TYPE)
{
public boolean isEnabled() {
return log().isInfoEnabled();
}
};
cSystemOut.addLogListener(log());
System.setOut(new PrintStream(cSystemOut, true));
cSystemErr = new LogEventParsingOutputStream
(log(), LogEvent.ERROR_TYPE)
{
public boolean isEnabled() {
return log().isErrorEnabled();
}
};
cSystemErr.addLogListener(log());
System.setErr(new PrintStream(cSystemErr, true));
}
}
} | class class_name[name] begin[{]
method[install, return_type[void], modifier[public static], parameter[]] begin[{]
SYNCHRONIZED[call[.log, parameter[]]] BEGIN[{]
if[member[.cInstalled]] begin[{]
assign[member[.cInstalled], literal[true]]
assign[member[.cOriginalOut], member[System.out]]
assign[member[.cOriginalErr], member[System.err]]
assign[member[.cSystemOut], ClassCreator(arguments=[MethodInvocation(arguments=[], member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=INFO_TYPE, postfix_operators=[], prefix_operators=[], qualifier=LogEvent, selectors=[])], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=isInfoEnabled, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=isEnabled, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LogEventParsingOutputStream, sub_type=None))]
call[cSystemOut.addLogListener, parameter[call[.log, parameter[]]]]
call[System.setOut, parameter[ClassCreator(arguments=[MemberReference(member=cSystemOut, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrintStream, sub_type=None))]]
assign[member[.cSystemErr], ClassCreator(arguments=[MethodInvocation(arguments=[], member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=ERROR_TYPE, postfix_operators=[], prefix_operators=[], qualifier=LogEvent, selectors=[])], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=isErrorEnabled, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=isEnabled, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LogEventParsingOutputStream, sub_type=None))]
call[cSystemErr.addLogListener, parameter[call[.log, parameter[]]]]
call[System.setErr, parameter[ClassCreator(arguments=[MemberReference(member=cSystemErr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrintStream, sub_type=None))]]
else begin[{]
None
end[}]
END[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[install] operator[SEP] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[log] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[cInstalled] operator[SEP] {
identifier[cInstalled] operator[=] literal[boolean] operator[SEP] identifier[cOriginalOut] operator[=] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[cOriginalErr] operator[=] identifier[System] operator[SEP] identifier[err] operator[SEP] identifier[cSystemOut] operator[=] Keyword[new] identifier[LogEventParsingOutputStream] operator[SEP] identifier[log] operator[SEP] operator[SEP] , identifier[LogEvent] operator[SEP] identifier[INFO_TYPE] operator[SEP] {
Keyword[public] Keyword[boolean] identifier[isEnabled] operator[SEP] operator[SEP] {
Keyword[return] identifier[log] operator[SEP] operator[SEP] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[cSystemOut] operator[SEP] identifier[addLogListener] operator[SEP] identifier[log] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[setOut] operator[SEP] Keyword[new] identifier[PrintStream] operator[SEP] identifier[cSystemOut] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[cSystemErr] operator[=] Keyword[new] identifier[LogEventParsingOutputStream] operator[SEP] identifier[log] operator[SEP] operator[SEP] , identifier[LogEvent] operator[SEP] identifier[ERROR_TYPE] operator[SEP] {
Keyword[public] Keyword[boolean] identifier[isEnabled] operator[SEP] operator[SEP] {
Keyword[return] identifier[log] operator[SEP] operator[SEP] operator[SEP] identifier[isErrorEnabled] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[cSystemErr] operator[SEP] identifier[addLogListener] operator[SEP] identifier[log] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[setErr] operator[SEP] Keyword[new] identifier[PrintStream] operator[SEP] identifier[cSystemErr] , literal[boolean] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
protected PGPPublicKey retrievePublicKey(PGPPublicKeyRing publicKeyRing, KeyFilter<PGPPublicKey> keyFilter) {
LOGGER.trace("retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)");
PGPPublicKey result = null;
Iterator<PGPPublicKey> publicKeyIterator = publicKeyRing.getPublicKeys();
LOGGER.debug("Iterating through public keys in public key ring");
while( result == null && publicKeyIterator.hasNext() ) {
PGPPublicKey key = publicKeyIterator.next();
LOGGER.info("Found secret key: {}", key.getKeyID());
LOGGER.debug("Checking public key with filter");
if( keyFilter.accept(key) ) {
LOGGER.info("Public key {} selected from key ring", key.getKeyID());
result = key;
}
}
return result;
} | class class_name[name] begin[{]
method[retrievePublicKey, return_type[type[PGPPublicKey]], modifier[protected], parameter[publicKeyRing, keyFilter]] begin[{]
call[LOGGER.trace, parameter[literal["retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)"]]]
local_variable[type[PGPPublicKey], result]
local_variable[type[Iterator], publicKeyIterator]
call[LOGGER.debug, parameter[literal["Iterating through public keys in public key ring"]]]
while[binary_operation[binary_operation[member[.result], ==, literal[null]], &&, call[publicKeyIterator.hasNext, parameter[]]]] begin[{]
local_variable[type[PGPPublicKey], key]
call[LOGGER.info, parameter[literal["Found secret key: {}"], call[key.getKeyID, parameter[]]]]
call[LOGGER.debug, parameter[literal["Checking public key with filter"]]]
if[call[keyFilter.accept, parameter[member[.key]]]] begin[{]
call[LOGGER.info, parameter[literal["Public key {} selected from key ring"], call[key.getKeyID, parameter[]]]]
assign[member[.result], member[.key]]
else begin[{]
None
end[}]
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[protected] identifier[PGPPublicKey] identifier[retrievePublicKey] operator[SEP] identifier[PGPPublicKeyRing] identifier[publicKeyRing] , identifier[KeyFilter] operator[<] identifier[PGPPublicKey] operator[>] identifier[keyFilter] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[PGPPublicKey] identifier[result] operator[=] Other[null] operator[SEP] identifier[Iterator] operator[<] identifier[PGPPublicKey] operator[>] identifier[publicKeyIterator] operator[=] identifier[publicKeyRing] operator[SEP] identifier[getPublicKeys] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[result] operator[==] Other[null] operator[&&] identifier[publicKeyIterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[PGPPublicKey] identifier[key] operator[=] identifier[publicKeyIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[key] operator[SEP] identifier[getKeyID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[keyFilter] operator[SEP] identifier[accept] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[key] operator[SEP] identifier[getKeyID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[key] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static Field getOptionalField(Class<?> clazz, String fieldName)
{
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}
catch(NoSuchFieldException expectable) {}
catch(SecurityException e) {
throw new BugError(e);
}
return null;
} | class class_name[name] begin[{]
method[getOptionalField, return_type[type[Field]], modifier[public static], parameter[clazz, fieldName]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDeclaredField, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setAccessible, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=expectable, types=['NoSuchFieldException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BugError, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SecurityException']))], finally_block=None, label=None, resources=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Field] identifier[getOptionalField] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[clazz] , identifier[String] identifier[fieldName] operator[SEP] {
Keyword[try] {
identifier[Field] identifier[field] operator[=] identifier[clazz] operator[SEP] identifier[getDeclaredField] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] identifier[field] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[field] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchFieldException] identifier[expectable] operator[SEP] {
}
Keyword[catch] operator[SEP] identifier[SecurityException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BugError] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
@Override
public String send() {
String messageID = null;
try {
messageID = super.send();
} catch (EmailException e) {
// check if original Exception is of type SendFailedException which
// should have been thrown by javax.mail.Transport.send()
if (e.getCause() instanceof AuthenticationFailedException) {
CmsMailHost host = OpenCms.getSystemInfo().getMailSettings().getDefaultMailHost();
// wrong user credentials in opencms-system.xml: mail api does not provide a message for authentication exception
CmsRuntimeException rte = new CmsRuntimeException(
Messages.get().container(
Messages.ERR_SEND_EMAIL_AUTHENTICATE_2,
host.getUsername(),
host.getHostname()));
rte.initCause(e);
throw rte;
} else {
CmsRuntimeException rte = new CmsRuntimeException(
Messages.get().container(Messages.ERR_SEND_EMAIL_CONFIG_0));
rte.initCause(e);
throw rte;
}
}
return messageID;
} | class class_name[name] begin[{]
method[send, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[String], messageID]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=messageID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=SuperMethodInvocation(arguments=[], member=send, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=AuthenticationFailedException, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=ERR_SEND_EMAIL_CONFIG_0, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[])], member=container, 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=CmsRuntimeException, sub_type=None)), name=rte)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsRuntimeException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initCause, postfix_operators=[], prefix_operators=[], qualifier=rte, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=rte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSystemInfo, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[], member=getMailSettings, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getDefaultMailHost, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=host)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsMailHost, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=ERR_SEND_EMAIL_AUTHENTICATE_2, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MethodInvocation(arguments=[], member=getUsername, postfix_operators=[], prefix_operators=[], qualifier=host, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getHostname, postfix_operators=[], prefix_operators=[], qualifier=host, selectors=[], type_arguments=None)], member=container, 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=CmsRuntimeException, sub_type=None)), name=rte)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsRuntimeException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initCause, postfix_operators=[], prefix_operators=[], qualifier=rte, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=rte, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['EmailException']))], finally_block=None, label=None, resources=None)
return[member[.messageID]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[send] operator[SEP] operator[SEP] {
identifier[String] identifier[messageID] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[messageID] operator[=] Keyword[super] operator[SEP] identifier[send] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[EmailException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] Keyword[instanceof] identifier[AuthenticationFailedException] operator[SEP] {
identifier[CmsMailHost] identifier[host] operator[=] identifier[OpenCms] operator[SEP] identifier[getSystemInfo] operator[SEP] operator[SEP] operator[SEP] identifier[getMailSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getDefaultMailHost] operator[SEP] operator[SEP] operator[SEP] identifier[CmsRuntimeException] identifier[rte] operator[=] Keyword[new] identifier[CmsRuntimeException] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_SEND_EMAIL_AUTHENTICATE_2] , identifier[host] operator[SEP] identifier[getUsername] operator[SEP] operator[SEP] , identifier[host] operator[SEP] identifier[getHostname] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rte] operator[SEP] identifier[initCause] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[rte] operator[SEP]
}
Keyword[else] {
identifier[CmsRuntimeException] identifier[rte] operator[=] Keyword[new] identifier[CmsRuntimeException] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_SEND_EMAIL_CONFIG_0] operator[SEP] operator[SEP] operator[SEP] identifier[rte] operator[SEP] identifier[initCause] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[rte] operator[SEP]
}
}
Keyword[return] identifier[messageID] operator[SEP]
}
|
private static String getBroadcastDateIgnoringCatchupRights(JsonArray broadcastArray, String broadcastType) {
String broadcastDate = "";
for(int i = 0; i < broadcastArray.size(); i++) {
JsonObject broadcastObject = broadcastArray.get(i).getAsJsonObject();
if(broadcastObject.has(JSON_ELEMENT_BROADCASTTYPE) &&
broadcastObject.has(JSON_ELEMENT_BROADCAST)) {
String type = broadcastObject.get(JSON_ELEMENT_BROADCASTTYPE).getAsString();
if(type.equals(broadcastType)) {
if (!broadcastObject.get(JSON_ELEMENT_BROADCAST).isJsonNull()) {
broadcastDate = (broadcastObject.get(JSON_ELEMENT_BROADCAST).getAsString());
}
}
}
}
return broadcastDate;
} | class class_name[name] begin[{]
method[getBroadcastDateIgnoringCatchupRights, return_type[type[String]], modifier[private static], parameter[broadcastArray, broadcastType]] begin[{]
local_variable[type[String], broadcastDate]
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=broadcastArray, selectors=[MethodInvocation(arguments=[], member=getAsJsonObject, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=broadcastObject)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonObject, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=JSON_ELEMENT_BROADCASTTYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=has, postfix_operators=[], prefix_operators=[], qualifier=broadcastObject, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=JSON_ELEMENT_BROADCAST, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=has, postfix_operators=[], prefix_operators=[], qualifier=broadcastObject, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=JSON_ELEMENT_BROADCASTTYPE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=broadcastObject, selectors=[MethodInvocation(arguments=[], member=getAsString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=broadcastType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=JSON_ELEMENT_BROADCAST, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=['!'], qualifier=broadcastObject, selectors=[MethodInvocation(arguments=[], member=isJsonNull, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=broadcastDate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=JSON_ELEMENT_BROADCAST, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=broadcastObject, selectors=[], type_arguments=None)), label=None)]))]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=broadcastArray, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.broadcastDate]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[getBroadcastDateIgnoringCatchupRights] operator[SEP] identifier[JsonArray] identifier[broadcastArray] , identifier[String] identifier[broadcastType] operator[SEP] {
identifier[String] identifier[broadcastDate] operator[=] literal[String] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[broadcastArray] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[JsonObject] identifier[broadcastObject] operator[=] identifier[broadcastArray] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getAsJsonObject] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[broadcastObject] operator[SEP] identifier[has] operator[SEP] identifier[JSON_ELEMENT_BROADCASTTYPE] operator[SEP] operator[&&] identifier[broadcastObject] operator[SEP] identifier[has] operator[SEP] identifier[JSON_ELEMENT_BROADCAST] operator[SEP] operator[SEP] {
identifier[String] identifier[type] operator[=] identifier[broadcastObject] operator[SEP] identifier[get] operator[SEP] identifier[JSON_ELEMENT_BROADCASTTYPE] operator[SEP] operator[SEP] identifier[getAsString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[equals] operator[SEP] identifier[broadcastType] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[broadcastObject] operator[SEP] identifier[get] operator[SEP] identifier[JSON_ELEMENT_BROADCAST] operator[SEP] operator[SEP] identifier[isJsonNull] operator[SEP] operator[SEP] operator[SEP] {
identifier[broadcastDate] operator[=] operator[SEP] identifier[broadcastObject] operator[SEP] identifier[get] operator[SEP] identifier[JSON_ELEMENT_BROADCAST] operator[SEP] operator[SEP] identifier[getAsString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
Keyword[return] identifier[broadcastDate] operator[SEP]
}
|
public BusItinerary getBusItinerary(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusItinerary itinerary : this.itineraries) {
if (cmp.compare(name, itinerary.getName()) == 0) {
return itinerary;
}
}
return null;
} | class class_name[name] begin[{]
method[getBusItinerary, return_type[type[BusItinerary]], modifier[public], parameter[name, nameComparator]] begin[{]
if[binary_operation[member[.name], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Comparator], cmp]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=itinerary, selectors=[], type_arguments=None)], member=compare, postfix_operators=[], prefix_operators=[], qualifier=cmp, 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=[ReturnStatement(expression=MemberReference(member=itinerary, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=itineraries, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=itinerary)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=BusItinerary, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[BusItinerary] identifier[getBusItinerary] operator[SEP] identifier[String] identifier[name] , identifier[Comparator] operator[<] identifier[String] operator[>] identifier[nameComparator] operator[SEP] {
Keyword[if] operator[SEP] identifier[name] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[final] identifier[Comparator] operator[<] identifier[String] operator[>] identifier[cmp] operator[=] identifier[nameComparator] operator[==] Other[null] operator[?] identifier[BusNetworkUtilities] operator[SEP] identifier[NAME_COMPARATOR] operator[:] identifier[nameComparator] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[BusItinerary] identifier[itinerary] operator[:] Keyword[this] operator[SEP] identifier[itineraries] operator[SEP] {
Keyword[if] operator[SEP] identifier[cmp] operator[SEP] identifier[compare] operator[SEP] identifier[name] , identifier[itinerary] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[itinerary] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public void checkout() throws RepositoryException, UnsupportedRepositoryOperationException
{
checkValid();
if (!session.getAccessManager().hasPermission(getACL(), new String[]{PermissionType.SET_PROPERTY},
session.getUserState().getIdentity()))
{
throw new AccessDeniedException("Access denied: checkout operation " + getPath() + " for: "
+ session.getUserID() + " item owner " + getACL().getOwner());
}
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
throw new UnsupportedRepositoryOperationException(
"Node.checkout() is not supported for not mix:versionable node ");
}
if (!checkLocking())
{
throw new LockException("Node " + getPath() + " is locked ");
}
if (checkedOut())
{
return;
}
SessionChangesLog changesLog = new SessionChangesLog(session);
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_ISCHECKEDOUT,
new TransientValueData(true))));
ValueData baseVersion =
((PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 0),
ItemType.PROPERTY)).getValues().get(0);
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_PREDECESSORS, baseVersion)));
dataManager.getTransactManager().save(changesLog);
session.getActionHandler().postCheckout(this);
} | class class_name[name] begin[{]
method[checkout, return_type[void], modifier[public], parameter[]] begin[{]
call[.checkValid, parameter[]]
if[call[session.getAccessManager, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Access denied: checkout operation "), operandr=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" for: "), operator=+), operandr=MethodInvocation(arguments=[], member=getUserID, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" item owner "), operator=+), operandr=MethodInvocation(arguments=[], member=getACL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getOwner, 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=AccessDeniedException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[THIS[call[None.isNodeType, parameter[member[Constants.MIX_VERSIONABLE]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Node.checkout() is not supported for not mix:versionable node ")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnsupportedRepositoryOperationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[.checkLocking, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Node "), operandr=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is locked "), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LockException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[.checkedOut, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[SessionChangesLog], changesLog]
call[changesLog.add, parameter[call[ItemState.createUpdatedState, parameter[call[.updatePropertyData, parameter[member[Constants.JCR_ISCHECKEDOUT], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TransientValueData, sub_type=None))]]]]]]
local_variable[type[ValueData], baseVersion]
call[changesLog.add, parameter[call[ItemState.createUpdatedState, parameter[call[.updatePropertyData, parameter[member[Constants.JCR_PREDECESSORS], member[.baseVersion]]]]]]]
call[dataManager.getTransactManager, parameter[]]
call[session.getActionHandler, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[checkout] operator[SEP] operator[SEP] Keyword[throws] identifier[RepositoryException] , identifier[UnsupportedRepositoryOperationException] {
identifier[checkValid] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[session] operator[SEP] identifier[getAccessManager] operator[SEP] operator[SEP] operator[SEP] identifier[hasPermission] operator[SEP] identifier[getACL] operator[SEP] operator[SEP] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[PermissionType] operator[SEP] identifier[SET_PROPERTY]
} , identifier[session] operator[SEP] identifier[getUserState] operator[SEP] operator[SEP] operator[SEP] identifier[getIdentity] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AccessDeniedException] operator[SEP] literal[String] operator[+] identifier[getPath] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[session] operator[SEP] identifier[getUserID] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[getACL] operator[SEP] operator[SEP] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[isNodeType] operator[SEP] identifier[Constants] operator[SEP] identifier[MIX_VERSIONABLE] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnsupportedRepositoryOperationException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[checkLocking] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[LockException] operator[SEP] literal[String] operator[+] identifier[getPath] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[checkedOut] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[SessionChangesLog] identifier[changesLog] operator[=] Keyword[new] identifier[SessionChangesLog] operator[SEP] identifier[session] operator[SEP] operator[SEP] identifier[changesLog] operator[SEP] identifier[add] operator[SEP] identifier[ItemState] operator[SEP] identifier[createUpdatedState] operator[SEP] identifier[updatePropertyData] operator[SEP] identifier[Constants] operator[SEP] identifier[JCR_ISCHECKEDOUT] , Keyword[new] identifier[TransientValueData] operator[SEP] literal[boolean] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ValueData] identifier[baseVersion] operator[=] operator[SEP] operator[SEP] identifier[PropertyData] operator[SEP] identifier[dataManager] operator[SEP] identifier[getItemData] operator[SEP] identifier[nodeData] operator[SEP] operator[SEP] , Keyword[new] identifier[QPathEntry] operator[SEP] identifier[Constants] operator[SEP] identifier[JCR_BASEVERSION] , Other[0] operator[SEP] , identifier[ItemType] operator[SEP] identifier[PROPERTY] operator[SEP] operator[SEP] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[changesLog] operator[SEP] identifier[add] operator[SEP] identifier[ItemState] operator[SEP] identifier[createUpdatedState] operator[SEP] identifier[updatePropertyData] operator[SEP] identifier[Constants] operator[SEP] identifier[JCR_PREDECESSORS] , identifier[baseVersion] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[dataManager] operator[SEP] identifier[getTransactManager] operator[SEP] operator[SEP] operator[SEP] identifier[save] operator[SEP] identifier[changesLog] operator[SEP] operator[SEP] identifier[session] operator[SEP] identifier[getActionHandler] operator[SEP] operator[SEP] operator[SEP] identifier[postCheckout] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
|
public static boolean isEmoji(String string) {
if (string == null) return false;
EmojiParser.UnicodeCandidate unicodeCandidate = EmojiParser.getNextUnicodeCandidate(string.toCharArray(), 0);
return unicodeCandidate != null &&
unicodeCandidate.getEmojiStartIndex() == 0 &&
unicodeCandidate.getFitzpatrickEndIndex() == string.length();
} | class class_name[name] begin[{]
method[isEmoji, return_type[type[boolean]], modifier[public static], parameter[string]] begin[{]
if[binary_operation[member[.string], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[EmojiParser], unicodeCandidate]
return[binary_operation[binary_operation[binary_operation[member[.unicodeCandidate], !=, literal[null]], &&, binary_operation[call[unicodeCandidate.getEmojiStartIndex, parameter[]], ==, literal[0]]], &&, binary_operation[call[unicodeCandidate.getFitzpatrickEndIndex, parameter[]], ==, call[string.length, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isEmoji] operator[SEP] identifier[String] identifier[string] operator[SEP] {
Keyword[if] operator[SEP] identifier[string] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[EmojiParser] operator[SEP] identifier[UnicodeCandidate] identifier[unicodeCandidate] operator[=] identifier[EmojiParser] operator[SEP] identifier[getNextUnicodeCandidate] operator[SEP] identifier[string] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] , Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[unicodeCandidate] operator[!=] Other[null] operator[&&] identifier[unicodeCandidate] operator[SEP] identifier[getEmojiStartIndex] operator[SEP] operator[SEP] operator[==] Other[0] operator[&&] identifier[unicodeCandidate] operator[SEP] identifier[getFitzpatrickEndIndex] operator[SEP] operator[SEP] operator[==] identifier[string] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
|
private void parseFeatures(JsonParser jp) throws IOException, SQLException {
jp.nextToken(); // FIELD_NAME features
// Passes all the properties until "Feature" object is found
while(!jp.getText().equalsIgnoreCase(GeoJsonField.FEATURES) &&
!jp.getText().equalsIgnoreCase(GeoJsonField.CRS)){
jp.nextToken();
if(jp.getCurrentToken().equals(JsonToken.START_ARRAY) || jp.getCurrentToken().equals(JsonToken.START_OBJECT)){
jp.skipChildren();
}
jp.nextToken();
}
String firstParam = jp.getText();
if(firstParam.equalsIgnoreCase(GeoJsonField.CRS)){
firstParam = skipCRS(jp);
}
if (firstParam.equalsIgnoreCase(GeoJsonField.FEATURES)) {
jp.nextToken(); // START_ARRAY [
JsonToken token = jp.nextToken(); // START_OBJECT {
long batchSize = 0;
while (token != JsonToken.END_ARRAY) {
jp.nextToken(); // FIELD_NAME type
jp.nextToken(); // VALUE_STRING Feature
String geomType = jp.getText();
if (geomType.equalsIgnoreCase(GeoJsonField.FEATURE)) {
if (progress.isCanceled()) {
throw new SQLException("Canceled by user");
}
Object[] values = parseFeature(jp);
for (int i = 0; i < values.length; i++) {
preparedStatement.setObject(i+1, values[i]);
}
preparedStatement.addBatch();
batchSize++;
if (batchSize >= BATCH_MAX_SIZE) {
preparedStatement.executeBatch();
preparedStatement.clearBatch();
batchSize = 0;
}
token = jp.nextToken(); //START_OBJECT new feature
featureCounter++;
if (nodeCountProgress++ % readFileSizeEachNode == 0) {
// Update Progress
try {
progress.setStep((int) (((double) fc.position() / fileSize) * 100));
} catch (IOException ex) {
// Ignore
}
}
if (batchSize > 0) {
preparedStatement.executeBatch();
}
} else {
throw new SQLException("Malformed GeoJSON file. Expected 'Feature', found '" + geomType + "'");
}
}
//LOOP END_ARRAY ]
log.info(featureCounter+ " geojson features have been imported.");
} else {
throw new SQLException("Malformed GeoJSON file. Expected 'features', found '" + firstParam + "'");
}
} | class class_name[name] begin[{]
method[parseFeatures, return_type[void], modifier[private], parameter[jp]] begin[{]
call[jp.nextToken, parameter[]]
while[binary_operation[call[jp.getText, parameter[]], &&, call[jp.getText, parameter[]]]] begin[{]
call[jp.nextToken, parameter[]]
if[binary_operation[call[jp.getCurrentToken, parameter[]], ||, call[jp.getCurrentToken, parameter[]]]] begin[{]
call[jp.skipChildren, parameter[]]
else begin[{]
None
end[}]
call[jp.nextToken, parameter[]]
end[}]
local_variable[type[String], firstParam]
if[call[firstParam.equalsIgnoreCase, parameter[member[GeoJsonField.CRS]]]] begin[{]
assign[member[.firstParam], call[.skipCRS, parameter[member[.jp]]]]
else begin[{]
None
end[}]
if[call[firstParam.equalsIgnoreCase, parameter[member[GeoJsonField.FEATURES]]]] begin[{]
call[jp.nextToken, parameter[]]
local_variable[type[JsonToken], token]
local_variable[type[long], batchSize]
while[binary_operation[member[.token], !=, member[JsonToken.END_ARRAY]]] begin[{]
call[jp.nextToken, parameter[]]
call[jp.nextToken, parameter[]]
local_variable[type[String], geomType]
if[call[geomType.equalsIgnoreCase, parameter[member[GeoJsonField.FEATURE]]]] begin[{]
if[call[progress.isCanceled, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Canceled by user")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Object], values]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=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=+), MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=setObject, postfix_operators=[], prefix_operators=[], qualifier=preparedStatement, 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=values, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[preparedStatement.addBatch, parameter[]]
member[.batchSize]
if[binary_operation[member[.batchSize], >=, member[.BATCH_MAX_SIZE]]] begin[{]
call[preparedStatement.executeBatch, parameter[]]
call[preparedStatement.clearBatch, parameter[]]
assign[member[.batchSize], literal[0]]
else begin[{]
None
end[}]
assign[member[.token], call[jp.nextToken, parameter[]]]
member[.featureCounter]
if[binary_operation[binary_operation[member[.nodeCountProgress], %, member[.readFileSizeEachNode]], ==, literal[0]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=Cast(expression=MethodInvocation(arguments=[], member=position, postfix_operators=[], prefix_operators=[], qualifier=fc, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=double)), operandr=MemberReference(member=fileSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=/), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=100), operator=*), type=BasicType(dimensions=[], name=int))], member=setStep, postfix_operators=[], prefix_operators=[], qualifier=progress, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[member[.batchSize], >, literal[0]]] begin[{]
call[preparedStatement.executeBatch, parameter[]]
else begin[{]
None
end[}]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Malformed GeoJSON file. Expected 'Feature', found '"), operandr=MemberReference(member=geomType, 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=SQLException, sub_type=None)), label=None)
end[}]
end[}]
call[log.info, parameter[binary_operation[member[.featureCounter], +, literal[" geojson features have been imported."]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Malformed GeoJSON file. Expected 'features', found '"), operandr=MemberReference(member=firstParam, 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=SQLException, sub_type=None)), label=None)
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[parseFeatures] operator[SEP] identifier[JsonParser] identifier[jp] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SQLException] {
identifier[jp] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[jp] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[GeoJsonField] operator[SEP] identifier[FEATURES] operator[SEP] operator[&&] operator[!] identifier[jp] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[GeoJsonField] operator[SEP] identifier[CRS] operator[SEP] operator[SEP] {
identifier[jp] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jp] operator[SEP] identifier[getCurrentToken] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[JsonToken] operator[SEP] identifier[START_ARRAY] operator[SEP] operator[||] identifier[jp] operator[SEP] identifier[getCurrentToken] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[JsonToken] operator[SEP] identifier[START_OBJECT] operator[SEP] operator[SEP] {
identifier[jp] operator[SEP] identifier[skipChildren] operator[SEP] operator[SEP] operator[SEP]
}
identifier[jp] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[firstParam] operator[=] identifier[jp] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstParam] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[GeoJsonField] operator[SEP] identifier[CRS] operator[SEP] operator[SEP] {
identifier[firstParam] operator[=] identifier[skipCRS] operator[SEP] identifier[jp] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[firstParam] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[GeoJsonField] operator[SEP] identifier[FEATURES] operator[SEP] operator[SEP] {
identifier[jp] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[JsonToken] identifier[token] operator[=] identifier[jp] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[batchSize] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[token] operator[!=] identifier[JsonToken] operator[SEP] identifier[END_ARRAY] operator[SEP] {
identifier[jp] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[jp] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[geomType] operator[=] identifier[jp] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[geomType] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[GeoJsonField] operator[SEP] identifier[FEATURE] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[progress] operator[SEP] identifier[isCanceled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Object] operator[SEP] operator[SEP] identifier[values] operator[=] identifier[parseFeature] operator[SEP] identifier[jp] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[values] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[preparedStatement] operator[SEP] identifier[setObject] operator[SEP] identifier[i] operator[+] Other[1] , identifier[values] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[preparedStatement] operator[SEP] identifier[addBatch] operator[SEP] operator[SEP] operator[SEP] identifier[batchSize] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[batchSize] operator[>=] identifier[BATCH_MAX_SIZE] operator[SEP] {
identifier[preparedStatement] operator[SEP] identifier[executeBatch] operator[SEP] operator[SEP] operator[SEP] identifier[preparedStatement] operator[SEP] identifier[clearBatch] operator[SEP] operator[SEP] operator[SEP] identifier[batchSize] operator[=] Other[0] operator[SEP]
}
identifier[token] operator[=] identifier[jp] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[featureCounter] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[nodeCountProgress] operator[++] operator[%] identifier[readFileSizeEachNode] operator[==] Other[0] operator[SEP] {
Keyword[try] {
identifier[progress] operator[SEP] identifier[setStep] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[double] operator[SEP] identifier[fc] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[/] identifier[fileSize] operator[SEP] operator[*] Other[100] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
}
}
Keyword[if] operator[SEP] identifier[batchSize] operator[>] Other[0] operator[SEP] {
identifier[preparedStatement] operator[SEP] identifier[executeBatch] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[+] identifier[geomType] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
identifier[log] operator[SEP] identifier[info] operator[SEP] identifier[featureCounter] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[+] identifier[firstParam] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("unchecked")
public synchronized <T> List<T> getInstances(Key<T> key) {
checkState(injector != null && poolScope != null, "WorkerPool has not been initialized, make sure Boot module and ServiceGraph is used");
checkArgument(injector.getExistingBinding(key) != null, "Binding for %s not found", key);
List<T> result = (List<T>) pool.get(key);
if (result != null) {
return result;
}
result = new ArrayList<>();
for (int i = 0; i < workers; i++) {
result.add(poolScope.inScope(this, i, () -> injector.getInstance(key)));
}
return result;
} | class class_name[name] begin[{]
method[getInstances, return_type[type[List]], modifier[synchronized public], parameter[key]] begin[{]
call[.checkState, parameter[binary_operation[binary_operation[member[.injector], !=, literal[null]], &&, binary_operation[member[.poolScope], !=, literal[null]]], literal["WorkerPool has not been initialized, make sure Boot module and ServiceGraph is used"]]]
call[.checkArgument, parameter[binary_operation[call[injector.getExistingBinding, parameter[member[.key]]], !=, literal[null]], literal["Binding for %s not found"], member[.key]]]
local_variable[type[List], result]
if[binary_operation[member[.result], !=, literal[null]]] begin[{]
return[member[.result]]
else begin[{]
None
end[}]
assign[member[.result], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getInstance, postfix_operators=[], prefix_operators=[], qualifier=injector, selectors=[], type_arguments=None), parameters=[])], member=inScope, postfix_operators=[], prefix_operators=[], qualifier=poolScope, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=workers, 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[member[.result]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[synchronized] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[getInstances] operator[SEP] identifier[Key] operator[<] identifier[T] operator[>] identifier[key] operator[SEP] {
identifier[checkState] operator[SEP] identifier[injector] operator[!=] Other[null] operator[&&] identifier[poolScope] operator[!=] Other[null] , literal[String] operator[SEP] operator[SEP] identifier[checkArgument] operator[SEP] identifier[injector] operator[SEP] identifier[getExistingBinding] operator[SEP] identifier[key] operator[SEP] operator[!=] Other[null] , literal[String] , identifier[key] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[result] operator[=] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] operator[SEP] identifier[pool] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[result] operator[SEP]
}
identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[workers] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[poolScope] operator[SEP] identifier[inScope] operator[SEP] Keyword[this] , identifier[i] , operator[SEP] operator[SEP] operator[->] identifier[injector] operator[SEP] identifier[getInstance] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public <A extends Annotation> void registerProcessor(final Class<A> annoClass, final FieldProcessor<A> processor) {
ArgUtils.notNull(annoClass, "annoClass");
ArgUtils.notNull(processor, "processor");
pocessorMap.put(annoClass, processor);
} | class class_name[name] begin[{]
method[registerProcessor, return_type[void], modifier[public], parameter[annoClass, processor]] begin[{]
call[ArgUtils.notNull, parameter[member[.annoClass], literal["annoClass"]]]
call[ArgUtils.notNull, parameter[member[.processor], literal["processor"]]]
call[pocessorMap.put, parameter[member[.annoClass], member[.processor]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[A] Keyword[extends] identifier[Annotation] operator[>] Keyword[void] identifier[registerProcessor] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[A] operator[>] identifier[annoClass] , Keyword[final] identifier[FieldProcessor] operator[<] identifier[A] operator[>] identifier[processor] operator[SEP] {
identifier[ArgUtils] operator[SEP] identifier[notNull] operator[SEP] identifier[annoClass] , literal[String] operator[SEP] operator[SEP] identifier[ArgUtils] operator[SEP] identifier[notNull] operator[SEP] identifier[processor] , literal[String] operator[SEP] operator[SEP] identifier[pocessorMap] operator[SEP] identifier[put] operator[SEP] identifier[annoClass] , identifier[processor] operator[SEP] operator[SEP]
}
|
@Override
public Agreement getWsagObject(String serializedData) throws ParserException{
Agreement agreement = null;
try{
logger.info("Will parse {}", serializedData);
agreement = mapper.readValue(serializedData, Agreement.class);
logger.info("Agreement parsed {}", agreement);
} catch (JsonProcessingException e) {
throw new ParserException(e);
} catch (Throwable e) {
throw new ParserException(e);
}
return agreement;
} | class class_name[name] begin[{]
method[getWsagObject, return_type[type[Agreement]], modifier[public], parameter[serializedData]] begin[{]
local_variable[type[Agreement], agreement]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Will parse {}"), MemberReference(member=serializedData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=agreement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=serializedData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Agreement, sub_type=None))], member=readValue, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Agreement parsed {}"), MemberReference(member=agreement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParserException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JsonProcessingException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParserException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)
return[member[.agreement]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Agreement] identifier[getWsagObject] operator[SEP] identifier[String] identifier[serializedData] operator[SEP] Keyword[throws] identifier[ParserException] {
identifier[Agreement] identifier[agreement] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[serializedData] operator[SEP] operator[SEP] identifier[agreement] operator[=] identifier[mapper] operator[SEP] identifier[readValue] operator[SEP] identifier[serializedData] , identifier[Agreement] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[agreement] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JsonProcessingException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ParserException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ParserException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[return] identifier[agreement] operator[SEP]
}
|
public void setRequestedBytes(int newRequestedBytes)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setRequestedBytes", newRequestedBytes);
requestedBytes = newRequestedBytes;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setRequestedBytes");
} | class class_name[name] begin[{]
method[setRequestedBytes, return_type[void], modifier[public], parameter[newRequestedBytes]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["setRequestedBytes"], member[.newRequestedBytes]]]
else begin[{]
None
end[}]
assign[member[.requestedBytes], member[.newRequestedBytes]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["setRequestedBytes"]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setRequestedBytes] operator[SEP] Keyword[int] identifier[newRequestedBytes] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[newRequestedBytes] operator[SEP] operator[SEP] identifier[requestedBytes] operator[=] identifier[newRequestedBytes] operator[SEP] Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
|
public void init(Object env, Map<String,Object> properties, Object applet)
{
super.init(env, properties, applet);
if (this.registerUniqueApplication(null, null) != Constants.NORMAL_RETURN)
{
this.free(); // Don't start this application (It's already running somewhere)
return;
}
// Okay good. I'm responsible for scheduling and running scheduled tasks.
final int MAX_TASKS = 1; // For now, run them sequentially
this.setTaskScheduler(new PrivateTaskScheduler(this, MAX_TASKS, true));
MessageManager messageManager = null;
if (this.getEnvironment() != null)
if (this.getEnvironment().getMessageApplication(true, properties) != null)
messageManager = this.getEnvironment().getMessageApplication(true, properties).getThickMessageManager();
if (messageManager == null) // Never
messageManager = RemoteMessageManager.getMessageManager(this);
String strQueueName = this.getProperty(MessageConstants.QUEUE_NAME);
if (strQueueName == null)
strQueueName = MessageConstants.TRX_RECEIVE_QUEUE; // Never
String strQueueType = this.getProperty(MessageConstants.QUEUE_TYPE);
if (strQueueType == null)
strQueueType = MessageConstants.INTRANET_QUEUE; // Never
BaseMessageReceiver receiver = (BaseMessageReceiver)messageManager.getMessageQueue(strQueueName, strQueueType).getMessageReceiver();
new BaseMessageListener(receiver) // Listener added to filter.
{
@SuppressWarnings("unchecked")
public int handleMessage(BaseMessage message)
{ // Whenever I'm pinged, restart the JobScanner which rescans the current job list
Map<String,Object> properties = null;
if (message instanceof MapMessage) // Always
properties = (Map<String,Object>)message.getData();
ProcessRunnerTask task = new ProcessRunnerTask(JobSchedulerApp.this, null, properties);
getTaskScheduler().addTask(task);
return super.handleMessage(message);
}
};
} | class class_name[name] begin[{]
method[init, return_type[void], modifier[public], parameter[env, properties, applet]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=env, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=applet, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=init, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
if[binary_operation[THIS[call[None.registerUniqueApplication, parameter[literal[null], literal[null]]]], !=, member[Constants.NORMAL_RETURN]]] begin[{]
THIS[call[None.free, parameter[]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[int], MAX_TASKS]
THIS[call[None.setTaskScheduler, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=MAX_TASKS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PrivateTaskScheduler, sub_type=None))]]]
local_variable[type[MessageManager], messageManager]
if[binary_operation[THIS[call[None.getEnvironment, parameter[]]], !=, literal[null]]] begin[{]
if[binary_operation[THIS[call[None.getEnvironment, parameter[]]call[None.getMessageApplication, parameter[literal[true], member[.properties]]]], !=, literal[null]]] begin[{]
assign[member[.messageManager], THIS[call[None.getEnvironment, parameter[]]call[None.getMessageApplication, parameter[literal[true], member[.properties]]]call[None.getThickMessageManager, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.messageManager], ==, literal[null]]] begin[{]
assign[member[.messageManager], call[RemoteMessageManager.getMessageManager, parameter[THIS[]]]]
else begin[{]
None
end[}]
local_variable[type[String], strQueueName]
if[binary_operation[member[.strQueueName], ==, literal[null]]] begin[{]
assign[member[.strQueueName], member[MessageConstants.TRX_RECEIVE_QUEUE]]
else begin[{]
None
end[}]
local_variable[type[String], strQueueType]
if[binary_operation[member[.strQueueType], ==, literal[null]]] begin[{]
assign[member[.strQueueType], member[MessageConstants.INTRANET_QUEUE]]
else begin[{]
None
end[}]
local_variable[type[BaseMessageReceiver], receiver]
ClassCreator(arguments=[MemberReference(member=receiver, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=[MethodDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unchecked"), name=SuppressWarnings)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=properties)], 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=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=MapMessage, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=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=Object, sub_type=None))], dimensions=[], name=Map, sub_type=None))), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=JobSchedulerApp, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=properties, 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=ProcessRunnerTask, sub_type=None)), name=task)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ProcessRunnerTask, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getTaskScheduler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=task, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addTask, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ReturnStatement(expression=SuperMethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleMessage, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=handleMessage, parameters=[FormalParameter(annotations=[], modifiers=set(), name=message, type=ReferenceType(arguments=None, dimensions=[], name=BaseMessage, sub_type=None), varargs=False)], return_type=BasicType(dimensions=[], name=int), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BaseMessageListener, sub_type=None))
end[}]
END[}] | Keyword[public] Keyword[void] identifier[init] operator[SEP] identifier[Object] identifier[env] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] , identifier[Object] identifier[applet] operator[SEP] {
Keyword[super] operator[SEP] identifier[init] operator[SEP] identifier[env] , identifier[properties] , identifier[applet] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[registerUniqueApplication] operator[SEP] Other[null] , Other[null] operator[SEP] operator[!=] identifier[Constants] operator[SEP] identifier[NORMAL_RETURN] operator[SEP] {
Keyword[this] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[final] Keyword[int] identifier[MAX_TASKS] operator[=] Other[1] operator[SEP] Keyword[this] operator[SEP] identifier[setTaskScheduler] operator[SEP] Keyword[new] identifier[PrivateTaskScheduler] operator[SEP] Keyword[this] , identifier[MAX_TASKS] , literal[boolean] operator[SEP] operator[SEP] operator[SEP] identifier[MessageManager] identifier[messageManager] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getEnvironment] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getEnvironment] operator[SEP] operator[SEP] operator[SEP] identifier[getMessageApplication] operator[SEP] literal[boolean] , identifier[properties] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[messageManager] operator[=] Keyword[this] operator[SEP] identifier[getEnvironment] operator[SEP] operator[SEP] operator[SEP] identifier[getMessageApplication] operator[SEP] literal[boolean] , identifier[properties] operator[SEP] operator[SEP] identifier[getThickMessageManager] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[messageManager] operator[==] Other[null] operator[SEP] identifier[messageManager] operator[=] identifier[RemoteMessageManager] operator[SEP] identifier[getMessageManager] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[String] identifier[strQueueName] operator[=] Keyword[this] operator[SEP] identifier[getProperty] operator[SEP] identifier[MessageConstants] operator[SEP] identifier[QUEUE_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strQueueName] operator[==] Other[null] operator[SEP] identifier[strQueueName] operator[=] identifier[MessageConstants] operator[SEP] identifier[TRX_RECEIVE_QUEUE] operator[SEP] identifier[String] identifier[strQueueType] operator[=] Keyword[this] operator[SEP] identifier[getProperty] operator[SEP] identifier[MessageConstants] operator[SEP] identifier[QUEUE_TYPE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strQueueType] operator[==] Other[null] operator[SEP] identifier[strQueueType] operator[=] identifier[MessageConstants] operator[SEP] identifier[INTRANET_QUEUE] operator[SEP] identifier[BaseMessageReceiver] identifier[receiver] operator[=] operator[SEP] identifier[BaseMessageReceiver] operator[SEP] identifier[messageManager] operator[SEP] identifier[getMessageQueue] operator[SEP] identifier[strQueueName] , identifier[strQueueType] operator[SEP] operator[SEP] identifier[getMessageReceiver] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[BaseMessageListener] operator[SEP] identifier[receiver] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[int] identifier[handleMessage] operator[SEP] identifier[BaseMessage] identifier[message] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[message] Keyword[instanceof] identifier[MapMessage] operator[SEP] identifier[properties] operator[=] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] identifier[message] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[ProcessRunnerTask] identifier[task] operator[=] Keyword[new] identifier[ProcessRunnerTask] operator[SEP] identifier[JobSchedulerApp] operator[SEP] Keyword[this] , Other[null] , identifier[properties] operator[SEP] operator[SEP] identifier[getTaskScheduler] operator[SEP] operator[SEP] operator[SEP] identifier[addTask] operator[SEP] identifier[task] operator[SEP] operator[SEP] Keyword[return] Keyword[super] operator[SEP] identifier[handleMessage] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public static String getJarHome(Object o)
{
String path = o.getClass().getProtectionDomain()
.getCodeSource().getLocation().getFile();
File jarFile = new File(path);
return jarFile.getParentFile().getAbsolutePath();
} | class class_name[name] begin[{]
method[getJarHome, return_type[type[String]], modifier[public static], parameter[o]] begin[{]
local_variable[type[String], path]
local_variable[type[File], jarFile]
return[call[jarFile.getParentFile, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getJarHome] operator[SEP] identifier[Object] identifier[o] operator[SEP] {
identifier[String] identifier[path] operator[=] identifier[o] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getProtectionDomain] operator[SEP] operator[SEP] operator[SEP] identifier[getCodeSource] operator[SEP] operator[SEP] operator[SEP] identifier[getLocation] operator[SEP] operator[SEP] operator[SEP] identifier[getFile] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[jarFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[return] identifier[jarFile] operator[SEP] identifier[getParentFile] operator[SEP] operator[SEP] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP]
}
|
protected boolean checkIfMatch(final HttpServletRequest request, final HttpServletResponse response, final Attributes resourceAttributes)
throws IOException {
final String eTag = resourceAttributes.getETag();
final String headerValue = request.getHeader("If-Match");
if (headerValue != null) {
if (headerValue.indexOf('*') == -1) {
final StringTokenizer commaTokenizer = new StringTokenizer(headerValue, ",");
boolean conditionSatisfied = false;
while (!conditionSatisfied && commaTokenizer.hasMoreTokens()) {
final String currentToken = commaTokenizer.nextToken();
if (currentToken.trim().equals(eTag))
conditionSatisfied = true;
}
// If none of the given ETags match, 412 Precodition failed is
// sent back
if (!conditionSatisfied) {
response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);
return false;
}
}
}
return true;
} | class class_name[name] begin[{]
method[checkIfMatch, return_type[type[boolean]], modifier[protected], parameter[request, response, resourceAttributes]] begin[{]
local_variable[type[String], eTag]
local_variable[type[String], headerValue]
if[binary_operation[member[.headerValue], !=, literal[null]]] begin[{]
if[binary_operation[call[headerValue.indexOf, parameter[literal['*']]], ==, literal[1]]] begin[{]
local_variable[type[StringTokenizer], commaTokenizer]
local_variable[type[boolean], conditionSatisfied]
while[binary_operation[member[.conditionSatisfied], &&, call[commaTokenizer.hasMoreTokens, parameter[]]]] begin[{]
local_variable[type[String], currentToken]
if[call[currentToken.trim, parameter[]]] begin[{]
assign[member[.conditionSatisfied], literal[true]]
else begin[{]
None
end[}]
end[}]
if[member[.conditionSatisfied]] begin[{]
call[response.sendError, parameter[member[HttpServletResponse.SC_PRECONDITION_FAILED]]]
return[literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[checkIfMatch] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[request] , Keyword[final] identifier[HttpServletResponse] identifier[response] , Keyword[final] identifier[Attributes] identifier[resourceAttributes] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[String] identifier[eTag] operator[=] identifier[resourceAttributes] operator[SEP] identifier[getETag] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[headerValue] operator[=] identifier[request] operator[SEP] identifier[getHeader] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[headerValue] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[headerValue] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[final] identifier[StringTokenizer] identifier[commaTokenizer] operator[=] Keyword[new] identifier[StringTokenizer] operator[SEP] identifier[headerValue] , literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[conditionSatisfied] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[conditionSatisfied] operator[&&] identifier[commaTokenizer] operator[SEP] identifier[hasMoreTokens] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[currentToken] operator[=] identifier[commaTokenizer] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentToken] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[eTag] operator[SEP] operator[SEP] identifier[conditionSatisfied] operator[=] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[conditionSatisfied] operator[SEP] {
identifier[response] operator[SEP] identifier[sendError] operator[SEP] identifier[HttpServletResponse] operator[SEP] identifier[SC_PRECONDITION_FAILED] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private void processAddDependency(Node n, Node parent) {
CodingConvention convention = compiler.getCodingConvention();
List<String> typeDecls =
convention.identifyTypeDeclarationCall(n);
// TODO(nnaze): Use of addDependency() should someday cause a warning
// as we migrate users to explicit goog.forwardDeclare() calls.
if (typeDecls != null) {
for (String typeDecl : typeDecls) {
compiler.forwardDeclareType(typeDecl);
}
}
// We can't modify parent, so just create a node that will
// get compiled out.
Node emptyNode = IR.number(0);
parent.replaceChild(n, emptyNode);
compiler.reportChangeToEnclosingScope(emptyNode);
} | class class_name[name] begin[{]
method[processAddDependency, return_type[void], modifier[private], parameter[n, parent]] begin[{]
local_variable[type[CodingConvention], convention]
local_variable[type[List], typeDecls]
if[binary_operation[member[.typeDecls], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=typeDecl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forwardDeclareType, postfix_operators=[], prefix_operators=[], qualifier=compiler, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=typeDecls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=typeDecl)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
local_variable[type[Node], emptyNode]
call[parent.replaceChild, parameter[member[.n], member[.emptyNode]]]
call[compiler.reportChangeToEnclosingScope, parameter[member[.emptyNode]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[processAddDependency] operator[SEP] identifier[Node] identifier[n] , identifier[Node] identifier[parent] operator[SEP] {
identifier[CodingConvention] identifier[convention] operator[=] identifier[compiler] operator[SEP] identifier[getCodingConvention] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[typeDecls] operator[=] identifier[convention] operator[SEP] identifier[identifyTypeDeclarationCall] operator[SEP] identifier[n] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[typeDecls] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[typeDecl] operator[:] identifier[typeDecls] operator[SEP] {
identifier[compiler] operator[SEP] identifier[forwardDeclareType] operator[SEP] identifier[typeDecl] operator[SEP] operator[SEP]
}
}
identifier[Node] identifier[emptyNode] operator[=] identifier[IR] operator[SEP] identifier[number] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[replaceChild] operator[SEP] identifier[n] , identifier[emptyNode] operator[SEP] operator[SEP] identifier[compiler] operator[SEP] identifier[reportChangeToEnclosingScope] operator[SEP] identifier[emptyNode] operator[SEP] operator[SEP]
}
|
public static String capitalize(final String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return str;
}
final int firstCodepoint = str.codePointAt(0);
final int newCodePoint = Character.toTitleCase(firstCodepoint);
if (firstCodepoint == newCodePoint) {
// already capitalized
return str;
}
final int newCodePoints[] = new int[strLen]; // cannot be longer than the char array
int outOffset = 0;
newCodePoints[outOffset++] = newCodePoint; // copy the first codepoint
for (int inOffset = Character.charCount(firstCodepoint); inOffset < strLen; ) {
final int codepoint = str.codePointAt(inOffset);
newCodePoints[outOffset++] = codepoint; // copy the remaining ones
inOffset += Character.charCount(codepoint);
}
return new String(newCodePoints, 0, outOffset);
} | class class_name[name] begin[{]
method[capitalize, return_type[type[String]], modifier[public static], parameter[str]] begin[{]
local_variable[type[int], strLen]
if[binary_operation[binary_operation[member[.str], ==, literal[null]], ||, binary_operation[assign[member[.strLen], call[str.length, parameter[]]], ==, literal[0]]]] begin[{]
return[member[.str]]
else begin[{]
None
end[}]
local_variable[type[int], firstCodepoint]
local_variable[type[int], newCodePoint]
if[binary_operation[member[.firstCodepoint], ==, member[.newCodePoint]]] begin[{]
return[member[.str]]
else begin[{]
None
end[}]
local_variable[type[int], newCodePoints]
local_variable[type[int], outOffset]
assign[member[.newCodePoints], member[.newCodePoint]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=inOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=codePointAt, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None), name=codepoint)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newCodePoints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=outOffset, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=codepoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=inOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=codepoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charCount, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=inOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=strLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[MemberReference(member=firstCodepoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charCount, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None), name=inOffset)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=None), label=None)
return[ClassCreator(arguments=[MemberReference(member=newCodePoints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=outOffset, 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=String, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[capitalize] operator[SEP] Keyword[final] identifier[String] identifier[str] operator[SEP] {
Keyword[int] identifier[strLen] operator[SEP] Keyword[if] operator[SEP] identifier[str] operator[==] Other[null] operator[||] operator[SEP] identifier[strLen] operator[=] identifier[str] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[str] operator[SEP]
}
Keyword[final] Keyword[int] identifier[firstCodepoint] operator[=] identifier[str] operator[SEP] identifier[codePointAt] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[newCodePoint] operator[=] identifier[Character] operator[SEP] identifier[toTitleCase] operator[SEP] identifier[firstCodepoint] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstCodepoint] operator[==] identifier[newCodePoint] operator[SEP] {
Keyword[return] identifier[str] operator[SEP]
}
Keyword[final] Keyword[int] identifier[newCodePoints] operator[SEP] operator[SEP] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[strLen] operator[SEP] operator[SEP] Keyword[int] identifier[outOffset] operator[=] Other[0] operator[SEP] identifier[newCodePoints] operator[SEP] identifier[outOffset] operator[++] operator[SEP] operator[=] identifier[newCodePoint] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[inOffset] operator[=] identifier[Character] operator[SEP] identifier[charCount] operator[SEP] identifier[firstCodepoint] operator[SEP] operator[SEP] identifier[inOffset] operator[<] identifier[strLen] operator[SEP] operator[SEP] {
Keyword[final] Keyword[int] identifier[codepoint] operator[=] identifier[str] operator[SEP] identifier[codePointAt] operator[SEP] identifier[inOffset] operator[SEP] operator[SEP] identifier[newCodePoints] operator[SEP] identifier[outOffset] operator[++] operator[SEP] operator[=] identifier[codepoint] operator[SEP] identifier[inOffset] operator[+=] identifier[Character] operator[SEP] identifier[charCount] operator[SEP] identifier[codepoint] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[newCodePoints] , Other[0] , identifier[outOffset] operator[SEP] operator[SEP]
}
|
public void printConstraint(PrintWriter pw)
{
Enumeration ec = getClauses();
boolean first = true;
while (ec.hasMoreElements()) {
Clause cl = (Clause)ec.nextElement();
if(!first) pw.print(" & ");
cl.printConstraint(pw);
first = false;
}
pw.flush();
} | class class_name[name] begin[{]
method[printConstraint, return_type[void], modifier[public], parameter[pw]] begin[{]
local_variable[type[Enumeration], ec]
local_variable[type[boolean], first]
while[call[ec.hasMoreElements, parameter[]]] begin[{]
local_variable[type[Clause], cl]
if[member[.first]] begin[{]
call[pw.print, parameter[literal[" & "]]]
else begin[{]
None
end[}]
call[cl.printConstraint, parameter[member[.pw]]]
assign[member[.first], literal[false]]
end[}]
call[pw.flush, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[printConstraint] operator[SEP] identifier[PrintWriter] identifier[pw] operator[SEP] {
identifier[Enumeration] identifier[ec] operator[=] identifier[getClauses] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[first] operator[=] literal[boolean] operator[SEP] Keyword[while] operator[SEP] identifier[ec] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[Clause] identifier[cl] operator[=] operator[SEP] identifier[Clause] operator[SEP] identifier[ec] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[first] operator[SEP] identifier[pw] operator[SEP] identifier[print] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[cl] operator[SEP] identifier[printConstraint] operator[SEP] identifier[pw] operator[SEP] operator[SEP] identifier[first] operator[=] literal[boolean] operator[SEP]
}
identifier[pw] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
|
private List<WyilFile> getExternals() throws IOException {
ArrayList<WyilFile> externals = new ArrayList<>();
List<Build.Package> pkgs = project.getPackages();
// Consider each package in turn and identify all contained WyilFiles
for (int i = 0; i != pkgs.size(); ++i) {
Build.Package p = pkgs.get(i);
// FIXME: This is kind broken me thinks. Potentially, we should be able to
// figure out what modules are supplied via the configuration.
List<Path.Entry<WyilFile>> entries = p.getRoot().get(Content.filter("**/*", WyilFile.ContentType));
for (int j = 0; j != entries.size(); ++j) {
externals.add(entries.get(j).read());
}
}
return externals;
} | class class_name[name] begin[{]
method[getExternals, return_type[type[List]], modifier[private], parameter[]] begin[{]
local_variable[type[ArrayList], externals]
local_variable[type[List], pkgs]
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=pkgs, selectors=[], type_arguments=None), name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Build, sub_type=ReferenceType(arguments=None, dimensions=None, name=Package, sub_type=None))), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRoot, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="**/*"), MemberReference(member=ContentType, postfix_operators=[], prefix_operators=[], qualifier=WyilFile, selectors=[])], member=filter, postfix_operators=[], prefix_operators=[], qualifier=Content, selectors=[], type_arguments=None)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=entries)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Path, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=WyilFile, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))], dimensions=[], name=List, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=entries, selectors=[MethodInvocation(arguments=[], member=read, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=externals, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=entries, selectors=[], type_arguments=None), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=pkgs, selectors=[], type_arguments=None), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.externals]]
end[}]
END[}] | Keyword[private] identifier[List] operator[<] identifier[WyilFile] operator[>] identifier[getExternals] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[ArrayList] operator[<] identifier[WyilFile] operator[>] identifier[externals] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Build] operator[SEP] identifier[Package] operator[>] identifier[pkgs] operator[=] identifier[project] operator[SEP] identifier[getPackages] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[!=] identifier[pkgs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[Build] operator[SEP] identifier[Package] identifier[p] operator[=] identifier[pkgs] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Path] operator[SEP] identifier[Entry] operator[<] identifier[WyilFile] operator[>] operator[>] identifier[entries] operator[=] identifier[p] operator[SEP] identifier[getRoot] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[Content] operator[SEP] identifier[filter] operator[SEP] literal[String] , identifier[WyilFile] operator[SEP] identifier[ContentType] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[!=] identifier[entries] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[j] operator[SEP] {
identifier[externals] operator[SEP] identifier[add] operator[SEP] identifier[entries] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[read] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[externals] operator[SEP]
}
|
public String resolveSystemReverse(String systemId)
throws MalformedURLException, IOException {
Vector resolved = resolveAllSystemReverse(systemId);
if (resolved != null && resolved.size() > 0) {
return (String) resolved.elementAt(0);
} else {
return null;
}
} | class class_name[name] begin[{]
method[resolveSystemReverse, return_type[type[String]], modifier[public], parameter[systemId]] begin[{]
local_variable[type[Vector], resolved]
if[binary_operation[binary_operation[member[.resolved], !=, literal[null]], &&, binary_operation[call[resolved.size, parameter[]], >, literal[0]]]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=elementAt, postfix_operators=[], prefix_operators=[], qualifier=resolved, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}] | Keyword[public] identifier[String] identifier[resolveSystemReverse] operator[SEP] identifier[String] identifier[systemId] operator[SEP] Keyword[throws] identifier[MalformedURLException] , identifier[IOException] {
identifier[Vector] identifier[resolved] operator[=] identifier[resolveAllSystemReverse] operator[SEP] identifier[systemId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resolved] operator[!=] Other[null] operator[&&] identifier[resolved] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] operator[SEP] identifier[String] operator[SEP] identifier[resolved] operator[SEP] identifier[elementAt] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
@XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "Rectangle", substitutionHeadNamespace = "http://www.opengis.net/gml", substitutionHeadName = "_SurfacePatch")
public JAXBElement<RectangleType> createRectangle(RectangleType value) {
return new JAXBElement<RectangleType>(_Rectangle_QNAME, RectangleType.class, null, value);
} | class class_name[name] begin[{]
method[createRectangle, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_Rectangle_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RectangleType, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RectangleType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] , identifier[substitutionHeadNamespace] operator[=] literal[String] , identifier[substitutionHeadName] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[RectangleType] operator[>] identifier[createRectangle] operator[SEP] identifier[RectangleType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[RectangleType] operator[>] operator[SEP] identifier[_Rectangle_QNAME] , identifier[RectangleType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
@NonNull
public SelfT withKeyspace(@Nullable String keyspaceName) {
return withKeyspace(keyspaceName == null ? null : CqlIdentifier.fromCql(keyspaceName));
} | class class_name[name] begin[{]
method[withKeyspace, return_type[type[SelfT]], modifier[public], parameter[keyspaceName]] begin[{]
return[call[.withKeyspace, parameter[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=keyspaceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=keyspaceName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromCql, postfix_operators=[], prefix_operators=[], qualifier=CqlIdentifier, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]]]
end[}]
END[}] | annotation[@] identifier[NonNull] Keyword[public] identifier[SelfT] identifier[withKeyspace] operator[SEP] annotation[@] identifier[Nullable] identifier[String] identifier[keyspaceName] operator[SEP] {
Keyword[return] identifier[withKeyspace] operator[SEP] identifier[keyspaceName] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[CqlIdentifier] operator[SEP] identifier[fromCql] operator[SEP] identifier[keyspaceName] 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.