code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
---|---|---|
@NonNull
@Override
public Iterator<AdminRow> iterator() {
return new AbstractIterator<AdminRow>() {
@Override
protected AdminRow computeNext() {
List<ByteBuffer> rowData = data.poll();
return (rowData == null)
? endOfData()
: new AdminRow(columnSpecs, rowData, protocolVersion);
}
};
} | class class_name[name] begin[{]
method[iterator, return_type[type[Iterator]], modifier[public], parameter[]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=poll, postfix_operators=[], prefix_operators=[], qualifier=data, selectors=[], type_arguments=None), name=rowData)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None))], dimensions=[], name=List, sub_type=None)), ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=rowData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=ClassCreator(arguments=[MemberReference(member=columnSpecs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rowData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=protocolVersion, 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=AdminRow, sub_type=None)), if_true=MethodInvocation(arguments=[], member=endOfData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], documentation=None, modifiers={'protected'}, name=computeNext, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=AdminRow, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AdminRow, sub_type=None))], dimensions=None, name=AbstractIterator, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[NonNull] annotation[@] identifier[Override] Keyword[public] identifier[Iterator] operator[<] identifier[AdminRow] operator[>] identifier[iterator] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[AbstractIterator] operator[<] identifier[AdminRow] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[protected] identifier[AdminRow] identifier[computeNext] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[ByteBuffer] operator[>] identifier[rowData] operator[=] identifier[data] operator[SEP] identifier[poll] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[rowData] operator[==] Other[null] operator[SEP] operator[?] identifier[endOfData] operator[SEP] operator[SEP] operator[:] Keyword[new] identifier[AdminRow] operator[SEP] identifier[columnSpecs] , identifier[rowData] , identifier[protocolVersion] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
@Override
public Integer getIntegerOrDie(String key) {
Integer value = getInteger(key);
if (value == null) {
throw new IllegalArgumentException(String.format(ERROR_KEYNOTFOUND, key));
} else {
return value;
}
} | class class_name[name] begin[{]
method[getIntegerOrDie, return_type[type[Integer]], modifier[public], parameter[key]] begin[{]
local_variable[type[Integer], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ERROR_KEYNOTFOUND, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
return[member[.value]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Integer] identifier[getIntegerOrDie] operator[SEP] identifier[String] identifier[key] operator[SEP] {
identifier[Integer] identifier[value] operator[=] identifier[getInteger] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[ERROR_KEYNOTFOUND] , identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[value] operator[SEP]
}
}
|
void beginPartUpload(final int nextPartNumber)
throws SdkClientException {
if (nextPartNumber < 1)
throw new IllegalArgumentException("part number must be at least 1");
if (partUploadInProgress) {
throw new SdkClientException(
"Parts are required to be uploaded in series");
}
synchronized (this) {
if (nextPartNumber - partNumber <= 1) {
partNumber = nextPartNumber;
partUploadInProgress = true;
} else {
throw new SdkClientException(
"Parts are required to be uploaded in series (partNumber="
+ partNumber + ", nextPartNumber="
+ nextPartNumber + ")");
}
}
} | class class_name[name] begin[{]
method[beginPartUpload, return_type[void], modifier[default], parameter[nextPartNumber]] begin[{]
if[binary_operation[member[.nextPartNumber], <, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="part number must be at least 1")], 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[member[.partUploadInProgress]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parts are required to be uploaded in series")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
SYNCHRONIZED[THIS[]] BEGIN[{]
if[binary_operation[binary_operation[member[.nextPartNumber], -, member[.partNumber]], <=, literal[1]]] begin[{]
assign[member[.partNumber], member[.nextPartNumber]]
assign[member[.partUploadInProgress], literal[true]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parts are required to be uploaded in series (partNumber="), operandr=MemberReference(member=partNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", nextPartNumber="), operator=+), operandr=MemberReference(member=nextPartNumber, 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=SdkClientException, sub_type=None)), label=None)
end[}]
END[}]
end[}]
END[}] | Keyword[void] identifier[beginPartUpload] operator[SEP] Keyword[final] Keyword[int] identifier[nextPartNumber] operator[SEP] Keyword[throws] identifier[SdkClientException] {
Keyword[if] operator[SEP] identifier[nextPartNumber] operator[<] Other[1] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[partUploadInProgress] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] identifier[nextPartNumber] operator[-] identifier[partNumber] operator[<=] Other[1] operator[SEP] {
identifier[partNumber] operator[=] identifier[nextPartNumber] operator[SEP] identifier[partUploadInProgress] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[partNumber] operator[+] literal[String] operator[+] identifier[nextPartNumber] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
|
public static <T extends MutableTreeNode<T>> void removeChild(T parent, T child) {
checkArgNotNull(parent, "parent");
int index = parent.getChildren().indexOf(child);
checkElementIndex(index, parent.getChildren().size());
parent.removeChild(index);
} | class class_name[name] begin[{]
method[removeChild, return_type[void], modifier[public static], parameter[parent, child]] begin[{]
call[.checkArgNotNull, parameter[member[.parent], literal["parent"]]]
local_variable[type[int], index]
call[.checkElementIndex, parameter[member[.index], call[parent.getChildren, parameter[]]]]
call[parent.removeChild, parameter[member[.index]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[MutableTreeNode] operator[<] identifier[T] operator[>] operator[>] Keyword[void] identifier[removeChild] operator[SEP] identifier[T] identifier[parent] , identifier[T] identifier[child] operator[SEP] {
identifier[checkArgNotNull] operator[SEP] identifier[parent] , literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[index] operator[=] identifier[parent] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[indexOf] operator[SEP] identifier[child] operator[SEP] operator[SEP] identifier[checkElementIndex] operator[SEP] identifier[index] , identifier[parent] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[removeChild] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
|
@Override
public void addRuleInstances (Digester digester)
{
// this creates the appropriate instance when we encounter a
// <class> tag
digester.addObjectCreate(_prefix + CLASS_PATH,
ComponentClass.class.getName());
// grab the attributes from the <class> tag
SetPropertyFieldsRule rule = new SetPropertyFieldsRule();
rule.addFieldParser("shadowColor", new FieldParser() {
public Object parse (String text) {
int[] values = StringUtil.parseIntArray(text);
return new Color(values[0], values[1], values[2], values[3]);
}
});
digester.addRule(_prefix + CLASS_PATH, rule);
// parse render priority overrides
String opath = _prefix + CLASS_PATH + "/override";
digester.addObjectCreate(opath, PriorityOverride.class.getName());
rule = new SetPropertyFieldsRule();
rule.addFieldParser("orients", new FieldParser() {
public Object parse (String text) {
String[] orients = StringUtil.parseStringArray(text);
ArrayIntSet oset = new ArrayIntSet();
for (String orient : orients) {
oset.add(DirectionUtil.fromShortString(orient));
}
return oset;
}
});
digester.addRule(opath, rule);
digester.addSetNext(opath, "addPriorityOverride",
PriorityOverride.class.getName());
} | class class_name[name] begin[{]
method[addRuleInstances, return_type[void], modifier[public], parameter[digester]] begin[{]
call[digester.addObjectCreate, parameter[binary_operation[member[._prefix], +, member[.CLASS_PATH]], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ComponentClass, sub_type=None))]]
local_variable[type[SetPropertyFieldsRule], rule]
call[rule.addFieldParser, parameter[literal["shadowColor"], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseIntArray, postfix_operators=[], prefix_operators=[], qualifier=StringUtil, selectors=[], type_arguments=None), name=values)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Color, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=parse, parameters=[FormalParameter(annotations=[], modifiers=set(), name=text, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FieldParser, sub_type=None))]]
call[digester.addRule, parameter[binary_operation[member[._prefix], +, member[.CLASS_PATH]], member[.rule]]]
local_variable[type[String], opath]
call[digester.addObjectCreate, parameter[member[.opath], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PriorityOverride, sub_type=None))]]
assign[member[.rule], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SetPropertyFieldsRule, sub_type=None))]
call[rule.addFieldParser, parameter[literal["orients"], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseStringArray, postfix_operators=[], prefix_operators=[], qualifier=StringUtil, selectors=[], type_arguments=None), name=orients)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], 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=ArrayIntSet, sub_type=None)), name=oset)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ArrayIntSet, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=orient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromShortString, postfix_operators=[], prefix_operators=[], qualifier=DirectionUtil, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=oset, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=orients, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=orient)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), ReturnStatement(expression=MemberReference(member=oset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=parse, parameters=[FormalParameter(annotations=[], modifiers=set(), name=text, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FieldParser, sub_type=None))]]
call[digester.addRule, parameter[member[.opath], member[.rule]]]
call[digester.addSetNext, parameter[member[.opath], literal["addPriorityOverride"], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=PriorityOverride, sub_type=None))]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[addRuleInstances] operator[SEP] identifier[Digester] identifier[digester] operator[SEP] {
identifier[digester] operator[SEP] identifier[addObjectCreate] operator[SEP] identifier[_prefix] operator[+] identifier[CLASS_PATH] , identifier[ComponentClass] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[SetPropertyFieldsRule] identifier[rule] operator[=] Keyword[new] identifier[SetPropertyFieldsRule] operator[SEP] operator[SEP] operator[SEP] identifier[rule] operator[SEP] identifier[addFieldParser] operator[SEP] literal[String] , Keyword[new] identifier[FieldParser] operator[SEP] operator[SEP] {
Keyword[public] identifier[Object] identifier[parse] operator[SEP] identifier[String] identifier[text] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[values] operator[=] identifier[StringUtil] operator[SEP] identifier[parseIntArray] operator[SEP] identifier[text] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Color] operator[SEP] identifier[values] operator[SEP] Other[0] operator[SEP] , identifier[values] operator[SEP] Other[1] operator[SEP] , identifier[values] operator[SEP] Other[2] operator[SEP] , identifier[values] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[digester] operator[SEP] identifier[addRule] operator[SEP] identifier[_prefix] operator[+] identifier[CLASS_PATH] , identifier[rule] operator[SEP] operator[SEP] identifier[String] identifier[opath] operator[=] identifier[_prefix] operator[+] identifier[CLASS_PATH] operator[+] literal[String] operator[SEP] identifier[digester] operator[SEP] identifier[addObjectCreate] operator[SEP] identifier[opath] , identifier[PriorityOverride] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[rule] operator[=] Keyword[new] identifier[SetPropertyFieldsRule] operator[SEP] operator[SEP] operator[SEP] identifier[rule] operator[SEP] identifier[addFieldParser] operator[SEP] literal[String] , Keyword[new] identifier[FieldParser] operator[SEP] operator[SEP] {
Keyword[public] identifier[Object] identifier[parse] operator[SEP] identifier[String] identifier[text] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[orients] operator[=] identifier[StringUtil] operator[SEP] identifier[parseStringArray] operator[SEP] identifier[text] operator[SEP] operator[SEP] identifier[ArrayIntSet] identifier[oset] operator[=] Keyword[new] identifier[ArrayIntSet] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[orient] operator[:] identifier[orients] operator[SEP] {
identifier[oset] operator[SEP] identifier[add] operator[SEP] identifier[DirectionUtil] operator[SEP] identifier[fromShortString] operator[SEP] identifier[orient] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[oset] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[digester] operator[SEP] identifier[addRule] operator[SEP] identifier[opath] , identifier[rule] operator[SEP] operator[SEP] identifier[digester] operator[SEP] identifier[addSetNext] operator[SEP] identifier[opath] , literal[String] , identifier[PriorityOverride] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Procedure
@Description("apoc.couchbase.upsert(hostOrKey, bucket, documentId, jsonDocument) yield id, expiry, cas, mutationToken, content - insert or overwrite a couchbase json document with its unique ID.")
public Stream<CouchbaseJsonDocument> upsert(@Name("hostOrKey") String hostOrKey, @Name("bucket") String bucket,
@Name("documentId") String documentId, @Name("json") String json) {
try (CouchbaseConnection couchbaseConnection = getCouchbaseConnection(hostOrKey, bucket)) {
JsonDocument jsonDocument = couchbaseConnection.upsert(documentId, json);
return jsonDocument == null ? Stream.empty() : Stream.of(new CouchbaseJsonDocument(jsonDocument));
}
} | class class_name[name] begin[{]
method[upsert, return_type[type[Stream]], modifier[public], parameter[hostOrKey, bucket, documentId, json]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=documentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=json, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=upsert, postfix_operators=[], prefix_operators=[], qualifier=couchbaseConnection, selectors=[], type_arguments=None), name=jsonDocument)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JsonDocument, sub_type=None)), ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=jsonDocument, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=jsonDocument, 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=CouchbaseJsonDocument, sub_type=None))], member=of, postfix_operators=[], prefix_operators=[], qualifier=Stream, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[], member=empty, postfix_operators=[], prefix_operators=[], qualifier=Stream, selectors=[], type_arguments=None)), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=couchbaseConnection, type=ReferenceType(arguments=None, dimensions=[], name=CouchbaseConnection, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=hostOrKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bucket, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getCouchbaseConnection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))])
end[}]
END[}] | annotation[@] identifier[Procedure] annotation[@] identifier[Description] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Stream] operator[<] identifier[CouchbaseJsonDocument] operator[>] identifier[upsert] operator[SEP] annotation[@] identifier[Name] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[hostOrKey] , annotation[@] identifier[Name] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[bucket] , annotation[@] identifier[Name] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[documentId] , annotation[@] identifier[Name] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[json] operator[SEP] {
Keyword[try] operator[SEP] identifier[CouchbaseConnection] identifier[couchbaseConnection] operator[=] identifier[getCouchbaseConnection] operator[SEP] identifier[hostOrKey] , identifier[bucket] operator[SEP] operator[SEP] {
identifier[JsonDocument] identifier[jsonDocument] operator[=] identifier[couchbaseConnection] operator[SEP] identifier[upsert] operator[SEP] identifier[documentId] , identifier[json] operator[SEP] operator[SEP] Keyword[return] identifier[jsonDocument] operator[==] Other[null] operator[?] identifier[Stream] operator[SEP] identifier[empty] operator[SEP] operator[SEP] operator[:] identifier[Stream] operator[SEP] identifier[of] operator[SEP] Keyword[new] identifier[CouchbaseJsonDocument] operator[SEP] identifier[jsonDocument] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public int awaitAdvanceInterruptibly(int phase,
long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException {
long nanos = unit.toNanos(timeout);
final Phaser root = this.root;
long s = (root == this) ? state : reconcileState();
int p = (int)(s >>> PHASE_SHIFT);
if (phase < 0)
return phase;
if (p == phase) {
QNode node = new QNode(this, phase, true, true, nanos);
p = root.internalAwaitAdvance(phase, node);
if (node.wasInterrupted)
throw new InterruptedException();
else if (p == phase)
throw new TimeoutException();
}
return p;
} | class class_name[name] begin[{]
method[awaitAdvanceInterruptibly, return_type[type[int]], modifier[public], parameter[phase, timeout, unit]] begin[{]
local_variable[type[long], nanos]
local_variable[type[Phaser], root]
local_variable[type[long], s]
local_variable[type[int], p]
if[binary_operation[member[.phase], <, literal[0]]] begin[{]
return[member[.phase]]
else begin[{]
None
end[}]
if[binary_operation[member[.p], ==, member[.phase]]] begin[{]
local_variable[type[QNode], node]
assign[member[.p], call[root.internalAwaitAdvance, parameter[member[.phase], member[.node]]]]
if[member[node.wasInterrupted]] 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=InterruptedException, sub_type=None)), label=None)
else begin[{]
if[binary_operation[member[.p], ==, member[.phase]]] 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=TimeoutException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[member[.p]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[awaitAdvanceInterruptibly] operator[SEP] Keyword[int] identifier[phase] , Keyword[long] identifier[timeout] , identifier[TimeUnit] identifier[unit] operator[SEP] Keyword[throws] identifier[InterruptedException] , identifier[TimeoutException] {
Keyword[long] identifier[nanos] operator[=] identifier[unit] operator[SEP] identifier[toNanos] operator[SEP] identifier[timeout] operator[SEP] operator[SEP] Keyword[final] identifier[Phaser] identifier[root] operator[=] Keyword[this] operator[SEP] identifier[root] operator[SEP] Keyword[long] identifier[s] operator[=] operator[SEP] identifier[root] operator[==] Keyword[this] operator[SEP] operator[?] identifier[state] operator[:] identifier[reconcileState] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[p] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[s] operator[>] operator[>] operator[>] identifier[PHASE_SHIFT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[phase] operator[<] Other[0] operator[SEP] Keyword[return] identifier[phase] operator[SEP] Keyword[if] operator[SEP] identifier[p] operator[==] identifier[phase] operator[SEP] {
identifier[QNode] identifier[node] operator[=] Keyword[new] identifier[QNode] operator[SEP] Keyword[this] , identifier[phase] , literal[boolean] , literal[boolean] , identifier[nanos] operator[SEP] operator[SEP] identifier[p] operator[=] identifier[root] operator[SEP] identifier[internalAwaitAdvance] operator[SEP] identifier[phase] , identifier[node] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[wasInterrupted] operator[SEP] Keyword[throw] Keyword[new] identifier[InterruptedException] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[p] operator[==] identifier[phase] operator[SEP] Keyword[throw] Keyword[new] identifier[TimeoutException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[p] operator[SEP]
}
|
protected void addElements(List<CmsContainerElementData> elements) {
for (CmsContainerElementData element : elements) {
m_elements.put(element.getClientId(), element);
}
} | class class_name[name] begin[{]
method[addElements, return_type[void], modifier[protected], parameter[elements]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClientId, postfix_operators=[], prefix_operators=[], qualifier=element, selectors=[], type_arguments=None), MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=m_elements, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=elements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=element)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsContainerElementData, sub_type=None))), label=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[addElements] operator[SEP] identifier[List] operator[<] identifier[CmsContainerElementData] operator[>] identifier[elements] operator[SEP] {
Keyword[for] operator[SEP] identifier[CmsContainerElementData] identifier[element] operator[:] identifier[elements] operator[SEP] {
identifier[m_elements] operator[SEP] identifier[put] operator[SEP] identifier[element] operator[SEP] identifier[getClientId] operator[SEP] operator[SEP] , identifier[element] operator[SEP] operator[SEP]
}
}
|
@Override
public void search(String crs, final VectorServerLayer layer, SearchCriterion[] criteria,
LogicalOperator operator, int maxResultSize, final FeatureMapFunction callback) {
SearchFeatureRequest request = new SearchFeatureRequest();
request.setBooleanOperator(operator.getValue());
request.setCriteria(criteria);
request.setMax(maxResultSize);
request.setLayerId(layer.getServerLayerId());
request.setCrs(crs);
request.setFilter(layer.getFilter());
request.setFeatureIncludes(11);
GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND);
command.setCommandRequest(request);
GeomajasServerExtension.getInstance().getCommandService().execute(command,
new AbstractCommandCallback<SearchFeatureResponse>() {
public void execute(SearchFeatureResponse response) {
List<Feature> features = new ArrayList<Feature>();
for (org.geomajas.layer.feature.Feature feature : response.getFeatures()) {
features.add(create(feature, layer));
}
Map<FeaturesSupported, List<Feature>> mapping = new HashMap<FeaturesSupported, List<Feature>>();
mapping.put(layer, features);
callback.execute(mapping);
}
});
} | class class_name[name] begin[{]
method[search, return_type[void], modifier[public], parameter[crs, layer, criteria, operator, maxResultSize, callback]] begin[{]
local_variable[type[SearchFeatureRequest], request]
call[request.setBooleanOperator, parameter[call[operator.getValue, parameter[]]]]
call[request.setCriteria, parameter[member[.criteria]]]
call[request.setMax, parameter[member[.maxResultSize]]]
call[request.setLayerId, parameter[call[layer.getServerLayerId, parameter[]]]]
call[request.setCrs, parameter[member[.crs]]]
call[request.setFilter, parameter[call[layer.getFilter, parameter[]]]]
call[request.setFeatureIncludes, parameter[literal[11]]]
local_variable[type[GwtCommand], command]
call[command.setCommandRequest, parameter[member[.request]]]
call[GeomajasServerExtension.getInstance, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[search] operator[SEP] identifier[String] identifier[crs] , Keyword[final] identifier[VectorServerLayer] identifier[layer] , identifier[SearchCriterion] operator[SEP] operator[SEP] identifier[criteria] , identifier[LogicalOperator] identifier[operator] , Keyword[int] identifier[maxResultSize] , Keyword[final] identifier[FeatureMapFunction] identifier[callback] operator[SEP] {
identifier[SearchFeatureRequest] identifier[request] operator[=] Keyword[new] identifier[SearchFeatureRequest] operator[SEP] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setBooleanOperator] operator[SEP] identifier[operator] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setCriteria] operator[SEP] identifier[criteria] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setMax] operator[SEP] identifier[maxResultSize] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setLayerId] operator[SEP] identifier[layer] operator[SEP] identifier[getServerLayerId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setCrs] operator[SEP] identifier[crs] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setFilter] operator[SEP] identifier[layer] operator[SEP] identifier[getFilter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setFeatureIncludes] operator[SEP] Other[11] operator[SEP] operator[SEP] identifier[GwtCommand] identifier[command] operator[=] Keyword[new] identifier[GwtCommand] operator[SEP] identifier[SearchFeatureRequest] operator[SEP] identifier[COMMAND] operator[SEP] operator[SEP] identifier[command] operator[SEP] identifier[setCommandRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[GeomajasServerExtension] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[getCommandService] operator[SEP] operator[SEP] operator[SEP] identifier[execute] operator[SEP] identifier[command] , Keyword[new] identifier[AbstractCommandCallback] operator[<] identifier[SearchFeatureResponse] operator[>] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[execute] operator[SEP] identifier[SearchFeatureResponse] identifier[response] operator[SEP] {
identifier[List] operator[<] identifier[Feature] operator[>] identifier[features] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Feature] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[org] operator[SEP] identifier[geomajas] operator[SEP] identifier[layer] operator[SEP] identifier[feature] operator[SEP] identifier[Feature] identifier[feature] operator[:] identifier[response] operator[SEP] identifier[getFeatures] operator[SEP] operator[SEP] operator[SEP] {
identifier[features] operator[SEP] identifier[add] operator[SEP] identifier[create] operator[SEP] identifier[feature] , identifier[layer] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Map] operator[<] identifier[FeaturesSupported] , identifier[List] operator[<] identifier[Feature] operator[>] operator[>] identifier[mapping] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[FeaturesSupported] , identifier[List] operator[<] identifier[Feature] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[mapping] operator[SEP] identifier[put] operator[SEP] identifier[layer] , identifier[features] operator[SEP] operator[SEP] identifier[callback] operator[SEP] identifier[execute] operator[SEP] identifier[mapping] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static Latency copyOf(AbstractLatency instance) {
if (instance instanceof Latency) {
return (Latency) instance;
}
return Latency.builder()
.from(instance)
.build();
} | class class_name[name] begin[{]
method[copyOf, return_type[type[Latency]], modifier[public static], parameter[instance]] begin[{]
if[binary_operation[member[.instance], instanceof, type[Latency]]] begin[{]
return[Cast(expression=MemberReference(member=instance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Latency, sub_type=None))]
else begin[{]
None
end[}]
return[call[Latency.builder, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Latency] identifier[copyOf] operator[SEP] identifier[AbstractLatency] identifier[instance] operator[SEP] {
Keyword[if] operator[SEP] identifier[instance] Keyword[instanceof] identifier[Latency] operator[SEP] {
Keyword[return] operator[SEP] identifier[Latency] operator[SEP] identifier[instance] operator[SEP]
}
Keyword[return] identifier[Latency] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] identifier[from] operator[SEP] identifier[instance] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean isDetailPage(CmsObject cms, CmsResource resource) {
return getCache(isOnline(cms)).isDetailPage(cms, resource);
} | class class_name[name] begin[{]
method[isDetailPage, return_type[type[boolean]], modifier[public], parameter[cms, resource]] begin[{]
return[call[.getCache, parameter[call[.isOnline, parameter[member[.cms]]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isDetailPage] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[CmsResource] identifier[resource] operator[SEP] {
Keyword[return] identifier[getCache] operator[SEP] identifier[isOnline] operator[SEP] identifier[cms] operator[SEP] operator[SEP] operator[SEP] identifier[isDetailPage] operator[SEP] identifier[cms] , identifier[resource] operator[SEP] operator[SEP]
}
|
private int calculateMaxPendingSplits(int splitAffinity, int totalDepth)
{
if (totalDepth == 0) {
return maxPendingSplitsPerTask;
}
// Use half the queue for any split
// Reserve the other half for splits that have some amount of network affinity
double queueFraction = 0.5 * (1.0 + splitAffinity / (double) totalDepth);
return (int) Math.ceil(maxPendingSplitsPerTask * queueFraction);
} | class class_name[name] begin[{]
method[calculateMaxPendingSplits, return_type[type[int]], modifier[private], parameter[splitAffinity, totalDepth]] begin[{]
if[binary_operation[member[.totalDepth], ==, literal[0]]] begin[{]
return[member[.maxPendingSplitsPerTask]]
else begin[{]
None
end[}]
local_variable[type[double], queueFraction]
return[Cast(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=maxPendingSplitsPerTask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=queueFraction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*)], member=ceil, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[calculateMaxPendingSplits] operator[SEP] Keyword[int] identifier[splitAffinity] , Keyword[int] identifier[totalDepth] operator[SEP] {
Keyword[if] operator[SEP] identifier[totalDepth] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[maxPendingSplitsPerTask] operator[SEP]
}
Keyword[double] identifier[queueFraction] operator[=] literal[Float] operator[*] operator[SEP] literal[Float] operator[+] identifier[splitAffinity] operator[/] operator[SEP] Keyword[double] operator[SEP] identifier[totalDepth] operator[SEP] operator[SEP] Keyword[return] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[ceil] operator[SEP] identifier[maxPendingSplitsPerTask] operator[*] identifier[queueFraction] operator[SEP] operator[SEP]
}
|
protected void
printVariable(DataCursor data, List<Slice> slices)
throws DapException
{
DapVariable dapv = (DapVariable) data.getTemplate();
if(data.isScalar()) {
assert slices == Slice.SCALARSLICES;
printScalar(data);
} else {// not scalar
printArray(data, slices);
}
} | class class_name[name] begin[{]
method[printVariable, return_type[void], modifier[protected], parameter[data, slices]] begin[{]
local_variable[type[DapVariable], dapv]
if[call[data.isScalar, parameter[]]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=slices, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SCALARSLICES, postfix_operators=[], prefix_operators=[], qualifier=Slice, selectors=[]), operator===), label=None, value=None)
call[.printScalar, parameter[member[.data]]]
else begin[{]
call[.printArray, parameter[member[.data], member[.slices]]]
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[printVariable] operator[SEP] identifier[DataCursor] identifier[data] , identifier[List] operator[<] identifier[Slice] operator[>] identifier[slices] operator[SEP] Keyword[throws] identifier[DapException] {
identifier[DapVariable] identifier[dapv] operator[=] operator[SEP] identifier[DapVariable] operator[SEP] identifier[data] operator[SEP] identifier[getTemplate] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[SEP] identifier[isScalar] operator[SEP] operator[SEP] operator[SEP] {
Keyword[assert] identifier[slices] operator[==] identifier[Slice] operator[SEP] identifier[SCALARSLICES] operator[SEP] identifier[printScalar] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[printArray] operator[SEP] identifier[data] , identifier[slices] operator[SEP] operator[SEP]
}
}
|
public java.util.List<LaunchPermission> getAdd() {
if (add == null) {
add = new com.amazonaws.internal.SdkInternalList<LaunchPermission>();
}
return add;
} | class class_name[name] begin[{]
method[getAdd, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.add], ==, literal[null]]] begin[{]
assign[member[.add], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=LaunchPermission, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.add]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[LaunchPermission] operator[>] identifier[getAdd] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[add] operator[==] Other[null] operator[SEP] {
identifier[add] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[LaunchPermission] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[add] operator[SEP]
}
|
public Result isValidWindows1252(byte[] buf) {
for (byte b : buf) {
if (!VALID_WINDOWS_1252[b + 128]) {
return Result.INVALID;
}
}
try {
return new Result(Validation.MAYBE, Charset.forName("Windows-1252"));
} catch (UnsupportedCharsetException e) {
return Result.INVALID;
}
} | class class_name[name] begin[{]
method[isValidWindows1252, return_type[type[Result]], modifier[public], parameter[buf]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=VALID_WINDOWS_1252, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=128), operator=+))]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=INVALID, postfix_operators=[], prefix_operators=[], qualifier=Result, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=b)], modifiers=set(), type=BasicType(dimensions=[], name=byte))), label=None)
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=MAYBE, postfix_operators=[], prefix_operators=[], qualifier=Validation, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Windows-1252")], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Charset, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Result, sub_type=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MemberReference(member=INVALID, postfix_operators=[], prefix_operators=[], qualifier=Result, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedCharsetException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Result] identifier[isValidWindows1252] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[buf] operator[SEP] {
Keyword[for] operator[SEP] Keyword[byte] identifier[b] operator[:] identifier[buf] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[VALID_WINDOWS_1252] operator[SEP] identifier[b] operator[+] Other[128] operator[SEP] operator[SEP] {
Keyword[return] identifier[Result] operator[SEP] identifier[INVALID] operator[SEP]
}
}
Keyword[try] {
Keyword[return] Keyword[new] identifier[Result] operator[SEP] identifier[Validation] operator[SEP] identifier[MAYBE] , identifier[Charset] operator[SEP] identifier[forName] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedCharsetException] identifier[e] operator[SEP] {
Keyword[return] identifier[Result] operator[SEP] identifier[INVALID] operator[SEP]
}
}
|
@Override
public final void setDefaultLocalAddresses(Iterable<? extends SocketAddress> localAddresses) {
if (localAddresses == null) {
throw new NullPointerException("localAddresses");
}
synchronized (bindLock) {
if (!boundAddresses.isEmpty()) {
throw new IllegalStateException(
"localAddress can't be set while the acceptor is bound.");
}
Collection<SocketAddress> newLocalAddresses =
new ArrayList<>();
for (SocketAddress a: localAddresses) {
checkAddressType(a);
newLocalAddresses.add(a);
}
if (newLocalAddresses.isEmpty()) {
throw new IllegalArgumentException("empty localAddresses");
}
this.defaultLocalAddresses.clear();
this.defaultLocalAddresses.addAll(newLocalAddresses);
}
} | class class_name[name] begin[{]
method[setDefaultLocalAddresses, return_type[void], modifier[final public], parameter[localAddresses]] begin[{]
if[binary_operation[member[.localAddresses], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="localAddresses")], 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[}]
SYNCHRONIZED[member[.bindLock]] BEGIN[{]
if[call[boundAddresses.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="localAddress can't be set while the acceptor is bound.")], 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[}]
local_variable[type[Collection], newLocalAddresses]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkAddressType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=newLocalAddresses, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=localAddresses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=a)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SocketAddress, sub_type=None))), label=None)
if[call[newLocalAddresses.isEmpty, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="empty localAddresses")], 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[}]
THIS[member[None.defaultLocalAddresses]call[None.clear, parameter[]]]
THIS[member[None.defaultLocalAddresses]call[None.addAll, parameter[member[.newLocalAddresses]]]]
END[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[setDefaultLocalAddresses] operator[SEP] identifier[Iterable] operator[<] operator[?] Keyword[extends] identifier[SocketAddress] operator[>] identifier[localAddresses] operator[SEP] {
Keyword[if] operator[SEP] identifier[localAddresses] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[bindLock] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[boundAddresses] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Collection] operator[<] identifier[SocketAddress] operator[>] identifier[newLocalAddresses] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[SocketAddress] identifier[a] operator[:] identifier[localAddresses] operator[SEP] {
identifier[checkAddressType] operator[SEP] identifier[a] operator[SEP] operator[SEP] identifier[newLocalAddresses] operator[SEP] identifier[add] operator[SEP] identifier[a] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[newLocalAddresses] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[defaultLocalAddresses] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[defaultLocalAddresses] operator[SEP] identifier[addAll] operator[SEP] identifier[newLocalAddresses] operator[SEP] operator[SEP]
}
}
|
@PUT
@Path("{user}")
@Consumes(MediaType.TEXT_PLAIN)
public Response addUser(@PathParam("user") String username, @HeaderParam("Authorization") @DefaultValue("no token") String auth, String message) throws Exception {
if(!this.isAuth(auth)) {
throw new Exception("Unauthorized!");
}
if( realm != null ){
AuthenticationManagerRequest req = new AuthenticationManagerRequest();
req.setAccountName(username);
req.setPassword(message);
req.setRequestType(RequestType.ADD);
sendMessage(req);
return Response.created(new URI("")).build();
}
return Response.status(Status.NOT_FOUND).build();
} | class class_name[name] begin[{]
method[addUser, return_type[type[Response]], modifier[public], parameter[username, auth, message]] begin[{]
if[THIS[call[None.isAuth, parameter[member[.auth]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unauthorized!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.realm], !=, literal[null]]] begin[{]
local_variable[type[AuthenticationManagerRequest], req]
call[req.setAccountName, parameter[member[.username]]]
call[req.setPassword, parameter[member[.message]]]
call[req.setRequestType, parameter[member[RequestType.ADD]]]
call[.sendMessage, parameter[member[.req]]]
return[call[Response.created, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=URI, sub_type=None))]]]
else begin[{]
None
end[}]
return[call[Response.status, parameter[member[Status.NOT_FOUND]]]]
end[}]
END[}] | annotation[@] identifier[PUT] annotation[@] identifier[Path] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Consumes] operator[SEP] identifier[MediaType] operator[SEP] identifier[TEXT_PLAIN] operator[SEP] Keyword[public] identifier[Response] identifier[addUser] operator[SEP] annotation[@] identifier[PathParam] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[username] , annotation[@] identifier[HeaderParam] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[DefaultValue] operator[SEP] literal[String] operator[SEP] identifier[String] identifier[auth] , identifier[String] identifier[message] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[isAuth] operator[SEP] identifier[auth] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[realm] operator[!=] Other[null] operator[SEP] {
identifier[AuthenticationManagerRequest] identifier[req] operator[=] Keyword[new] identifier[AuthenticationManagerRequest] operator[SEP] operator[SEP] operator[SEP] identifier[req] operator[SEP] identifier[setAccountName] operator[SEP] identifier[username] operator[SEP] operator[SEP] identifier[req] operator[SEP] identifier[setPassword] operator[SEP] identifier[message] operator[SEP] operator[SEP] identifier[req] operator[SEP] identifier[setRequestType] operator[SEP] identifier[RequestType] operator[SEP] identifier[ADD] operator[SEP] operator[SEP] identifier[sendMessage] operator[SEP] identifier[req] operator[SEP] operator[SEP] Keyword[return] identifier[Response] operator[SEP] identifier[created] operator[SEP] Keyword[new] identifier[URI] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Response] operator[SEP] identifier[status] operator[SEP] identifier[Status] operator[SEP] identifier[NOT_FOUND] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
private I_CmsResourceWrapper getResourceTypeWrapper(CmsResource res) {
Iterator<I_CmsResourceWrapper> iter = getWrappers().iterator();
while (iter.hasNext()) {
I_CmsResourceWrapper wrapper = iter.next();
if (wrapper.isWrappedResource(m_cms, res)) {
return wrapper;
}
}
return null;
} | class class_name[name] begin[{]
method[getResourceTypeWrapper, return_type[type[I_CmsResourceWrapper]], modifier[private], parameter[res]] begin[{]
local_variable[type[Iterator], iter]
while[call[iter.hasNext, parameter[]]] begin[{]
local_variable[type[I_CmsResourceWrapper], wrapper]
if[call[wrapper.isWrappedResource, parameter[member[.m_cms], member[.res]]]] begin[{]
return[member[.wrapper]]
else begin[{]
None
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[I_CmsResourceWrapper] identifier[getResourceTypeWrapper] operator[SEP] identifier[CmsResource] identifier[res] operator[SEP] {
identifier[Iterator] operator[<] identifier[I_CmsResourceWrapper] operator[>] identifier[iter] operator[=] identifier[getWrappers] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[I_CmsResourceWrapper] identifier[wrapper] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[wrapper] operator[SEP] identifier[isWrappedResource] operator[SEP] identifier[m_cms] , identifier[res] operator[SEP] operator[SEP] {
Keyword[return] identifier[wrapper] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
@NonNull
public static ArrayExpressionIn every(@NonNull VariableExpression variable) {
if (variable == null) {
throw new IllegalArgumentException("variable cannot be null.");
}
return new ArrayExpressionIn(QuantifiesType.EVERY, variable);
} | class class_name[name] begin[{]
method[every, return_type[type[ArrayExpressionIn]], modifier[public static], parameter[variable]] begin[{]
if[binary_operation[member[.variable], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="variable cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=EVERY, postfix_operators=[], prefix_operators=[], qualifier=QuantifiesType, selectors=[]), MemberReference(member=variable, 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=ArrayExpressionIn, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[NonNull] Keyword[public] Keyword[static] identifier[ArrayExpressionIn] identifier[every] operator[SEP] annotation[@] identifier[NonNull] identifier[VariableExpression] identifier[variable] operator[SEP] {
Keyword[if] operator[SEP] identifier[variable] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[ArrayExpressionIn] operator[SEP] identifier[QuantifiesType] operator[SEP] identifier[EVERY] , identifier[variable] operator[SEP] operator[SEP]
}
|
public static int calculateThreads(final int executorThreads, final String name) {
// For current standard 8 core machines this is 10 regardless.
// On Java 10, you might get less than 8 core reported, but it will still size as if it's 8
// Beyond 8 core you MIGHT undersize if running on Docker, but otherwise should be fine.
final int optimalThreads= Math.max(BASE_OPTIMAL_THREADS, (Runtime.getRuntime().availableProcessors() + THREAD_OVERHEAD));
int threadsChosen = optimalThreads;
if (executorThreads > optimalThreads) {
// They requested more, sure we can do that!
threadsChosen = executorThreads;
LOG.warn("Requested more than optimal threads. This is not necessarily an error, but you may be overallocating.");
} else {
// They weren't auto tuning (<0))
if (executorThreads > 0) {
LOG.warn("You requested less than optimal threads. We've ignored that.");
}
}
LOG.debug("For factory {}, Optimal Threads {}, Configured Threads {}", name, optimalThreads, threadsChosen);
return threadsChosen;
} | class class_name[name] begin[{]
method[calculateThreads, return_type[type[int]], modifier[public static], parameter[executorThreads, name]] begin[{]
local_variable[type[int], optimalThreads]
local_variable[type[int], threadsChosen]
if[binary_operation[member[.executorThreads], >, member[.optimalThreads]]] begin[{]
assign[member[.threadsChosen], member[.executorThreads]]
call[LOG.warn, parameter[literal["Requested more than optimal threads. This is not necessarily an error, but you may be overallocating."]]]
else begin[{]
if[binary_operation[member[.executorThreads], >, literal[0]]] begin[{]
call[LOG.warn, parameter[literal["You requested less than optimal threads. We've ignored that."]]]
else begin[{]
None
end[}]
end[}]
call[LOG.debug, parameter[literal["For factory {}, Optimal Threads {}, Configured Threads {}"], member[.name], member[.optimalThreads], member[.threadsChosen]]]
return[member[.threadsChosen]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[calculateThreads] operator[SEP] Keyword[final] Keyword[int] identifier[executorThreads] , Keyword[final] identifier[String] identifier[name] operator[SEP] {
Keyword[final] Keyword[int] identifier[optimalThreads] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[BASE_OPTIMAL_THREADS] , operator[SEP] identifier[Runtime] operator[SEP] identifier[getRuntime] operator[SEP] operator[SEP] operator[SEP] identifier[availableProcessors] operator[SEP] operator[SEP] operator[+] identifier[THREAD_OVERHEAD] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[threadsChosen] operator[=] identifier[optimalThreads] operator[SEP] Keyword[if] operator[SEP] identifier[executorThreads] operator[>] identifier[optimalThreads] operator[SEP] {
identifier[threadsChosen] operator[=] identifier[executorThreads] operator[SEP] identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[executorThreads] operator[>] Other[0] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[name] , identifier[optimalThreads] , identifier[threadsChosen] operator[SEP] operator[SEP] Keyword[return] identifier[threadsChosen] operator[SEP]
}
|
private Xpp3Dom getChild(Xpp3Dom parentNode, String name) {
Xpp3Dom child = parentNode.getChild(name);
if (child != null) {
return child;
}
return parentNode.getChild(namespace + name);
} | class class_name[name] begin[{]
method[getChild, return_type[type[Xpp3Dom]], modifier[private], parameter[parentNode, name]] begin[{]
local_variable[type[Xpp3Dom], child]
if[binary_operation[member[.child], !=, literal[null]]] begin[{]
return[member[.child]]
else begin[{]
None
end[}]
return[call[parentNode.getChild, parameter[binary_operation[member[.namespace], +, member[.name]]]]]
end[}]
END[}] | Keyword[private] identifier[Xpp3Dom] identifier[getChild] operator[SEP] identifier[Xpp3Dom] identifier[parentNode] , identifier[String] identifier[name] operator[SEP] {
identifier[Xpp3Dom] identifier[child] operator[=] identifier[parentNode] operator[SEP] identifier[getChild] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[child] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[child] operator[SEP]
}
Keyword[return] identifier[parentNode] operator[SEP] identifier[getChild] operator[SEP] identifier[namespace] operator[+] identifier[name] operator[SEP] operator[SEP]
}
|
public void addAll(final Iterable<String> strings) {
checkNotNull(strings);
for (String string : strings) {
add(string);
}
} | class class_name[name] begin[{]
method[addAll, return_type[void], modifier[public], parameter[strings]] begin[{]
call[.checkNotNull, parameter[member[.strings]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=string, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=strings, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=string)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addAll] operator[SEP] Keyword[final] identifier[Iterable] operator[<] identifier[String] operator[>] identifier[strings] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[strings] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[string] operator[:] identifier[strings] operator[SEP] {
identifier[add] operator[SEP] identifier[string] operator[SEP] operator[SEP]
}
}
|
public static void initSecret(ServletContext ctx)
{
if(ctx == null)
{
throw new NullPointerException("ServletContext ctx");
}
if (log.isLoggable(Level.FINE))
{
log.fine("Storing SecretKey @ " + INIT_SECRET_KEY_CACHE);
}
// Create and store SecretKey on application scope
String cache = ctx.getInitParameter(INIT_SECRET_KEY_CACHE);
if(cache == null)
{
cache = ctx.getInitParameter(INIT_SECRET_KEY_CACHE.toLowerCase());
}
if (!"false".equals(cache))
{
String algorithm = findAlgorithm(ctx);
// you want to create this as few times as possible
ctx.setAttribute(INIT_SECRET_KEY_CACHE, new SecretKeySpec(
findSecret(ctx, algorithm), algorithm));
}
if (log.isLoggable(Level.FINE))
{
log.fine("Storing SecretKey @ " + INIT_MAC_SECRET_KEY_CACHE);
}
String macCache = ctx.getInitParameter(INIT_MAC_SECRET_KEY_CACHE);
if(macCache == null)
{
macCache = ctx.getInitParameter(INIT_MAC_SECRET_KEY_CACHE.toLowerCase());
}
if (!"false".equals(macCache))
{
String macAlgorithm = findMacAlgorithm(ctx);
// init mac secret and algorithm
ctx.setAttribute(INIT_MAC_SECRET_KEY_CACHE, new SecretKeySpec(
findMacSecret(ctx, macAlgorithm), macAlgorithm));
}
} | class class_name[name] begin[{]
method[initSecret, return_type[void], modifier[public static], parameter[ctx]] begin[{]
if[binary_operation[member[.ctx], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ServletContext ctx")], 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[}]
if[call[log.isLoggable, parameter[member[Level.FINE]]]] begin[{]
call[log.fine, parameter[binary_operation[literal["Storing SecretKey @ "], +, member[.INIT_SECRET_KEY_CACHE]]]]
else begin[{]
None
end[}]
local_variable[type[String], cache]
if[binary_operation[member[.cache], ==, literal[null]]] begin[{]
assign[member[.cache], call[ctx.getInitParameter, parameter[call[INIT_SECRET_KEY_CACHE.toLowerCase, parameter[]]]]]
else begin[{]
None
end[}]
if[literal["false"]] begin[{]
local_variable[type[String], algorithm]
call[ctx.setAttribute, parameter[member[.INIT_SECRET_KEY_CACHE], ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=algorithm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findSecret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=algorithm, 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=SecretKeySpec, sub_type=None))]]
else begin[{]
None
end[}]
if[call[log.isLoggable, parameter[member[Level.FINE]]]] begin[{]
call[log.fine, parameter[binary_operation[literal["Storing SecretKey @ "], +, member[.INIT_MAC_SECRET_KEY_CACHE]]]]
else begin[{]
None
end[}]
local_variable[type[String], macCache]
if[binary_operation[member[.macCache], ==, literal[null]]] begin[{]
assign[member[.macCache], call[ctx.getInitParameter, parameter[call[INIT_MAC_SECRET_KEY_CACHE.toLowerCase, parameter[]]]]]
else begin[{]
None
end[}]
if[literal["false"]] begin[{]
local_variable[type[String], macAlgorithm]
call[ctx.setAttribute, parameter[member[.INIT_MAC_SECRET_KEY_CACHE], ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=ctx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=macAlgorithm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findMacSecret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=macAlgorithm, 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=SecretKeySpec, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[initSecret] operator[SEP] identifier[ServletContext] identifier[ctx] operator[SEP] {
Keyword[if] operator[SEP] identifier[ctx] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[+] identifier[INIT_SECRET_KEY_CACHE] operator[SEP] operator[SEP]
}
identifier[String] identifier[cache] operator[=] identifier[ctx] operator[SEP] identifier[getInitParameter] operator[SEP] identifier[INIT_SECRET_KEY_CACHE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cache] operator[==] Other[null] operator[SEP] {
identifier[cache] operator[=] identifier[ctx] operator[SEP] identifier[getInitParameter] operator[SEP] identifier[INIT_SECRET_KEY_CACHE] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[cache] operator[SEP] operator[SEP] {
identifier[String] identifier[algorithm] operator[=] identifier[findAlgorithm] operator[SEP] identifier[ctx] operator[SEP] operator[SEP] identifier[ctx] operator[SEP] identifier[setAttribute] operator[SEP] identifier[INIT_SECRET_KEY_CACHE] , Keyword[new] identifier[SecretKeySpec] operator[SEP] identifier[findSecret] operator[SEP] identifier[ctx] , identifier[algorithm] operator[SEP] , identifier[algorithm] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[log] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[+] identifier[INIT_MAC_SECRET_KEY_CACHE] operator[SEP] operator[SEP]
}
identifier[String] identifier[macCache] operator[=] identifier[ctx] operator[SEP] identifier[getInitParameter] operator[SEP] identifier[INIT_MAC_SECRET_KEY_CACHE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[macCache] operator[==] Other[null] operator[SEP] {
identifier[macCache] operator[=] identifier[ctx] operator[SEP] identifier[getInitParameter] operator[SEP] identifier[INIT_MAC_SECRET_KEY_CACHE] operator[SEP] identifier[toLowerCase] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[macCache] operator[SEP] operator[SEP] {
identifier[String] identifier[macAlgorithm] operator[=] identifier[findMacAlgorithm] operator[SEP] identifier[ctx] operator[SEP] operator[SEP] identifier[ctx] operator[SEP] identifier[setAttribute] operator[SEP] identifier[INIT_MAC_SECRET_KEY_CACHE] , Keyword[new] identifier[SecretKeySpec] operator[SEP] identifier[findMacSecret] operator[SEP] identifier[ctx] , identifier[macAlgorithm] operator[SEP] , identifier[macAlgorithm] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static boolean hasTimeTemplate(String template) {
for (int i = 0; i < timeTemplates.length; i++) {
if (template.indexOf(timeTemplates[i]) >= 0) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[hasTimeTemplate, return_type[type[boolean]], modifier[public static], parameter[template]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=timeTemplates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=template, 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=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), 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=timeTemplates, 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[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[hasTimeTemplate] operator[SEP] identifier[String] identifier[template] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[timeTemplates] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[template] operator[SEP] identifier[indexOf] operator[SEP] identifier[timeTemplates] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[>=] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static boolean adjustNumber(Class<?>[] paramTypes, Object[] args, int index) {
if (paramTypes[index].isPrimitive()) {
if (paramTypes[index] == int.class) {
args[index] = LdiIntegerConversionUtil.toInteger(args[index]);
return true;
} else if (paramTypes[index] == double.class) {
args[index] = LdiDoubleConversionUtil.toDouble(args[index]);
return true;
} else if (paramTypes[index] == long.class) {
args[index] = LdiLongConversionUtil.toLong(args[index]);
return true;
} else if (paramTypes[index] == short.class) {
args[index] = LdiShortConversionUtil.toShort(args[index]);
return true;
} else if (paramTypes[index] == float.class) {
args[index] = LdiFloatConversionUtil.toFloat(args[index]);
return true;
}
} else {
if (paramTypes[index] == Integer.class) {
args[index] = LdiIntegerConversionUtil.toInteger(args[index]);
return true;
} else if (paramTypes[index] == Double.class) {
args[index] = LdiDoubleConversionUtil.toDouble(args[index]);
return true;
} else if (paramTypes[index] == Long.class) {
args[index] = LdiLongConversionUtil.toLong(args[index]);
return true;
} else if (paramTypes[index] == Short.class) {
args[index] = LdiShortConversionUtil.toShort(args[index]);
return true;
} else if (paramTypes[index] == Float.class) {
args[index] = LdiFloatConversionUtil.toFloat(args[index]);
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[adjustNumber, return_type[type[boolean]], modifier[private static], parameter[paramTypes, args, index]] begin[{]
if[member[.paramTypes]] begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=int))]] begin[{]
assign[member[.args], call[LdiIntegerConversionUtil.toInteger, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=double))]] begin[{]
assign[member[.args], call[LdiDoubleConversionUtil.toDouble, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=long))]] begin[{]
assign[member[.args], call[LdiLongConversionUtil.toLong, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=short))]] begin[{]
assign[member[.args], call[LdiShortConversionUtil.toShort, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=[], name=float))]] begin[{]
assign[member[.args], call[LdiFloatConversionUtil.toFloat, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
else begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Integer, sub_type=None))]] begin[{]
assign[member[.args], call[LdiIntegerConversionUtil.toInteger, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Double, sub_type=None))]] begin[{]
assign[member[.args], call[LdiDoubleConversionUtil.toDouble, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Long, sub_type=None))]] begin[{]
assign[member[.args], call[LdiLongConversionUtil.toLong, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Short, sub_type=None))]] begin[{]
assign[member[.args], call[LdiShortConversionUtil.toShort, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
if[binary_operation[member[.paramTypes], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Float, sub_type=None))]] begin[{]
assign[member[.args], call[LdiFloatConversionUtil.toFloat, parameter[member[.args]]]]
return[literal[true]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[adjustNumber] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[paramTypes] , identifier[Object] operator[SEP] operator[SEP] identifier[args] , Keyword[int] identifier[index] operator[SEP] {
Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[isPrimitive] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] Keyword[int] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiIntegerConversionUtil] operator[SEP] identifier[toInteger] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] Keyword[double] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiDoubleConversionUtil] operator[SEP] identifier[toDouble] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] Keyword[long] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiLongConversionUtil] operator[SEP] identifier[toLong] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] Keyword[short] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiShortConversionUtil] operator[SEP] identifier[toShort] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] Keyword[float] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiFloatConversionUtil] operator[SEP] identifier[toFloat] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] identifier[Integer] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiIntegerConversionUtil] operator[SEP] identifier[toInteger] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] identifier[Double] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiDoubleConversionUtil] operator[SEP] identifier[toDouble] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] identifier[Long] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiLongConversionUtil] operator[SEP] identifier[toLong] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] identifier[Short] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiShortConversionUtil] operator[SEP] identifier[toShort] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[paramTypes] operator[SEP] identifier[index] operator[SEP] operator[==] identifier[Float] operator[SEP] Keyword[class] operator[SEP] {
identifier[args] operator[SEP] identifier[index] operator[SEP] operator[=] identifier[LdiFloatConversionUtil] operator[SEP] identifier[toFloat] operator[SEP] identifier[args] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public Observable<JobResponseInner> getJobAsync(String resourceGroupName, String resourceName, String jobId) {
return getJobWithServiceResponseAsync(resourceGroupName, resourceName, jobId).map(new Func1<ServiceResponse<JobResponseInner>, JobResponseInner>() {
@Override
public JobResponseInner call(ServiceResponse<JobResponseInner> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[getJobAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, resourceName, jobId]] begin[{]
return[call[.getJobWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.resourceName], member[.jobId]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[JobResponseInner] operator[>] identifier[getJobAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[resourceName] , identifier[String] identifier[jobId] operator[SEP] {
Keyword[return] identifier[getJobWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[resourceName] , identifier[jobId] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[JobResponseInner] operator[>] , identifier[JobResponseInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[JobResponseInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[JobResponseInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public List<Class> findClasses(Class cls, String[] pkgnames) {
List<Class> result;
int i;
HashSet<Class> classes;
result = new ArrayList<>();
classes = new HashSet<>();
for (i = 0; i < pkgnames.length; i++)
classes.addAll(findClassesInPackage(cls, pkgnames[i]));
// sort result
result.addAll(classes);
Collections.sort(result, new ClassCompare());
return result;
}
/**
* Checks the given package for classes that inherited from the given class,
* in case it's a class, or implement this class, in case it's an interface.
*
* @param classname the class/interface to look for
* @param pkgname the package to search in
* @return a list with all the found classnames
*/
public List<String> findNamesInPackage(String classname, String pkgname) {
List<String> result;
Class cls;
result = new ArrayList<>();
try {
cls = Class.forName(classname);
result = findNamesInPackage(cls, pkgname);
}
catch (Throwable t) {
getLogger().log(Level.SEVERE, "Failed to instantiate '" + classname + "'/" + pkgname + " (findNamesInPackage):", t);
}
return result;
}
/**
* Checks the given package for classes that inherited from the given class,
* in case it's a class, or implement this class, in case it's an interface.
*
* @param classname the class/interface to look for
* @param pkgname the package to search in
* @return a list with all the found classes
*/
public List<Class> findClassesInPackage(String classname, String pkgname) {
List<Class> result;
Class cls;
result = new ArrayList<>();
try {
cls = Class.forName(classname);
result = findClassesInPackage(cls, pkgname);
}
catch (Throwable t) {
getLogger().log(Level.SEVERE, "Failed to instantiate '" + classname + "'/" + pkgname + " (findClassesInPackage):", t);
}
return result;
}
/**
* Checks the given package for classes that inherited from the given class,
* in case it's a class, or implement this class, in case it's an interface.
*
* @param cls the class/interface to look for
* @param pkgname the package to search in
* @return a list with all the found classnames
*/
public List<String> findNamesInPackage(Class cls, String pkgname) {
List<String> result;
List<Class> classes;
int i;
Class clsNew;
// already cached?
result = getNameCache(cls, pkgname);
if (result == null) {
getLogger().info("Searching for '" + cls.getName() + "' in '" + pkgname + "':");
result = new ArrayList<>();
classes = new ArrayList<>();
if (m_Cache.getClassnames(pkgname) != null)
result.addAll(m_Cache.getClassnames(pkgname));
// check classes
i = 0;
while (i < result.size()) {
try {
// no inner classes
if (result.get(i).indexOf('$') > -1) {
result.remove(i);
continue;
}
// blacklisted?
if (isBlacklisted(result.get(i))) {
result.remove(i);
continue;
}
clsNew = Class.forName(result.get(i));
// no abstract classes
if (Modifier.isAbstract(clsNew.getModifiers())) {
m_Cache.remove(result.get(i));
result.remove(i);
continue;
}
// only classes with default constructor?
if (m_OnlyDefaultConstructor) {
try {
clsNew.getConstructor();
}
catch (Exception e) {
m_Cache.remove(result.get(i));
result.remove(i);
continue;
}
}
// only serializable classes?
if (m_OnlySerializable) {
if (!ClassLocator.hasInterface(Serializable.class, clsNew)) {
m_Cache.remove(result.get(i));
result.remove(i);
continue;
}
}
// must implement interface
if ( (cls.isInterface()) && (!hasInterface(cls, clsNew)) ) {
result.remove(i);
}
// must be derived from class
else if ( (!cls.isInterface()) && (!isSubclass(cls, clsNew)) ) {
result.remove(i);
}
else {
classes.add(clsNew);
i++;
}
}
catch (Throwable t) {
if ((t.getCause() != null) && (t.getCause() instanceof HeadlessException)) {
getLogger().warning("Cannot instantiate '" + result.get(i) + "' in headless environment - skipped.");
}
else {
getLogger().log(Level.SEVERE, "Failed to instantiate '" + result.get(i) + "' (find):", t);
}
blacklist(result.get(i));
result.remove(i);
}
}
// sort result
if (result.size() != classes.size())
throw new IllegalStateException(
"Differing number of classnames and classes: " + result.size() + " != " + classes.size());
Collections.sort(result, new StringCompare());
Collections.sort(classes, new ClassCompare());
// add to cache
addCache(cls, pkgname, result, classes);
}
return result;
}
/**
* Checks the given package for classes that inherited from the given class,
* in case it's a class, or implement this class, in case it's an interface.
*
* @param cls the class/interface to look for
* @param pkgname the package to search in
* @return a list with all the found classes
*/
public List<Class> findClassesInPackage(Class cls, String pkgname) {
// to fill cache
findNamesInPackage(cls, pkgname);
return getClassCache(cls, pkgname);
} | class class_name[name] begin[{]
method[findClasses, return_type[type[List]], modifier[public], parameter[cls, pkgnames]] begin[{]
local_variable[type[List], result]
local_variable[type[int], i]
local_variable[type[HashSet], classes]
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))]
assign[member[.classes], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashSet, sub_type=None))]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pkgnames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=findClassesInPackage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=classes, 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=pkgnames, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[result.addAll, parameter[member[.classes]]]
call[Collections.sort, parameter[member[.result], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassCompare, sub_type=None))]]
return[member[.result]]
end[}]
method[findNamesInPackage, return_type[type[List]], modifier[public], parameter[classname, pkgname]] begin[{]
local_variable[type[List], result]
local_variable[type[Class], cls]
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))]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pkgname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findNamesInPackage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to instantiate '"), operandr=MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'/"), operator=+), operandr=MemberReference(member=pkgname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" (findNamesInPackage):"), operator=+), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
return[member[.result]]
end[}]
method[findClassesInPackage, return_type[type[List]], modifier[public], parameter[classname, pkgname]] begin[{]
local_variable[type[List], result]
local_variable[type[Class], cls]
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))]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pkgname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findClassesInPackage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to instantiate '"), operandr=MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'/"), operator=+), operandr=MemberReference(member=pkgname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" (findClassesInPackage):"), operator=+), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
return[member[.result]]
end[}]
method[findNamesInPackage, return_type[type[List]], modifier[public], parameter[cls, pkgname]] begin[{]
local_variable[type[List], result]
local_variable[type[List], classes]
local_variable[type[int], i]
local_variable[type[Class], clsNew]
assign[member[.result], call[.getNameCache, parameter[member[.cls], member[.pkgname]]]]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
call[.getLogger, parameter[]]
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))]
assign[member[.classes], 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))]
if[binary_operation[call[m_Cache.getClassnames, parameter[member[.pkgname]]], !=, literal[null]]] begin[{]
call[result.addAll, parameter[call[m_Cache.getClassnames, parameter[member[.pkgname]]]]]
else begin[{]
None
end[}]
assign[member[.i], literal[0]]
while[binary_operation[member[.i], <, call[result.size, parameter[]]]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='$')], member=indexOf, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=isBlacklisted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=clsNew, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getModifiers, postfix_operators=[], prefix_operators=[], qualifier=clsNew, selectors=[], type_arguments=None)], member=isAbstract, postfix_operators=[], prefix_operators=[], qualifier=Modifier, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=m_Cache, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)])), IfStatement(condition=MemberReference(member=m_OnlyDefaultConstructor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getConstructor, postfix_operators=[], prefix_operators=[], qualifier=clsNew, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=m_Cache, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)])), IfStatement(condition=MemberReference(member=m_OnlySerializable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Serializable, sub_type=None)), MemberReference(member=clsNew, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasInterface, postfix_operators=[], prefix_operators=['!'], qualifier=ClassLocator, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=m_Cache, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=None, label=None)]))])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isInterface, postfix_operators=[], prefix_operators=[], qualifier=cls, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clsNew, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=hasInterface, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isInterface, postfix_operators=[], prefix_operators=[], qualifier=cls, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=cls, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clsNew, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isSubclass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=clsNew, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=classes, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getCause, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None), operandr=ReferenceType(arguments=None, dimensions=[], name=HeadlessException, sub_type=None), operator=instanceof), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to instantiate '"), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' (find):"), operator=+), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLogger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot instantiate '"), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' in headless environment - skipped."), operator=+)], member=warning, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None)], member=blacklist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
if[binary_operation[call[result.size, parameter[]], !=, call[classes.size, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Differing number of classnames and classes: "), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" != "), operator=+), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=classes, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[Collections.sort, parameter[member[.result], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringCompare, sub_type=None))]]
call[Collections.sort, parameter[member[.classes], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassCompare, sub_type=None))]]
call[.addCache, parameter[member[.cls], member[.pkgname], member[.result], member[.classes]]]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
method[findClassesInPackage, return_type[type[List]], modifier[public], parameter[cls, pkgname]] begin[{]
call[.findNamesInPackage, parameter[member[.cls], member[.pkgname]]]
return[call[.getClassCache, parameter[member[.cls], member[.pkgname]]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Class] operator[>] identifier[findClasses] operator[SEP] identifier[Class] identifier[cls] , identifier[String] operator[SEP] operator[SEP] identifier[pkgnames] operator[SEP] {
identifier[List] operator[<] identifier[Class] operator[>] identifier[result] operator[SEP] Keyword[int] identifier[i] operator[SEP] identifier[HashSet] operator[<] identifier[Class] operator[>] identifier[classes] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[classes] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[pkgnames] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] identifier[classes] operator[SEP] identifier[addAll] operator[SEP] identifier[findClassesInPackage] operator[SEP] identifier[cls] , identifier[pkgnames] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[addAll] operator[SEP] identifier[classes] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[result] , Keyword[new] identifier[ClassCompare] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[findNamesInPackage] operator[SEP] identifier[String] identifier[classname] , identifier[String] identifier[pkgname] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[result] operator[SEP] identifier[Class] identifier[cls] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[cls] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[classname] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[findNamesInPackage] operator[SEP] identifier[cls] , identifier[pkgname] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , literal[String] operator[+] identifier[classname] operator[+] literal[String] operator[+] identifier[pkgname] operator[+] literal[String] , identifier[t] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
Keyword[public] identifier[List] operator[<] identifier[Class] operator[>] identifier[findClassesInPackage] operator[SEP] identifier[String] identifier[classname] , identifier[String] identifier[pkgname] operator[SEP] {
identifier[List] operator[<] identifier[Class] operator[>] identifier[result] operator[SEP] identifier[Class] identifier[cls] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[cls] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[classname] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[findClassesInPackage] operator[SEP] identifier[cls] , identifier[pkgname] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , literal[String] operator[+] identifier[classname] operator[+] literal[String] operator[+] identifier[pkgname] operator[+] literal[String] , identifier[t] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[findNamesInPackage] operator[SEP] identifier[Class] identifier[cls] , identifier[String] identifier[pkgname] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[result] operator[SEP] identifier[List] operator[<] identifier[Class] operator[>] identifier[classes] operator[SEP] Keyword[int] identifier[i] operator[SEP] identifier[Class] identifier[clsNew] operator[SEP] identifier[result] operator[=] identifier[getNameCache] operator[SEP] identifier[cls] , identifier[pkgname] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[cls] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[pkgname] operator[+] literal[String] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[classes] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_Cache] operator[SEP] identifier[getClassnames] operator[SEP] identifier[pkgname] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[result] operator[SEP] identifier[addAll] operator[SEP] identifier[m_Cache] operator[SEP] identifier[getClassnames] operator[SEP] identifier[pkgname] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[<] identifier[result] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[>] operator[-] Other[1] operator[SEP] {
identifier[result] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isBlacklisted] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
identifier[clsNew] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Modifier] operator[SEP] identifier[isAbstract] operator[SEP] identifier[clsNew] operator[SEP] identifier[getModifiers] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_Cache] operator[SEP] identifier[remove] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_OnlyDefaultConstructor] operator[SEP] {
Keyword[try] {
identifier[clsNew] operator[SEP] identifier[getConstructor] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[m_Cache] operator[SEP] identifier[remove] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[m_OnlySerializable] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[ClassLocator] operator[SEP] identifier[hasInterface] operator[SEP] identifier[Serializable] operator[SEP] Keyword[class] , identifier[clsNew] operator[SEP] operator[SEP] {
identifier[m_Cache] operator[SEP] identifier[remove] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[continue] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[SEP] identifier[cls] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[SEP] operator[!] identifier[hasInterface] operator[SEP] identifier[cls] , identifier[clsNew] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] operator[!] identifier[cls] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[SEP] operator[&&] operator[SEP] operator[!] identifier[isSubclass] operator[SEP] identifier[cls] , identifier[clsNew] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[classes] operator[SEP] identifier[add] operator[SEP] identifier[clsNew] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[t] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] Keyword[instanceof] identifier[HeadlessException] operator[SEP] operator[SEP] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[+] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[getLogger] operator[SEP] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] , literal[String] operator[+] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[+] literal[String] , identifier[t] operator[SEP] operator[SEP]
}
identifier[blacklist] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[remove] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[result] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] identifier[classes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[result] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[classes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[result] , Keyword[new] identifier[StringCompare] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[classes] , Keyword[new] identifier[ClassCompare] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[addCache] operator[SEP] identifier[cls] , identifier[pkgname] , identifier[result] , identifier[classes] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
Keyword[public] identifier[List] operator[<] identifier[Class] operator[>] identifier[findClassesInPackage] operator[SEP] identifier[Class] identifier[cls] , identifier[String] identifier[pkgname] operator[SEP] {
identifier[findNamesInPackage] operator[SEP] identifier[cls] , identifier[pkgname] operator[SEP] operator[SEP] Keyword[return] identifier[getClassCache] operator[SEP] identifier[cls] , identifier[pkgname] operator[SEP] operator[SEP]
}
|
public CompletableFuture<Object> postAsync(final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> post(configuration), getExecutor());
} | class class_name[name] begin[{]
method[postAsync, return_type[type[CompletableFuture]], modifier[public], parameter[configuration]] begin[{]
return[call[CompletableFuture.supplyAsync, parameter[LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=configuration, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=post, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), parameters=[]), call[.getExecutor, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[CompletableFuture] operator[<] identifier[Object] operator[>] identifier[postAsync] operator[SEP] Keyword[final] identifier[Consumer] operator[<] identifier[HttpConfig] operator[>] identifier[configuration] operator[SEP] {
Keyword[return] identifier[CompletableFuture] operator[SEP] identifier[supplyAsync] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[post] operator[SEP] identifier[configuration] operator[SEP] , identifier[getExecutor] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public LocalVariable getLocalVariable(int useLocation, int number) {
LocalVariableTableAttr table = mOldLocalVariableTable;
if (table == null) {
table = mLocalVariableTable;
}
if (table == null) {
return null;
} else {
return table.getLocalVariable(useLocation, number);
}
} | class class_name[name] begin[{]
method[getLocalVariable, return_type[type[LocalVariable]], modifier[public], parameter[useLocation, number]] begin[{]
local_variable[type[LocalVariableTableAttr], table]
if[binary_operation[member[.table], ==, literal[null]]] begin[{]
assign[member[.table], member[.mLocalVariableTable]]
else begin[{]
None
end[}]
if[binary_operation[member[.table], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
return[call[table.getLocalVariable, parameter[member[.useLocation], member[.number]]]]
end[}]
end[}]
END[}] | Keyword[public] identifier[LocalVariable] identifier[getLocalVariable] operator[SEP] Keyword[int] identifier[useLocation] , Keyword[int] identifier[number] operator[SEP] {
identifier[LocalVariableTableAttr] identifier[table] operator[=] identifier[mOldLocalVariableTable] operator[SEP] Keyword[if] operator[SEP] identifier[table] operator[==] Other[null] operator[SEP] {
identifier[table] operator[=] identifier[mLocalVariableTable] operator[SEP]
}
Keyword[if] operator[SEP] identifier[table] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[table] operator[SEP] identifier[getLocalVariable] operator[SEP] identifier[useLocation] , identifier[number] operator[SEP] operator[SEP]
}
}
|
void resolveBootUpdates(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception {
connection.openConnection(controller, callback);
// Keep a reference to the the controller
this.controller = controller;
} | class class_name[name] begin[{]
method[resolveBootUpdates, return_type[void], modifier[default], parameter[controller, callback]] begin[{]
call[connection.openConnection, parameter[member[.controller], member[.callback]]]
assign[THIS[member[None.controller]], member[.controller]]
end[}]
END[}] | Keyword[void] identifier[resolveBootUpdates] operator[SEP] Keyword[final] identifier[ModelController] identifier[controller] , Keyword[final] identifier[ActiveOperation] operator[SEP] identifier[CompletedCallback] operator[<] identifier[ModelNode] operator[>] identifier[callback] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[connection] operator[SEP] identifier[openConnection] operator[SEP] identifier[controller] , identifier[callback] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[controller] operator[=] identifier[controller] operator[SEP]
}
|
public java.lang.String getBodyrows() {
return (java.lang.String) getStateHelper().eval(PropertyKeys.bodyrows);
} | class class_name[name] begin[{]
method[getBodyrows, return_type[type[java]], modifier[public], parameter[]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[], member=getStateHelper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=bodyrows, postfix_operators=[], prefix_operators=[], qualifier=PropertyKeys, selectors=[])], member=eval, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=lang, sub_type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))))]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] identifier[getBodyrows] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[java] operator[SEP] identifier[lang] operator[SEP] identifier[String] operator[SEP] identifier[getStateHelper] operator[SEP] operator[SEP] operator[SEP] identifier[eval] operator[SEP] identifier[PropertyKeys] operator[SEP] identifier[bodyrows] operator[SEP] operator[SEP]
}
|
public int getImageSize() {
int filePages = (int) header.get(FILE_PAGES);
int lastPageSize = (int) header.get(LAST_PAGE_SIZE);
int imageSize = (filePages - 1) * PAGE_SIZE + lastPageSize;
if (lastPageSize == 0) {
imageSize += PAGE_SIZE;
}
return imageSize;
} | class class_name[name] begin[{]
method[getImageSize, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[int], filePages]
local_variable[type[int], lastPageSize]
local_variable[type[int], imageSize]
if[binary_operation[member[.lastPageSize], ==, literal[0]]] begin[{]
assign[member[.imageSize], member[.PAGE_SIZE]]
else begin[{]
None
end[}]
return[member[.imageSize]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getImageSize] operator[SEP] operator[SEP] {
Keyword[int] identifier[filePages] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[header] operator[SEP] identifier[get] operator[SEP] identifier[FILE_PAGES] operator[SEP] operator[SEP] Keyword[int] identifier[lastPageSize] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[header] operator[SEP] identifier[get] operator[SEP] identifier[LAST_PAGE_SIZE] operator[SEP] operator[SEP] Keyword[int] identifier[imageSize] operator[=] operator[SEP] identifier[filePages] operator[-] Other[1] operator[SEP] operator[*] identifier[PAGE_SIZE] operator[+] identifier[lastPageSize] operator[SEP] Keyword[if] operator[SEP] identifier[lastPageSize] operator[==] Other[0] operator[SEP] {
identifier[imageSize] operator[+=] identifier[PAGE_SIZE] operator[SEP]
}
Keyword[return] identifier[imageSize] operator[SEP]
}
|
public static double Clamp(double x, DoubleRange range) {
return Clamp(x, range.getMin(), range.getMax());
} | class class_name[name] begin[{]
method[Clamp, return_type[type[double]], modifier[public static], parameter[x, range]] begin[{]
return[call[.Clamp, parameter[member[.x], call[range.getMin, parameter[]], call[range.getMax, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[Clamp] operator[SEP] Keyword[double] identifier[x] , identifier[DoubleRange] identifier[range] operator[SEP] {
Keyword[return] identifier[Clamp] operator[SEP] identifier[x] , identifier[range] operator[SEP] identifier[getMin] operator[SEP] operator[SEP] , identifier[range] operator[SEP] identifier[getMax] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@XmlTransient
public Boolean getFieldValueAsBoolean(String fieldNameParam) {
Field fieldWithName = this.getField(fieldNameParam);
return (fieldWithName == null) ? null : fieldWithName.getFieldValueAsBoolean();
} | class class_name[name] begin[{]
method[getFieldValueAsBoolean, return_type[type[Boolean]], modifier[public], parameter[fieldNameParam]] begin[{]
local_variable[type[Field], fieldWithName]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=fieldWithName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getFieldValueAsBoolean, postfix_operators=[], prefix_operators=[], qualifier=fieldWithName, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | annotation[@] identifier[XmlTransient] Keyword[public] identifier[Boolean] identifier[getFieldValueAsBoolean] operator[SEP] identifier[String] identifier[fieldNameParam] operator[SEP] {
identifier[Field] identifier[fieldWithName] operator[=] Keyword[this] operator[SEP] identifier[getField] operator[SEP] identifier[fieldNameParam] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[fieldWithName] operator[==] Other[null] operator[SEP] operator[?] Other[null] operator[:] identifier[fieldWithName] operator[SEP] identifier[getFieldValueAsBoolean] operator[SEP] operator[SEP] operator[SEP]
}
|
public void removeAllWriter(boolean close)
{
if (close)
synchronized (writers) {
for (final Iterator i = writers.iterator(); i.hasNext();)
((LogWriter) i.next()).close();
}
writers = new Vector();
} | class class_name[name] begin[{]
method[removeAllWriter, return_type[void], modifier[public], parameter[close]] begin[{]
if[member[.close]] begin[{]
SYNCHRONIZED[member[.writers]] BEGIN[{]
ForStatement(body=StatementExpression(expression=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=LogWriter, sub_type=None)), label=None), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=i, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=writers, selectors=[], type_arguments=None), name=i)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
END[}]
else begin[{]
None
end[}]
assign[member[.writers], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Vector, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeAllWriter] operator[SEP] Keyword[boolean] identifier[close] operator[SEP] {
Keyword[if] operator[SEP] identifier[close] operator[SEP] Keyword[synchronized] operator[SEP] identifier[writers] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[Iterator] identifier[i] operator[=] identifier[writers] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[LogWriter] operator[SEP] identifier[i] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writers] operator[=] Keyword[new] identifier[Vector] operator[SEP] operator[SEP] operator[SEP]
}
|
private List fetchEntity(Class entityClass, Object rowId, EntityMetadata entityMetadata,
List<String> relationNames, String tableName, List results, FilterList filter, Queue filterClausequeue,
String... columns) throws IOException
{
results = new ArrayList();
List<AbstractManagedType> subManagedType = getSubManagedType(entityClass, entityMetadata);
if (!subManagedType.isEmpty())
{
for (AbstractManagedType subEntity : subManagedType)
{
EntityMetadata subEntityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata,
subEntity.getJavaType());
List tempResults = handler.readData(tableName, subEntityMetadata.getEntityClazz(), subEntityMetadata,
rowId, subEntityMetadata.getRelationNames(), filter, columns);
if (tempResults != null && !tempResults.isEmpty())
{
results.addAll(tempResults);
}
}
}
else
{
results = handler.readData(tableName, entityMetadata.getEntityClazz(), entityMetadata, rowId,
relationNames, filter, columns);
}
if (rowId != null)
{
KunderaCoreUtils.printQuery("Fetch data from " + entityMetadata.getTableName() + " for PK " + rowId,
showQuery);
}
else if (showQuery && filterClausequeue.size() > 0)
{
KunderaCoreUtils.printQueryWithFilterClause(filterClausequeue, entityMetadata.getTableName());
}
return results;
} | class class_name[name] begin[{]
method[fetchEntity, return_type[type[List]], modifier[private], parameter[entityClass, rowId, entityMetadata, relationNames, tableName, results, filter, filterClausequeue, columns]] begin[{]
assign[member[.results], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ArrayList, sub_type=None))]
local_variable[type[List], subManagedType]
if[call[subManagedType.isEmpty, parameter[]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=kunderaMetadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getJavaType, postfix_operators=[], prefix_operators=[], qualifier=subEntity, selectors=[], type_arguments=None)], member=getEntityMetadata, postfix_operators=[], prefix_operators=[], qualifier=KunderaMetadataManager, selectors=[], type_arguments=None), name=subEntityMetadata)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EntityMetadata, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getEntityClazz, postfix_operators=[], prefix_operators=[], qualifier=subEntityMetadata, selectors=[], type_arguments=None), MemberReference(member=subEntityMetadata, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rowId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getRelationNames, postfix_operators=[], prefix_operators=[], qualifier=subEntityMetadata, selectors=[], type_arguments=None), MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=columns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readData, postfix_operators=[], prefix_operators=[], qualifier=handler, selectors=[], type_arguments=None), name=tempResults)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=tempResults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=tempResults, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tempResults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=subManagedType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=subEntity)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AbstractManagedType, sub_type=None))), label=None)
else begin[{]
assign[member[.results], call[handler.readData, parameter[member[.tableName], call[entityMetadata.getEntityClazz, parameter[]], member[.entityMetadata], member[.rowId], member[.relationNames], member[.filter], member[.columns]]]]
end[}]
if[binary_operation[member[.rowId], !=, literal[null]]] begin[{]
call[KunderaCoreUtils.printQuery, parameter[binary_operation[binary_operation[binary_operation[literal["Fetch data from "], +, call[entityMetadata.getTableName, parameter[]]], +, literal[" for PK "]], +, member[.rowId]], member[.showQuery]]]
else begin[{]
if[binary_operation[member[.showQuery], &&, binary_operation[call[filterClausequeue.size, parameter[]], >, literal[0]]]] begin[{]
call[KunderaCoreUtils.printQueryWithFilterClause, parameter[member[.filterClausequeue], call[entityMetadata.getTableName, parameter[]]]]
else begin[{]
None
end[}]
end[}]
return[member[.results]]
end[}]
END[}] | Keyword[private] identifier[List] identifier[fetchEntity] operator[SEP] identifier[Class] identifier[entityClass] , identifier[Object] identifier[rowId] , identifier[EntityMetadata] identifier[entityMetadata] , identifier[List] operator[<] identifier[String] operator[>] identifier[relationNames] , identifier[String] identifier[tableName] , identifier[List] identifier[results] , identifier[FilterList] identifier[filter] , identifier[Queue] identifier[filterClausequeue] , identifier[String] operator[...] identifier[columns] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[results] operator[=] Keyword[new] identifier[ArrayList] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[AbstractManagedType] operator[>] identifier[subManagedType] operator[=] identifier[getSubManagedType] operator[SEP] identifier[entityClass] , identifier[entityMetadata] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[subManagedType] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[AbstractManagedType] identifier[subEntity] operator[:] identifier[subManagedType] operator[SEP] {
identifier[EntityMetadata] identifier[subEntityMetadata] operator[=] identifier[KunderaMetadataManager] operator[SEP] identifier[getEntityMetadata] operator[SEP] identifier[kunderaMetadata] , identifier[subEntity] operator[SEP] identifier[getJavaType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] identifier[tempResults] operator[=] identifier[handler] operator[SEP] identifier[readData] operator[SEP] identifier[tableName] , identifier[subEntityMetadata] operator[SEP] identifier[getEntityClazz] operator[SEP] operator[SEP] , identifier[subEntityMetadata] , identifier[rowId] , identifier[subEntityMetadata] operator[SEP] identifier[getRelationNames] operator[SEP] operator[SEP] , identifier[filter] , identifier[columns] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tempResults] operator[!=] Other[null] operator[&&] operator[!] identifier[tempResults] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[results] operator[SEP] identifier[addAll] operator[SEP] identifier[tempResults] operator[SEP] operator[SEP]
}
}
}
Keyword[else] {
identifier[results] operator[=] identifier[handler] operator[SEP] identifier[readData] operator[SEP] identifier[tableName] , identifier[entityMetadata] operator[SEP] identifier[getEntityClazz] operator[SEP] operator[SEP] , identifier[entityMetadata] , identifier[rowId] , identifier[relationNames] , identifier[filter] , identifier[columns] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[rowId] operator[!=] Other[null] operator[SEP] {
identifier[KunderaCoreUtils] operator[SEP] identifier[printQuery] operator[SEP] literal[String] operator[+] identifier[entityMetadata] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[rowId] , identifier[showQuery] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[showQuery] operator[&&] identifier[filterClausequeue] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[KunderaCoreUtils] operator[SEP] identifier[printQueryWithFilterClause] operator[SEP] identifier[filterClausequeue] , identifier[entityMetadata] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[results] operator[SEP]
}
|
public void onClose()
{
RuntimeException ce = null;
for (final Agent agent : agents)
{
try
{
agent.onClose();
}
catch (final Exception ex)
{
if (ce == null)
{
ce = new RuntimeException(getClass().getName() + ": underlying agent error on close");
}
ce.addSuppressed(ex);
}
}
if (ce != null)
{
throw ce;
}
} | class class_name[name] begin[{]
method[onClose, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[RuntimeException], ce]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=onClose, postfix_operators=[], prefix_operators=[], qualifier=agent, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ce, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ce, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=": underlying agent error on close"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addSuppressed, postfix_operators=[], prefix_operators=[], qualifier=ce, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=agents, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=agent)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Agent, sub_type=None))), label=None)
if[binary_operation[member[.ce], !=, literal[null]]] begin[{]
ThrowStatement(expression=MemberReference(member=ce, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[onClose] operator[SEP] operator[SEP] {
identifier[RuntimeException] identifier[ce] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Agent] identifier[agent] operator[:] identifier[agents] operator[SEP] {
Keyword[try] {
identifier[agent] operator[SEP] identifier[onClose] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] identifier[ce] operator[==] Other[null] operator[SEP] {
identifier[ce] operator[=] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[ce] operator[SEP] identifier[addSuppressed] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[ce] operator[!=] Other[null] operator[SEP] {
Keyword[throw] identifier[ce] operator[SEP]
}
}
|
String getEffectiveNamespace() {
String namespace = Tenant.getNamespace();
if (namespace == null) {
namespace = datastore.getOptions().getNamespace();
}
return namespace;
} | class class_name[name] begin[{]
method[getEffectiveNamespace, return_type[type[String]], modifier[default], parameter[]] begin[{]
local_variable[type[String], namespace]
if[binary_operation[member[.namespace], ==, literal[null]]] begin[{]
assign[member[.namespace], call[datastore.getOptions, parameter[]]]
else begin[{]
None
end[}]
return[member[.namespace]]
end[}]
END[}] | identifier[String] identifier[getEffectiveNamespace] operator[SEP] operator[SEP] {
identifier[String] identifier[namespace] operator[=] identifier[Tenant] operator[SEP] identifier[getNamespace] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[namespace] operator[==] Other[null] operator[SEP] {
identifier[namespace] operator[=] identifier[datastore] operator[SEP] identifier[getOptions] operator[SEP] operator[SEP] operator[SEP] identifier[getNamespace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[namespace] operator[SEP]
}
|
@SuppressWarnings("unchecked")
private ThreadContextDescriptor captureRaThreadContext(WSContextService contextSvc) {
Map<String, String> execProps = new HashMap<String, String>();
execProps.put(WSContextService.DEFAULT_CONTEXT, WSContextService.ALL_CONTEXT_TYPES);
execProps.put(WSContextService.REQUIRE_AVAILABLE_APP, "false");
return contextSvc.captureThreadContext(execProps);
} | class class_name[name] begin[{]
method[captureRaThreadContext, return_type[type[ThreadContextDescriptor]], modifier[private], parameter[contextSvc]] begin[{]
local_variable[type[Map], execProps]
call[execProps.put, parameter[member[WSContextService.DEFAULT_CONTEXT], member[WSContextService.ALL_CONTEXT_TYPES]]]
call[execProps.put, parameter[member[WSContextService.REQUIRE_AVAILABLE_APP], literal["false"]]]
return[call[contextSvc.captureThreadContext, parameter[member[.execProps]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] identifier[ThreadContextDescriptor] identifier[captureRaThreadContext] operator[SEP] identifier[WSContextService] identifier[contextSvc] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[execProps] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[execProps] operator[SEP] identifier[put] operator[SEP] identifier[WSContextService] operator[SEP] identifier[DEFAULT_CONTEXT] , identifier[WSContextService] operator[SEP] identifier[ALL_CONTEXT_TYPES] operator[SEP] operator[SEP] identifier[execProps] operator[SEP] identifier[put] operator[SEP] identifier[WSContextService] operator[SEP] identifier[REQUIRE_AVAILABLE_APP] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[contextSvc] operator[SEP] identifier[captureThreadContext] operator[SEP] identifier[execProps] operator[SEP] operator[SEP]
}
|
@Override
public boolean containsValue(final Object value) {
lock.readLock().lock();
try {
return contains(value);
} finally {
lock.readLock().unlock();
}
} | class class_name[name] begin[{]
method[containsValue, return_type[type[boolean]], modifier[public], parameter[value]] begin[{]
call[lock.readLock, parameter[]]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=readLock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[containsValue] operator[SEP] Keyword[final] identifier[Object] identifier[value] operator[SEP] {
identifier[lock] operator[SEP] identifier[readLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[contains] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[readLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Nonnull
public static <T1, T2> LToLongBiFunction<T1, T2> toLongBiFunctionFrom(Consumer<LToLongBiFunctionBuilder<T1, T2>> buildingFunction) {
LToLongBiFunctionBuilder builder = new LToLongBiFunctionBuilder();
buildingFunction.accept(builder);
return builder.build();
} | class class_name[name] begin[{]
method[toLongBiFunctionFrom, return_type[type[LToLongBiFunction]], modifier[public static], parameter[buildingFunction]] begin[{]
local_variable[type[LToLongBiFunctionBuilder], builder]
call[buildingFunction.accept, parameter[member[.builder]]]
return[call[builder.build, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] operator[<] identifier[T1] , identifier[T2] operator[>] identifier[LToLongBiFunction] operator[<] identifier[T1] , identifier[T2] operator[>] identifier[toLongBiFunctionFrom] operator[SEP] identifier[Consumer] operator[<] identifier[LToLongBiFunctionBuilder] operator[<] identifier[T1] , identifier[T2] operator[>] operator[>] identifier[buildingFunction] operator[SEP] {
identifier[LToLongBiFunctionBuilder] identifier[builder] operator[=] Keyword[new] identifier[LToLongBiFunctionBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[buildingFunction] operator[SEP] identifier[accept] operator[SEP] identifier[builder] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String replaceVariables( final VariableResolver pResolver, final String pExpression, final String pOpen, final String pClose ) {
final char[] open = pOpen.toCharArray();
final char[] close = pClose.toCharArray();
final StringBuilder out = new StringBuilder();
StringBuilder sb = new StringBuilder();
char[] last = null;
int wo = 0;
int wc = 0;
int level = 0;
for (char c : pExpression.toCharArray()) {
if (c == open[wo]) {
if (wc > 0) {
sb.append(close, 0, wc);
}
wc = 0;
wo++;
if (open.length == wo) {
// found open
if (last == open) {
out.append(open);
}
level++;
out.append(sb);
sb = new StringBuilder();
wo = 0;
last = open;
}
} else if (c == close[wc]) {
if (wo > 0) {
sb.append(open, 0, wo);
}
wo = 0;
wc++;
if (close.length == wc) {
// found close
if (last == open) {
final String variable = pResolver.get(sb.toString());
if (variable != null) {
out.append(variable);
} else {
out.append(open);
out.append(sb);
out.append(close);
}
} else {
out.append(sb);
out.append(close);
}
sb = new StringBuilder();
level--;
wc = 0;
last = close;
}
} else {
if (wo > 0) {
sb.append(open, 0, wo);
}
if (wc > 0) {
sb.append(close, 0, wc);
}
sb.append(c);
wo = wc = 0;
}
}
if (wo > 0) {
sb.append(open, 0, wo);
}
if (wc > 0) {
sb.append(close, 0, wc);
}
if (level > 0) {
out.append(open);
}
out.append(sb);
return out.toString();
} | class class_name[name] begin[{]
method[replaceVariables, return_type[type[String]], modifier[public static], parameter[pResolver, pExpression, pOpen, pClose]] begin[{]
local_variable[type[char], open]
local_variable[type[char], close]
local_variable[type[StringBuilder], out]
local_variable[type[StringBuilder], sb]
local_variable[type[char], last]
local_variable[type[int], wo]
local_variable[type[int], wc]
local_variable[type[int], level]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=wo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator===), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=wo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=wo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=wo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Assignment(expressionl=MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=wo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=wo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=wo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), StatementExpression(expression=MemberReference(member=wc, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=close, selectors=[]), operandr=MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=last, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=pResolver, selectors=[], type_arguments=None), name=variable)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=variable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=variable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]))])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sb, 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=StringBuilder, sub_type=None))), label=None), StatementExpression(expression=MemberReference(member=level, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=last, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=close, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=wc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), StatementExpression(expression=MemberReference(member=wo, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=open, selectors=[]), operandr=MemberReference(member=wo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=last, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MemberReference(member=level, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sb, 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=StringBuilder, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=wo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=last, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=pExpression, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char))), label=None)
if[binary_operation[member[.wo], >, literal[0]]] begin[{]
call[sb.append, parameter[member[.open], literal[0], member[.wo]]]
else begin[{]
None
end[}]
if[binary_operation[member[.wc], >, literal[0]]] begin[{]
call[sb.append, parameter[member[.close], literal[0], member[.wc]]]
else begin[{]
None
end[}]
if[binary_operation[member[.level], >, literal[0]]] begin[{]
call[out.append, parameter[member[.open]]]
else begin[{]
None
end[}]
call[out.append, parameter[member[.sb]]]
return[call[out.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[replaceVariables] operator[SEP] Keyword[final] identifier[VariableResolver] identifier[pResolver] , Keyword[final] identifier[String] identifier[pExpression] , Keyword[final] identifier[String] identifier[pOpen] , Keyword[final] identifier[String] identifier[pClose] operator[SEP] {
Keyword[final] Keyword[char] operator[SEP] operator[SEP] identifier[open] operator[=] identifier[pOpen] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[char] operator[SEP] operator[SEP] identifier[close] operator[=] identifier[pClose] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[out] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[last] operator[=] Other[null] operator[SEP] Keyword[int] identifier[wo] operator[=] Other[0] operator[SEP] Keyword[int] identifier[wc] operator[=] Other[0] operator[SEP] Keyword[int] identifier[level] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[char] identifier[c] operator[:] identifier[pExpression] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[==] identifier[open] operator[SEP] identifier[wo] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[wc] operator[>] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[close] , Other[0] , identifier[wc] operator[SEP] operator[SEP]
}
identifier[wc] operator[=] Other[0] operator[SEP] identifier[wo] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[open] operator[SEP] identifier[length] operator[==] identifier[wo] operator[SEP] {
Keyword[if] operator[SEP] identifier[last] operator[==] identifier[open] operator[SEP] {
identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[open] operator[SEP] operator[SEP]
}
identifier[level] operator[++] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[sb] operator[SEP] operator[SEP] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[wo] operator[=] Other[0] operator[SEP] identifier[last] operator[=] identifier[open] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] identifier[close] operator[SEP] identifier[wc] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[wo] operator[>] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[open] , Other[0] , identifier[wo] operator[SEP] operator[SEP]
}
identifier[wo] operator[=] Other[0] operator[SEP] identifier[wc] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[close] operator[SEP] identifier[length] operator[==] identifier[wc] operator[SEP] {
Keyword[if] operator[SEP] identifier[last] operator[==] identifier[open] operator[SEP] {
Keyword[final] identifier[String] identifier[variable] operator[=] identifier[pResolver] operator[SEP] identifier[get] operator[SEP] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[variable] operator[!=] Other[null] operator[SEP] {
identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[variable] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[open] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[sb] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[close] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[sb] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[close] operator[SEP] operator[SEP]
}
identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[level] operator[--] operator[SEP] identifier[wc] operator[=] Other[0] operator[SEP] identifier[last] operator[=] identifier[close] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[wo] operator[>] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[open] , Other[0] , identifier[wo] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[wc] operator[>] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[close] , Other[0] , identifier[wc] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[wo] operator[=] identifier[wc] operator[=] Other[0] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[wo] operator[>] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[open] , Other[0] , identifier[wo] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[wc] operator[>] Other[0] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[close] , Other[0] , identifier[wc] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[level] operator[>] Other[0] operator[SEP] {
identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[open] operator[SEP] operator[SEP]
}
identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[sb] operator[SEP] operator[SEP] Keyword[return] identifier[out] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setPropagatingVgws(java.util.Collection<PropagatingVgw> propagatingVgws) {
if (propagatingVgws == null) {
this.propagatingVgws = null;
return;
}
this.propagatingVgws = new com.amazonaws.internal.SdkInternalList<PropagatingVgw>(propagatingVgws);
} | class class_name[name] begin[{]
method[setPropagatingVgws, return_type[void], modifier[public], parameter[propagatingVgws]] begin[{]
if[binary_operation[member[.propagatingVgws], ==, literal[null]]] begin[{]
assign[THIS[member[None.propagatingVgws]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.propagatingVgws]], ClassCreator(arguments=[MemberReference(member=propagatingVgws, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=PropagatingVgw, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setPropagatingVgws] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[PropagatingVgw] operator[>] identifier[propagatingVgws] operator[SEP] {
Keyword[if] operator[SEP] identifier[propagatingVgws] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[propagatingVgws] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[propagatingVgws] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[PropagatingVgw] operator[>] operator[SEP] identifier[propagatingVgws] operator[SEP] operator[SEP]
}
|
public boolean isExists(String index) {
IndicesExistsRequestBuilder indicesExistsRequestBuilder =
admin().indices().prepareExists(index);
return JMElasticsearchUtil
.logRequestQueryAndReturn("isExists",
indicesExistsRequestBuilder,
indicesExistsRequestBuilder.execute())
.isExists();
} | class class_name[name] begin[{]
method[isExists, return_type[type[boolean]], modifier[public], parameter[index]] begin[{]
local_variable[type[IndicesExistsRequestBuilder], indicesExistsRequestBuilder]
return[call[JMElasticsearchUtil.logRequestQueryAndReturn, parameter[literal["isExists"], member[.indicesExistsRequestBuilder], call[indicesExistsRequestBuilder.execute, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isExists] operator[SEP] identifier[String] identifier[index] operator[SEP] {
identifier[IndicesExistsRequestBuilder] identifier[indicesExistsRequestBuilder] operator[=] identifier[admin] operator[SEP] operator[SEP] operator[SEP] identifier[indices] operator[SEP] operator[SEP] operator[SEP] identifier[prepareExists] operator[SEP] identifier[index] operator[SEP] operator[SEP] Keyword[return] identifier[JMElasticsearchUtil] operator[SEP] identifier[logRequestQueryAndReturn] operator[SEP] literal[String] , identifier[indicesExistsRequestBuilder] , identifier[indicesExistsRequestBuilder] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[isExists] operator[SEP] operator[SEP] operator[SEP]
}
|
public static final ReadableInterval getReadableInterval(ReadableInterval interval) {
if (interval == null) {
long now = DateTimeUtils.currentTimeMillis();
interval = new Interval(now, now);
}
return interval;
} | class class_name[name] begin[{]
method[getReadableInterval, return_type[type[ReadableInterval]], modifier[final public static], parameter[interval]] begin[{]
if[binary_operation[member[.interval], ==, literal[null]]] begin[{]
local_variable[type[long], now]
assign[member[.interval], ClassCreator(arguments=[MemberReference(member=now, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=now, 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=Interval, sub_type=None))]
else begin[{]
None
end[}]
return[member[.interval]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[final] identifier[ReadableInterval] identifier[getReadableInterval] operator[SEP] identifier[ReadableInterval] identifier[interval] operator[SEP] {
Keyword[if] operator[SEP] identifier[interval] operator[==] Other[null] operator[SEP] {
Keyword[long] identifier[now] operator[=] identifier[DateTimeUtils] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[interval] operator[=] Keyword[new] identifier[Interval] operator[SEP] identifier[now] , identifier[now] operator[SEP] operator[SEP]
}
Keyword[return] identifier[interval] operator[SEP]
}
|
@Bind(optional = true, aggregate = true)
public synchronized void bindDialect(IDialect dialect) {
LOGGER.debug("Binding a new dialect using the prefix '{}' and containing {}",
dialect.getPrefix(),
dialect.getProcessors());
if (this.dialects.add(dialect)) {
// We must reconfigure the engine
configure();
// Update all templates.
for (Template template : getTemplates()) {
((ThymeLeafTemplateImplementation) template).updateEngine(engine);
}
}
} | class class_name[name] begin[{]
method[bindDialect, return_type[void], modifier[synchronized public], parameter[dialect]] begin[{]
call[LOGGER.debug, parameter[literal["Binding a new dialect using the prefix '{}' and containing {}"], call[dialect.getPrefix, parameter[]], call[dialect.getProcessors, parameter[]]]]
if[THIS[member[None.dialects]call[None.add, parameter[member[.dialect]]]]] begin[{]
call[.configure, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=template, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ThymeLeafTemplateImplementation, sub_type=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getTemplates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=template)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Template, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Bind] operator[SEP] identifier[optional] operator[=] literal[boolean] , identifier[aggregate] operator[=] literal[boolean] operator[SEP] Keyword[public] Keyword[synchronized] Keyword[void] identifier[bindDialect] operator[SEP] identifier[IDialect] identifier[dialect] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[dialect] operator[SEP] identifier[getPrefix] operator[SEP] operator[SEP] , identifier[dialect] operator[SEP] identifier[getProcessors] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[dialects] operator[SEP] identifier[add] operator[SEP] identifier[dialect] operator[SEP] operator[SEP] {
identifier[configure] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Template] identifier[template] operator[:] identifier[getTemplates] operator[SEP] operator[SEP] operator[SEP] {
operator[SEP] operator[SEP] identifier[ThymeLeafTemplateImplementation] operator[SEP] identifier[template] operator[SEP] operator[SEP] identifier[updateEngine] operator[SEP] identifier[engine] operator[SEP] operator[SEP]
}
}
}
|
public ULocale canonicalize(ULocale ulocale) {
// TODO Get the data from CLDR, use Java conventions.
String lang = ulocale.getLanguage();
String lang2 = canonicalMap.get(lang);
String script = ulocale.getScript();
String script2 = canonicalMap.get(script);
String region = ulocale.getCountry();
String region2 = canonicalMap.get(region);
if (lang2 != null || script2 != null || region2 != null) {
return new ULocale(
lang2 == null ? lang : lang2,
script2 == null ? script : script2,
region2 == null ? region : region2
);
}
return ulocale;
} | class class_name[name] begin[{]
method[canonicalize, return_type[type[ULocale]], modifier[public], parameter[ulocale]] begin[{]
local_variable[type[String], lang]
local_variable[type[String], lang2]
local_variable[type[String], script]
local_variable[type[String], script2]
local_variable[type[String], region]
local_variable[type[String], region2]
if[binary_operation[binary_operation[binary_operation[member[.lang2], !=, literal[null]], ||, binary_operation[member[.script2], !=, literal[null]]], ||, binary_operation[member[.region2], !=, literal[null]]]] begin[{]
return[ClassCreator(arguments=[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=lang2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=lang2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=lang, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=script2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=script2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=script, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=region2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=region2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=region, 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=ULocale, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ulocale]]
end[}]
END[}] | Keyword[public] identifier[ULocale] identifier[canonicalize] operator[SEP] identifier[ULocale] identifier[ulocale] operator[SEP] {
identifier[String] identifier[lang] operator[=] identifier[ulocale] operator[SEP] identifier[getLanguage] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[lang2] operator[=] identifier[canonicalMap] operator[SEP] identifier[get] operator[SEP] identifier[lang] operator[SEP] operator[SEP] identifier[String] identifier[script] operator[=] identifier[ulocale] operator[SEP] identifier[getScript] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[script2] operator[=] identifier[canonicalMap] operator[SEP] identifier[get] operator[SEP] identifier[script] operator[SEP] operator[SEP] identifier[String] identifier[region] operator[=] identifier[ulocale] operator[SEP] identifier[getCountry] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[region2] operator[=] identifier[canonicalMap] operator[SEP] identifier[get] operator[SEP] identifier[region] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lang2] operator[!=] Other[null] operator[||] identifier[script2] operator[!=] Other[null] operator[||] identifier[region2] operator[!=] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[ULocale] operator[SEP] identifier[lang2] operator[==] Other[null] operator[?] identifier[lang] operator[:] identifier[lang2] , identifier[script2] operator[==] Other[null] operator[?] identifier[script] operator[:] identifier[script2] , identifier[region2] operator[==] Other[null] operator[?] identifier[region] operator[:] identifier[region2] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ulocale] operator[SEP]
}
|
public Long getLong(String column) {
Number n = getNumber(column);
return n != null ? n.longValue() : null;
} | class class_name[name] begin[{]
method[getLong, return_type[type[Long]], modifier[public], parameter[column]] begin[{]
local_variable[type[Number], n]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[], member=longValue, postfix_operators=[], prefix_operators=[], qualifier=n, selectors=[], type_arguments=None))]
end[}]
END[}] | Keyword[public] identifier[Long] identifier[getLong] operator[SEP] identifier[String] identifier[column] operator[SEP] {
identifier[Number] identifier[n] operator[=] identifier[getNumber] operator[SEP] identifier[column] operator[SEP] operator[SEP] Keyword[return] identifier[n] operator[!=] Other[null] operator[?] identifier[n] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
public static <T> Iterable<T> cycle(final Iterable<T> iterable) {
checkNotNull(iterable);
return new FluentIterable<T>() {
@Override
public Iterator<T> iterator() {
return Iterators.cycle(iterable);
}
@Override
public String toString() {
return iterable.toString() + " (cycled)";
}
};
} | class class_name[name] begin[{]
method[cycle, return_type[type[Iterable]], modifier[public static], parameter[iterable]] begin[{]
call[.checkNotNull, parameter[member[.iterable]]]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=iterable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cycle, postfix_operators=[], prefix_operators=[], qualifier=Iterators, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=iterator, parameters=[], return_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Iterator, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=BinaryOperation(operandl=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=iterable, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" (cycled)"), operator=+), label=None)], documentation=None, modifiers={'public'}, name=toString, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=FluentIterable, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[cycle] operator[SEP] Keyword[final] identifier[Iterable] operator[<] identifier[T] operator[>] identifier[iterable] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[iterable] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[FluentIterable] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Iterator] operator[<] identifier[T] operator[>] identifier[iterator] operator[SEP] operator[SEP] {
Keyword[return] identifier[Iterators] operator[SEP] identifier[cycle] operator[SEP] identifier[iterable] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[toString] operator[SEP] operator[SEP] {
Keyword[return] identifier[iterable] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP]
}
} operator[SEP]
}
|
public static DateTimeFormatter ofLocalizedTime(FormatStyle timeStyle) {
Jdk8Methods.requireNonNull(timeStyle, "timeStyle");
return new DateTimeFormatterBuilder().appendLocalized(null, timeStyle)
.toFormatter().withChronology(IsoChronology.INSTANCE);
} | class class_name[name] begin[{]
method[ofLocalizedTime, return_type[type[DateTimeFormatter]], modifier[public static], parameter[timeStyle]] begin[{]
call[Jdk8Methods.requireNonNull, parameter[member[.timeStyle], literal["timeStyle"]]]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=timeStyle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=appendLocalized, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=toFormatter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=INSTANCE, postfix_operators=[], prefix_operators=[], qualifier=IsoChronology, selectors=[])], member=withChronology, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DateTimeFormatterBuilder, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DateTimeFormatter] identifier[ofLocalizedTime] operator[SEP] identifier[FormatStyle] identifier[timeStyle] operator[SEP] {
identifier[Jdk8Methods] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[timeStyle] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[DateTimeFormatterBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[appendLocalized] operator[SEP] Other[null] , identifier[timeStyle] operator[SEP] operator[SEP] identifier[toFormatter] operator[SEP] operator[SEP] operator[SEP] identifier[withChronology] operator[SEP] identifier[IsoChronology] operator[SEP] identifier[INSTANCE] operator[SEP] operator[SEP]
}
|
public List<Interceptors<BeansDescriptor>> getAllInterceptors()
{
List<Interceptors<BeansDescriptor>> list = new ArrayList<Interceptors<BeansDescriptor>>();
List<Node> nodeList = model.get("interceptors");
for (Node node : nodeList)
{
Interceptors<BeansDescriptor> type = new InterceptorsImpl<BeansDescriptor>(this, "interceptors", model, node);
list.add(type);
}
return list;
} | class class_name[name] begin[{]
method[getAllInterceptors, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], list]
local_variable[type[List], nodeList]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="interceptors"), MemberReference(member=model, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BeansDescriptor, sub_type=None))], dimensions=None, name=InterceptorsImpl, sub_type=None)), name=type)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=BeansDescriptor, sub_type=None))], dimensions=[], name=Interceptors, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=nodeList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
return[member[.list]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[Interceptors] operator[<] identifier[BeansDescriptor] operator[>] operator[>] identifier[getAllInterceptors] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Interceptors] operator[<] identifier[BeansDescriptor] operator[>] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Interceptors] operator[<] identifier[BeansDescriptor] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[model] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[node] operator[:] identifier[nodeList] operator[SEP] {
identifier[Interceptors] operator[<] identifier[BeansDescriptor] operator[>] identifier[type] operator[=] Keyword[new] identifier[InterceptorsImpl] operator[<] identifier[BeansDescriptor] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[model] , identifier[node] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
@Override
public InputStream render(Context context, Result result) throws RenderableException {
try {
return FileUtils.openInputStream(file);
} catch (IOException e) {
throw new RenderableException("Cannot read file " + file.getAbsolutePath(), e);
}
} | class class_name[name] begin[{]
method[render, return_type[type[InputStream]], modifier[public], parameter[context, result]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=openInputStream, postfix_operators=[], prefix_operators=[], qualifier=FileUtils, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot read file "), operandr=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RenderableException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[InputStream] identifier[render] operator[SEP] identifier[Context] identifier[context] , identifier[Result] identifier[result] operator[SEP] Keyword[throws] identifier[RenderableException] {
Keyword[try] {
Keyword[return] identifier[FileUtils] operator[SEP] identifier[openInputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RenderableException] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public VirtualAction createAction(ActionRuntime runtime, ActionResponseReflector reflector) {
return newGodHandableAction(runtime, reflector, prepareVestibuleTxStage(), getRequestManager());
} | class class_name[name] begin[{]
method[createAction, return_type[type[VirtualAction]], modifier[public], parameter[runtime, reflector]] begin[{]
return[call[.newGodHandableAction, parameter[member[.runtime], member[.reflector], call[.prepareVestibuleTxStage, parameter[]], call[.getRequestManager, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[VirtualAction] identifier[createAction] operator[SEP] identifier[ActionRuntime] identifier[runtime] , identifier[ActionResponseReflector] identifier[reflector] operator[SEP] {
Keyword[return] identifier[newGodHandableAction] operator[SEP] identifier[runtime] , identifier[reflector] , identifier[prepareVestibuleTxStage] operator[SEP] operator[SEP] , identifier[getRequestManager] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void getItemInfo(int[] ids, Callback<List<Item>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getItemInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | class class_name[name] begin[{]
method[getItemInfo, return_type[void], modifier[public], parameter[ids, callback]] begin[{]
call[.isParamValid, parameter[ClassCreator(arguments=[MemberReference(member=ids, 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=ParamChecker, sub_type=None))]]
call[gw2API.getItemInfo, parameter[call[.processIds, parameter[member[.ids]]], call[GuildWars2.lang.getValue, parameter[]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[getItemInfo] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[ids] , identifier[Callback] operator[<] identifier[List] operator[<] identifier[Item] operator[>] operator[>] identifier[callback] operator[SEP] Keyword[throws] identifier[GuildWars2Exception] , identifier[NullPointerException] {
identifier[isParamValid] operator[SEP] Keyword[new] identifier[ParamChecker] operator[SEP] identifier[ids] operator[SEP] operator[SEP] operator[SEP] identifier[gw2API] operator[SEP] identifier[getItemInfo] operator[SEP] identifier[processIds] operator[SEP] identifier[ids] operator[SEP] , identifier[GuildWars2] operator[SEP] identifier[lang] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[enqueue] operator[SEP] identifier[callback] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
@Override
public void run(Class<? extends Object> toRun, JobManager handler, Map<String, String> handlerParameters)
{
// initialize the spring context with all requested classes on first boot -
// and only on first boot: the Spring context cannot be refreshed multiple times.
if (!refreshed)
{
synchronized (AnnotationSpringContextBootstrapHandler.class)
{
if (!refreshed)
{
// Add the different elements to the context path
if (handlerParameters.containsKey("beanNameGenerator"))
{
Class<? extends BeanNameGenerator> clazz;
try
{
clazz = (Class<? extends BeanNameGenerator>) AnnotationSpringContextBootstrapHandler.class.getClassLoader()
.loadClass(handlerParameters.get("beanNameGenerator"));
}
catch (ClassNotFoundException e)
{
throw new RuntimeException("The handler beanNameGenerator class [" + handlerParameters.get("beanNameGenerator")
+ "] cannot be found.", e);
}
BeanNameGenerator generator;
try
{
generator = clazz.newInstance();
}
catch (Exception e)
{
throw new RuntimeException("The handler beanNameGenerator class [" + handlerParameters.get("beanNameGenerator")
+ "] was found but cannot be instantiated. Check it has a no-arguments constructor.", e);
}
ctx.setBeanNameGenerator(generator);
}
if (handlerParameters.containsKey("contextDisplayName"))
{
ctx.setDisplayName(handlerParameters.get("contextDisplayName"));
}
if (handlerParameters.containsKey("contextId"))
{
ctx.setId(handlerParameters.get("contextId"));
}
if (handlerParameters.containsKey("allowCircularReferences"))
{
boolean allow = Boolean.parseBoolean(handlerParameters.get("allowCircularReferences"));
ctx.setAllowCircularReferences(allow);
}
if (handlerParameters.containsKey("additionalScan"))
{
ctx.scan(handlerParameters.get("additionalScan").split(","));
}
else
{
ctx.register(toRun);
}
// Create a holder for the parameters.
BeanDefinition def = new RootBeanDefinition(HashMap.class);
def.setScope(THREAD_SCOPE_NAME);
ctx.registerBeanDefinition("runtimeParameters", def);
// This is a factory to retrieve the JobManager. We cannot just inject the JM, as it is created at runtime, long after
// the context has been created!
def = new RootBeanDefinition(JobManagerProvider.class);
def.setScope(BeanDefinition.SCOPE_SINGLETON);
ctx.registerBeanDefinition("jobManagerProvider", def);
// It would however be possible to use a lazy bean injection. But this would require the user to put @Lazy everywhere,
// or else the result is null... Too fragile. The provider/factory pattern above does the same thing and forces the user
// to do a lazy call.
// def = new RootBeanDefinition(JobManager.class);
// def.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
// def.setLazyInit(true);
// def.setFactoryBeanName("jobManagerProvider");
// def.setFactoryMethodName("getObject");
// ctx.registerBeanDefinition("jobManager", def);
// Go: this initializes the context
ctx.refresh();
refreshed = true;
}
}
}
} | class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[toRun, handler, handlerParameters]] begin[{]
if[member[.refreshed]] begin[{]
SYNCHRONIZED[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AnnotationSpringContextBootstrapHandler, sub_type=None))] BEGIN[{]
if[member[.refreshed]] begin[{]
if[call[handlerParameters.containsKey, parameter[literal["beanNameGenerator"]]]] begin[{]
local_variable[type[Class], clazz]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="beanNameGenerator")], member=get, postfix_operators=[], prefix_operators=[], qualifier=handlerParameters, selectors=[], type_arguments=None)], member=loadClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=AnnotationSpringContextBootstrapHandler, sub_type=None)), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=BeanNameGenerator, sub_type=None))], dimensions=[], name=Class, sub_type=None))), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The handler beanNameGenerator class ["), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="beanNameGenerator")], member=get, postfix_operators=[], prefix_operators=[], qualifier=handlerParameters, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] cannot be found."), 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=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
local_variable[type[BeanNameGenerator], generator]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=generator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The handler beanNameGenerator class ["), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="beanNameGenerator")], member=get, postfix_operators=[], prefix_operators=[], qualifier=handlerParameters, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] was found but cannot be instantiated. Check it has a no-arguments constructor."), 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=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)
call[ctx.setBeanNameGenerator, parameter[member[.generator]]]
else begin[{]
None
end[}]
if[call[handlerParameters.containsKey, parameter[literal["contextDisplayName"]]]] begin[{]
call[ctx.setDisplayName, parameter[call[handlerParameters.get, parameter[literal["contextDisplayName"]]]]]
else begin[{]
None
end[}]
if[call[handlerParameters.containsKey, parameter[literal["contextId"]]]] begin[{]
call[ctx.setId, parameter[call[handlerParameters.get, parameter[literal["contextId"]]]]]
else begin[{]
None
end[}]
if[call[handlerParameters.containsKey, parameter[literal["allowCircularReferences"]]]] begin[{]
local_variable[type[boolean], allow]
call[ctx.setAllowCircularReferences, parameter[member[.allow]]]
else begin[{]
None
end[}]
if[call[handlerParameters.containsKey, parameter[literal["additionalScan"]]]] begin[{]
call[ctx.scan, parameter[call[handlerParameters.get, parameter[literal["additionalScan"]]]]]
else begin[{]
call[ctx.register, parameter[member[.toRun]]]
end[}]
local_variable[type[BeanDefinition], def]
call[def.setScope, parameter[member[.THREAD_SCOPE_NAME]]]
call[ctx.registerBeanDefinition, parameter[literal["runtimeParameters"], member[.def]]]
assign[member[.def], ClassCreator(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JobManagerProvider, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RootBeanDefinition, sub_type=None))]
call[def.setScope, parameter[member[BeanDefinition.SCOPE_SINGLETON]]]
call[ctx.registerBeanDefinition, parameter[literal["jobManagerProvider"], member[.def]]]
call[ctx.refresh, parameter[]]
assign[member[.refreshed], literal[true]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Object] operator[>] identifier[toRun] , identifier[JobManager] identifier[handler] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[handlerParameters] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[refreshed] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[AnnotationSpringContextBootstrapHandler] operator[SEP] Keyword[class] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[refreshed] operator[SEP] {
Keyword[if] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[Class] operator[<] operator[?] Keyword[extends] identifier[BeanNameGenerator] operator[>] identifier[clazz] operator[SEP] Keyword[try] {
identifier[clazz] operator[=] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[BeanNameGenerator] operator[>] operator[SEP] identifier[AnnotationSpringContextBootstrapHandler] operator[SEP] Keyword[class] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] identifier[loadClass] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[handlerParameters] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[BeanNameGenerator] identifier[generator] operator[SEP] Keyword[try] {
identifier[generator] operator[=] identifier[clazz] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[handlerParameters] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[ctx] operator[SEP] identifier[setBeanNameGenerator] operator[SEP] identifier[generator] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[ctx] operator[SEP] identifier[setDisplayName] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[ctx] operator[SEP] identifier[setId] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[boolean] identifier[allow] operator[=] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[ctx] operator[SEP] identifier[setAllowCircularReferences] operator[SEP] identifier[allow] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[ctx] operator[SEP] identifier[scan] operator[SEP] identifier[handlerParameters] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ctx] operator[SEP] identifier[register] operator[SEP] identifier[toRun] operator[SEP] operator[SEP]
}
identifier[BeanDefinition] identifier[def] operator[=] Keyword[new] identifier[RootBeanDefinition] operator[SEP] identifier[HashMap] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[def] operator[SEP] identifier[setScope] operator[SEP] identifier[THREAD_SCOPE_NAME] operator[SEP] operator[SEP] identifier[ctx] operator[SEP] identifier[registerBeanDefinition] operator[SEP] literal[String] , identifier[def] operator[SEP] operator[SEP] identifier[def] operator[=] Keyword[new] identifier[RootBeanDefinition] operator[SEP] identifier[JobManagerProvider] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[def] operator[SEP] identifier[setScope] operator[SEP] identifier[BeanDefinition] operator[SEP] identifier[SCOPE_SINGLETON] operator[SEP] operator[SEP] identifier[ctx] operator[SEP] identifier[registerBeanDefinition] operator[SEP] literal[String] , identifier[def] operator[SEP] operator[SEP] identifier[ctx] operator[SEP] identifier[refresh] operator[SEP] operator[SEP] operator[SEP] identifier[refreshed] operator[=] literal[boolean] operator[SEP]
}
}
}
}
|
@InterfaceAudience.Public
public SavedRevision getCurrentRevision() {
if (currentRevision == null)
currentRevision = getRevision(null);
return currentRevision;
} | class class_name[name] begin[{]
method[getCurrentRevision, return_type[type[SavedRevision]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.currentRevision], ==, literal[null]]] begin[{]
assign[member[.currentRevision], call[.getRevision, parameter[literal[null]]]]
else begin[{]
None
end[}]
return[member[.currentRevision]]
end[}]
END[}] | annotation[@] identifier[InterfaceAudience] operator[SEP] identifier[Public] Keyword[public] identifier[SavedRevision] identifier[getCurrentRevision] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[currentRevision] operator[==] Other[null] operator[SEP] identifier[currentRevision] operator[=] identifier[getRevision] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[currentRevision] operator[SEP]
}
|
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public List<Haus> getHaus() {
if (haus == null) {
haus = new ArrayList<Haus>();
}
return this.haus;
} | class class_name[name] begin[{]
method[getHaus, return_type[type[List]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.haus], ==, literal[null]]] begin[{]
assign[member[.haus], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Haus, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
return[THIS[member[None.haus]]]
end[}]
END[}] | annotation[@] identifier[Generated] operator[SEP] identifier[value] operator[=] literal[String] , identifier[date] operator[=] literal[String] , identifier[comments] operator[=] literal[String] operator[SEP] Keyword[public] identifier[List] operator[<] identifier[Haus] operator[>] identifier[getHaus] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[haus] operator[==] Other[null] operator[SEP] {
identifier[haus] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Haus] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[haus] operator[SEP]
}
|
Symbol addConstant(final Object value) {
if (value instanceof Integer) {
return addConstantInteger(((Integer) value).intValue());
} else if (value instanceof Byte) {
return addConstantInteger(((Byte) value).intValue());
} else if (value instanceof Character) {
return addConstantInteger(((Character) value).charValue());
} else if (value instanceof Short) {
return addConstantInteger(((Short) value).intValue());
} else if (value instanceof Boolean) {
return addConstantInteger(((Boolean) value).booleanValue() ? 1 : 0);
} else if (value instanceof Float) {
return addConstantFloat(((Float) value).floatValue());
} else if (value instanceof Long) {
return addConstantLong(((Long) value).longValue());
} else if (value instanceof Double) {
return addConstantDouble(((Double) value).doubleValue());
} else if (value instanceof String) {
return addConstantString((String) value);
} else if (value instanceof Type) {
Type type = (Type) value;
int typeSort = type.getSort();
if (typeSort == Type.OBJECT) {
return addConstantClass(type.getInternalName());
} else if (typeSort == Type.METHOD) {
return addConstantMethodType(type.getDescriptor());
} else { // type is a primitive or array type.
return addConstantClass(type.getDescriptor());
}
} else if (value instanceof Handle) {
Handle handle = (Handle) value;
return addConstantMethodHandle(
handle.getTag(),
handle.getOwner(),
handle.getName(),
handle.getDesc(),
handle.isInterface());
} else {
throw new IllegalArgumentException("value " + value);
}
} | class class_name[name] begin[{]
method[addConstant, return_type[type[Symbol]], modifier[default], parameter[value]] begin[{]
if[binary_operation[member[.value], instanceof, type[Integer]]] begin[{]
return[call[.addConstantInteger, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Byte]]] begin[{]
return[call[.addConstantInteger, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Byte, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Character]]] begin[{]
return[call[.addConstantInteger, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Character, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Short]]] begin[{]
return[call[.addConstantInteger, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Short, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Boolean]]] begin[{]
return[call[.addConstantInteger, parameter[TernaryExpression(condition=Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None)), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Float]]] begin[{]
return[call[.addConstantFloat, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Float, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Long]]] begin[{]
return[call[.addConstantLong, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Double]]] begin[{]
return[call[.addConstantDouble, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[String]]] begin[{]
return[call[.addConstantString, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Type]]] begin[{]
local_variable[type[Type], type]
local_variable[type[int], typeSort]
if[binary_operation[member[.typeSort], ==, member[Type.OBJECT]]] begin[{]
return[call[.addConstantClass, parameter[call[type.getInternalName, parameter[]]]]]
else begin[{]
if[binary_operation[member[.typeSort], ==, member[Type.METHOD]]] begin[{]
return[call[.addConstantMethodType, parameter[call[type.getDescriptor, parameter[]]]]]
else begin[{]
return[call[.addConstantClass, parameter[call[type.getDescriptor, parameter[]]]]]
end[}]
end[}]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Handle]]] begin[{]
local_variable[type[Handle], handle]
return[call[.addConstantMethodHandle, parameter[call[handle.getTag, parameter[]], call[handle.getOwner, parameter[]], call[handle.getName, parameter[]], call[handle.getDesc, parameter[]], call[handle.isInterface, parameter[]]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="value "), operandr=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | identifier[Symbol] identifier[addConstant] operator[SEP] Keyword[final] identifier[Object] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Integer] operator[SEP] {
Keyword[return] identifier[addConstantInteger] operator[SEP] operator[SEP] operator[SEP] identifier[Integer] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Byte] operator[SEP] {
Keyword[return] identifier[addConstantInteger] operator[SEP] operator[SEP] operator[SEP] identifier[Byte] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Character] operator[SEP] {
Keyword[return] identifier[addConstantInteger] operator[SEP] operator[SEP] operator[SEP] identifier[Character] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[charValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Short] operator[SEP] {
Keyword[return] identifier[addConstantInteger] operator[SEP] operator[SEP] operator[SEP] identifier[Short] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Boolean] operator[SEP] {
Keyword[return] identifier[addConstantInteger] operator[SEP] operator[SEP] operator[SEP] identifier[Boolean] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[?] Other[1] operator[:] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Float] operator[SEP] {
Keyword[return] identifier[addConstantFloat] operator[SEP] operator[SEP] operator[SEP] identifier[Float] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[floatValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Long] operator[SEP] {
Keyword[return] identifier[addConstantLong] operator[SEP] operator[SEP] operator[SEP] identifier[Long] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[longValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Double] operator[SEP] {
Keyword[return] identifier[addConstantDouble] operator[SEP] operator[SEP] operator[SEP] identifier[Double] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[String] operator[SEP] {
Keyword[return] identifier[addConstantString] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Type] operator[SEP] {
identifier[Type] identifier[type] operator[=] operator[SEP] identifier[Type] operator[SEP] identifier[value] operator[SEP] Keyword[int] identifier[typeSort] operator[=] identifier[type] operator[SEP] identifier[getSort] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[typeSort] operator[==] identifier[Type] operator[SEP] identifier[OBJECT] operator[SEP] {
Keyword[return] identifier[addConstantClass] operator[SEP] identifier[type] operator[SEP] identifier[getInternalName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[typeSort] operator[==] identifier[Type] operator[SEP] identifier[METHOD] operator[SEP] {
Keyword[return] identifier[addConstantMethodType] operator[SEP] identifier[type] operator[SEP] identifier[getDescriptor] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[addConstantClass] operator[SEP] identifier[type] operator[SEP] identifier[getDescriptor] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Handle] operator[SEP] {
identifier[Handle] identifier[handle] operator[=] operator[SEP] identifier[Handle] operator[SEP] identifier[value] operator[SEP] Keyword[return] identifier[addConstantMethodHandle] operator[SEP] identifier[handle] operator[SEP] identifier[getTag] operator[SEP] operator[SEP] , identifier[handle] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] , identifier[handle] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[handle] operator[SEP] identifier[getDesc] operator[SEP] operator[SEP] , identifier[handle] operator[SEP] identifier[isInterface] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[value] operator[SEP] operator[SEP]
}
}
|
private void trackFeatures(Image input, RectangleRotate_F64 region) {
pairs.reset();
currentImage.process(input);
for( int i = 0; i < currentImage.getNumLayers(); i++ ) {
Image layer = currentImage.getLayer(i);
gradient.process(layer,currentDerivX[i],currentDerivY[i]);
}
// convert to float to avoid excessive conversions from double to float
float cx = (float)region.cx;
float cy = (float)region.cy;
float height = (float)(region.height);
float width = (float)(region.width);
float c = (float)Math.cos(region.theta);
float s = (float)Math.sin(region.theta);
float p = 1.0f/(config.numberOfSamples-1);
for( int i = 0; i < config.numberOfSamples; i++ ) {
float y = (p*i-0.5f)*height;
for( int j = 0; j < config.numberOfSamples; j++ ) {
float x = (p*j - 0.5f)*width;
float xx = cx + x*c - y*s;
float yy = cy + x*s + y*c;
// track in the forward direction
track.x = xx;
track.y = yy;
klt.setImage(previousImage,previousDerivX,previousDerivY);
if( !klt.setDescription(track) ) {
continue;
}
klt.setImage(currentImage,currentDerivX,currentDerivY);
KltTrackFault fault = klt.track(track);
if( fault != KltTrackFault.SUCCESS ) {
continue;
}
float xc = track.x;
float yc = track.y;
// validate by tracking backwards
if( !klt.setDescription(track) ) {
continue;
}
klt.setImage(previousImage,previousDerivX,previousDerivY);
fault = klt.track(track);
if( fault != KltTrackFault.SUCCESS ) {
continue;
}
float error = UtilPoint2D_F32.distanceSq(track.x, track.y, xx, yy);
if( error > maximumErrorFB ) {
continue;
}
// create a list of the observations
AssociatedPair a = pairs.grow();
a.p1.x = xx;
a.p1.y = yy;
a.p2.x = xc;
a.p2.y = yc;
}
}
} | class class_name[name] begin[{]
method[trackFeatures, return_type[void], modifier[private], parameter[input, region]] begin[{]
call[pairs.reset, parameter[]]
call[currentImage.process, parameter[member[.input]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLayer, postfix_operators=[], prefix_operators=[], qualifier=currentImage, selectors=[], type_arguments=None), name=layer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Image, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=layer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentDerivX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=currentDerivY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=process, postfix_operators=[], prefix_operators=[], qualifier=gradient, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getNumLayers, postfix_operators=[], prefix_operators=[], qualifier=currentImage, 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)
local_variable[type[float], cx]
local_variable[type[float], cy]
local_variable[type[float], height]
local_variable[type[float], width]
local_variable[type[float], c]
local_variable[type[float], s]
local_variable[type[float], p]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.5f), operator=-), operandr=MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), name=y)], modifiers=set(), type=BasicType(dimensions=[], name=float)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0.5f), operator=-), operandr=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), name=x)], modifiers=set(), type=BasicType(dimensions=[], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=cx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=-), name=xx)], modifiers=set(), type=BasicType(dimensions=[], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=cy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), operandr=BinaryOperation(operandl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), name=yy)], modifiers=set(), type=BasicType(dimensions=[], name=float)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=track, selectors=[]), type==, value=MemberReference(member=xx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=track, selectors=[]), type==, value=MemberReference(member=yy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=previousImage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=previousDerivX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=previousDerivY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setImage, postfix_operators=[], prefix_operators=[], qualifier=klt, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=track, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDescription, postfix_operators=[], prefix_operators=['!'], qualifier=klt, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=currentImage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentDerivX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentDerivY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setImage, postfix_operators=[], prefix_operators=[], qualifier=klt, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=track, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=track, postfix_operators=[], prefix_operators=[], qualifier=klt, selectors=[], type_arguments=None), name=fault)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=KltTrackFault, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=fault, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SUCCESS, postfix_operators=[], prefix_operators=[], qualifier=KltTrackFault, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=track, selectors=[]), name=xc)], modifiers=set(), type=BasicType(dimensions=[], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=track, selectors=[]), name=yc)], modifiers=set(), type=BasicType(dimensions=[], name=float)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=track, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDescription, postfix_operators=[], prefix_operators=['!'], qualifier=klt, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=previousImage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=previousDerivX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=previousDerivY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setImage, postfix_operators=[], prefix_operators=[], qualifier=klt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=fault, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=track, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=track, postfix_operators=[], prefix_operators=[], qualifier=klt, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=fault, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SUCCESS, postfix_operators=[], prefix_operators=[], qualifier=KltTrackFault, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=track, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=track, selectors=[]), MemberReference(member=xx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=yy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=distanceSq, postfix_operators=[], prefix_operators=[], qualifier=UtilPoint2D_F32, selectors=[], type_arguments=None), name=error)], modifiers=set(), type=BasicType(dimensions=[], name=float)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=maximumErrorFB, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=grow, postfix_operators=[], prefix_operators=[], qualifier=pairs, selectors=[], type_arguments=None), name=a)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AssociatedPair, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=a.p1, selectors=[]), type==, value=MemberReference(member=xx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=a.p1, selectors=[]), type==, value=MemberReference(member=yy, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=a.p2, selectors=[]), type==, value=MemberReference(member=xc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=a.p2, selectors=[]), type==, value=MemberReference(member=yc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numberOfSamples, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numberOfSamples, postfix_operators=[], prefix_operators=[], qualifier=config, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[trackFeatures] operator[SEP] identifier[Image] identifier[input] , identifier[RectangleRotate_F64] identifier[region] operator[SEP] {
identifier[pairs] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[currentImage] operator[SEP] identifier[process] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[currentImage] operator[SEP] identifier[getNumLayers] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Image] identifier[layer] operator[=] identifier[currentImage] operator[SEP] identifier[getLayer] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[gradient] operator[SEP] identifier[process] operator[SEP] identifier[layer] , identifier[currentDerivX] operator[SEP] identifier[i] operator[SEP] , identifier[currentDerivY] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[float] identifier[cx] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[region] operator[SEP] identifier[cx] operator[SEP] Keyword[float] identifier[cy] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[region] operator[SEP] identifier[cy] operator[SEP] Keyword[float] identifier[height] operator[=] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[region] operator[SEP] identifier[height] operator[SEP] operator[SEP] Keyword[float] identifier[width] operator[=] operator[SEP] Keyword[float] operator[SEP] operator[SEP] identifier[region] operator[SEP] identifier[width] operator[SEP] operator[SEP] Keyword[float] identifier[c] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[cos] operator[SEP] identifier[region] operator[SEP] identifier[theta] operator[SEP] operator[SEP] Keyword[float] identifier[s] operator[=] operator[SEP] Keyword[float] operator[SEP] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[region] operator[SEP] identifier[theta] operator[SEP] operator[SEP] Keyword[float] identifier[p] operator[=] literal[Float] operator[/] operator[SEP] identifier[config] operator[SEP] identifier[numberOfSamples] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[config] operator[SEP] identifier[numberOfSamples] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[float] identifier[y] operator[=] operator[SEP] identifier[p] operator[*] identifier[i] operator[-] literal[Float] operator[SEP] operator[*] identifier[height] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[config] operator[SEP] identifier[numberOfSamples] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[float] identifier[x] operator[=] operator[SEP] identifier[p] operator[*] identifier[j] operator[-] literal[Float] operator[SEP] operator[*] identifier[width] operator[SEP] Keyword[float] identifier[xx] operator[=] identifier[cx] operator[+] identifier[x] operator[*] identifier[c] operator[-] identifier[y] operator[*] identifier[s] operator[SEP] Keyword[float] identifier[yy] operator[=] identifier[cy] operator[+] identifier[x] operator[*] identifier[s] operator[+] identifier[y] operator[*] identifier[c] operator[SEP] identifier[track] operator[SEP] identifier[x] operator[=] identifier[xx] operator[SEP] identifier[track] operator[SEP] identifier[y] operator[=] identifier[yy] operator[SEP] identifier[klt] operator[SEP] identifier[setImage] operator[SEP] identifier[previousImage] , identifier[previousDerivX] , identifier[previousDerivY] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[klt] operator[SEP] identifier[setDescription] operator[SEP] identifier[track] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[klt] operator[SEP] identifier[setImage] operator[SEP] identifier[currentImage] , identifier[currentDerivX] , identifier[currentDerivY] operator[SEP] operator[SEP] identifier[KltTrackFault] identifier[fault] operator[=] identifier[klt] operator[SEP] identifier[track] operator[SEP] identifier[track] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fault] operator[!=] identifier[KltTrackFault] operator[SEP] identifier[SUCCESS] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[float] identifier[xc] operator[=] identifier[track] operator[SEP] identifier[x] operator[SEP] Keyword[float] identifier[yc] operator[=] identifier[track] operator[SEP] identifier[y] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[klt] operator[SEP] identifier[setDescription] operator[SEP] identifier[track] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[klt] operator[SEP] identifier[setImage] operator[SEP] identifier[previousImage] , identifier[previousDerivX] , identifier[previousDerivY] operator[SEP] operator[SEP] identifier[fault] operator[=] identifier[klt] operator[SEP] identifier[track] operator[SEP] identifier[track] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fault] operator[!=] identifier[KltTrackFault] operator[SEP] identifier[SUCCESS] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[float] identifier[error] operator[=] identifier[UtilPoint2D_F32] operator[SEP] identifier[distanceSq] operator[SEP] identifier[track] operator[SEP] identifier[x] , identifier[track] operator[SEP] identifier[y] , identifier[xx] , identifier[yy] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[error] operator[>] identifier[maximumErrorFB] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[AssociatedPair] identifier[a] operator[=] identifier[pairs] operator[SEP] identifier[grow] operator[SEP] operator[SEP] operator[SEP] identifier[a] operator[SEP] identifier[p1] operator[SEP] identifier[x] operator[=] identifier[xx] operator[SEP] identifier[a] operator[SEP] identifier[p1] operator[SEP] identifier[y] operator[=] identifier[yy] operator[SEP] identifier[a] operator[SEP] identifier[p2] operator[SEP] identifier[x] operator[=] identifier[xc] operator[SEP] identifier[a] operator[SEP] identifier[p2] operator[SEP] identifier[y] operator[=] identifier[yc] operator[SEP]
}
}
}
|
@Nonnull
public static <T> LObjIntConsumerBuilder<T> objIntConsumer(Consumer<LObjIntConsumer<T>> consumer) {
return new LObjIntConsumerBuilder(consumer);
} | class class_name[name] begin[{]
method[objIntConsumer, return_type[type[LObjIntConsumerBuilder]], modifier[public static], parameter[consumer]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=consumer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LObjIntConsumerBuilder, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[LObjIntConsumerBuilder] operator[<] identifier[T] operator[>] identifier[objIntConsumer] operator[SEP] identifier[Consumer] operator[<] identifier[LObjIntConsumer] operator[<] identifier[T] operator[>] operator[>] identifier[consumer] operator[SEP] {
Keyword[return] Keyword[new] identifier[LObjIntConsumerBuilder] operator[SEP] identifier[consumer] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("deprecation")
private static String getInputTypeFromCellType(final Cell cell) {
String inputType = TieConstants.CELL_INPUT_TYPE_TEXT;
if (cell.getCellTypeEnum() == CellType.NUMERIC) {
inputType = TieConstants.CELL_INPUT_TYPE_DOUBLE;
}
CellStyle style = cell.getCellStyle();
if (style != null) {
int formatIndex = style.getDataFormat();
String formatString = style.getDataFormatString();
if (DateUtil.isADateFormat(formatIndex, formatString)) {
inputType = TieConstants.CELL_INPUT_TYPE_DATE;
} else {
if (isAPercentageCell(formatString)) {
inputType = TieConstants.CELL_INPUT_TYPE_PERCENTAGE;
}
}
}
return inputType;
} | class class_name[name] begin[{]
method[getInputTypeFromCellType, return_type[type[String]], modifier[private static], parameter[cell]] begin[{]
local_variable[type[String], inputType]
if[binary_operation[call[cell.getCellTypeEnum, parameter[]], ==, member[CellType.NUMERIC]]] begin[{]
assign[member[.inputType], member[TieConstants.CELL_INPUT_TYPE_DOUBLE]]
else begin[{]
None
end[}]
local_variable[type[CellStyle], style]
if[binary_operation[member[.style], !=, literal[null]]] begin[{]
local_variable[type[int], formatIndex]
local_variable[type[String], formatString]
if[call[DateUtil.isADateFormat, parameter[member[.formatIndex], member[.formatString]]]] begin[{]
assign[member[.inputType], member[TieConstants.CELL_INPUT_TYPE_DATE]]
else begin[{]
if[call[.isAPercentageCell, parameter[member[.formatString]]]] begin[{]
assign[member[.inputType], member[TieConstants.CELL_INPUT_TYPE_PERCENTAGE]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
return[member[.inputType]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] Keyword[static] identifier[String] identifier[getInputTypeFromCellType] operator[SEP] Keyword[final] identifier[Cell] identifier[cell] operator[SEP] {
identifier[String] identifier[inputType] operator[=] identifier[TieConstants] operator[SEP] identifier[CELL_INPUT_TYPE_TEXT] operator[SEP] Keyword[if] operator[SEP] identifier[cell] operator[SEP] identifier[getCellTypeEnum] operator[SEP] operator[SEP] operator[==] identifier[CellType] operator[SEP] identifier[NUMERIC] operator[SEP] {
identifier[inputType] operator[=] identifier[TieConstants] operator[SEP] identifier[CELL_INPUT_TYPE_DOUBLE] operator[SEP]
}
identifier[CellStyle] identifier[style] operator[=] identifier[cell] operator[SEP] identifier[getCellStyle] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[style] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[formatIndex] operator[=] identifier[style] operator[SEP] identifier[getDataFormat] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[formatString] operator[=] identifier[style] operator[SEP] identifier[getDataFormatString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DateUtil] operator[SEP] identifier[isADateFormat] operator[SEP] identifier[formatIndex] , identifier[formatString] operator[SEP] operator[SEP] {
identifier[inputType] operator[=] identifier[TieConstants] operator[SEP] identifier[CELL_INPUT_TYPE_DATE] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[isAPercentageCell] operator[SEP] identifier[formatString] operator[SEP] operator[SEP] {
identifier[inputType] operator[=] identifier[TieConstants] operator[SEP] identifier[CELL_INPUT_TYPE_PERCENTAGE] operator[SEP]
}
}
}
Keyword[return] identifier[inputType] operator[SEP]
}
|
@SuppressWarnings("fallthrough")
protected DCReference reference(boolean allowMember) throws ParseException {
int pos = bp;
int depth = 0;
// scan to find the end of the signature, by looking for the first
// whitespace not enclosed in () or <>, or the end of the tag
loop:
while (bp < buflen) {
switch (ch) {
case '\n': case '\r': case '\f':
newline = true;
// fallthrough
case ' ': case '\t':
if (depth == 0)
break loop;
break;
case '(':
case '<':
newline = false;
depth++;
break;
case ')':
case '>':
newline = false;
--depth;
break;
case '}':
if (bp == pos)
return null;
newline = false;
break loop;
case '@':
if (newline)
break loop;
// fallthrough
default:
newline = false;
}
nextChar();
}
if (depth != 0)
throw new ParseException("dc.unterminated.signature");
String sig = newString(pos, bp);
// Break sig apart into qualifiedExpr member paramTypes.
JCTree qualExpr;
Name member;
List<JCTree> paramTypes;
Log.DeferredDiagnosticHandler deferredDiagnosticHandler
= new Log.DeferredDiagnosticHandler(fac.log);
try {
int hash = sig.indexOf("#");
int lparen = sig.indexOf("(", hash + 1);
if (hash == -1) {
if (lparen == -1) {
qualExpr = parseType(sig);
member = null;
} else {
qualExpr = null;
member = parseMember(sig.substring(0, lparen));
}
} else {
qualExpr = (hash == 0) ? null : parseType(sig.substring(0, hash));
if (lparen == -1)
member = parseMember(sig.substring(hash + 1));
else
member = parseMember(sig.substring(hash + 1, lparen));
}
if (lparen < 0) {
paramTypes = null;
} else {
int rparen = sig.indexOf(")", lparen);
if (rparen != sig.length() - 1)
throw new ParseException("dc.ref.bad.parens");
paramTypes = parseParams(sig.substring(lparen + 1, rparen));
}
if (!deferredDiagnosticHandler.getDiagnostics().isEmpty())
throw new ParseException("dc.ref.syntax.error");
} finally {
fac.log.popDiagnosticHandler(deferredDiagnosticHandler);
}
return m.at(pos).newReferenceTree(sig, qualExpr, member, paramTypes).setEndPos(bp);
} | class class_name[name] begin[{]
method[reference, return_type[type[DCReference]], modifier[protected], parameter[allowMember]] begin[{]
local_variable[type[int], pos]
local_variable[type[int], depth]
while[binary_operation[member[.bp], <, member[.buflen]]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\r'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\f')], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\t')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=depth, 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=BreakStatement(goto=loop, label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='('), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='<')], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), StatementExpression(expression=MemberReference(member=depth, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=')'), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='>')], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), StatementExpression(expression=MemberReference(member=depth, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='}')], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), BreakStatement(goto=loop, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='@')], statements=[IfStatement(condition=MemberReference(member=newline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BreakStatement(goto=loop, label=None))]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])], expression=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
call[.nextChar, parameter[]]
end[}]
if[binary_operation[member[.depth], !=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dc.unterminated.signature")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], sig]
local_variable[type[JCTree], qualExpr]
local_variable[type[Name], member]
local_variable[type[List], paramTypes]
local_variable[type[Log], deferredDiagnosticHandler]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="#")], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None), name=hash)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="("), BinaryOperation(operandl=MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None), name=lparen)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=qualExpr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None)], member=parseType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lparen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=member, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=lparen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None)], member=parseMember, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=member, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=hash, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None)], member=parseMember, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lparen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=qualExpr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=member, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=lparen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None)], member=parseMember, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=qualExpr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=sig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=member, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)]))])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=lparen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), MemberReference(member=lparen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None), name=rparen)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=rparen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=!=), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dc.ref.bad.parens")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None)), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=paramTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=lparen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=rparen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=sig, selectors=[], type_arguments=None)], member=parseParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=paramTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=getDiagnostics, postfix_operators=[], prefix_operators=['!'], qualifier=deferredDiagnosticHandler, selectors=[MethodInvocation(arguments=[], member=isEmpty, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dc.ref.syntax.error")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParseException, sub_type=None)), label=None))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=deferredDiagnosticHandler, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=popDiagnosticHandler, postfix_operators=[], prefix_operators=[], qualifier=fac.log, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
return[call[m.at, parameter[member[.pos]]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] identifier[DCReference] identifier[reference] operator[SEP] Keyword[boolean] identifier[allowMember] operator[SEP] Keyword[throws] identifier[ParseException] {
Keyword[int] identifier[pos] operator[=] identifier[bp] operator[SEP] Keyword[int] identifier[depth] operator[=] Other[0] operator[SEP] identifier[loop] operator[:] Keyword[while] operator[SEP] identifier[bp] operator[<] identifier[buflen] operator[SEP] {
Keyword[switch] operator[SEP] identifier[ch] operator[SEP] {
Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] identifier[newline] operator[=] literal[boolean] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[depth] operator[==] Other[0] operator[SEP] Keyword[break] identifier[loop] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] identifier[newline] operator[=] literal[boolean] operator[SEP] identifier[depth] operator[++] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[case] literal[String] operator[:] identifier[newline] operator[=] literal[boolean] operator[SEP] operator[--] identifier[depth] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[bp] operator[==] identifier[pos] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[newline] operator[=] literal[boolean] operator[SEP] Keyword[break] identifier[loop] operator[SEP] Keyword[case] literal[String] operator[:] Keyword[if] operator[SEP] identifier[newline] operator[SEP] Keyword[break] identifier[loop] operator[SEP] Keyword[default] operator[:] identifier[newline] operator[=] literal[boolean] operator[SEP]
}
identifier[nextChar] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[depth] operator[!=] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[ParseException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[sig] operator[=] identifier[newString] operator[SEP] identifier[pos] , identifier[bp] operator[SEP] operator[SEP] identifier[JCTree] identifier[qualExpr] operator[SEP] identifier[Name] identifier[member] operator[SEP] identifier[List] operator[<] identifier[JCTree] operator[>] identifier[paramTypes] operator[SEP] identifier[Log] operator[SEP] identifier[DeferredDiagnosticHandler] identifier[deferredDiagnosticHandler] operator[=] Keyword[new] identifier[Log] operator[SEP] identifier[DeferredDiagnosticHandler] operator[SEP] identifier[fac] operator[SEP] identifier[log] operator[SEP] operator[SEP] Keyword[try] {
Keyword[int] identifier[hash] operator[=] identifier[sig] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[lparen] operator[=] identifier[sig] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[hash] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hash] operator[==] operator[-] Other[1] operator[SEP] {
Keyword[if] operator[SEP] identifier[lparen] operator[==] operator[-] Other[1] operator[SEP] {
identifier[qualExpr] operator[=] identifier[parseType] operator[SEP] identifier[sig] operator[SEP] operator[SEP] identifier[member] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
identifier[qualExpr] operator[=] Other[null] operator[SEP] identifier[member] operator[=] identifier[parseMember] operator[SEP] identifier[sig] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[lparen] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[qualExpr] operator[=] operator[SEP] identifier[hash] operator[==] Other[0] operator[SEP] operator[?] Other[null] operator[:] identifier[parseType] operator[SEP] identifier[sig] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[hash] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lparen] operator[==] operator[-] Other[1] operator[SEP] identifier[member] operator[=] identifier[parseMember] operator[SEP] identifier[sig] operator[SEP] identifier[substring] operator[SEP] identifier[hash] operator[+] Other[1] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[member] operator[=] identifier[parseMember] operator[SEP] identifier[sig] operator[SEP] identifier[substring] operator[SEP] identifier[hash] operator[+] Other[1] , identifier[lparen] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lparen] operator[<] Other[0] operator[SEP] {
identifier[paramTypes] operator[=] Other[null] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[rparen] operator[=] identifier[sig] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[lparen] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[rparen] operator[!=] identifier[sig] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] Keyword[throw] Keyword[new] identifier[ParseException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[paramTypes] operator[=] identifier[parseParams] operator[SEP] identifier[sig] operator[SEP] identifier[substring] operator[SEP] identifier[lparen] operator[+] Other[1] , identifier[rparen] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[deferredDiagnosticHandler] operator[SEP] identifier[getDiagnostics] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ParseException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[fac] operator[SEP] identifier[log] operator[SEP] identifier[popDiagnosticHandler] operator[SEP] identifier[deferredDiagnosticHandler] operator[SEP] operator[SEP]
}
Keyword[return] identifier[m] operator[SEP] identifier[at] operator[SEP] identifier[pos] operator[SEP] operator[SEP] identifier[newReferenceTree] operator[SEP] identifier[sig] , identifier[qualExpr] , identifier[member] , identifier[paramTypes] operator[SEP] operator[SEP] identifier[setEndPos] operator[SEP] identifier[bp] operator[SEP] operator[SEP]
}
|
public void doMutation(double probability, BinarySolution solution) {
for (int i = 0; i < solution.getNumberOfVariables(); i++) {
for (int j = 0; j < solution.getVariableValue(i).getBinarySetLength(); j++) {
if (randomGenerator.getRandomValue() <= probability) {
solution.getVariableValue(i).flip(j);
}
}
}
} | class class_name[name] begin[{]
method[doMutation, return_type[void], modifier[public], parameter[probability, solution]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getRandomValue, postfix_operators=[], prefix_operators=[], qualifier=randomGenerator, selectors=[], type_arguments=None), operandr=MemberReference(member=probability, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getVariableValue, postfix_operators=[], prefix_operators=[], qualifier=solution, selectors=[MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=flip, 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=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getVariableValue, postfix_operators=[], prefix_operators=[], qualifier=solution, selectors=[MethodInvocation(arguments=[], member=getBinarySetLength, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], 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=getNumberOfVariables, postfix_operators=[], prefix_operators=[], qualifier=solution, 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)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[doMutation] operator[SEP] Keyword[double] identifier[probability] , identifier[BinarySolution] identifier[solution] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[solution] operator[SEP] identifier[getNumberOfVariables] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[solution] operator[SEP] identifier[getVariableValue] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getBinarySetLength] operator[SEP] operator[SEP] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[randomGenerator] operator[SEP] identifier[getRandomValue] operator[SEP] operator[SEP] operator[<=] identifier[probability] operator[SEP] {
identifier[solution] operator[SEP] identifier[getVariableValue] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[flip] operator[SEP] identifier[j] operator[SEP] operator[SEP]
}
}
}
}
|
@Nonnull
public JSDefinedClass removeField (@Nonnull final JSFieldVar aField)
{
ValueEnforcer.notNull (aField, "Field");
if (m_aFields.remove (aField.name ()) != aField)
throw new IllegalArgumentException ("Failed to remove field '" +
aField.name () +
"' from " +
m_aFields.keySet ());
return this;
} | class class_name[name] begin[{]
method[removeField, return_type[type[JSDefinedClass]], modifier[public], parameter[aField]] begin[{]
call[ValueEnforcer.notNull, parameter[member[.aField], literal["Field"]]]
if[binary_operation[call[m_aFields.remove, parameter[call[aField.name, parameter[]]]], !=, member[.aField]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to remove field '"), operandr=MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=aField, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' from "), operator=+), operandr=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=m_aFields, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] identifier[JSDefinedClass] identifier[removeField] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[JSFieldVar] identifier[aField] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[aField] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_aFields] operator[SEP] identifier[remove] operator[SEP] identifier[aField] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[SEP] operator[!=] identifier[aField] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[aField] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[m_aFields] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static void preApproveSubscriptionIfRequiredAndPossible(Roster roster, BareJid jid)
throws NotLoggedInException, NotConnectedException, InterruptedException {
if (!roster.isSubscriptionPreApprovalSupported()) {
return;
}
RosterEntry entry = roster.getEntry(jid);
if (entry == null || (!entry.canSeeMyPresence() && !entry.isApproved())) {
try {
roster.preApprove(jid);
} catch (FeatureNotSupportedException e) {
// Should never happen since we checked for the feature above.
throw new AssertionError(e);
}
}
} | class class_name[name] begin[{]
method[preApproveSubscriptionIfRequiredAndPossible, return_type[void], modifier[public static], parameter[roster, jid]] begin[{]
if[call[roster.isSubscriptionPreApprovalSupported, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[RosterEntry], entry]
if[binary_operation[binary_operation[member[.entry], ==, literal[null]], ||, binary_operation[call[entry.canSeeMyPresence, parameter[]], &&, call[entry.isApproved, parameter[]]]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=preApprove, postfix_operators=[], prefix_operators=[], qualifier=roster, 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=AssertionError, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['FeatureNotSupportedException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[preApproveSubscriptionIfRequiredAndPossible] operator[SEP] identifier[Roster] identifier[roster] , identifier[BareJid] identifier[jid] operator[SEP] Keyword[throws] identifier[NotLoggedInException] , identifier[NotConnectedException] , identifier[InterruptedException] {
Keyword[if] operator[SEP] operator[!] identifier[roster] operator[SEP] identifier[isSubscriptionPreApprovalSupported] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[RosterEntry] identifier[entry] operator[=] identifier[roster] operator[SEP] identifier[getEntry] operator[SEP] identifier[jid] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[==] Other[null] operator[||] operator[SEP] operator[!] identifier[entry] operator[SEP] identifier[canSeeMyPresence] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[entry] operator[SEP] identifier[isApproved] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[roster] operator[SEP] identifier[preApprove] operator[SEP] identifier[jid] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[FeatureNotSupportedException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AssertionError] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public static void begin(ServletRequest request,
ServletResponse response,
String serviceName,
String objectId)
throws ServletException
{
ServiceContext context = (ServiceContext) _localContext.get();
if (context == null) {
context = new ServiceContext();
_localContext.set(context);
}
context._request = request;
context._response = response;
context._serviceName = serviceName;
context._objectId = objectId;
context._count++;
} | class class_name[name] begin[{]
method[begin, return_type[void], modifier[public static], parameter[request, response, serviceName, objectId]] begin[{]
local_variable[type[ServiceContext], context]
if[binary_operation[member[.context], ==, literal[null]]] begin[{]
assign[member[.context], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServiceContext, sub_type=None))]
call[_localContext.set, parameter[member[.context]]]
else begin[{]
None
end[}]
assign[member[context._request], member[.request]]
assign[member[context._response], member[.response]]
assign[member[context._serviceName], member[.serviceName]]
assign[member[context._objectId], member[.objectId]]
member[context._count]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[begin] operator[SEP] identifier[ServletRequest] identifier[request] , identifier[ServletResponse] identifier[response] , identifier[String] identifier[serviceName] , identifier[String] identifier[objectId] operator[SEP] Keyword[throws] identifier[ServletException] {
identifier[ServiceContext] identifier[context] operator[=] operator[SEP] identifier[ServiceContext] operator[SEP] identifier[_localContext] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[context] operator[==] Other[null] operator[SEP] {
identifier[context] operator[=] Keyword[new] identifier[ServiceContext] operator[SEP] operator[SEP] operator[SEP] identifier[_localContext] operator[SEP] identifier[set] operator[SEP] identifier[context] operator[SEP] operator[SEP]
}
identifier[context] operator[SEP] identifier[_request] operator[=] identifier[request] operator[SEP] identifier[context] operator[SEP] identifier[_response] operator[=] identifier[response] operator[SEP] identifier[context] operator[SEP] identifier[_serviceName] operator[=] identifier[serviceName] operator[SEP] identifier[context] operator[SEP] identifier[_objectId] operator[=] identifier[objectId] operator[SEP] identifier[context] operator[SEP] identifier[_count] operator[++] operator[SEP]
}
|
private void processRequireCall(NodeTraversal t, Node n, Node parent) {
Node left = n.getFirstChild();
Node arg = left.getNext();
String method = left.getFirstChild().getNext().getString();
if (verifyLastArgumentIsString(left, arg)) {
String ns = arg.getString();
ProvidedName provided = providedNames.get(ns);
if (provided == null || !provided.isExplicitlyProvided()) {
unrecognizedRequires.add(new UnrecognizedRequire(n, ns, method.equals("requireType")));
} else {
JSModule providedModule = provided.explicitModule;
if (!provided.isFromExterns()) {
checkNotNull(providedModule, n);
JSModule module = t.getModule();
// A cross-chunk goog.require must match a goog.provide in an earlier chunk. However, a
// cross-chunk goog.requireType is allowed to match a goog.provide in a later chunk.
if (module != providedModule
&& !moduleGraph.dependsOn(module, providedModule)
&& !method.equals("requireType")) {
compiler.report(
JSError.make(
n,
ProcessClosurePrimitives.XMODULE_REQUIRE_ERROR,
ns,
providedModule.getName(),
module.getName()));
}
}
}
maybeAddNameToSymbolTable(left);
maybeAddStringToSymbolTable(arg);
// Requires should be removed before further processing.
// Some clients run closure pass multiple times, first with
// the checks for broken requires turned off. In these cases, we
// allow broken requires to be preserved by the first run to
// let them be caught in the subsequent run.
if (!preserveGoogProvidesAndRequires && (provided != null || requiresLevel.isOn())) {
requiresToBeRemoved.add(parent);
}
}
} | class class_name[name] begin[{]
method[processRequireCall, return_type[void], modifier[private], parameter[t, n, parent]] begin[{]
local_variable[type[Node], left]
local_variable[type[Node], arg]
local_variable[type[String], method]
if[call[.verifyLastArgumentIsString, parameter[member[.left], member[.arg]]]] begin[{]
local_variable[type[String], ns]
local_variable[type[ProvidedName], provided]
if[binary_operation[binary_operation[member[.provided], ==, literal[null]], ||, call[provided.isExplicitlyProvided, parameter[]]]] begin[{]
call[unrecognizedRequires.add, parameter[ClassCreator(arguments=[MemberReference(member=n, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="requireType")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnrecognizedRequire, sub_type=None))]]
else begin[{]
local_variable[type[JSModule], providedModule]
if[call[provided.isFromExterns, parameter[]]] begin[{]
call[.checkNotNull, parameter[member[.providedModule], member[.n]]]
local_variable[type[JSModule], module]
if[binary_operation[binary_operation[binary_operation[member[.module], !=, member[.providedModule]], &&, call[moduleGraph.dependsOn, parameter[member[.module], member[.providedModule]]]], &&, call[method.equals, parameter[literal["requireType"]]]]] begin[{]
call[compiler.report, parameter[call[JSError.make, parameter[member[.n], member[ProcessClosurePrimitives.XMODULE_REQUIRE_ERROR], member[.ns], call[providedModule.getName, parameter[]], call[module.getName, parameter[]]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
call[.maybeAddNameToSymbolTable, parameter[member[.left]]]
call[.maybeAddStringToSymbolTable, parameter[member[.arg]]]
if[binary_operation[member[.preserveGoogProvidesAndRequires], &&, binary_operation[binary_operation[member[.provided], !=, literal[null]], ||, call[requiresLevel.isOn, parameter[]]]]] begin[{]
call[requiresToBeRemoved.add, parameter[member[.parent]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[processRequireCall] operator[SEP] identifier[NodeTraversal] identifier[t] , identifier[Node] identifier[n] , identifier[Node] identifier[parent] operator[SEP] {
identifier[Node] identifier[left] operator[=] identifier[n] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[SEP] identifier[Node] identifier[arg] operator[=] identifier[left] operator[SEP] identifier[getNext] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[method] operator[=] identifier[left] operator[SEP] identifier[getFirstChild] operator[SEP] operator[SEP] operator[SEP] identifier[getNext] operator[SEP] operator[SEP] operator[SEP] identifier[getString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[verifyLastArgumentIsString] operator[SEP] identifier[left] , identifier[arg] operator[SEP] operator[SEP] {
identifier[String] identifier[ns] operator[=] identifier[arg] operator[SEP] identifier[getString] operator[SEP] operator[SEP] operator[SEP] identifier[ProvidedName] identifier[provided] operator[=] identifier[providedNames] operator[SEP] identifier[get] operator[SEP] identifier[ns] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[provided] operator[==] Other[null] operator[||] operator[!] identifier[provided] operator[SEP] identifier[isExplicitlyProvided] operator[SEP] operator[SEP] operator[SEP] {
identifier[unrecognizedRequires] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[UnrecognizedRequire] operator[SEP] identifier[n] , identifier[ns] , identifier[method] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[JSModule] identifier[providedModule] operator[=] identifier[provided] operator[SEP] identifier[explicitModule] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[provided] operator[SEP] identifier[isFromExterns] operator[SEP] operator[SEP] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[providedModule] , identifier[n] operator[SEP] operator[SEP] identifier[JSModule] identifier[module] operator[=] identifier[t] operator[SEP] identifier[getModule] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[module] operator[!=] identifier[providedModule] operator[&&] operator[!] identifier[moduleGraph] operator[SEP] identifier[dependsOn] operator[SEP] identifier[module] , identifier[providedModule] operator[SEP] operator[&&] operator[!] identifier[method] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[compiler] operator[SEP] identifier[report] operator[SEP] identifier[JSError] operator[SEP] identifier[make] operator[SEP] identifier[n] , identifier[ProcessClosurePrimitives] operator[SEP] identifier[XMODULE_REQUIRE_ERROR] , identifier[ns] , identifier[providedModule] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[module] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[maybeAddNameToSymbolTable] operator[SEP] identifier[left] operator[SEP] operator[SEP] identifier[maybeAddStringToSymbolTable] operator[SEP] identifier[arg] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[preserveGoogProvidesAndRequires] operator[&&] operator[SEP] identifier[provided] operator[!=] Other[null] operator[||] identifier[requiresLevel] operator[SEP] identifier[isOn] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[requiresToBeRemoved] operator[SEP] identifier[add] operator[SEP] identifier[parent] operator[SEP] operator[SEP]
}
}
}
|
public PurgeQueueResult purgeQueue(PurgeQueueRequest purgeQueueRequest)
throws AmazonServiceException, AmazonClientException {
LOG.warn("Calling purgeQueue deletes SQS messages without deleting their payload from S3.");
if (purgeQueueRequest == null) {
String errorMessage = "purgeQueueRequest cannot be null.";
LOG.error(errorMessage);
throw new AmazonClientException(errorMessage);
}
purgeQueueRequest.getRequestClientOptions().appendUserAgent(SQSExtendedClientConstants.USER_AGENT_HEADER);
return super.purgeQueue(purgeQueueRequest);
} | class class_name[name] begin[{]
method[purgeQueue, return_type[type[PurgeQueueResult]], modifier[public], parameter[purgeQueueRequest]] begin[{]
call[LOG.warn, parameter[literal["Calling purgeQueue deletes SQS messages without deleting their payload from S3."]]]
if[binary_operation[member[.purgeQueueRequest], ==, literal[null]]] begin[{]
local_variable[type[String], errorMessage]
call[LOG.error, parameter[member[.errorMessage]]]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=errorMessage, 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=AmazonClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[purgeQueueRequest.getRequestClientOptions, parameter[]]
return[SuperMethodInvocation(arguments=[MemberReference(member=purgeQueueRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=purgeQueue, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | Keyword[public] identifier[PurgeQueueResult] identifier[purgeQueue] operator[SEP] identifier[PurgeQueueRequest] identifier[purgeQueueRequest] operator[SEP] Keyword[throws] identifier[AmazonServiceException] , identifier[AmazonClientException] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[purgeQueueRequest] operator[==] Other[null] operator[SEP] {
identifier[String] identifier[errorMessage] operator[=] literal[String] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[errorMessage] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[AmazonClientException] operator[SEP] identifier[errorMessage] operator[SEP] operator[SEP]
}
identifier[purgeQueueRequest] operator[SEP] identifier[getRequestClientOptions] operator[SEP] operator[SEP] operator[SEP] identifier[appendUserAgent] operator[SEP] identifier[SQSExtendedClientConstants] operator[SEP] identifier[USER_AGENT_HEADER] operator[SEP] operator[SEP] Keyword[return] Keyword[super] operator[SEP] identifier[purgeQueue] operator[SEP] identifier[purgeQueueRequest] operator[SEP] operator[SEP]
}
|
public Setup setEnvironment(final Environment environment) {
switch (environment) {
case SANDBOX : this.environment = SANDBOX_URL; break;
case PRODUCTION : this.environment = PRODUCTION_URL; break;
case CONNECT_SANDBOX : this.environment = CONNECT_SANDBOX_URL; break;
case CONNECT_PRODUCTION : this.environment = CONNECT_PRODUCTION_URL; break;
default : this.environment = "";
}
return this;
} | class class_name[name] begin[{]
method[setEnvironment, return_type[type[Setup]], modifier[public], parameter[environment]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['SANDBOX'], statements=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=environment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=SANDBOX_URL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['PRODUCTION'], statements=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=environment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=PRODUCTION_URL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CONNECT_SANDBOX'], statements=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=environment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=CONNECT_SANDBOX_URL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['CONNECT_PRODUCTION'], statements=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=environment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=MemberReference(member=CONNECT_PRODUCTION_URL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=environment, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")), label=None)])], expression=MemberReference(member=environment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Setup] identifier[setEnvironment] operator[SEP] Keyword[final] identifier[Environment] identifier[environment] operator[SEP] {
Keyword[switch] operator[SEP] identifier[environment] operator[SEP] {
Keyword[case] identifier[SANDBOX] operator[:] Keyword[this] operator[SEP] identifier[environment] operator[=] identifier[SANDBOX_URL] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[PRODUCTION] operator[:] Keyword[this] operator[SEP] identifier[environment] operator[=] identifier[PRODUCTION_URL] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CONNECT_SANDBOX] operator[:] Keyword[this] operator[SEP] identifier[environment] operator[=] identifier[CONNECT_SANDBOX_URL] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[CONNECT_PRODUCTION] operator[:] Keyword[this] operator[SEP] identifier[environment] operator[=] identifier[CONNECT_PRODUCTION_URL] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[this] operator[SEP] identifier[environment] operator[=] literal[String] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public Optional<NrqlAlertCondition> update(NrqlAlertCondition condition)
{
return HTTP.PUT(String.format("/v2/alerts_nrql_conditions/%d.json", condition.getId()), condition, NRQL_ALERT_CONDITION);
} | class class_name[name] begin[{]
method[update, return_type[type[Optional]], modifier[public], parameter[condition]] begin[{]
return[call[HTTP.PUT, parameter[call[String.format, parameter[literal["/v2/alerts_nrql_conditions/%d.json"], call[condition.getId, parameter[]]]], member[.condition], member[.NRQL_ALERT_CONDITION]]]]
end[}]
END[}] | Keyword[public] identifier[Optional] operator[<] identifier[NrqlAlertCondition] operator[>] identifier[update] operator[SEP] identifier[NrqlAlertCondition] identifier[condition] operator[SEP] {
Keyword[return] identifier[HTTP] operator[SEP] identifier[PUT] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[condition] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] , identifier[condition] , identifier[NRQL_ALERT_CONDITION] operator[SEP] operator[SEP]
}
|
final GoogleCredential getDefaultCredential(HttpTransport transport, JsonFactory jsonFactory)
throws IOException {
synchronized (this) {
if (cachedCredential == null) {
cachedCredential = getDefaultCredentialUnsynchronized(transport, jsonFactory);
}
if (cachedCredential != null) {
return cachedCredential;
}
}
throw new IOException(String.format(
"The Application Default Credentials are not available. They are available if running "
+ "on Google App Engine, Google Compute Engine, or Google Cloud Shell. Otherwise, "
+ "the environment variable %s must be defined pointing to a file defining "
+ "the credentials. See %s for more information.",
CREDENTIAL_ENV_VAR,
HELP_PERMALINK));
} | class class_name[name] begin[{]
method[getDefaultCredential, return_type[type[GoogleCredential]], modifier[final], parameter[transport, jsonFactory]] begin[{]
SYNCHRONIZED[THIS[]] BEGIN[{]
if[binary_operation[member[.cachedCredential], ==, literal[null]]] begin[{]
assign[member[.cachedCredential], call[.getDefaultCredentialUnsynchronized, parameter[member[.transport], member[.jsonFactory]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.cachedCredential], !=, literal[null]]] begin[{]
return[member[.cachedCredential]]
else begin[{]
None
end[}]
END[}]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The Application Default Credentials are not available. They are available if running "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="on Google App Engine, Google Compute Engine, or Google Cloud Shell. Otherwise, "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="the environment variable %s must be defined pointing to a file defining "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="the credentials. See %s for more information."), operator=+), MemberReference(member=CREDENTIAL_ENV_VAR, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=HELP_PERMALINK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[final] identifier[GoogleCredential] identifier[getDefaultCredential] operator[SEP] identifier[HttpTransport] identifier[transport] , identifier[JsonFactory] identifier[jsonFactory] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] identifier[cachedCredential] operator[==] Other[null] operator[SEP] {
identifier[cachedCredential] operator[=] identifier[getDefaultCredentialUnsynchronized] operator[SEP] identifier[transport] , identifier[jsonFactory] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[cachedCredential] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[cachedCredential] operator[SEP]
}
}
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] operator[+] literal[String] operator[+] literal[String] , identifier[CREDENTIAL_ENV_VAR] , identifier[HELP_PERMALINK] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected int findPrototypeId(String s)
{
int id;
// #generated# Last update: 2009-05-25 16:01:00 EDT
{ id = 0; String X = null;
L: switch (s.length()) {
case 5: X="parse";id=Id_parse; break L;
case 8: X="toSource";id=Id_toSource; break L;
case 9: X="stringify";id=Id_stringify; break L;
}
if (X!=null && X!=s && !X.equals(s)) id = 0;
}
// #/generated#
return id;
} | class class_name[name] begin[{]
method[findPrototypeId, return_type[type[int]], modifier[protected], parameter[s]] begin[{]
local_variable[type[int], id]
assign[member[.id], literal[0]]
local_variable[type[String], X]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=X, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="parse")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=Id_parse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=L, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=X, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="toSource")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=Id_toSource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=L, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=9)], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=X, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="stringify")), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=Id_stringify, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=L, label=None)])], expression=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), label=L)
if[binary_operation[binary_operation[binary_operation[member[.X], !=, literal[null]], &&, binary_operation[member[.X], !=, member[.s]]], &&, call[X.equals, parameter[member[.s]]]]] begin[{]
assign[member[.id], literal[0]]
else begin[{]
None
end[}]
return[member[.id]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[int] identifier[findPrototypeId] operator[SEP] identifier[String] identifier[s] operator[SEP] {
Keyword[int] identifier[id] operator[SEP] {
identifier[id] operator[=] Other[0] operator[SEP] identifier[String] identifier[X] operator[=] Other[null] operator[SEP] identifier[L] operator[:] Keyword[switch] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] Other[5] operator[:] identifier[X] operator[=] literal[String] operator[SEP] identifier[id] operator[=] identifier[Id_parse] operator[SEP] Keyword[break] identifier[L] operator[SEP] Keyword[case] Other[8] operator[:] identifier[X] operator[=] literal[String] operator[SEP] identifier[id] operator[=] identifier[Id_toSource] operator[SEP] Keyword[break] identifier[L] operator[SEP] Keyword[case] Other[9] operator[:] identifier[X] operator[=] literal[String] operator[SEP] identifier[id] operator[=] identifier[Id_stringify] operator[SEP] Keyword[break] identifier[L] operator[SEP]
}
Keyword[if] operator[SEP] identifier[X] operator[!=] Other[null] operator[&&] identifier[X] operator[!=] identifier[s] operator[&&] operator[!] identifier[X] operator[SEP] identifier[equals] operator[SEP] identifier[s] operator[SEP] operator[SEP] identifier[id] operator[=] Other[0] operator[SEP]
}
Keyword[return] identifier[id] operator[SEP]
}
|
private ChooseConfig searchAnnotatedConfig(ChooseConfig cc) {
if((isNull(cc)||cc == ChooseConfig.DESTINATION) && Annotation.isInheritedMapped(destination))
return ChooseConfig.DESTINATION;
if((isNull(cc)||cc == ChooseConfig.SOURCE) && Annotation.isInheritedMapped(source))
return ChooseConfig.SOURCE;
return null;
} | class class_name[name] begin[{]
method[searchAnnotatedConfig, return_type[type[ChooseConfig]], modifier[private], parameter[cc]] begin[{]
if[binary_operation[binary_operation[call[.isNull, parameter[member[.cc]]], ||, binary_operation[member[.cc], ==, member[ChooseConfig.DESTINATION]]], &&, call[Annotation.isInheritedMapped, parameter[member[.destination]]]]] begin[{]
return[member[ChooseConfig.DESTINATION]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[call[.isNull, parameter[member[.cc]]], ||, binary_operation[member[.cc], ==, member[ChooseConfig.SOURCE]]], &&, call[Annotation.isInheritedMapped, parameter[member[.source]]]]] begin[{]
return[member[ChooseConfig.SOURCE]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[private] identifier[ChooseConfig] identifier[searchAnnotatedConfig] operator[SEP] identifier[ChooseConfig] identifier[cc] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[isNull] operator[SEP] identifier[cc] operator[SEP] operator[||] identifier[cc] operator[==] identifier[ChooseConfig] operator[SEP] identifier[DESTINATION] operator[SEP] operator[&&] identifier[Annotation] operator[SEP] identifier[isInheritedMapped] operator[SEP] identifier[destination] operator[SEP] operator[SEP] Keyword[return] identifier[ChooseConfig] operator[SEP] identifier[DESTINATION] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[isNull] operator[SEP] identifier[cc] operator[SEP] operator[||] identifier[cc] operator[==] identifier[ChooseConfig] operator[SEP] identifier[SOURCE] operator[SEP] operator[&&] identifier[Annotation] operator[SEP] identifier[isInheritedMapped] operator[SEP] identifier[source] operator[SEP] operator[SEP] Keyword[return] identifier[ChooseConfig] operator[SEP] identifier[SOURCE] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
|
public boolean containsAll(Iterable<? extends C> values) {
if (Iterables.isEmpty(values)) {
return true;
}
// this optimizes testing equality of two range-backed sets
if (values instanceof SortedSet) {
SortedSet<? extends C> set = cast(values);
Comparator<?> comparator = set.comparator();
if (Ordering.natural().equals(comparator) || comparator == null) {
return contains(set.first()) && contains(set.last());
}
}
for (C value : values) {
if (!contains(value)) {
return false;
}
}
return true;
} | class class_name[name] begin[{]
method[containsAll, return_type[type[boolean]], modifier[public], parameter[values]] begin[{]
if[call[Iterables.isEmpty, parameter[member[.values]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
if[binary_operation[member[.values], instanceof, type[SortedSet]]] begin[{]
local_variable[type[SortedSet], set]
local_variable[type[Comparator], comparator]
if[binary_operation[call[Ordering.natural, parameter[]], ||, binary_operation[member[.comparator], ==, literal[null]]]] begin[{]
return[binary_operation[call[.contains, parameter[call[set.first, parameter[]]]], &&, call[.contains, parameter[call[set.last, parameter[]]]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=C, sub_type=None))), label=None)
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[containsAll] operator[SEP] identifier[Iterable] operator[<] operator[?] Keyword[extends] identifier[C] operator[>] identifier[values] operator[SEP] {
Keyword[if] operator[SEP] identifier[Iterables] operator[SEP] identifier[isEmpty] operator[SEP] identifier[values] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[values] Keyword[instanceof] identifier[SortedSet] operator[SEP] {
identifier[SortedSet] operator[<] operator[?] Keyword[extends] identifier[C] operator[>] identifier[set] operator[=] identifier[cast] operator[SEP] identifier[values] operator[SEP] operator[SEP] identifier[Comparator] operator[<] operator[?] operator[>] identifier[comparator] operator[=] identifier[set] operator[SEP] identifier[comparator] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Ordering] operator[SEP] identifier[natural] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[comparator] operator[SEP] operator[||] identifier[comparator] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[contains] operator[SEP] identifier[set] operator[SEP] identifier[first] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[contains] operator[SEP] identifier[set] operator[SEP] identifier[last] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[C] identifier[value] operator[:] identifier[values] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[contains] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private static void updateFilterSDASet(double mib, List<SteepDownArea> sdaset, double ixi) {
Iterator<SteepDownArea> iter = sdaset.iterator();
while(iter.hasNext()) {
SteepDownArea sda = iter.next();
if(sda.getMaximum() * ixi <= mib) {
iter.remove();
}
else {
// Update
if(mib > sda.getMib()) {
sda.setMib(mib);
}
}
}
} | class class_name[name] begin[{]
method[updateFilterSDASet, return_type[void], modifier[private static], parameter[mib, sdaset, ixi]] begin[{]
local_variable[type[Iterator], iter]
while[call[iter.hasNext, parameter[]]] begin[{]
local_variable[type[SteepDownArea], sda]
if[binary_operation[binary_operation[call[sda.getMaximum, parameter[]], *, member[.ixi]], <=, member[.mib]]] begin[{]
call[iter.remove, parameter[]]
else begin[{]
if[binary_operation[member[.mib], >, call[sda.getMib, parameter[]]]] begin[{]
call[sda.setMib, parameter[member[.mib]]]
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[updateFilterSDASet] operator[SEP] Keyword[double] identifier[mib] , identifier[List] operator[<] identifier[SteepDownArea] operator[>] identifier[sdaset] , Keyword[double] identifier[ixi] operator[SEP] {
identifier[Iterator] operator[<] identifier[SteepDownArea] operator[>] identifier[iter] operator[=] identifier[sdaset] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[iter] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[SteepDownArea] identifier[sda] operator[=] identifier[iter] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sda] operator[SEP] identifier[getMaximum] operator[SEP] operator[SEP] operator[*] identifier[ixi] operator[<=] identifier[mib] operator[SEP] {
identifier[iter] operator[SEP] identifier[remove] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[mib] operator[>] identifier[sda] operator[SEP] identifier[getMib] operator[SEP] operator[SEP] operator[SEP] {
identifier[sda] operator[SEP] identifier[setMib] operator[SEP] identifier[mib] operator[SEP] operator[SEP]
}
}
}
}
|
public void getConversations(final EndpointConversationsCompletionListener completionListener) {
if (!isConnected()) {
getEndpointConversationsError(completionListener, "Can't complete request when not connected, " +
"Please reconnect!");
return;
}
String urlEndpoint = "/v1/endpoints/" + localEndpointID + "/conversations";
signalingChannel.sendRESTMessage("get", urlEndpoint, null,
new RespokeSignalingChannel.RESTListener() {
@Override
public void onSuccess(Object response) {
if (!(response instanceof JSONArray)) {
getEndpointConversationsError(completionListener, "Invalid response from server");
return;
}
final JSONArray json = (JSONArray) response;
final List<EndpointConversationInfo> results = new ArrayList<EndpointConversationInfo>();
try {
for (int i = 0; i < json.length(); i++) {
final JSONObject jsonConversationInfo = json.getJSONObject(i);
final EndpointConversationInfo info = new EndpointConversationInfo();
final JSONObject jsonMessage = jsonConversationInfo.getJSONObject("latestMsg");
info.latestMessage = buildGroupMessage(jsonMessage);
info.groupId = jsonConversationInfo.getString("groupId");
info.sourceId = jsonConversationInfo.getString("sourceId");
info.unreadCount = jsonConversationInfo.getInt("unreadCount");
info.timestamp = new Date(jsonConversationInfo.getLong("timestamp"));
results.add(info);
}
} catch (JSONException e) {
getEndpointConversationsError(completionListener, "Error parsing JSON response");
return;
}
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (completionListener != null) {
completionListener.onSuccess(results);
}
}
});
}
@Override
public void onError(final String errorMessage) {
getEndpointConversationsError(completionListener, errorMessage);
}
});
} | class class_name[name] begin[{]
method[getConversations, return_type[void], modifier[public], parameter[completionListener]] begin[{]
if[call[.isConnected, parameter[]]] begin[{]
call[.getEndpointConversationsError, parameter[member[.completionListener], binary_operation[literal["Can't complete request when not connected, "], +, literal["Please reconnect!"]]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[String], urlEndpoint]
call[signalingChannel.sendRESTMessage, parameter[literal["get"], member[.urlEndpoint], literal[null], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JSONArray, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=completionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid response from server")], member=getEndpointConversationsError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JSONArray, sub_type=None)), name=json)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=JSONArray, 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=EndpointConversationInfo, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None)), name=results)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=EndpointConversationInfo, sub_type=None))], dimensions=[], name=List, sub_type=None)), TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getJSONObject, postfix_operators=[], prefix_operators=[], qualifier=json, selectors=[], type_arguments=None), name=jsonConversationInfo)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=JSONObject, 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=EndpointConversationInfo, sub_type=None)), name=info)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=EndpointConversationInfo, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="latestMsg")], member=getJSONObject, postfix_operators=[], prefix_operators=[], qualifier=jsonConversationInfo, selectors=[], type_arguments=None), name=jsonMessage)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=JSONObject, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=latestMessage, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=jsonMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildGroupMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=groupId, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="groupId")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=jsonConversationInfo, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=sourceId, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="sourceId")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=jsonConversationInfo, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=unreadCount, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unreadCount")], member=getInt, postfix_operators=[], prefix_operators=[], qualifier=jsonConversationInfo, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=timestamp, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="timestamp")], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=jsonConversationInfo, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], 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=json, 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)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=completionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error parsing JSON response")], member=getEndpointConversationsError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JSONException']))], finally_block=None, label=None, resources=None), StatementExpression(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getMainLooper, postfix_operators=[], prefix_operators=[], qualifier=Looper, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=completionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=results, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onSuccess, postfix_operators=[], prefix_operators=[], qualifier=completionListener, selectors=[], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Runnable, sub_type=None))], member=post, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Handler, sub_type=None)), label=None)], documentation=None, modifiers={'public'}, name=onSuccess, parameters=[FormalParameter(annotations=[], modifiers=set(), name=response, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=completionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=errorMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getEndpointConversationsError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onError, parameters=[FormalParameter(annotations=[], modifiers={'final'}, name=errorMessage, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RespokeSignalingChannel, sub_type=ReferenceType(arguments=None, dimensions=None, name=RESTListener, sub_type=None)))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[getConversations] operator[SEP] Keyword[final] identifier[EndpointConversationsCompletionListener] identifier[completionListener] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isConnected] operator[SEP] operator[SEP] operator[SEP] {
identifier[getEndpointConversationsError] operator[SEP] identifier[completionListener] , literal[String] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[String] identifier[urlEndpoint] operator[=] literal[String] operator[+] identifier[localEndpointID] operator[+] literal[String] operator[SEP] identifier[signalingChannel] operator[SEP] identifier[sendRESTMessage] operator[SEP] literal[String] , identifier[urlEndpoint] , Other[null] , Keyword[new] identifier[RespokeSignalingChannel] operator[SEP] identifier[RESTListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onSuccess] operator[SEP] identifier[Object] identifier[response] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[response] Keyword[instanceof] identifier[JSONArray] operator[SEP] operator[SEP] {
identifier[getEndpointConversationsError] operator[SEP] identifier[completionListener] , literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[final] identifier[JSONArray] identifier[json] operator[=] operator[SEP] identifier[JSONArray] operator[SEP] identifier[response] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[EndpointConversationInfo] operator[>] identifier[results] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[EndpointConversationInfo] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[json] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] identifier[JSONObject] identifier[jsonConversationInfo] operator[=] identifier[json] operator[SEP] identifier[getJSONObject] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[final] identifier[EndpointConversationInfo] identifier[info] operator[=] Keyword[new] identifier[EndpointConversationInfo] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[JSONObject] identifier[jsonMessage] operator[=] identifier[jsonConversationInfo] operator[SEP] identifier[getJSONObject] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[info] operator[SEP] identifier[latestMessage] operator[=] identifier[buildGroupMessage] operator[SEP] identifier[jsonMessage] operator[SEP] operator[SEP] identifier[info] operator[SEP] identifier[groupId] operator[=] identifier[jsonConversationInfo] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[info] operator[SEP] identifier[sourceId] operator[=] identifier[jsonConversationInfo] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[info] operator[SEP] identifier[unreadCount] operator[=] identifier[jsonConversationInfo] operator[SEP] identifier[getInt] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[info] operator[SEP] identifier[timestamp] operator[=] Keyword[new] identifier[Date] operator[SEP] identifier[jsonConversationInfo] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[results] operator[SEP] identifier[add] operator[SEP] identifier[info] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[JSONException] identifier[e] operator[SEP] {
identifier[getEndpointConversationsError] operator[SEP] identifier[completionListener] , literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[new] identifier[Handler] operator[SEP] identifier[Looper] operator[SEP] identifier[getMainLooper] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[post] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[completionListener] operator[!=] Other[null] operator[SEP] {
identifier[completionListener] operator[SEP] identifier[onSuccess] operator[SEP] identifier[results] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onError] operator[SEP] Keyword[final] identifier[String] identifier[errorMessage] operator[SEP] {
identifier[getEndpointConversationsError] operator[SEP] identifier[completionListener] , identifier[errorMessage] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public Pager<Branch> getBranches(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException {
return (new Pager<Branch>(this, Branch.class, itemsPerPage, null, "projects",
getProjectIdOrPath(projectIdOrPath), "repository", "branches"));
} | class class_name[name] begin[{]
method[getBranches, return_type[type[Pager]], modifier[public], parameter[projectIdOrPath, itemsPerPage]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Branch, sub_type=None)), MemberReference(member=itemsPerPage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="projects"), MethodInvocation(arguments=[MemberReference(member=projectIdOrPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProjectIdOrPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="repository"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="branches")], 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=Branch, sub_type=None))], dimensions=None, name=Pager, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Pager] operator[<] identifier[Branch] operator[>] identifier[getBranches] operator[SEP] identifier[Object] identifier[projectIdOrPath] , Keyword[int] identifier[itemsPerPage] operator[SEP] Keyword[throws] identifier[GitLabApiException] {
Keyword[return] operator[SEP] Keyword[new] identifier[Pager] operator[<] identifier[Branch] operator[>] operator[SEP] Keyword[this] , identifier[Branch] operator[SEP] Keyword[class] , identifier[itemsPerPage] , Other[null] , literal[String] , identifier[getProjectIdOrPath] operator[SEP] identifier[projectIdOrPath] operator[SEP] , literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public Paragraph createParagraph(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException {
return initTextElementArray(styleHelper.style(new Paragraph(Float.NaN), data, stylers), data, stylers);
} | class class_name[name] begin[{]
method[createParagraph, return_type[type[Paragraph]], modifier[public], parameter[data, stylers]] begin[{]
return[call[.initTextElementArray, parameter[call[styleHelper.style, parameter[ClassCreator(arguments=[MemberReference(member=NaN, postfix_operators=[], prefix_operators=[], qualifier=Float, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Paragraph, sub_type=None)), member[.data], member[.stylers]]], member[.data], member[.stylers]]]]
end[}]
END[}] | Keyword[public] identifier[Paragraph] identifier[createParagraph] operator[SEP] identifier[Object] identifier[data] , identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[BaseStyler] operator[>] identifier[stylers] operator[SEP] Keyword[throws] identifier[VectorPrintException] {
Keyword[return] identifier[initTextElementArray] operator[SEP] identifier[styleHelper] operator[SEP] identifier[style] operator[SEP] Keyword[new] identifier[Paragraph] operator[SEP] identifier[Float] operator[SEP] identifier[NaN] operator[SEP] , identifier[data] , identifier[stylers] operator[SEP] , identifier[data] , identifier[stylers] operator[SEP] operator[SEP]
}
|
Integer getVersionOrThrow(CMAResource resource, String action) {
final Integer version = resource.getVersion();
if (version == null) {
throw new IllegalArgumentException(String.format(
"Cannot perform %s action on a resource that has no version associated.",
action));
}
return version;
} | class class_name[name] begin[{]
method[getVersionOrThrow, return_type[type[Integer]], modifier[default], parameter[resource, action]] begin[{]
local_variable[type[Integer], version]
if[binary_operation[member[.version], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot perform %s action on a resource that has no version associated."), MemberReference(member=action, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.version]]
end[}]
END[}] | identifier[Integer] identifier[getVersionOrThrow] operator[SEP] identifier[CMAResource] identifier[resource] , identifier[String] identifier[action] operator[SEP] {
Keyword[final] identifier[Integer] identifier[version] operator[=] identifier[resource] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[version] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[action] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[version] operator[SEP]
}
|
private int dpToPx(float dp) {
final DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, displayMetrics);
return Math.round(px);
} | class class_name[name] begin[{]
method[dpToPx, return_type[type[int]], modifier[private], parameter[dp]] begin[{]
local_variable[type[DisplayMetrics], displayMetrics]
local_variable[type[float], px]
return[call[Math.round, parameter[member[.px]]]]
end[}]
END[}] | Keyword[private] Keyword[int] identifier[dpToPx] operator[SEP] Keyword[float] identifier[dp] operator[SEP] {
Keyword[final] identifier[DisplayMetrics] identifier[displayMetrics] operator[=] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getResources] operator[SEP] operator[SEP] operator[SEP] identifier[getDisplayMetrics] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[px] operator[=] identifier[TypedValue] operator[SEP] identifier[applyDimension] operator[SEP] identifier[TypedValue] operator[SEP] identifier[COMPLEX_UNIT_DIP] , identifier[dp] , identifier[displayMetrics] operator[SEP] operator[SEP] Keyword[return] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[px] operator[SEP] operator[SEP]
}
|
private Message buildMapEntryMessage(Message.Builder mapBuilder, Field field,
Object mapKey, Object mapValue) {
FieldDescriptor keyFieldDescriptor =
mapBuilder.getDescriptorForType().findFieldByName(MAP_KEY_FIELD_NAME);
FieldDescriptor valueFieldDescriptor =
mapBuilder.getDescriptorForType().findFieldByName(MAP_VALUE_FIELD_NAME);
boolean isKeyStruct = field.getMapKeyField().isStruct();
boolean isValueStruct = field.getMapValueField().isStruct();
Object convertedKey;
if (isKeyStruct) {
convertedKey = doConvert((TBase<?, ?>) mapKey);
} else {
convertedKey = sanitizeRawValue(mapKey, field.getMapKeyField());
}
Object convertedValue;
if (isValueStruct) {
convertedValue = doConvert((TBase<?, ?>) mapValue);
} else {
convertedValue = sanitizeRawValue(mapValue, field.getMapValueField());
}
mapBuilder.setField(keyFieldDescriptor, convertedKey);
mapBuilder.setField(valueFieldDescriptor, convertedValue);
return mapBuilder.build();
} | class class_name[name] begin[{]
method[buildMapEntryMessage, return_type[type[Message]], modifier[private], parameter[mapBuilder, field, mapKey, mapValue]] begin[{]
local_variable[type[FieldDescriptor], keyFieldDescriptor]
local_variable[type[FieldDescriptor], valueFieldDescriptor]
local_variable[type[boolean], isKeyStruct]
local_variable[type[boolean], isValueStruct]
local_variable[type[Object], convertedKey]
if[member[.isKeyStruct]] begin[{]
assign[member[.convertedKey], call[.doConvert, parameter[Cast(expression=MemberReference(member=mapKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=TBase, sub_type=None))]]]
else begin[{]
assign[member[.convertedKey], call[.sanitizeRawValue, parameter[member[.mapKey], call[field.getMapKeyField, parameter[]]]]]
end[}]
local_variable[type[Object], convertedValue]
if[member[.isValueStruct]] begin[{]
assign[member[.convertedValue], call[.doConvert, parameter[Cast(expression=MemberReference(member=mapValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=TBase, sub_type=None))]]]
else begin[{]
assign[member[.convertedValue], call[.sanitizeRawValue, parameter[member[.mapValue], call[field.getMapValueField, parameter[]]]]]
end[}]
call[mapBuilder.setField, parameter[member[.keyFieldDescriptor], member[.convertedKey]]]
call[mapBuilder.setField, parameter[member[.valueFieldDescriptor], member[.convertedValue]]]
return[call[mapBuilder.build, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[Message] identifier[buildMapEntryMessage] operator[SEP] identifier[Message] operator[SEP] identifier[Builder] identifier[mapBuilder] , identifier[Field] identifier[field] , identifier[Object] identifier[mapKey] , identifier[Object] identifier[mapValue] operator[SEP] {
identifier[FieldDescriptor] identifier[keyFieldDescriptor] operator[=] identifier[mapBuilder] operator[SEP] identifier[getDescriptorForType] operator[SEP] operator[SEP] operator[SEP] identifier[findFieldByName] operator[SEP] identifier[MAP_KEY_FIELD_NAME] operator[SEP] operator[SEP] identifier[FieldDescriptor] identifier[valueFieldDescriptor] operator[=] identifier[mapBuilder] operator[SEP] identifier[getDescriptorForType] operator[SEP] operator[SEP] operator[SEP] identifier[findFieldByName] operator[SEP] identifier[MAP_VALUE_FIELD_NAME] operator[SEP] operator[SEP] Keyword[boolean] identifier[isKeyStruct] operator[=] identifier[field] operator[SEP] identifier[getMapKeyField] operator[SEP] operator[SEP] operator[SEP] identifier[isStruct] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isValueStruct] operator[=] identifier[field] operator[SEP] identifier[getMapValueField] operator[SEP] operator[SEP] operator[SEP] identifier[isStruct] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[convertedKey] operator[SEP] Keyword[if] operator[SEP] identifier[isKeyStruct] operator[SEP] {
identifier[convertedKey] operator[=] identifier[doConvert] operator[SEP] operator[SEP] identifier[TBase] operator[<] operator[?] , operator[?] operator[>] operator[SEP] identifier[mapKey] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[convertedKey] operator[=] identifier[sanitizeRawValue] operator[SEP] identifier[mapKey] , identifier[field] operator[SEP] identifier[getMapKeyField] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Object] identifier[convertedValue] operator[SEP] Keyword[if] operator[SEP] identifier[isValueStruct] operator[SEP] {
identifier[convertedValue] operator[=] identifier[doConvert] operator[SEP] operator[SEP] identifier[TBase] operator[<] operator[?] , operator[?] operator[>] operator[SEP] identifier[mapValue] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[convertedValue] operator[=] identifier[sanitizeRawValue] operator[SEP] identifier[mapValue] , identifier[field] operator[SEP] identifier[getMapValueField] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mapBuilder] operator[SEP] identifier[setField] operator[SEP] identifier[keyFieldDescriptor] , identifier[convertedKey] operator[SEP] operator[SEP] identifier[mapBuilder] operator[SEP] identifier[setField] operator[SEP] identifier[valueFieldDescriptor] , identifier[convertedValue] operator[SEP] operator[SEP] Keyword[return] identifier[mapBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
@SuppressWarnings("unchecked")
public void setModifiedWith(PROCESS modifiedWith) {
this.modifiedWith = assertNotNull(modifiedWith, () -> "Modified with is required");
this.lastModifiedWith = defaultIfNull(this.lastModifiedWith, this.modifiedWith);
} | class class_name[name] begin[{]
method[setModifiedWith, return_type[void], modifier[public], parameter[modifiedWith]] begin[{]
assign[THIS[member[None.modifiedWith]], call[.assertNotNull, parameter[member[.modifiedWith], LambdaExpression(body=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Modified with is required"), parameters=[])]]]
assign[THIS[member[None.lastModifiedWith]], call[.defaultIfNull, parameter[THIS[member[None.lastModifiedWith]], THIS[member[None.modifiedWith]]]]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[setModifiedWith] operator[SEP] identifier[PROCESS] identifier[modifiedWith] operator[SEP] {
Keyword[this] operator[SEP] identifier[modifiedWith] operator[=] identifier[assertNotNull] operator[SEP] identifier[modifiedWith] , operator[SEP] operator[SEP] operator[->] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[lastModifiedWith] operator[=] identifier[defaultIfNull] operator[SEP] Keyword[this] operator[SEP] identifier[lastModifiedWith] , Keyword[this] operator[SEP] identifier[modifiedWith] operator[SEP] operator[SEP]
}
|
private void compactByAge() {
if (maxLogAge != null) {
long currentTime = System.currentTimeMillis();
JournalSegment<LogEntry> compactSegment = null;
Long compactIndex = null;
for (JournalSegment<LogEntry> segment : journal.segments()) {
if (currentTime - segment.descriptor().updated() > maxLogAge.toMillis()) {
log.debug("Found expired journal segment {}", segment.file().file());
compactSegment = segment;
} else if (compactSegment != null) {
compactIndex = segment.index();
break;
}
}
if (compactIndex != null) {
log.info("Compacting journal by age up to {}", compactIndex);
journal.compact(compactIndex);
}
}
} | class class_name[name] begin[{]
method[compactByAge, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.maxLogAge], !=, literal[null]]] begin[{]
local_variable[type[long], currentTime]
local_variable[type[JournalSegment], compactSegment]
local_variable[type[Long], compactIndex]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=currentTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=descriptor, postfix_operators=[], prefix_operators=[], qualifier=segment, selectors=[MethodInvocation(arguments=[], member=updated, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=-), operandr=MethodInvocation(arguments=[], member=toMillis, postfix_operators=[], prefix_operators=[], qualifier=maxLogAge, selectors=[], type_arguments=None), operator=>), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=compactSegment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=compactIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=index, postfix_operators=[], prefix_operators=[], qualifier=segment, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Found expired journal segment {}"), MethodInvocation(arguments=[], member=file, postfix_operators=[], prefix_operators=[], qualifier=segment, selectors=[MethodInvocation(arguments=[], member=file, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=compactSegment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=segment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=segments, postfix_operators=[], prefix_operators=[], qualifier=journal, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=segment)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=LogEntry, sub_type=None))], dimensions=[], name=JournalSegment, sub_type=None))), label=None)
if[binary_operation[member[.compactIndex], !=, literal[null]]] begin[{]
call[log.info, parameter[literal["Compacting journal by age up to {}"], member[.compactIndex]]]
call[journal.compact, parameter[member[.compactIndex]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[compactByAge] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[maxLogAge] operator[!=] Other[null] operator[SEP] {
Keyword[long] identifier[currentTime] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[JournalSegment] operator[<] identifier[LogEntry] operator[>] identifier[compactSegment] operator[=] Other[null] operator[SEP] identifier[Long] identifier[compactIndex] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] identifier[JournalSegment] operator[<] identifier[LogEntry] operator[>] identifier[segment] operator[:] identifier[journal] operator[SEP] identifier[segments] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[currentTime] operator[-] identifier[segment] operator[SEP] identifier[descriptor] operator[SEP] operator[SEP] operator[SEP] identifier[updated] operator[SEP] operator[SEP] operator[>] identifier[maxLogAge] operator[SEP] identifier[toMillis] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[segment] operator[SEP] identifier[file] operator[SEP] operator[SEP] operator[SEP] identifier[file] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[compactSegment] operator[=] identifier[segment] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[compactSegment] operator[!=] Other[null] operator[SEP] {
identifier[compactIndex] operator[=] identifier[segment] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[compactIndex] operator[!=] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[compactIndex] operator[SEP] operator[SEP] identifier[journal] operator[SEP] identifier[compact] operator[SEP] identifier[compactIndex] operator[SEP] operator[SEP]
}
}
}
|
@Override
public synchronized int executeUpdate(String query) throws DatabaseEngineException {
String[] split = query.split(Constants.UNIT_SEPARATOR_CHARACTER + "");
int i = -1;
for (String s : split) {
if (StringUtils.isNotBlank(s)) {
i = super.executeUpdate(s);
}
}
return i;
} | class class_name[name] begin[{]
method[executeUpdate, return_type[type[int]], modifier[synchronized public], parameter[query]] begin[{]
local_variable[type[String], split]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotBlank, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=SuperMethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=executeUpdate, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.i]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] Keyword[int] identifier[executeUpdate] operator[SEP] identifier[String] identifier[query] operator[SEP] Keyword[throws] identifier[DatabaseEngineException] {
identifier[String] operator[SEP] operator[SEP] identifier[split] operator[=] identifier[query] operator[SEP] identifier[split] operator[SEP] identifier[Constants] operator[SEP] identifier[UNIT_SEPARATOR_CHARACTER] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] operator[-] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[s] operator[:] identifier[split] operator[SEP] {
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[s] operator[SEP] operator[SEP] {
identifier[i] operator[=] Keyword[super] operator[SEP] identifier[executeUpdate] operator[SEP] identifier[s] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[i] operator[SEP]
}
|
public static boolean reallyDifferent(JsonNode source, JsonNode dest, boolean ignoreTimestampMSDiffs) {
if (source == null || source instanceof NullNode) {
if (dest == null || dest instanceof NullNode) {
return false;
} else {
return true;
}
} else if (dest == null || dest instanceof NullNode) {
return true;
} else {
String s1 = source.asText();
String s2 = dest.asText();
if (s1.equals(s2)) {
return false;
}
// They are different strings
// Do they look like dates?
Date d1;
Date d2;
DateFormat fmt = ClientConstants.getDateFormat();
try {
d1 = fmt.parse(s1);
} catch (Exception e) {
return true;
}
try {
d2 = fmt.parse(s2);
} catch (Exception e) {
return true;
}
if (ignoreTimestampMSDiffs) {
long d1ms = 1000 * (d1.getTime() / 1000);
long d2ms = 1000 * (d2.getTime() / 1000);
return d1ms != d2ms;
} else {
return d1.getTime() != d2.getTime();
}
}
} | class class_name[name] begin[{]
method[reallyDifferent, return_type[type[boolean]], modifier[public static], parameter[source, dest, ignoreTimestampMSDiffs]] begin[{]
if[binary_operation[binary_operation[member[.source], ==, literal[null]], ||, binary_operation[member[.source], instanceof, type[NullNode]]]] begin[{]
if[binary_operation[binary_operation[member[.dest], ==, literal[null]], ||, binary_operation[member[.dest], instanceof, type[NullNode]]]] begin[{]
return[literal[false]]
else begin[{]
return[literal[true]]
end[}]
else begin[{]
if[binary_operation[binary_operation[member[.dest], ==, literal[null]], ||, binary_operation[member[.dest], instanceof, type[NullNode]]]] begin[{]
return[literal[true]]
else begin[{]
local_variable[type[String], s1]
local_variable[type[String], s2]
if[call[s1.equals, parameter[member[.s2]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[Date], d1]
local_variable[type[Date], d2]
local_variable[type[DateFormat], fmt]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=d1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=s1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=fmt, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=d2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=s2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=fmt, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
if[member[.ignoreTimestampMSDiffs]] begin[{]
local_variable[type[long], d1ms]
local_variable[type[long], d2ms]
return[binary_operation[member[.d1ms], !=, member[.d2ms]]]
else begin[{]
return[binary_operation[call[d1.getTime, parameter[]], !=, call[d2.getTime, parameter[]]]]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[reallyDifferent] operator[SEP] identifier[JsonNode] identifier[source] , identifier[JsonNode] identifier[dest] , Keyword[boolean] identifier[ignoreTimestampMSDiffs] operator[SEP] {
Keyword[if] operator[SEP] identifier[source] operator[==] Other[null] operator[||] identifier[source] Keyword[instanceof] identifier[NullNode] operator[SEP] {
Keyword[if] operator[SEP] identifier[dest] operator[==] Other[null] operator[||] identifier[dest] Keyword[instanceof] identifier[NullNode] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[dest] operator[==] Other[null] operator[||] identifier[dest] Keyword[instanceof] identifier[NullNode] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[String] identifier[s1] operator[=] identifier[source] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[s2] operator[=] identifier[dest] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s1] operator[SEP] identifier[equals] operator[SEP] identifier[s2] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Date] identifier[d1] operator[SEP] identifier[Date] identifier[d2] operator[SEP] identifier[DateFormat] identifier[fmt] operator[=] identifier[ClientConstants] operator[SEP] identifier[getDateFormat] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[d1] operator[=] identifier[fmt] operator[SEP] identifier[parse] operator[SEP] identifier[s1] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[try] {
identifier[d2] operator[=] identifier[fmt] operator[SEP] identifier[parse] operator[SEP] identifier[s2] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[ignoreTimestampMSDiffs] operator[SEP] {
Keyword[long] identifier[d1ms] operator[=] Other[1000] operator[*] operator[SEP] identifier[d1] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[/] Other[1000] operator[SEP] operator[SEP] Keyword[long] identifier[d2ms] operator[=] Other[1000] operator[*] operator[SEP] identifier[d2] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[/] Other[1000] operator[SEP] operator[SEP] Keyword[return] identifier[d1ms] operator[!=] identifier[d2ms] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[d1] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[!=] identifier[d2] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public CreateIssueParams milestoneIds(List milestoneIds) {
for (Object milestoneId : milestoneIds) {
parameters.add(new NameValuePair("milestoneId[]", milestoneId.toString()));
}
return this;
} | class class_name[name] begin[{]
method[milestoneIds, return_type[type[CreateIssueParams]], modifier[public], parameter[milestoneIds]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="milestoneId[]"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=milestoneId, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NameValuePair, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=parameters, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=milestoneIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=milestoneId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CreateIssueParams] identifier[milestoneIds] operator[SEP] identifier[List] identifier[milestoneIds] operator[SEP] {
Keyword[for] operator[SEP] identifier[Object] identifier[milestoneId] operator[:] identifier[milestoneIds] operator[SEP] {
identifier[parameters] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[NameValuePair] operator[SEP] literal[String] , identifier[milestoneId] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static <K1, V1, K2, V2> void setReducer(JobConf jobConf,
Class<? extends Reducer<K1, V1, K2, V2>> klass,
Class<? extends K1> inputKeyClass,
Class<? extends V1> inputValueClass,
Class<? extends K2> outputKeyClass,
Class<? extends V2> outputValueClass,
boolean byValue, JobConf reducerConf) {
String prefix = getPrefix(false);
if (jobConf.getClass(prefix + CHAIN_REDUCER_CLASS, null) != null) {
throw new IllegalStateException("Reducer has been already set");
}
jobConf.setClass(prefix + CHAIN_REDUCER_CLASS, klass, Reducer.class);
// if the Reducer does not have a private JobConf create an empty one
if (reducerConf == null) {
// using a JobConf without defaults to make it lightweight.
// still the chain JobConf may have all defaults and this conf is
// overlapped to the chain JobConf one.
reducerConf = new JobConf(false);
}
// store in the private reducer conf the input/output classes of the reducer
// and if it works by value or by reference
reducerConf.setBoolean(MAPPER_BY_VALUE, byValue);
reducerConf.setClass(REDUCER_INPUT_KEY_CLASS, inputKeyClass, Object.class);
reducerConf.setClass(REDUCER_INPUT_VALUE_CLASS, inputValueClass,
Object.class);
reducerConf.setClass(REDUCER_OUTPUT_KEY_CLASS, outputKeyClass,
Object.class);
reducerConf.setClass(REDUCER_OUTPUT_VALUE_CLASS, outputValueClass,
Object.class);
// serialize the private mapper jobconf in the chain jobconf.
Stringifier<JobConf> stringifier =
new DefaultStringifier<JobConf>(jobConf, JobConf.class);
try {
jobConf.set(prefix + CHAIN_REDUCER_CONFIG,
stringifier.toString(new JobConf(reducerConf)));
}
catch (IOException ioEx) {
throw new RuntimeException(ioEx);
}
} | class class_name[name] begin[{]
method[setReducer, return_type[void], modifier[public static], parameter[jobConf, klass, inputKeyClass, inputValueClass, outputKeyClass, outputValueClass, byValue, reducerConf]] begin[{]
local_variable[type[String], prefix]
if[binary_operation[call[jobConf.getClass, parameter[binary_operation[member[.prefix], +, member[.CHAIN_REDUCER_CLASS]], literal[null]]], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Reducer has been already set")], 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[}]
call[jobConf.setClass, parameter[binary_operation[member[.prefix], +, member[.CHAIN_REDUCER_CLASS]], member[.klass], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Reducer, sub_type=None))]]
if[binary_operation[member[.reducerConf], ==, literal[null]]] begin[{]
assign[member[.reducerConf], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JobConf, sub_type=None))]
else begin[{]
None
end[}]
call[reducerConf.setBoolean, parameter[member[.MAPPER_BY_VALUE], member[.byValue]]]
call[reducerConf.setClass, parameter[member[.REDUCER_INPUT_KEY_CLASS], member[.inputKeyClass], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
call[reducerConf.setClass, parameter[member[.REDUCER_INPUT_VALUE_CLASS], member[.inputValueClass], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
call[reducerConf.setClass, parameter[member[.REDUCER_OUTPUT_KEY_CLASS], member[.outputKeyClass], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
call[reducerConf.setClass, parameter[member[.REDUCER_OUTPUT_VALUE_CLASS], member[.outputValueClass], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
local_variable[type[Stringifier], stringifier]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=CHAIN_REDUCER_CONFIG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=reducerConf, 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=JobConf, sub_type=None))], member=toString, postfix_operators=[], prefix_operators=[], qualifier=stringifier, selectors=[], type_arguments=None)], member=set, postfix_operators=[], prefix_operators=[], qualifier=jobConf, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ioEx, 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=ioEx, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[K1] , identifier[V1] , identifier[K2] , identifier[V2] operator[>] Keyword[void] identifier[setReducer] operator[SEP] identifier[JobConf] identifier[jobConf] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Reducer] operator[<] identifier[K1] , identifier[V1] , identifier[K2] , identifier[V2] operator[>] operator[>] identifier[klass] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[K1] operator[>] identifier[inputKeyClass] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[V1] operator[>] identifier[inputValueClass] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[K2] operator[>] identifier[outputKeyClass] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[V2] operator[>] identifier[outputValueClass] , Keyword[boolean] identifier[byValue] , identifier[JobConf] identifier[reducerConf] operator[SEP] {
identifier[String] identifier[prefix] operator[=] identifier[getPrefix] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[jobConf] operator[SEP] identifier[getClass] operator[SEP] identifier[prefix] operator[+] identifier[CHAIN_REDUCER_CLASS] , Other[null] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[jobConf] operator[SEP] identifier[setClass] operator[SEP] identifier[prefix] operator[+] identifier[CHAIN_REDUCER_CLASS] , identifier[klass] , identifier[Reducer] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reducerConf] operator[==] Other[null] operator[SEP] {
identifier[reducerConf] operator[=] Keyword[new] identifier[JobConf] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
identifier[reducerConf] operator[SEP] identifier[setBoolean] operator[SEP] identifier[MAPPER_BY_VALUE] , identifier[byValue] operator[SEP] operator[SEP] identifier[reducerConf] operator[SEP] identifier[setClass] operator[SEP] identifier[REDUCER_INPUT_KEY_CLASS] , identifier[inputKeyClass] , identifier[Object] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[reducerConf] operator[SEP] identifier[setClass] operator[SEP] identifier[REDUCER_INPUT_VALUE_CLASS] , identifier[inputValueClass] , identifier[Object] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[reducerConf] operator[SEP] identifier[setClass] operator[SEP] identifier[REDUCER_OUTPUT_KEY_CLASS] , identifier[outputKeyClass] , identifier[Object] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[reducerConf] operator[SEP] identifier[setClass] operator[SEP] identifier[REDUCER_OUTPUT_VALUE_CLASS] , identifier[outputValueClass] , identifier[Object] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Stringifier] operator[<] identifier[JobConf] operator[>] identifier[stringifier] operator[=] Keyword[new] identifier[DefaultStringifier] operator[<] identifier[JobConf] operator[>] operator[SEP] identifier[jobConf] , identifier[JobConf] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[try] {
identifier[jobConf] operator[SEP] identifier[set] operator[SEP] identifier[prefix] operator[+] identifier[CHAIN_REDUCER_CONFIG] , identifier[stringifier] operator[SEP] identifier[toString] operator[SEP] Keyword[new] identifier[JobConf] operator[SEP] identifier[reducerConf] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ioEx] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[ioEx] operator[SEP] operator[SEP]
}
}
|
protected JvmIdentifiableElement doGetLinkedFeature(/* @Nullable */ XExpression featureOrConstructorCall) {
if (linkingMap == null || featureOrConstructorCall == null || featureOrConstructorCall.eClass() == XbasePackage.Literals.XCLOSURE)
return null;
IApplicableCandidate candidate = linkingMap.get(featureOrConstructorCall);
if (candidate == null)
return null;
return ((ILinkingCandidate) candidate).getFeature();
} | class class_name[name] begin[{]
method[doGetLinkedFeature, return_type[type[JvmIdentifiableElement]], modifier[protected], parameter[featureOrConstructorCall]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.linkingMap], ==, literal[null]], ||, binary_operation[member[.featureOrConstructorCall], ==, literal[null]]], ||, binary_operation[call[featureOrConstructorCall.eClass, parameter[]], ==, member[XbasePackage.Literals.XCLOSURE]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[IApplicableCandidate], candidate]
if[binary_operation[member[.candidate], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[Cast(expression=MemberReference(member=candidate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ILinkingCandidate, sub_type=None))]
end[}]
END[}] | Keyword[protected] identifier[JvmIdentifiableElement] identifier[doGetLinkedFeature] operator[SEP] identifier[XExpression] identifier[featureOrConstructorCall] operator[SEP] {
Keyword[if] operator[SEP] identifier[linkingMap] operator[==] Other[null] operator[||] identifier[featureOrConstructorCall] operator[==] Other[null] operator[||] identifier[featureOrConstructorCall] operator[SEP] identifier[eClass] operator[SEP] operator[SEP] operator[==] identifier[XbasePackage] operator[SEP] identifier[Literals] operator[SEP] identifier[XCLOSURE] operator[SEP] Keyword[return] Other[null] operator[SEP] identifier[IApplicableCandidate] identifier[candidate] operator[=] identifier[linkingMap] operator[SEP] identifier[get] operator[SEP] identifier[featureOrConstructorCall] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[candidate] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[ILinkingCandidate] operator[SEP] identifier[candidate] operator[SEP] operator[SEP] identifier[getFeature] operator[SEP] operator[SEP] operator[SEP]
}
|
public void sendUserEvent(KeyValueCollection userData, String callUuid) throws WorkspaceApiException {
this.sendUserEvent(userData, callUuid, null);
} | class class_name[name] begin[{]
method[sendUserEvent, return_type[void], modifier[public], parameter[userData, callUuid]] begin[{]
THIS[call[None.sendUserEvent, parameter[member[.userData], member[.callUuid], literal[null]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[sendUserEvent] operator[SEP] identifier[KeyValueCollection] identifier[userData] , identifier[String] identifier[callUuid] operator[SEP] Keyword[throws] identifier[WorkspaceApiException] {
Keyword[this] operator[SEP] identifier[sendUserEvent] operator[SEP] identifier[userData] , identifier[callUuid] , Other[null] operator[SEP] operator[SEP]
}
|
public void expandSuperTypes() {
if (store.keySet().contains(index(SubTypesScanner.class))) {
final Multimap<String, String> mmap = store.get(index(SubTypesScanner.class));
final Collection<String> values = mmap.values();
final Set<String> keys = Sets.difference(mmap.keySet() , new HashSet<>(values));
final Multimap<String, String> expand = new MultimapImpl<>();
for (final String key : keys) {
expandSupertypes(expand , key , forName(key));
}
mmap.putAll(expand);
}
} | class class_name[name] begin[{]
method[expandSuperTypes, return_type[void], modifier[public], parameter[]] begin[{]
if[call[store.keySet, parameter[]]] begin[{]
local_variable[type[Multimap], mmap]
local_variable[type[Collection], values]
local_variable[type[Set], keys]
local_variable[type[Multimap], expand]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=expand, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=expandSupertypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[mmap.putAll, parameter[member[.expand]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[expandSuperTypes] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[store] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[index] operator[SEP] identifier[SubTypesScanner] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[Multimap] operator[<] identifier[String] , identifier[String] operator[>] identifier[mmap] operator[=] identifier[store] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] identifier[SubTypesScanner] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Collection] operator[<] identifier[String] operator[>] identifier[values] operator[=] identifier[mmap] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[keys] operator[=] identifier[Sets] operator[SEP] identifier[difference] operator[SEP] identifier[mmap] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] , Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Multimap] operator[<] identifier[String] , identifier[String] operator[>] identifier[expand] operator[=] Keyword[new] identifier[MultimapImpl] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[key] operator[:] identifier[keys] operator[SEP] {
identifier[expandSupertypes] operator[SEP] identifier[expand] , identifier[key] , identifier[forName] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
identifier[mmap] operator[SEP] identifier[putAll] operator[SEP] identifier[expand] operator[SEP] operator[SEP]
}
}
|
public static Boolean[] box(boolean[] array) {
dbc.precondition(array != null, "cannot box a null boolean array");
final Boolean[] result = new Boolean[array.length];
for (int i = 0; i != result.length; ++i) {
result[i] = array[i];
}
return result;
} | class class_name[name] begin[{]
method[box, return_type[type[Boolean]], modifier[public static], parameter[array]] begin[{]
call[dbc.precondition, parameter[binary_operation[member[.array], !=, literal[null]], literal["cannot box a null boolean array"]]]
local_variable[type[Boolean], result]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=result, 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[}] | Keyword[public] Keyword[static] identifier[Boolean] operator[SEP] operator[SEP] identifier[box] operator[SEP] Keyword[boolean] operator[SEP] operator[SEP] identifier[array] operator[SEP] {
identifier[dbc] operator[SEP] identifier[precondition] operator[SEP] identifier[array] operator[!=] Other[null] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Boolean] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[Boolean] operator[SEP] identifier[array] 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[result] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[result] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public static void PEMtoP12(File pem, String pemPassword, File toP12, String p12Password) throws IOException
{
if (!pem.exists())
throw new IllegalArgumentException("pem file does not exist: " + pem.getPath());
Execed openssl = Exec.utilityAs(null,
OPENSSL,
"pkcs12",
"-nodes",
"-in",
pem.getPath(),
"-out",
toP12.getPath(),
"-export",
"-passin",
"pass:" + pemPassword,
"-passout",
"pass:" + p12Password);
int returnCode = openssl.waitForExit();
if (returnCode != 0)
throw new IllegalStateException("Unexpected openssl exit code " + returnCode + "; output:\n" +
openssl.getStandardOut());
} | class class_name[name] begin[{]
method[PEMtoP12, return_type[void], modifier[public static], parameter[pem, pemPassword, toP12, p12Password]] begin[{]
if[call[pem.exists, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="pem file does not exist: "), operandr=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=pem, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Execed], openssl]
local_variable[type[int], returnCode]
if[binary_operation[member[.returnCode], !=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected openssl exit code "), operandr=MemberReference(member=returnCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="; output:\n"), operator=+), operandr=MethodInvocation(arguments=[], member=getStandardOut, postfix_operators=[], prefix_operators=[], qualifier=openssl, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[PEMtoP12] operator[SEP] identifier[File] identifier[pem] , identifier[String] identifier[pemPassword] , identifier[File] identifier[toP12] , identifier[String] identifier[p12Password] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[pem] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[pem] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Execed] identifier[openssl] operator[=] identifier[Exec] operator[SEP] identifier[utilityAs] operator[SEP] Other[null] , identifier[OPENSSL] , literal[String] , literal[String] , literal[String] , identifier[pem] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , literal[String] , identifier[toP12] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] , literal[String] , literal[String] , literal[String] operator[+] identifier[pemPassword] , literal[String] , literal[String] operator[+] identifier[p12Password] operator[SEP] operator[SEP] Keyword[int] identifier[returnCode] operator[=] identifier[openssl] operator[SEP] identifier[waitForExit] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[returnCode] operator[!=] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] identifier[returnCode] operator[+] literal[String] operator[+] identifier[openssl] operator[SEP] identifier[getStandardOut] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static char getChar(String symbol)
{
CharInfo info = (CharInfo) fSymbolMap.get(symbol);
return (info != null) ? (char) info.fCode : '\0';
} | class class_name[name] begin[{]
method[getChar, return_type[type[char]], modifier[public static], parameter[symbol]] begin[{]
local_variable[type[CharInfo], info]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\0'), if_true=Cast(expression=MemberReference(member=fCode, postfix_operators=[], prefix_operators=[], qualifier=info, selectors=[]), type=BasicType(dimensions=[], name=char)))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[char] identifier[getChar] operator[SEP] identifier[String] identifier[symbol] operator[SEP] {
identifier[CharInfo] identifier[info] operator[=] operator[SEP] identifier[CharInfo] operator[SEP] identifier[fSymbolMap] operator[SEP] identifier[get] operator[SEP] identifier[symbol] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[info] operator[!=] Other[null] operator[SEP] operator[?] operator[SEP] Keyword[char] operator[SEP] identifier[info] operator[SEP] identifier[fCode] operator[:] literal[String] operator[SEP]
}
|
public void runPendingTasks() {
try {
loop.runTasks();
} catch (Exception e) {
recordException(e);
}
try {
loop.runScheduledTasks();
} catch (Exception e) {
recordException(e);
}
} | class class_name[name] begin[{]
method[runPendingTasks, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=runTasks, postfix_operators=[], prefix_operators=[], qualifier=loop, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recordException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=runScheduledTasks, postfix_operators=[], prefix_operators=[], qualifier=loop, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recordException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[runPendingTasks] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[loop] operator[SEP] identifier[runTasks] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[recordException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[loop] operator[SEP] identifier[runScheduledTasks] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[recordException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static Document toDocument(final String aFilePath, final String aPattern, final boolean aDeepConversion)
throws FileNotFoundException, ParserConfigurationException {
final Element element = toElement(aFilePath, aPattern, aDeepConversion);
final Document document = element.getOwnerDocument();
document.appendChild(element);
return document;
} | class class_name[name] begin[{]
method[toDocument, return_type[type[Document]], modifier[public static], parameter[aFilePath, aPattern, aDeepConversion]] begin[{]
local_variable[type[Element], element]
local_variable[type[Document], document]
call[document.appendChild, parameter[member[.element]]]
return[member[.document]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Document] identifier[toDocument] operator[SEP] Keyword[final] identifier[String] identifier[aFilePath] , Keyword[final] identifier[String] identifier[aPattern] , Keyword[final] Keyword[boolean] identifier[aDeepConversion] operator[SEP] Keyword[throws] identifier[FileNotFoundException] , identifier[ParserConfigurationException] {
Keyword[final] identifier[Element] identifier[element] operator[=] identifier[toElement] operator[SEP] identifier[aFilePath] , identifier[aPattern] , identifier[aDeepConversion] operator[SEP] operator[SEP] Keyword[final] identifier[Document] identifier[document] operator[=] identifier[element] operator[SEP] identifier[getOwnerDocument] operator[SEP] operator[SEP] operator[SEP] identifier[document] operator[SEP] identifier[appendChild] operator[SEP] identifier[element] operator[SEP] operator[SEP] Keyword[return] identifier[document] operator[SEP]
}
|
protected VertCoordType getLevelType(int code) {
VertCoordType result = wmoTable3.get(code);
if (result == null)
result = new VertCoordType(code, "unknownLayer"+code, null, "unknownLayer"+code, null, false, false);
return result;
} | class class_name[name] begin[{]
method[getLevelType, return_type[type[VertCoordType]], modifier[protected], parameter[code]] begin[{]
local_variable[type[VertCoordType], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
assign[member[.result], ClassCreator(arguments=[MemberReference(member=code, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unknownLayer"), operandr=MemberReference(member=code, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="unknownLayer"), operandr=MemberReference(member=code, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VertCoordType, sub_type=None))]
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[protected] identifier[VertCoordType] identifier[getLevelType] operator[SEP] Keyword[int] identifier[code] operator[SEP] {
identifier[VertCoordType] identifier[result] operator[=] identifier[wmoTable3] operator[SEP] identifier[get] operator[SEP] identifier[code] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] identifier[result] operator[=] Keyword[new] identifier[VertCoordType] operator[SEP] identifier[code] , literal[String] operator[+] identifier[code] , Other[null] , literal[String] operator[+] identifier[code] , Other[null] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
protected void doSend(Postcard postcard, SMailPostingMessage message) {
logMailBefore(postcard, message);
RuntimeException cause = null;
try {
retryableSend(postcard, message);
} catch (RuntimeException e) {
cause = e;
if (postcard.isSuppressSendFailure()) {
logSuppressedCause(postcard, message, e);
} else {
throw e;
}
} finally {
logMailFinally(postcard, message, cause);
}
} | class class_name[name] begin[{]
method[doSend, return_type[void], modifier[protected], parameter[postcard, message]] begin[{]
call[.logMailBefore, parameter[member[.postcard], member[.message]]]
local_variable[type[RuntimeException], cause]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=postcard, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=retryableSend, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isSuppressSendFailure, postfix_operators=[], prefix_operators=[], qualifier=postcard, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=postcard, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=logSuppressedCause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RuntimeException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=postcard, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=logMailFinally, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[doSend] operator[SEP] identifier[Postcard] identifier[postcard] , identifier[SMailPostingMessage] identifier[message] operator[SEP] {
identifier[logMailBefore] operator[SEP] identifier[postcard] , identifier[message] operator[SEP] operator[SEP] identifier[RuntimeException] identifier[cause] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[retryableSend] operator[SEP] identifier[postcard] , identifier[message] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[e] operator[SEP] {
identifier[cause] operator[=] identifier[e] operator[SEP] Keyword[if] operator[SEP] identifier[postcard] operator[SEP] identifier[isSuppressSendFailure] operator[SEP] operator[SEP] operator[SEP] {
identifier[logSuppressedCause] operator[SEP] identifier[postcard] , identifier[message] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] identifier[e] operator[SEP]
}
}
Keyword[finally] {
identifier[logMailFinally] operator[SEP] identifier[postcard] , identifier[message] , identifier[cause] operator[SEP] operator[SEP]
}
}
|
public GeneralTimestamp<FrenchRepublicanCalendar> atTime(
int hour,
int minute
) {
return this.at(PlainTime.of(hour, minute));
} | class class_name[name] begin[{]
method[atTime, return_type[type[GeneralTimestamp]], modifier[public], parameter[hour, minute]] begin[{]
return[THIS[call[None.at, parameter[call[PlainTime.of, parameter[member[.hour], member[.minute]]]]]]]
end[}]
END[}] | Keyword[public] identifier[GeneralTimestamp] operator[<] identifier[FrenchRepublicanCalendar] operator[>] identifier[atTime] operator[SEP] Keyword[int] identifier[hour] , Keyword[int] identifier[minute] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[at] operator[SEP] identifier[PlainTime] operator[SEP] identifier[of] operator[SEP] identifier[hour] , identifier[minute] operator[SEP] operator[SEP] operator[SEP]
}
|
private IQueryAtom matchExact(final IAtomContainer mol, final IAtom atom) {
final IChemObjectBuilder bldr = atom.getBuilder();
int elem = atom.getAtomicNumber();
// attach atom skipped
if (elem == 0)
return null;
int hcnt = atom.getImplicitHydrogenCount();
int val = hcnt;
int con = hcnt;
for (IBond bond : mol.getConnectedBondsList(atom)) {
val += bond.getOrder().numeric();
con++;
if (bond.getOther(atom).getAtomicNumber() == 1)
hcnt++;
}
Expr expr = new Expr(Expr.Type.ELEMENT, elem)
.and(new Expr(Expr.Type.TOTAL_DEGREE, con))
.and(new Expr(Expr.Type.TOTAL_H_COUNT, hcnt))
.and(new Expr(Expr.Type.VALENCE, val));
return new QueryAtom(expr);
} | class class_name[name] begin[{]
method[matchExact, return_type[type[IQueryAtom]], modifier[private], parameter[mol, atom]] begin[{]
local_variable[type[IChemObjectBuilder], bldr]
local_variable[type[int], elem]
if[binary_operation[member[.elem], ==, literal[0]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], hcnt]
local_variable[type[int], val]
local_variable[type[int], con]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getOrder, postfix_operators=[], prefix_operators=[], qualifier=bond, selectors=[MethodInvocation(arguments=[], member=numeric, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=con, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=atom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getOther, postfix_operators=[], prefix_operators=[], qualifier=bond, selectors=[MethodInvocation(arguments=[], member=getAtomicNumber, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=MemberReference(member=hcnt, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=atom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getConnectedBondsList, postfix_operators=[], prefix_operators=[], qualifier=mol, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bond)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IBond, sub_type=None))), label=None)
local_variable[type[Expr], expr]
return[ClassCreator(arguments=[MemberReference(member=expr, 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=QueryAtom, sub_type=None))]
end[}]
END[}] | Keyword[private] identifier[IQueryAtom] identifier[matchExact] operator[SEP] Keyword[final] identifier[IAtomContainer] identifier[mol] , Keyword[final] identifier[IAtom] identifier[atom] operator[SEP] {
Keyword[final] identifier[IChemObjectBuilder] identifier[bldr] operator[=] identifier[atom] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[elem] operator[=] identifier[atom] operator[SEP] identifier[getAtomicNumber] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[elem] operator[==] Other[0] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[int] identifier[hcnt] operator[=] identifier[atom] operator[SEP] identifier[getImplicitHydrogenCount] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[val] operator[=] identifier[hcnt] operator[SEP] Keyword[int] identifier[con] operator[=] identifier[hcnt] operator[SEP] Keyword[for] operator[SEP] identifier[IBond] identifier[bond] operator[:] identifier[mol] operator[SEP] identifier[getConnectedBondsList] operator[SEP] identifier[atom] operator[SEP] operator[SEP] {
identifier[val] operator[+=] identifier[bond] operator[SEP] identifier[getOrder] operator[SEP] operator[SEP] operator[SEP] identifier[numeric] operator[SEP] operator[SEP] operator[SEP] identifier[con] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[bond] operator[SEP] identifier[getOther] operator[SEP] identifier[atom] operator[SEP] operator[SEP] identifier[getAtomicNumber] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] identifier[hcnt] operator[++] operator[SEP]
}
identifier[Expr] identifier[expr] operator[=] Keyword[new] identifier[Expr] operator[SEP] identifier[Expr] operator[SEP] identifier[Type] operator[SEP] identifier[ELEMENT] , identifier[elem] operator[SEP] operator[SEP] identifier[and] operator[SEP] Keyword[new] identifier[Expr] operator[SEP] identifier[Expr] operator[SEP] identifier[Type] operator[SEP] identifier[TOTAL_DEGREE] , identifier[con] operator[SEP] operator[SEP] operator[SEP] identifier[and] operator[SEP] Keyword[new] identifier[Expr] operator[SEP] identifier[Expr] operator[SEP] identifier[Type] operator[SEP] identifier[TOTAL_H_COUNT] , identifier[hcnt] operator[SEP] operator[SEP] operator[SEP] identifier[and] operator[SEP] Keyword[new] identifier[Expr] operator[SEP] identifier[Expr] operator[SEP] identifier[Type] operator[SEP] identifier[VALENCE] , identifier[val] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[QueryAtom] operator[SEP] identifier[expr] operator[SEP] operator[SEP]
}
|
public void populateSalary(ResultSet row, ObjectNode s) throws SQLException {
s.put("employeeId", row.getInt("emp_no"));
s.put("salary", row.getInt("salary"));
Calendar fromDate = Calendar.getInstance();
fromDate.setTime(row.getDate("from_date"));
s.put("fromDate", dateFormat.format(fromDate.getTime()));
Calendar toDate = Calendar.getInstance();
toDate.setTime(row.getDate("to_date"));
s.put("toDate", dateFormat.format(toDate.getTime()));
} | class class_name[name] begin[{]
method[populateSalary, return_type[void], modifier[public], parameter[row, s]] begin[{]
call[s.put, parameter[literal["employeeId"], call[row.getInt, parameter[literal["emp_no"]]]]]
call[s.put, parameter[literal["salary"], call[row.getInt, parameter[literal["salary"]]]]]
local_variable[type[Calendar], fromDate]
call[fromDate.setTime, parameter[call[row.getDate, parameter[literal["from_date"]]]]]
call[s.put, parameter[literal["fromDate"], call[dateFormat.format, parameter[call[fromDate.getTime, parameter[]]]]]]
local_variable[type[Calendar], toDate]
call[toDate.setTime, parameter[call[row.getDate, parameter[literal["to_date"]]]]]
call[s.put, parameter[literal["toDate"], call[dateFormat.format, parameter[call[toDate.getTime, parameter[]]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[populateSalary] operator[SEP] identifier[ResultSet] identifier[row] , identifier[ObjectNode] identifier[s] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[s] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[row] operator[SEP] identifier[getInt] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[row] operator[SEP] identifier[getInt] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[Calendar] identifier[fromDate] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[fromDate] operator[SEP] identifier[setTime] operator[SEP] identifier[row] operator[SEP] identifier[getDate] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[dateFormat] operator[SEP] identifier[format] operator[SEP] identifier[fromDate] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Calendar] identifier[toDate] operator[=] identifier[Calendar] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[toDate] operator[SEP] identifier[setTime] operator[SEP] identifier[row] operator[SEP] identifier[getDate] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[s] operator[SEP] identifier[put] operator[SEP] literal[String] , identifier[dateFormat] operator[SEP] identifier[format] operator[SEP] identifier[toDate] operator[SEP] identifier[getTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.