code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
protected static <T extends ElkEntity, I extends ElkEntity> void printMemberAxioms(
final I member, final List<I> equivalentMembers,
final SortedSet<T> directSuperMembers, final Taxonomy<T> taxonomy,
final ElkObject.Factory factory, final Appendable writer)
throws IOException {
if (equivalentMembers.size() > 1) {
final ElkAxiom axiom = member.accept(
getEquivalentAxiomProvider(equivalentMembers, factory));
OwlFunctionalStylePrinter.append(writer, axiom, true);
writer.append('\n');
}
// TODO: this should exclude implicit axioms as owl:Thing ⊑ owl:Nothing
if (!member.equals(taxonomy.getBottomNode().getCanonicalMember())) {
for (final T superMember : directSuperMembers) {
if (!superMember
.equals(taxonomy.getTopNode().getCanonicalMember())) {
final ElkAxiom axiom = member
.accept(getSubAxiomProvider(superMember, factory));
OwlFunctionalStylePrinter.append(writer, axiom, true);
writer.append('\n');
}
}
}
} | class class_name[name] begin[{]
method[printMemberAxioms, return_type[void], modifier[static protected], parameter[member, equivalentMembers, directSuperMembers, taxonomy, factory, writer]] begin[{]
if[binary_operation[call[equivalentMembers.size, parameter[]], >, literal[1]]] begin[{]
local_variable[type[ElkAxiom], axiom]
call[OwlFunctionalStylePrinter.append, parameter[member[.writer], member[.axiom], literal[true]]]
call[writer.append, parameter[literal['\n']]]
else begin[{]
None
end[}]
if[call[member.equals, parameter[call[taxonomy.getBottomNode, parameter[]]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTopNode, postfix_operators=[], prefix_operators=[], qualifier=taxonomy, selectors=[MethodInvocation(arguments=[], member=getCanonicalMember, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=superMember, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=superMember, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=factory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getSubAxiomProvider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=accept, postfix_operators=[], prefix_operators=[], qualifier=member, selectors=[], type_arguments=None), name=axiom)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ElkAxiom, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=axiom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=append, postfix_operators=[], prefix_operators=[], qualifier=OwlFunctionalStylePrinter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n')], member=append, postfix_operators=[], prefix_operators=[], qualifier=writer, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=directSuperMembers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=superMember)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[ElkEntity] , identifier[I] Keyword[extends] identifier[ElkEntity] operator[>] Keyword[void] identifier[printMemberAxioms] operator[SEP] Keyword[final] identifier[I] identifier[member] , Keyword[final] identifier[List] operator[<] identifier[I] operator[>] identifier[equivalentMembers] , Keyword[final] identifier[SortedSet] operator[<] identifier[T] operator[>] identifier[directSuperMembers] , Keyword[final] identifier[Taxonomy] operator[<] identifier[T] operator[>] identifier[taxonomy] , Keyword[final] identifier[ElkObject] operator[SEP] identifier[Factory] identifier[factory] , Keyword[final] identifier[Appendable] identifier[writer] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[equivalentMembers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[1] operator[SEP] {
Keyword[final] identifier[ElkAxiom] identifier[axiom] operator[=] identifier[member] operator[SEP] identifier[accept] operator[SEP] identifier[getEquivalentAxiomProvider] operator[SEP] identifier[equivalentMembers] , identifier[factory] operator[SEP] operator[SEP] operator[SEP] identifier[OwlFunctionalStylePrinter] operator[SEP] identifier[append] operator[SEP] identifier[writer] , identifier[axiom] , literal[boolean] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[member] operator[SEP] identifier[equals] operator[SEP] identifier[taxonomy] operator[SEP] identifier[getBottomNode] operator[SEP] operator[SEP] operator[SEP] identifier[getCanonicalMember] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[T] identifier[superMember] operator[:] identifier[directSuperMembers] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[superMember] operator[SEP] identifier[equals] operator[SEP] identifier[taxonomy] operator[SEP] identifier[getTopNode] operator[SEP] operator[SEP] operator[SEP] identifier[getCanonicalMember] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[ElkAxiom] identifier[axiom] operator[=] identifier[member] operator[SEP] identifier[accept] operator[SEP] identifier[getSubAxiomProvider] operator[SEP] identifier[superMember] , identifier[factory] operator[SEP] operator[SEP] operator[SEP] identifier[OwlFunctionalStylePrinter] operator[SEP] identifier[append] operator[SEP] identifier[writer] , identifier[axiom] , literal[boolean] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
}
|
@Override
public Object format(final Object _object,
final String _pattern)
throws EFapsException
{
final Object ret;
final DecimalFormat formatter
= (DecimalFormat) NumberFormat.getInstance(Context.getThreadContext().getLocale());
formatter.applyPattern(_pattern);
if (_object instanceof Object[]) {
final String tmp = formatter.format(((Object[]) _object)[0]);
((Object[]) _object)[0] = tmp;
ret = _object;
} else {
ret = formatter.format(_object);
}
return ret;
} | class class_name[name] begin[{]
method[format, return_type[type[Object]], modifier[public], parameter[_object, _pattern]] begin[{]
local_variable[type[Object], ret]
local_variable[type[DecimalFormat], formatter]
call[formatter.applyPattern, parameter[member[._pattern]]]
if[binary_operation[member[._object], instanceof, type[Object]]] begin[{]
local_variable[type[String], tmp]
assign[Cast(expression=MemberReference(member=_object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None)), member[.tmp]]
assign[member[.ret], member[._object]]
else begin[{]
assign[member[.ret], call[formatter.format, parameter[member[._object]]]]
end[}]
return[member[.ret]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[format] operator[SEP] Keyword[final] identifier[Object] identifier[_object] , Keyword[final] identifier[String] identifier[_pattern] operator[SEP] Keyword[throws] identifier[EFapsException] {
Keyword[final] identifier[Object] identifier[ret] operator[SEP] Keyword[final] identifier[DecimalFormat] identifier[formatter] operator[=] operator[SEP] identifier[DecimalFormat] operator[SEP] identifier[NumberFormat] operator[SEP] identifier[getInstance] operator[SEP] identifier[Context] operator[SEP] identifier[getThreadContext] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[formatter] operator[SEP] identifier[applyPattern] operator[SEP] identifier[_pattern] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_object] Keyword[instanceof] identifier[Object] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[tmp] operator[=] identifier[formatter] operator[SEP] identifier[format] operator[SEP] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[_object] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] identifier[_object] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[=] identifier[tmp] operator[SEP] identifier[ret] operator[=] identifier[_object] operator[SEP]
}
Keyword[else] {
identifier[ret] operator[=] identifier[formatter] operator[SEP] identifier[format] operator[SEP] identifier[_object] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
public PlainTimestamp atTime(
int hour,
int minute,
int second
) {
return this.at(PlainTime.of(hour, minute, second));
} | class class_name[name] begin[{]
method[atTime, return_type[type[PlainTimestamp]], modifier[public], parameter[hour, minute, second]] begin[{]
return[THIS[call[None.at, parameter[call[PlainTime.of, parameter[member[.hour], member[.minute], member[.second]]]]]]]
end[}]
END[}] | Keyword[public] identifier[PlainTimestamp] identifier[atTime] operator[SEP] Keyword[int] identifier[hour] , Keyword[int] identifier[minute] , Keyword[int] identifier[second] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[at] operator[SEP] identifier[PlainTime] operator[SEP] identifier[of] operator[SEP] identifier[hour] , identifier[minute] , identifier[second] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String toJSON(Object value, ObjectMapper mapper) {
try {
return mapper.writeValueAsString(value);
} catch (IOException ex) {
throw new FacebookException(ex);
}
} | class class_name[name] begin[{]
method[toJSON, return_type[type[String]], modifier[public static], parameter[value, mapper]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeValueAsString, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FacebookException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[toJSON] operator[SEP] identifier[Object] identifier[value] , identifier[ObjectMapper] identifier[mapper] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[mapper] operator[SEP] identifier[writeValueAsString] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FacebookException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
|
public ContactService getContactService() {
if (_contactService == null) {
synchronized (CCApi2.class) {
if (_contactService == null) {
_contactService = _retrofit.create(ContactService.class);
}
}
}
return _contactService;
} | class class_name[name] begin[{]
method[getContactService, return_type[type[ContactService]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[._contactService], ==, literal[null]]] begin[{]
SYNCHRONIZED[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CCApi2, sub_type=None))] BEGIN[{]
if[binary_operation[member[._contactService], ==, literal[null]]] begin[{]
assign[member[._contactService], call[_retrofit.create, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ContactService, sub_type=None))]]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
return[member[._contactService]]
end[}]
END[}] | Keyword[public] identifier[ContactService] identifier[getContactService] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[_contactService] operator[==] Other[null] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[CCApi2] operator[SEP] Keyword[class] operator[SEP] {
Keyword[if] operator[SEP] identifier[_contactService] operator[==] Other[null] operator[SEP] {
identifier[_contactService] operator[=] identifier[_retrofit] operator[SEP] identifier[create] operator[SEP] identifier[ContactService] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[_contactService] operator[SEP]
}
|
public Struct getTraitDefinition(final String guid, final String traitName) throws AtlasServiceException{
JSONObject jsonResponse = callAPIWithBodyAndParams(API.GET_TRAIT_DEFINITION, null, guid, TRAIT_DEFINITIONS, traitName);
try {
return InstanceSerialization.fromJsonStruct(jsonResponse.getString(AtlasClient.RESULTS), false);
}catch (JSONException e){
throw new AtlasServiceException(API.GET_TRAIT_DEFINITION, e);
}
} | class class_name[name] begin[{]
method[getTraitDefinition, return_type[type[Struct]], modifier[public], parameter[guid, traitName]] begin[{]
local_variable[type[JSONObject], jsonResponse]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=RESULTS, postfix_operators=[], prefix_operators=[], qualifier=AtlasClient, selectors=[])], member=getString, postfix_operators=[], prefix_operators=[], qualifier=jsonResponse, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=fromJsonStruct, postfix_operators=[], prefix_operators=[], qualifier=InstanceSerialization, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=GET_TRAIT_DEFINITION, postfix_operators=[], prefix_operators=[], qualifier=API, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AtlasServiceException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JSONException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Struct] identifier[getTraitDefinition] operator[SEP] Keyword[final] identifier[String] identifier[guid] , Keyword[final] identifier[String] identifier[traitName] operator[SEP] Keyword[throws] identifier[AtlasServiceException] {
identifier[JSONObject] identifier[jsonResponse] operator[=] identifier[callAPIWithBodyAndParams] operator[SEP] identifier[API] operator[SEP] identifier[GET_TRAIT_DEFINITION] , Other[null] , identifier[guid] , identifier[TRAIT_DEFINITIONS] , identifier[traitName] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[InstanceSerialization] operator[SEP] identifier[fromJsonStruct] operator[SEP] identifier[jsonResponse] operator[SEP] identifier[getString] operator[SEP] identifier[AtlasClient] operator[SEP] identifier[RESULTS] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JSONException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[AtlasServiceException] operator[SEP] identifier[API] operator[SEP] identifier[GET_TRAIT_DEFINITION] , identifier[e] operator[SEP] operator[SEP]
}
}
|
private void avoidObstacle(int nextStep, int max)
{
if (nextStep >= max - 1)
{
pathStoppedRequested = true;
}
final Collection<Integer> cid = mapPath.getObjectsId(path.getX(nextStep), path.getY(nextStep));
if (sharedPathIds.containsAll(cid))
{
setDestination(destX, destY);
}
else
{
if (!ignoredIds.containsAll(cid))
{
setDestination(destX, destY);
}
}
} | class class_name[name] begin[{]
method[avoidObstacle, return_type[void], modifier[private], parameter[nextStep, max]] begin[{]
if[binary_operation[member[.nextStep], >=, binary_operation[member[.max], -, literal[1]]]] begin[{]
assign[member[.pathStoppedRequested], literal[true]]
else begin[{]
None
end[}]
local_variable[type[Collection], cid]
if[call[sharedPathIds.containsAll, parameter[member[.cid]]]] begin[{]
call[.setDestination, parameter[member[.destX], member[.destY]]]
else begin[{]
if[call[ignoredIds.containsAll, parameter[member[.cid]]]] begin[{]
call[.setDestination, parameter[member[.destX], member[.destY]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[avoidObstacle] operator[SEP] Keyword[int] identifier[nextStep] , Keyword[int] identifier[max] operator[SEP] {
Keyword[if] operator[SEP] identifier[nextStep] operator[>=] identifier[max] operator[-] Other[1] operator[SEP] {
identifier[pathStoppedRequested] operator[=] literal[boolean] operator[SEP]
}
Keyword[final] identifier[Collection] operator[<] identifier[Integer] operator[>] identifier[cid] operator[=] identifier[mapPath] operator[SEP] identifier[getObjectsId] operator[SEP] identifier[path] operator[SEP] identifier[getX] operator[SEP] identifier[nextStep] operator[SEP] , identifier[path] operator[SEP] identifier[getY] operator[SEP] identifier[nextStep] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sharedPathIds] operator[SEP] identifier[containsAll] operator[SEP] identifier[cid] operator[SEP] operator[SEP] {
identifier[setDestination] operator[SEP] identifier[destX] , identifier[destY] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] operator[!] identifier[ignoredIds] operator[SEP] identifier[containsAll] operator[SEP] identifier[cid] operator[SEP] operator[SEP] {
identifier[setDestination] operator[SEP] identifier[destX] , identifier[destY] operator[SEP] operator[SEP]
}
}
}
|
public com.squareup.okhttp.Call optionsPostAsync(OptionsPost body, final ApiCallback<OptionsPostResponseStatusSuccess> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = optionsPostValidateBeforeCall(body, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<OptionsPostResponseStatusSuccess>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | class class_name[name] begin[{]
method[optionsPostAsync, return_type[type[com]], modifier[public], parameter[body, callback]] begin[{]
local_variable[type[ProgressResponseBody], progressListener]
local_variable[type[ProgressRequestBody], progressRequestListener]
if[binary_operation[member[.callback], !=, literal[null]]] begin[{]
assign[member[.progressListener], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bytesRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=contentLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=done, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onDownloadProgress, postfix_operators=[], prefix_operators=[], qualifier=callback, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=update, parameters=[FormalParameter(annotations=[], modifiers=set(), name=bytesRead, type=BasicType(dimensions=[], name=long), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=contentLength, type=BasicType(dimensions=[], name=long), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=done, type=BasicType(dimensions=[], name=boolean), 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=ProgressResponseBody, sub_type=ReferenceType(arguments=None, dimensions=None, name=ProgressListener, sub_type=None)))]
assign[member[.progressRequestListener], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bytesWritten, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=contentLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=done, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onUploadProgress, postfix_operators=[], prefix_operators=[], qualifier=callback, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onRequestProgress, parameters=[FormalParameter(annotations=[], modifiers=set(), name=bytesWritten, type=BasicType(dimensions=[], name=long), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=contentLength, type=BasicType(dimensions=[], name=long), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=done, type=BasicType(dimensions=[], name=boolean), 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=ProgressRequestBody, sub_type=ReferenceType(arguments=None, dimensions=None, name=ProgressRequestListener, sub_type=None)))]
else begin[{]
None
end[}]
local_variable[type[com], call]
local_variable[type[Type], localVarReturnType]
call[apiClient.executeAsync, parameter[member[.call], member[.localVarReturnType], member[.callback]]]
return[member[.call]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[optionsPostAsync] operator[SEP] identifier[OptionsPost] identifier[body] , Keyword[final] identifier[ApiCallback] operator[<] identifier[OptionsPostResponseStatusSuccess] operator[>] identifier[callback] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[ProgressResponseBody] operator[SEP] identifier[ProgressListener] identifier[progressListener] operator[=] Other[null] operator[SEP] identifier[ProgressRequestBody] operator[SEP] identifier[ProgressRequestListener] identifier[progressRequestListener] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[callback] operator[!=] Other[null] operator[SEP] {
identifier[progressListener] operator[=] Keyword[new] identifier[ProgressResponseBody] operator[SEP] identifier[ProgressListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[update] operator[SEP] Keyword[long] identifier[bytesRead] , Keyword[long] identifier[contentLength] , Keyword[boolean] identifier[done] operator[SEP] {
identifier[callback] operator[SEP] identifier[onDownloadProgress] operator[SEP] identifier[bytesRead] , identifier[contentLength] , identifier[done] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[progressRequestListener] operator[=] Keyword[new] identifier[ProgressRequestBody] operator[SEP] identifier[ProgressRequestListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onRequestProgress] operator[SEP] Keyword[long] identifier[bytesWritten] , Keyword[long] identifier[contentLength] , Keyword[boolean] identifier[done] operator[SEP] {
identifier[callback] operator[SEP] identifier[onUploadProgress] operator[SEP] identifier[bytesWritten] , identifier[contentLength] , identifier[done] operator[SEP] operator[SEP]
}
} operator[SEP]
}
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[optionsPostValidateBeforeCall] operator[SEP] identifier[body] , identifier[progressListener] , identifier[progressRequestListener] operator[SEP] operator[SEP] identifier[Type] identifier[localVarReturnType] operator[=] Keyword[new] identifier[TypeToken] operator[<] identifier[OptionsPostResponseStatusSuccess] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[apiClient] operator[SEP] identifier[executeAsync] operator[SEP] identifier[call] , identifier[localVarReturnType] , identifier[callback] operator[SEP] operator[SEP] Keyword[return] identifier[call] operator[SEP]
}
|
public ServiceFuture<LiveOutputInner> beginCreateAsync(String resourceGroupName, String accountName, String liveEventName, String liveOutputName, LiveOutputInner parameters, final ServiceCallback<LiveOutputInner> serviceCallback) {
return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName, parameters), serviceCallback);
} | class class_name[name] begin[{]
method[beginCreateAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, accountName, liveEventName, liveOutputName, parameters, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.beginCreateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.accountName], member[.liveEventName], member[.liveOutputName], member[.parameters]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[LiveOutputInner] operator[>] identifier[beginCreateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[accountName] , identifier[String] identifier[liveEventName] , identifier[String] identifier[liveOutputName] , identifier[LiveOutputInner] identifier[parameters] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[LiveOutputInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[beginCreateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[accountName] , identifier[liveEventName] , identifier[liveOutputName] , identifier[parameters] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public Variable addVariable(String varName, Class componentType, Dimension[] dims) {
List<Dimension> list = new ArrayList<Dimension>();
list.addAll(Arrays.asList(dims));
return addVariable(varName, DataType.getType(componentType, false), list); // LOOK unsigned
} | class class_name[name] begin[{]
method[addVariable, return_type[type[Variable]], modifier[public], parameter[varName, componentType, dims]] begin[{]
local_variable[type[List], list]
call[list.addAll, parameter[call[Arrays.asList, parameter[member[.dims]]]]]
return[call[.addVariable, parameter[member[.varName], call[DataType.getType, parameter[member[.componentType], literal[false]]], member[.list]]]]
end[}]
END[}] | Keyword[public] identifier[Variable] identifier[addVariable] operator[SEP] identifier[String] identifier[varName] , identifier[Class] identifier[componentType] , identifier[Dimension] operator[SEP] operator[SEP] identifier[dims] operator[SEP] {
identifier[List] operator[<] identifier[Dimension] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Dimension] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[dims] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[addVariable] operator[SEP] identifier[varName] , identifier[DataType] operator[SEP] identifier[getType] operator[SEP] identifier[componentType] , literal[boolean] operator[SEP] , identifier[list] operator[SEP] operator[SEP]
}
|
public void start() {
connector.registerConnectorListener(this::onCommandReceived);
connector.registerConnectionChangeListener(this::onConnectionChange);
connector.start();
executor.scheduleAtFixedRate(this::checkHeartbeat, 1000, 1000, TimeUnit.MILLISECONDS);
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[]] begin[{]
call[connector.registerConnectorListener, parameter[MethodReference(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), method=MemberReference(member=onCommandReceived, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])]]
call[connector.registerConnectionChangeListener, parameter[MethodReference(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), method=MemberReference(member=onConnectionChange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])]]
call[connector.start, parameter[]]
call[executor.scheduleAtFixedRate, parameter[MethodReference(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), method=MemberReference(member=checkHeartbeat, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), literal[1000], literal[1000], member[TimeUnit.MILLISECONDS]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[start] operator[SEP] operator[SEP] {
identifier[connector] operator[SEP] identifier[registerConnectorListener] operator[SEP] Keyword[this] operator[::] identifier[onCommandReceived] operator[SEP] operator[SEP] identifier[connector] operator[SEP] identifier[registerConnectionChangeListener] operator[SEP] Keyword[this] operator[::] identifier[onConnectionChange] operator[SEP] operator[SEP] identifier[connector] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[executor] operator[SEP] identifier[scheduleAtFixedRate] operator[SEP] Keyword[this] operator[::] identifier[checkHeartbeat] , Other[1000] , Other[1000] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
|
public final boolean isInferredConst() {
if (nameNode == null) {
return false;
}
return nameNode.getBooleanProp(Node.IS_CONSTANT_VAR)
|| nameNode.getBooleanProp(Node.IS_CONSTANT_NAME);
} | class class_name[name] begin[{]
method[isInferredConst, return_type[type[boolean]], modifier[final public], parameter[]] begin[{]
if[binary_operation[member[.nameNode], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[call[nameNode.getBooleanProp, parameter[member[Node.IS_CONSTANT_VAR]]], ||, call[nameNode.getBooleanProp, parameter[member[Node.IS_CONSTANT_NAME]]]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[boolean] identifier[isInferredConst] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[nameNode] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] identifier[nameNode] operator[SEP] identifier[getBooleanProp] operator[SEP] identifier[Node] operator[SEP] identifier[IS_CONSTANT_VAR] operator[SEP] operator[||] identifier[nameNode] operator[SEP] identifier[getBooleanProp] operator[SEP] identifier[Node] operator[SEP] identifier[IS_CONSTANT_NAME] operator[SEP] operator[SEP]
}
|
public Enumeration listMessagingEngines(String busName) {
if (!isInitialized()) {
Vector v = new Vector();
return v.elements();
}
return _jsmain.listMessagingEngines(busName);
} | class class_name[name] begin[{]
method[listMessagingEngines, return_type[type[Enumeration]], modifier[public], parameter[busName]] begin[{]
if[call[.isInitialized, parameter[]]] begin[{]
local_variable[type[Vector], v]
return[call[v.elements, parameter[]]]
else begin[{]
None
end[}]
return[call[_jsmain.listMessagingEngines, parameter[member[.busName]]]]
end[}]
END[}] | Keyword[public] identifier[Enumeration] identifier[listMessagingEngines] operator[SEP] identifier[String] identifier[busName] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isInitialized] operator[SEP] operator[SEP] operator[SEP] {
identifier[Vector] identifier[v] operator[=] Keyword[new] identifier[Vector] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[v] operator[SEP] identifier[elements] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[_jsmain] operator[SEP] identifier[listMessagingEngines] operator[SEP] identifier[busName] operator[SEP] operator[SEP]
}
|
public SlotOffer generateSlotOffer() {
Preconditions.checkState(TaskSlotState.ACTIVE == state || TaskSlotState.ALLOCATED == state,
"The task slot is not in state active or allocated.");
Preconditions.checkState(allocationId != null, "The task slot are not allocated");
return new SlotOffer(allocationId, index, resourceProfile);
} | class class_name[name] begin[{]
method[generateSlotOffer, return_type[type[SlotOffer]], modifier[public], parameter[]] begin[{]
call[Preconditions.checkState, parameter[binary_operation[binary_operation[member[TaskSlotState.ACTIVE], ==, member[.state]], ||, binary_operation[member[TaskSlotState.ALLOCATED], ==, member[.state]]], literal["The task slot is not in state active or allocated."]]]
call[Preconditions.checkState, parameter[binary_operation[member[.allocationId], !=, literal[null]], literal["The task slot are not allocated"]]]
return[ClassCreator(arguments=[MemberReference(member=allocationId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resourceProfile, 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=SlotOffer, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[SlotOffer] identifier[generateSlotOffer] operator[SEP] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[TaskSlotState] operator[SEP] identifier[ACTIVE] operator[==] identifier[state] operator[||] identifier[TaskSlotState] operator[SEP] identifier[ALLOCATED] operator[==] identifier[state] , literal[String] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[allocationId] operator[!=] Other[null] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[SlotOffer] operator[SEP] identifier[allocationId] , identifier[index] , identifier[resourceProfile] operator[SEP] operator[SEP]
}
|
public Observable<Page<SharedAccessSignatureAuthorizationRuleInner>> listKeysNextAsync(final String nextPageLink) {
return listKeysNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<SharedAccessSignatureAuthorizationRuleInner>>, Page<SharedAccessSignatureAuthorizationRuleInner>>() {
@Override
public Page<SharedAccessSignatureAuthorizationRuleInner> call(ServiceResponse<Page<SharedAccessSignatureAuthorizationRuleInner>> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[listKeysNextAsync, return_type[type[Observable]], modifier[public], parameter[nextPageLink]] begin[{]
return[call[.listKeysNextWithServiceResponseAsync, parameter[member[.nextPageLink]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Page] operator[<] identifier[SharedAccessSignatureAuthorizationRuleInner] operator[>] operator[>] identifier[listKeysNextAsync] operator[SEP] Keyword[final] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[return] identifier[listKeysNextWithServiceResponseAsync] operator[SEP] identifier[nextPageLink] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[SharedAccessSignatureAuthorizationRuleInner] operator[>] operator[>] , identifier[Page] operator[<] identifier[SharedAccessSignatureAuthorizationRuleInner] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Page] operator[<] identifier[SharedAccessSignatureAuthorizationRuleInner] operator[>] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[SharedAccessSignatureAuthorizationRuleInner] operator[>] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static String encode(String content) {
if (content == null || content.length() == 0) {
return content;
}
return org.apache.commons.codec.binary.Base64.encodeBase64String(content.getBytes()).trim();
} | class class_name[name] begin[{]
method[encode, return_type[type[String]], modifier[public static], parameter[content]] begin[{]
if[binary_operation[binary_operation[member[.content], ==, literal[null]], ||, binary_operation[call[content.length, parameter[]], ==, literal[0]]]] begin[{]
return[member[.content]]
else begin[{]
None
end[}]
return[call[org.apache.commons.codec.binary.Base64.encodeBase64String, parameter[call[content.getBytes, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[encode] operator[SEP] identifier[String] identifier[content] operator[SEP] {
Keyword[if] operator[SEP] identifier[content] operator[==] Other[null] operator[||] identifier[content] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[content] operator[SEP]
}
Keyword[return] identifier[org] operator[SEP] identifier[apache] operator[SEP] identifier[commons] operator[SEP] identifier[codec] operator[SEP] identifier[binary] operator[SEP] identifier[Base64] operator[SEP] identifier[encodeBase64String] operator[SEP] identifier[content] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP]
}
|
private String rewriteUri(String internalUri) {
// if an object wrapper is used, rewrite the uri
if (m_cms != null) {
Object obj = m_cms.getRequestContext().getAttribute(CmsObjectWrapper.ATTRIBUTE_NAME);
if (obj != null) {
CmsObjectWrapper wrapper = (CmsObjectWrapper)obj;
return wrapper.restoreLink(internalUri);
}
}
return internalUri;
} | class class_name[name] begin[{]
method[rewriteUri, return_type[type[String]], modifier[private], parameter[internalUri]] begin[{]
if[binary_operation[member[.m_cms], !=, literal[null]]] begin[{]
local_variable[type[Object], obj]
if[binary_operation[member[.obj], !=, literal[null]]] begin[{]
local_variable[type[CmsObjectWrapper], wrapper]
return[call[wrapper.restoreLink, parameter[member[.internalUri]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.internalUri]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[rewriteUri] operator[SEP] identifier[String] identifier[internalUri] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_cms] operator[!=] Other[null] operator[SEP] {
identifier[Object] identifier[obj] operator[=] identifier[m_cms] operator[SEP] identifier[getRequestContext] operator[SEP] operator[SEP] operator[SEP] identifier[getAttribute] operator[SEP] identifier[CmsObjectWrapper] operator[SEP] identifier[ATTRIBUTE_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[obj] operator[!=] Other[null] operator[SEP] {
identifier[CmsObjectWrapper] identifier[wrapper] operator[=] operator[SEP] identifier[CmsObjectWrapper] operator[SEP] identifier[obj] operator[SEP] Keyword[return] identifier[wrapper] operator[SEP] identifier[restoreLink] operator[SEP] identifier[internalUri] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[internalUri] operator[SEP]
}
|
public static <T> FlowableTransformer<T,T> doOnNextCount(Consumer<Integer> onNext) {
return obs -> obs.lift(new FlowableEmissionCounter<>(new CountObserver(onNext,null,null)));
} | class class_name[name] begin[{]
method[doOnNextCount, return_type[type[FlowableTransformer]], modifier[public static], parameter[onNext]] begin[{]
return[LambdaExpression(body=MethodInvocation(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=onNext, 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=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CountObserver, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=FlowableEmissionCounter, sub_type=None))], member=lift, postfix_operators=[], prefix_operators=[], qualifier=obs, selectors=[], type_arguments=None), parameters=[MemberReference(member=obs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[FlowableTransformer] operator[<] identifier[T] , identifier[T] operator[>] identifier[doOnNextCount] operator[SEP] identifier[Consumer] operator[<] identifier[Integer] operator[>] identifier[onNext] operator[SEP] {
Keyword[return] identifier[obs] operator[->] identifier[obs] operator[SEP] identifier[lift] operator[SEP] Keyword[new] identifier[FlowableEmissionCounter] operator[<] operator[>] operator[SEP] Keyword[new] identifier[CountObserver] operator[SEP] identifier[onNext] , Other[null] , Other[null] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void removeValue() {
if (!isSimpleValue()) {
m_hasValue = false;
m_widgetHolder.clear();
generateLabel();
} else {
// only deactivate the widget and restore the default value
m_widget.setActive(false);
m_widget.setValue("");
addActivationHandler();
}
addStyleName(formCss().emptyValue());
removeValidationMessage();
} | class class_name[name] begin[{]
method[removeValue, return_type[void], modifier[public], parameter[]] begin[{]
if[call[.isSimpleValue, parameter[]]] begin[{]
assign[member[.m_hasValue], literal[false]]
call[m_widgetHolder.clear, parameter[]]
call[.generateLabel, parameter[]]
else begin[{]
call[m_widget.setActive, parameter[literal[false]]]
call[m_widget.setValue, parameter[literal[""]]]
call[.addActivationHandler, parameter[]]
end[}]
call[.addStyleName, parameter[call[.formCss, parameter[]]]]
call[.removeValidationMessage, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeValue] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isSimpleValue] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_hasValue] operator[=] literal[boolean] operator[SEP] identifier[m_widgetHolder] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[generateLabel] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[m_widget] operator[SEP] identifier[setActive] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[m_widget] operator[SEP] identifier[setValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[addActivationHandler] operator[SEP] operator[SEP] operator[SEP]
}
identifier[addStyleName] operator[SEP] identifier[formCss] operator[SEP] operator[SEP] operator[SEP] identifier[emptyValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[removeValidationMessage] operator[SEP] operator[SEP] operator[SEP]
}
|
public PresentsSession lookupClient (String bureauId)
{
Bureau bureau = _bureaus.get(bureauId);
if (bureau == null) {
return null;
}
return bureau.client;
} | class class_name[name] begin[{]
method[lookupClient, return_type[type[PresentsSession]], modifier[public], parameter[bureauId]] begin[{]
local_variable[type[Bureau], bureau]
if[binary_operation[member[.bureau], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[member[bureau.client]]
end[}]
END[}] | Keyword[public] identifier[PresentsSession] identifier[lookupClient] operator[SEP] identifier[String] identifier[bureauId] operator[SEP] {
identifier[Bureau] identifier[bureau] operator[=] identifier[_bureaus] operator[SEP] identifier[get] operator[SEP] identifier[bureauId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bureau] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[bureau] operator[SEP] identifier[client] operator[SEP]
}
|
public static ComboBox getOUComboBox(CmsObject cms, String baseOu, Log log, boolean includeWebOU) {
ComboBox combo = null;
try {
IndexedContainer container = new IndexedContainer();
container.addContainerProperty("desc", String.class, "");
for (String ou : CmsOUHandler.getManagableOUs(cms)) {
if (includeWebOU | !OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, ou).hasFlagWebuser()) {
Item item = container.addItem(ou);
if (ou == "") {
CmsOrganizationalUnit root = OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, "");
item.getItemProperty("desc").setValue(root.getDisplayName(A_CmsUI.get().getLocale()));
} else {
item.getItemProperty("desc").setValue(
OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, ou).getDisplayName(
A_CmsUI.get().getLocale()));
}
}
}
combo = new ComboBox(null, container);
combo.setTextInputAllowed(true);
combo.setNullSelectionAllowed(false);
combo.setWidth("379px");
combo.setInputPrompt(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_CLICK_TO_EDIT_0));
combo.setItemCaptionPropertyId("desc");
combo.setFilteringMode(FilteringMode.CONTAINS);
combo.select(baseOu);
} catch (CmsException e) {
if (log != null) {
log.error("Unable to read OU", e);
}
}
return combo;
} | class class_name[name] begin[{]
method[getOUComboBox, return_type[type[ComboBox]], modifier[public static], parameter[cms, baseOu, log, includeWebOU]] begin[{]
local_variable[type[ComboBox], combo]
TryStatement(block=[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=IndexedContainer, sub_type=None)), name=container)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IndexedContainer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="desc"), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=addContainerProperty, postfix_operators=[], prefix_operators=[], qualifier=container, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=includeWebOU, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getOrgUnitManager, postfix_operators=[], prefix_operators=['!'], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MemberReference(member=cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ou, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readOrganizationalUnit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=hasFlagWebuser, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=|), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ou, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addItem, postfix_operators=[], prefix_operators=[], qualifier=container, selectors=[], type_arguments=None), name=item)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Item, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ou, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="desc")], member=getItemProperty, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOrgUnitManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MemberReference(member=cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ou, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readOrganizationalUnit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=A_CmsUI, selectors=[MethodInvocation(arguments=[], member=getLocale, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=getDisplayName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setValue, 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=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getOrgUnitManager, postfix_operators=[], prefix_operators=[], qualifier=OpenCms, selectors=[MethodInvocation(arguments=[MemberReference(member=cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=readOrganizationalUnit, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=root)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsOrganizationalUnit, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="desc")], member=getItemProperty, postfix_operators=[], prefix_operators=[], qualifier=item, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=A_CmsUI, selectors=[MethodInvocation(arguments=[], member=getLocale, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=getDisplayName, postfix_operators=[], prefix_operators=[], qualifier=root, selectors=[], type_arguments=None)], member=setValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getManagableOUs, postfix_operators=[], prefix_operators=[], qualifier=CmsOUHandler, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ou)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=combo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=container, 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=ComboBox, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setTextInputAllowed, postfix_operators=[], prefix_operators=[], qualifier=combo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=setNullSelectionAllowed, postfix_operators=[], prefix_operators=[], qualifier=combo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="379px")], member=setWidth, postfix_operators=[], prefix_operators=[], qualifier=combo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCurrent, postfix_operators=[], prefix_operators=[], qualifier=UI, selectors=[MethodInvocation(arguments=[], member=getLocale, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=getBundle, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=GUI_EXPLORER_CLICK_TO_EDIT_0, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[])], member=key, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setInputPrompt, postfix_operators=[], prefix_operators=[], qualifier=combo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="desc")], member=setItemCaptionPropertyId, postfix_operators=[], prefix_operators=[], qualifier=combo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=CONTAINS, postfix_operators=[], prefix_operators=[], qualifier=FilteringMode, selectors=[])], member=setFilteringMode, postfix_operators=[], prefix_operators=[], qualifier=combo, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=baseOu, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=select, postfix_operators=[], prefix_operators=[], qualifier=combo, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to read OU"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CmsException']))], finally_block=None, label=None, resources=None)
return[member[.combo]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ComboBox] identifier[getOUComboBox] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[String] identifier[baseOu] , identifier[Log] identifier[log] , Keyword[boolean] identifier[includeWebOU] operator[SEP] {
identifier[ComboBox] identifier[combo] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[IndexedContainer] identifier[container] operator[=] Keyword[new] identifier[IndexedContainer] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[addContainerProperty] operator[SEP] literal[String] , identifier[String] operator[SEP] Keyword[class] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[ou] operator[:] identifier[CmsOUHandler] operator[SEP] identifier[getManagableOUs] operator[SEP] identifier[cms] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[includeWebOU] operator[|] operator[!] identifier[OpenCms] operator[SEP] identifier[getOrgUnitManager] operator[SEP] operator[SEP] operator[SEP] identifier[readOrganizationalUnit] operator[SEP] identifier[cms] , identifier[ou] operator[SEP] operator[SEP] identifier[hasFlagWebuser] operator[SEP] operator[SEP] operator[SEP] {
identifier[Item] identifier[item] operator[=] identifier[container] operator[SEP] identifier[addItem] operator[SEP] identifier[ou] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ou] operator[==] literal[String] operator[SEP] {
identifier[CmsOrganizationalUnit] identifier[root] operator[=] identifier[OpenCms] operator[SEP] identifier[getOrgUnitManager] operator[SEP] operator[SEP] operator[SEP] identifier[readOrganizationalUnit] operator[SEP] identifier[cms] , literal[String] operator[SEP] operator[SEP] identifier[item] operator[SEP] identifier[getItemProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] identifier[root] operator[SEP] identifier[getDisplayName] operator[SEP] identifier[A_CmsUI] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[item] operator[SEP] identifier[getItemProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[setValue] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getOrgUnitManager] operator[SEP] operator[SEP] operator[SEP] identifier[readOrganizationalUnit] operator[SEP] identifier[cms] , identifier[ou] operator[SEP] operator[SEP] identifier[getDisplayName] operator[SEP] identifier[A_CmsUI] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[combo] operator[=] Keyword[new] identifier[ComboBox] operator[SEP] Other[null] , identifier[container] operator[SEP] operator[SEP] identifier[combo] operator[SEP] identifier[setTextInputAllowed] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[combo] operator[SEP] identifier[setNullSelectionAllowed] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[combo] operator[SEP] identifier[setWidth] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[combo] operator[SEP] identifier[setInputPrompt] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] identifier[UI] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_EXPLORER_CLICK_TO_EDIT_0] operator[SEP] operator[SEP] operator[SEP] identifier[combo] operator[SEP] identifier[setItemCaptionPropertyId] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[combo] operator[SEP] identifier[setFilteringMode] operator[SEP] identifier[FilteringMode] operator[SEP] identifier[CONTAINS] operator[SEP] operator[SEP] identifier[combo] operator[SEP] identifier[select] operator[SEP] identifier[baseOu] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CmsException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[!=] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[combo] operator[SEP]
}
|
public static int getLocalVariableEndRange(LocalVariableTable lvt, int reg, int curPC) {
int endRange = Integer.MAX_VALUE;
if (lvt != null) {
LocalVariable lv = lvt.getLocalVariable(reg, curPC);
if (lv != null) {
endRange = lv.getStartPC() + lv.getLength();
}
}
return endRange;
} | class class_name[name] begin[{]
method[getLocalVariableEndRange, return_type[type[int]], modifier[public static], parameter[lvt, reg, curPC]] begin[{]
local_variable[type[int], endRange]
if[binary_operation[member[.lvt], !=, literal[null]]] begin[{]
local_variable[type[LocalVariable], lv]
if[binary_operation[member[.lv], !=, literal[null]]] begin[{]
assign[member[.endRange], binary_operation[call[lv.getStartPC, parameter[]], +, call[lv.getLength, parameter[]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.endRange]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[getLocalVariableEndRange] operator[SEP] identifier[LocalVariableTable] identifier[lvt] , Keyword[int] identifier[reg] , Keyword[int] identifier[curPC] operator[SEP] {
Keyword[int] identifier[endRange] operator[=] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[if] operator[SEP] identifier[lvt] operator[!=] Other[null] operator[SEP] {
identifier[LocalVariable] identifier[lv] operator[=] identifier[lvt] operator[SEP] identifier[getLocalVariable] operator[SEP] identifier[reg] , identifier[curPC] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lv] operator[!=] Other[null] operator[SEP] {
identifier[endRange] operator[=] identifier[lv] operator[SEP] identifier[getStartPC] operator[SEP] operator[SEP] operator[+] identifier[lv] operator[SEP] identifier[getLength] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[endRange] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static <T> T newInstance(String clazz) throws UtilException {
try {
return (T) Class.forName(clazz).newInstance();
} catch (Exception e) {
throw new UtilException(e, "Instance class [{}] error!", clazz);
}
} | class class_name[name] begin[{]
method[newInstance, return_type[type[T]], modifier[public static], parameter[clazz]] begin[{]
TryStatement(block=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[MethodInvocation(arguments=[], member=newInstance, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Instance class [{}] error!"), MemberReference(member=clazz, 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=UtilException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[newInstance] operator[SEP] identifier[String] identifier[clazz] operator[SEP] Keyword[throws] identifier[UtilException] {
Keyword[try] {
Keyword[return] operator[SEP] identifier[T] operator[SEP] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[clazz] operator[SEP] 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[UtilException] operator[SEP] identifier[e] , literal[String] , identifier[clazz] operator[SEP] operator[SEP]
}
}
|
public JBBPTextWriter Short(final int value) throws IOException {
ensureValueMode();
String convertedByExtras = null;
for (final Extra e : this.extras) {
convertedByExtras = e.doConvertShortToStr(this, value & 0xFFFF);
if (convertedByExtras != null) {
break;
}
}
if (convertedByExtras == null) {
final long valueToWrite;
if (this.byteOrder == JBBPByteOrder.LITTLE_ENDIAN) {
valueToWrite = JBBPUtils.reverseByteOrder(value, 2);
} else {
valueToWrite = value;
}
printValueString(JBBPUtils.ensureMinTextLength(JBBPUtils.ulong2str(valueToWrite & 0xFFFFL, this.radix, CHAR_BUFFER), this.maxCharsRadixForShort, '0', 0));
} else {
printValueString(convertedByExtras);
}
return this;
} | class class_name[name] begin[{]
method[Short, return_type[type[JBBPTextWriter]], modifier[public], parameter[value]] begin[{]
call[.ensureValueMode, parameter[]]
local_variable[type[String], convertedByExtras]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=convertedByExtras, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xFFFF), operator=&)], member=doConvertShortToStr, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=convertedByExtras, 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=[BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=extras, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=e)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Extra, sub_type=None))), label=None)
if[binary_operation[member[.convertedByExtras], ==, literal[null]]] begin[{]
local_variable[type[long], valueToWrite]
if[binary_operation[THIS[member[None.byteOrder]], ==, member[JBBPByteOrder.LITTLE_ENDIAN]]] begin[{]
assign[member[.valueToWrite], call[JBBPUtils.reverseByteOrder, parameter[member[.value], literal[2]]]]
else begin[{]
assign[member[.valueToWrite], member[.value]]
end[}]
call[.printValueString, parameter[call[JBBPUtils.ensureMinTextLength, parameter[call[JBBPUtils.ulong2str, parameter[binary_operation[member[.valueToWrite], &, literal[0xFFFFL]], THIS[member[None.radix]], member[.CHAR_BUFFER]]], THIS[member[None.maxCharsRadixForShort]], literal['0'], literal[0]]]]]
else begin[{]
call[.printValueString, parameter[member[.convertedByExtras]]]
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[JBBPTextWriter] identifier[Short] operator[SEP] Keyword[final] Keyword[int] identifier[value] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[ensureValueMode] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[convertedByExtras] operator[=] Other[null] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Extra] identifier[e] operator[:] Keyword[this] operator[SEP] identifier[extras] operator[SEP] {
identifier[convertedByExtras] operator[=] identifier[e] operator[SEP] identifier[doConvertShortToStr] operator[SEP] Keyword[this] , identifier[value] operator[&] literal[Integer] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[convertedByExtras] operator[!=] Other[null] operator[SEP] {
Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[convertedByExtras] operator[==] Other[null] operator[SEP] {
Keyword[final] Keyword[long] identifier[valueToWrite] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[byteOrder] operator[==] identifier[JBBPByteOrder] operator[SEP] identifier[LITTLE_ENDIAN] operator[SEP] {
identifier[valueToWrite] operator[=] identifier[JBBPUtils] operator[SEP] identifier[reverseByteOrder] operator[SEP] identifier[value] , Other[2] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[valueToWrite] operator[=] identifier[value] operator[SEP]
}
identifier[printValueString] operator[SEP] identifier[JBBPUtils] operator[SEP] identifier[ensureMinTextLength] operator[SEP] identifier[JBBPUtils] operator[SEP] identifier[ulong2str] operator[SEP] identifier[valueToWrite] operator[&] literal[Integer] , Keyword[this] operator[SEP] identifier[radix] , identifier[CHAR_BUFFER] operator[SEP] , Keyword[this] operator[SEP] identifier[maxCharsRadixForShort] , literal[String] , Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[printValueString] operator[SEP] identifier[convertedByExtras] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
private static Object unwrap(Object object) {
if (object instanceof Reflector) {
return ((Reflector) object).get();
}
return object;
} | class class_name[name] begin[{]
method[unwrap, return_type[type[Object]], modifier[private static], parameter[object]] begin[{]
if[binary_operation[member[.object], instanceof, type[Reflector]]] begin[{]
return[Cast(expression=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Reflector, sub_type=None))]
else begin[{]
None
end[}]
return[member[.object]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Object] identifier[unwrap] operator[SEP] identifier[Object] identifier[object] operator[SEP] {
Keyword[if] operator[SEP] identifier[object] Keyword[instanceof] identifier[Reflector] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[Reflector] operator[SEP] identifier[object] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[object] operator[SEP]
}
|
public AttributeValue withBS(java.nio.ByteBuffer... bS) {
if (getBS() == null) setBS(new java.util.ArrayList<java.nio.ByteBuffer>(bS.length));
for (java.nio.ByteBuffer value : bS) {
getBS().add(value);
}
return this;
} | class class_name[name] begin[{]
method[withBS, return_type[type[AttributeValue]], modifier[public], parameter[bS]] begin[{]
if[binary_operation[call[.getBS, parameter[]], ==, literal[null]]] begin[{]
call[.setBS, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=bS, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=nio, sub_type=ReferenceType(arguments=None, dimensions=None, name=ByteBuffer, sub_type=None))))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=getBS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=bS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=nio, sub_type=ReferenceType(arguments=None, dimensions=None, name=ByteBuffer, sub_type=None))))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[AttributeValue] identifier[withBS] operator[SEP] identifier[java] operator[SEP] identifier[nio] operator[SEP] identifier[ByteBuffer] operator[...] identifier[bS] operator[SEP] {
Keyword[if] operator[SEP] identifier[getBS] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] identifier[setBS] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[java] operator[SEP] identifier[nio] operator[SEP] identifier[ByteBuffer] operator[>] operator[SEP] identifier[bS] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[java] operator[SEP] identifier[nio] operator[SEP] identifier[ByteBuffer] identifier[value] operator[:] identifier[bS] operator[SEP] {
identifier[getBS] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public long getLong(TemporalField field) {
if (field instanceof ChronoField) {
switch ((ChronoField) field) {
case MONTH_OF_YEAR: return month;
case PROLEPTIC_MONTH: return getProlepticMonth();
case YEAR_OF_ERA: return (year < 1 ? 1 - year : year);
case YEAR: return year;
case ERA: return (year < 1 ? 0 : 1);
}
throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return field.getFrom(this);
} | class class_name[name] begin[{]
method[getLong, return_type[type[long]], modifier[public], parameter[field]] begin[{]
if[binary_operation[member[.field], instanceof, type[ChronoField]]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['MONTH_OF_YEAR'], statements=[ReturnStatement(expression=MemberReference(member=month, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['PROLEPTIC_MONTH'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getProlepticMonth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['YEAR_OF_ERA'], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=year, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<), if_false=MemberReference(member=year, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=MemberReference(member=year, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)), label=None)]), SwitchStatementCase(case=['YEAR'], statements=[ReturnStatement(expression=MemberReference(member=year, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), SwitchStatementCase(case=['ERA'], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=year, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)])], expression=Cast(expression=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ChronoField, sub_type=None)), label=None)
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported field: "), operandr=MemberReference(member=field, 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=UnsupportedTemporalTypeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[field.getFrom, parameter[THIS[]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[getLong] operator[SEP] identifier[TemporalField] identifier[field] operator[SEP] {
Keyword[if] operator[SEP] identifier[field] Keyword[instanceof] identifier[ChronoField] operator[SEP] {
Keyword[switch] operator[SEP] operator[SEP] identifier[ChronoField] operator[SEP] identifier[field] operator[SEP] {
Keyword[case] identifier[MONTH_OF_YEAR] operator[:] Keyword[return] identifier[month] operator[SEP] Keyword[case] identifier[PROLEPTIC_MONTH] operator[:] Keyword[return] identifier[getProlepticMonth] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[YEAR_OF_ERA] operator[:] Keyword[return] operator[SEP] identifier[year] operator[<] Other[1] operator[?] Other[1] operator[-] identifier[year] operator[:] identifier[year] operator[SEP] operator[SEP] Keyword[case] identifier[YEAR] operator[:] Keyword[return] identifier[year] operator[SEP] Keyword[case] identifier[ERA] operator[:] Keyword[return] operator[SEP] identifier[year] operator[<] Other[1] operator[?] Other[0] operator[:] Other[1] operator[SEP] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[UnsupportedTemporalTypeException] operator[SEP] literal[String] operator[+] identifier[field] operator[SEP] operator[SEP]
}
Keyword[return] identifier[field] operator[SEP] identifier[getFrom] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
|
public PagedList<CloudJobSchedule> listJobSchedules(DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleListOptions options = new JobScheduleListOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().jobSchedules().list(options);
} | class class_name[name] begin[{]
method[listJobSchedules, return_type[type[PagedList]], modifier[public], parameter[detailLevel, additionalBehaviors]] begin[{]
local_variable[type[JobScheduleListOptions], options]
local_variable[type[BehaviorManager], bhMgr]
call[bhMgr.appendDetailLevelToPerCallBehaviors, parameter[member[.detailLevel]]]
call[bhMgr.applyRequestBehaviors, parameter[member[.options]]]
return[THIS[member[None.parentBatchClient]call[None.protocolLayer, parameter[]]call[None.jobSchedules, parameter[]]call[None.list, parameter[member[.options]]]]]
end[}]
END[}] | Keyword[public] identifier[PagedList] operator[<] identifier[CloudJobSchedule] operator[>] identifier[listJobSchedules] operator[SEP] identifier[DetailLevel] identifier[detailLevel] , identifier[Iterable] operator[<] identifier[BatchClientBehavior] operator[>] identifier[additionalBehaviors] operator[SEP] Keyword[throws] identifier[BatchErrorException] , identifier[IOException] {
identifier[JobScheduleListOptions] identifier[options] operator[=] Keyword[new] identifier[JobScheduleListOptions] operator[SEP] operator[SEP] operator[SEP] identifier[BehaviorManager] identifier[bhMgr] operator[=] Keyword[new] identifier[BehaviorManager] operator[SEP] Keyword[this] operator[SEP] identifier[customBehaviors] operator[SEP] operator[SEP] , identifier[additionalBehaviors] operator[SEP] operator[SEP] identifier[bhMgr] operator[SEP] identifier[appendDetailLevelToPerCallBehaviors] operator[SEP] identifier[detailLevel] operator[SEP] operator[SEP] identifier[bhMgr] operator[SEP] identifier[applyRequestBehaviors] operator[SEP] identifier[options] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[parentBatchClient] operator[SEP] identifier[protocolLayer] operator[SEP] operator[SEP] operator[SEP] identifier[jobSchedules] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[options] operator[SEP] operator[SEP]
}
|
public InputStream getOutput(String resourceGroupName, String automationAccountName, String jobId) {
return getOutputWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).toBlocking().single().body();
} | class class_name[name] begin[{]
method[getOutput, return_type[type[InputStream]], modifier[public], parameter[resourceGroupName, automationAccountName, jobId]] begin[{]
return[call[.getOutputWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.automationAccountName], member[.jobId]]]]
end[}]
END[}] | Keyword[public] identifier[InputStream] identifier[getOutput] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[automationAccountName] , identifier[String] identifier[jobId] operator[SEP] {
Keyword[return] identifier[getOutputWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[automationAccountName] , identifier[jobId] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
private void executeGalaxyScript(final String scriptName) {
final String bashScript = String.format("cd %s; if [ -d .venv ]; then . .venv/bin/activate; fi; %s", getPath(), scriptName);
IoUtils.executeAndWait("bash", "-c", bashScript);
} | class class_name[name] begin[{]
method[executeGalaxyScript, return_type[void], modifier[private], parameter[scriptName]] begin[{]
local_variable[type[String], bashScript]
call[IoUtils.executeAndWait, parameter[literal["bash"], literal["-c"], member[.bashScript]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[executeGalaxyScript] operator[SEP] Keyword[final] identifier[String] identifier[scriptName] operator[SEP] {
Keyword[final] identifier[String] identifier[bashScript] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[getPath] operator[SEP] operator[SEP] , identifier[scriptName] operator[SEP] operator[SEP] identifier[IoUtils] operator[SEP] identifier[executeAndWait] operator[SEP] literal[String] , literal[String] , identifier[bashScript] operator[SEP] operator[SEP]
}
|
public String getSubscriberId()
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "getSubscriberId");
String subscriberId = _consumerDispatcher.getConsumerDispatcherState().getSubscriberID();
if (tc.isEntryEnabled())
SibTr.exit(tc, "getSubscriberId", subscriberId);
return subscriberId;
} | class class_name[name] begin[{]
method[getSubscriberId, return_type[type[String]], modifier[public], parameter[]] begin[{]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["getSubscriberId"]]]
else begin[{]
None
end[}]
local_variable[type[String], subscriberId]
if[call[tc.isEntryEnabled, parameter[]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["getSubscriberId"], member[.subscriberId]]]
else begin[{]
None
end[}]
return[member[.subscriberId]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getSubscriberId] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[subscriberId] operator[=] identifier[_consumerDispatcher] operator[SEP] identifier[getConsumerDispatcherState] operator[SEP] operator[SEP] operator[SEP] identifier[getSubscriberID] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[subscriberId] operator[SEP] operator[SEP] Keyword[return] identifier[subscriberId] operator[SEP]
}
|
private Polygon computeConvexHull() {
GrahamScanConvexHull2D inner = new GrahamScanConvexHull2D();
for(double[] point : points) {
if(checkCandidate(point)) {
inner.add(point);
}
}
return inner.getHull();
} | class class_name[name] begin[{]
method[computeConvexHull, return_type[type[Polygon]], modifier[private], parameter[]] begin[{]
local_variable[type[GrahamScanConvexHull2D], inner]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=point, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkCandidate, 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=point, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=inner, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=points, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=point)], modifiers=set(), type=BasicType(dimensions=[None], name=double))), label=None)
return[call[inner.getHull, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[Polygon] identifier[computeConvexHull] operator[SEP] operator[SEP] {
identifier[GrahamScanConvexHull2D] identifier[inner] operator[=] Keyword[new] identifier[GrahamScanConvexHull2D] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[point] operator[:] identifier[points] operator[SEP] {
Keyword[if] operator[SEP] identifier[checkCandidate] operator[SEP] identifier[point] operator[SEP] operator[SEP] {
identifier[inner] operator[SEP] identifier[add] operator[SEP] identifier[point] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[inner] operator[SEP] identifier[getHull] operator[SEP] operator[SEP] operator[SEP]
}
|
public static LocalDateTime of(LocalDate date, LocalTime time) {
Objects.requireNonNull(date, "date");
Objects.requireNonNull(time, "time");
return new LocalDateTime(date, time);
} | class class_name[name] begin[{]
method[of, return_type[type[LocalDateTime]], modifier[public static], parameter[date, time]] begin[{]
call[Objects.requireNonNull, parameter[member[.date], literal["date"]]]
call[Objects.requireNonNull, parameter[member[.time], literal["time"]]]
return[ClassCreator(arguments=[MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=time, 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=LocalDateTime, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[LocalDateTime] identifier[of] operator[SEP] identifier[LocalDate] identifier[date] , identifier[LocalTime] identifier[time] operator[SEP] {
identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[date] , literal[String] operator[SEP] operator[SEP] identifier[Objects] operator[SEP] identifier[requireNonNull] operator[SEP] identifier[time] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[LocalDateTime] operator[SEP] identifier[date] , identifier[time] operator[SEP] operator[SEP]
}
|
public Matrix4x3d rotateY(double ang, Matrix4x3d dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.rotationY(ang);
double sin, cos;
if (ang == Math.PI || ang == -Math.PI) {
cos = -1.0;
sin = 0.0;
} else if (ang == Math.PI * 0.5 || ang == -Math.PI * 1.5) {
cos = 0.0;
sin = 1.0;
} else if (ang == -Math.PI * 0.5 || ang == Math.PI * 1.5) {
cos = 0.0;
sin = -1.0;
} else {
sin = Math.sin(ang);
cos = Math.cosFromSin(sin, ang);
}
double rm00 = cos;
double rm02 = -sin;
double rm20 = sin;
double rm22 = cos;
// add temporaries for dependent values
double nm00 = m00 * rm00 + m20 * rm02;
double nm01 = m01 * rm00 + m21 * rm02;
double nm02 = m02 * rm00 + m22 * rm02;
// set non-dependent values directly
dest.m20 = m00 * rm20 + m20 * rm22;
dest.m21 = m01 * rm20 + m21 * rm22;
dest.m22 = m02 * rm20 + m22 * rm22;
// set other values
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.m10 = m10;
dest.m11 = m11;
dest.m12 = m12;
dest.m30 = m30;
dest.m31 = m31;
dest.m32 = m32;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
return dest;
} | class class_name[name] begin[{]
method[rotateY, return_type[type[Matrix4x3d]], modifier[public], parameter[ang, dest]] begin[{]
if[binary_operation[binary_operation[member[.properties], &, member[.PROPERTY_IDENTITY]], !=, literal[0]]] begin[{]
return[call[dest.rotationY, parameter[member[.ang]]]]
else begin[{]
None
end[}]
local_variable[type[double], sin]
if[binary_operation[binary_operation[member[.ang], ==, member[Math.PI]], ||, binary_operation[member[.ang], ==, member[Math.PI]]]] begin[{]
assign[member[.cos], literal[1.0]]
assign[member[.sin], literal[0.0]]
else begin[{]
if[binary_operation[binary_operation[member[.ang], ==, binary_operation[member[Math.PI], *, literal[0.5]]], ||, binary_operation[member[.ang], ==, binary_operation[member[Math.PI], *, literal[1.5]]]]] begin[{]
assign[member[.cos], literal[0.0]]
assign[member[.sin], literal[1.0]]
else begin[{]
if[binary_operation[binary_operation[member[.ang], ==, binary_operation[member[Math.PI], *, literal[0.5]]], ||, binary_operation[member[.ang], ==, binary_operation[member[Math.PI], *, literal[1.5]]]]] begin[{]
assign[member[.cos], literal[0.0]]
assign[member[.sin], literal[1.0]]
else begin[{]
assign[member[.sin], call[Math.sin, parameter[member[.ang]]]]
assign[member[.cos], call[Math.cosFromSin, parameter[member[.sin], member[.ang]]]]
end[}]
end[}]
end[}]
local_variable[type[double], rm00]
local_variable[type[double], rm02]
local_variable[type[double], rm20]
local_variable[type[double], rm22]
local_variable[type[double], nm00]
local_variable[type[double], nm01]
local_variable[type[double], nm02]
assign[member[dest.m20], binary_operation[binary_operation[member[.m00], *, member[.rm20]], +, binary_operation[member[.m20], *, member[.rm22]]]]
assign[member[dest.m21], binary_operation[binary_operation[member[.m01], *, member[.rm20]], +, binary_operation[member[.m21], *, member[.rm22]]]]
assign[member[dest.m22], binary_operation[binary_operation[member[.m02], *, member[.rm20]], +, binary_operation[member[.m22], *, member[.rm22]]]]
assign[member[dest.m00], member[.nm00]]
assign[member[dest.m01], member[.nm01]]
assign[member[dest.m02], member[.nm02]]
assign[member[dest.m10], member[.m10]]
assign[member[dest.m11], member[.m11]]
assign[member[dest.m12], member[.m12]]
assign[member[dest.m30], member[.m30]]
assign[member[dest.m31], member[.m31]]
assign[member[dest.m32], member[.m32]]
assign[member[dest.properties], binary_operation[member[.properties], &, binary_operation[member[.PROPERTY_IDENTITY], |, member[.PROPERTY_TRANSLATION]]]]
return[member[.dest]]
end[}]
END[}] | Keyword[public] identifier[Matrix4x3d] identifier[rotateY] operator[SEP] Keyword[double] identifier[ang] , identifier[Matrix4x3d] identifier[dest] operator[SEP] {
Keyword[if] operator[SEP] operator[SEP] identifier[properties] operator[&] identifier[PROPERTY_IDENTITY] operator[SEP] operator[!=] Other[0] operator[SEP] Keyword[return] identifier[dest] operator[SEP] identifier[rotationY] operator[SEP] identifier[ang] operator[SEP] operator[SEP] Keyword[double] identifier[sin] , identifier[cos] operator[SEP] Keyword[if] operator[SEP] identifier[ang] operator[==] identifier[Math] operator[SEP] identifier[PI] operator[||] identifier[ang] operator[==] operator[-] identifier[Math] operator[SEP] identifier[PI] operator[SEP] {
identifier[cos] operator[=] operator[-] literal[Float] operator[SEP] identifier[sin] operator[=] literal[Float] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ang] operator[==] identifier[Math] operator[SEP] identifier[PI] operator[*] literal[Float] operator[||] identifier[ang] operator[==] operator[-] identifier[Math] operator[SEP] identifier[PI] operator[*] literal[Float] operator[SEP] {
identifier[cos] operator[=] literal[Float] operator[SEP] identifier[sin] operator[=] literal[Float] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ang] operator[==] operator[-] identifier[Math] operator[SEP] identifier[PI] operator[*] literal[Float] operator[||] identifier[ang] operator[==] identifier[Math] operator[SEP] identifier[PI] operator[*] literal[Float] operator[SEP] {
identifier[cos] operator[=] literal[Float] operator[SEP] identifier[sin] operator[=] operator[-] literal[Float] operator[SEP]
}
Keyword[else] {
identifier[sin] operator[=] identifier[Math] operator[SEP] identifier[sin] operator[SEP] identifier[ang] operator[SEP] operator[SEP] identifier[cos] operator[=] identifier[Math] operator[SEP] identifier[cosFromSin] operator[SEP] identifier[sin] , identifier[ang] operator[SEP] operator[SEP]
}
Keyword[double] identifier[rm00] operator[=] identifier[cos] operator[SEP] Keyword[double] identifier[rm02] operator[=] operator[-] identifier[sin] operator[SEP] Keyword[double] identifier[rm20] operator[=] identifier[sin] operator[SEP] Keyword[double] identifier[rm22] operator[=] identifier[cos] operator[SEP] Keyword[double] identifier[nm00] operator[=] identifier[m00] operator[*] identifier[rm00] operator[+] identifier[m20] operator[*] identifier[rm02] operator[SEP] Keyword[double] identifier[nm01] operator[=] identifier[m01] operator[*] identifier[rm00] operator[+] identifier[m21] operator[*] identifier[rm02] operator[SEP] Keyword[double] identifier[nm02] operator[=] identifier[m02] operator[*] identifier[rm00] operator[+] identifier[m22] operator[*] identifier[rm02] operator[SEP] identifier[dest] operator[SEP] identifier[m20] operator[=] identifier[m00] operator[*] identifier[rm20] operator[+] identifier[m20] operator[*] identifier[rm22] operator[SEP] identifier[dest] operator[SEP] identifier[m21] operator[=] identifier[m01] operator[*] identifier[rm20] operator[+] identifier[m21] operator[*] identifier[rm22] operator[SEP] identifier[dest] operator[SEP] identifier[m22] operator[=] identifier[m02] operator[*] identifier[rm20] operator[+] identifier[m22] operator[*] identifier[rm22] operator[SEP] identifier[dest] operator[SEP] identifier[m00] operator[=] identifier[nm00] operator[SEP] identifier[dest] operator[SEP] identifier[m01] operator[=] identifier[nm01] operator[SEP] identifier[dest] operator[SEP] identifier[m02] operator[=] identifier[nm02] operator[SEP] identifier[dest] operator[SEP] identifier[m10] operator[=] identifier[m10] operator[SEP] identifier[dest] operator[SEP] identifier[m11] operator[=] identifier[m11] operator[SEP] identifier[dest] operator[SEP] identifier[m12] operator[=] identifier[m12] operator[SEP] identifier[dest] operator[SEP] identifier[m30] operator[=] identifier[m30] operator[SEP] identifier[dest] operator[SEP] identifier[m31] operator[=] identifier[m31] operator[SEP] identifier[dest] operator[SEP] identifier[m32] operator[=] identifier[m32] operator[SEP] identifier[dest] operator[SEP] identifier[properties] operator[=] identifier[properties] operator[&] operator[~] operator[SEP] identifier[PROPERTY_IDENTITY] operator[|] identifier[PROPERTY_TRANSLATION] operator[SEP] operator[SEP] Keyword[return] identifier[dest] operator[SEP]
}
|
public boolean showPreviousPage() {
AbstractWizardPage previousPage;
try {
previousPage = pageHistory.pop();
} catch (EmptyStackException e) {
// Previous page is null. Updating buttons and ignoring request.
updateButtons();
return false;
}
setPage(previousPage);
return true;
} | class class_name[name] begin[{]
method[showPreviousPage, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[AbstractWizardPage], previousPage]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=previousPage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=pop, postfix_operators=[], prefix_operators=[], qualifier=pageHistory, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=updateButtons, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['EmptyStackException']))], finally_block=None, label=None, resources=None)
call[.setPage, parameter[member[.previousPage]]]
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[showPreviousPage] operator[SEP] operator[SEP] {
identifier[AbstractWizardPage] identifier[previousPage] operator[SEP] Keyword[try] {
identifier[previousPage] operator[=] identifier[pageHistory] operator[SEP] identifier[pop] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[EmptyStackException] identifier[e] operator[SEP] {
identifier[updateButtons] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
identifier[setPage] operator[SEP] identifier[previousPage] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
public static <T> T dtoFromClass(T entity, DTO dtoTemplate, String proxyClassName) throws HyalineException {
try {
return createDTO(entity, dtoTemplate, false, proxyClassName);
} catch (CannotInstantiateProxyException | DTODefinitionException e) {
e.printStackTrace();
throw new HyalineException();
}
} | class class_name[name] begin[{]
method[dtoFromClass, return_type[type[T]], modifier[public static], parameter[entity, dtoTemplate, proxyClassName]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=entity, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dtoTemplate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=proxyClassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createDTO, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HyalineException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CannotInstantiateProxyException', 'DTODefinitionException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[dtoFromClass] operator[SEP] identifier[T] identifier[entity] , identifier[DTO] identifier[dtoTemplate] , identifier[String] identifier[proxyClassName] operator[SEP] Keyword[throws] identifier[HyalineException] {
Keyword[try] {
Keyword[return] identifier[createDTO] operator[SEP] identifier[entity] , identifier[dtoTemplate] , literal[boolean] , identifier[proxyClassName] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CannotInstantiateProxyException] operator[|] identifier[DTODefinitionException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[HyalineException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public EEnum getSTOBORNTION() {
if (stoborntionEEnum == null) {
stoborntionEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(73);
}
return stoborntionEEnum;
} | class class_name[name] begin[{]
method[getSTOBORNTION, return_type[type[EEnum]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.stoborntionEEnum], ==, literal[null]]] begin[{]
assign[member[.stoborntionEEnum], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=73)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EEnum, sub_type=None))]
else begin[{]
None
end[}]
return[member[.stoborntionEEnum]]
end[}]
END[}] | Keyword[public] identifier[EEnum] identifier[getSTOBORNTION] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[stoborntionEEnum] operator[==] Other[null] operator[SEP] {
identifier[stoborntionEEnum] operator[=] operator[SEP] identifier[EEnum] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[AfplibPackage] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[73] operator[SEP] operator[SEP]
}
Keyword[return] identifier[stoborntionEEnum] operator[SEP]
}
|
public static double GTSlikeScore(Point3d[] x, Point3d[] y) {
if (x.length != y.length) {
throw new IllegalArgumentException(
"Point arrays are not of the same length.");
}
int contacts = 0;
for (Point3d px : x) {
double minDist = Double.MAX_VALUE;
for (Point3d py : y) {
minDist = Math.min(minDist, px.distanceSquared(py));
}
if (minDist > 64)
continue;
contacts++;
if (minDist > 16)
continue;
contacts++;
if (minDist > 4)
continue;
contacts++;
if (minDist > 1)
continue;
contacts++;
}
return contacts * 25.0 / x.length;
} | class class_name[name] begin[{]
method[GTSlikeScore, return_type[type[double]], modifier[public static], parameter[x, y]] begin[{]
if[binary_operation[member[x.length], !=, member[y.length]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Point arrays are not of the same length.")], 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[int], contacts]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[]), name=minDist)], modifiers=set(), type=BasicType(dimensions=[], name=double)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=minDist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=minDist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=py, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=distanceSquared, postfix_operators=[], prefix_operators=[], qualifier=px, selectors=[], type_arguments=None)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=py)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Point3d, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=minDist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=64), operator=>), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), StatementExpression(expression=MemberReference(member=contacts, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=minDist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16), operator=>), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), StatementExpression(expression=MemberReference(member=contacts, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=minDist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=>), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), StatementExpression(expression=MemberReference(member=contacts, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=minDist, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=>), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), StatementExpression(expression=MemberReference(member=contacts, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=px)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Point3d, sub_type=None))), label=None)
return[binary_operation[binary_operation[member[.contacts], *, literal[25.0]], /, member[x.length]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[GTSlikeScore] operator[SEP] identifier[Point3d] operator[SEP] operator[SEP] identifier[x] , identifier[Point3d] operator[SEP] operator[SEP] identifier[y] operator[SEP] {
Keyword[if] operator[SEP] identifier[x] operator[SEP] identifier[length] operator[!=] identifier[y] operator[SEP] identifier[length] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[int] identifier[contacts] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Point3d] identifier[px] operator[:] identifier[x] operator[SEP] {
Keyword[double] identifier[minDist] operator[=] identifier[Double] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[for] operator[SEP] identifier[Point3d] identifier[py] operator[:] identifier[y] operator[SEP] {
identifier[minDist] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[minDist] , identifier[px] operator[SEP] identifier[distanceSquared] operator[SEP] identifier[py] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[minDist] operator[>] Other[64] operator[SEP] Keyword[continue] operator[SEP] identifier[contacts] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[minDist] operator[>] Other[16] operator[SEP] Keyword[continue] operator[SEP] identifier[contacts] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[minDist] operator[>] Other[4] operator[SEP] Keyword[continue] operator[SEP] identifier[contacts] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[minDist] operator[>] Other[1] operator[SEP] Keyword[continue] operator[SEP] identifier[contacts] operator[++] operator[SEP]
}
Keyword[return] identifier[contacts] operator[*] literal[Float] operator[/] identifier[x] operator[SEP] identifier[length] operator[SEP]
}
|
public synchronized <T extends Object> T register(Class<T> type) throws InvalidTypeException, TypeFilterException, DoubleIDException, InvalidMethodException, InvocationException, ControllerPersistenceException {
return register(type, null);
} | class class_name[name] begin[{]
method[register, return_type[type[T]], modifier[synchronized public], parameter[type]] begin[{]
return[call[.register, parameter[member[.type], literal[null]]]]
end[}]
END[}] | Keyword[public] Keyword[synchronized] operator[<] identifier[T] Keyword[extends] identifier[Object] operator[>] identifier[T] identifier[register] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[type] operator[SEP] Keyword[throws] identifier[InvalidTypeException] , identifier[TypeFilterException] , identifier[DoubleIDException] , identifier[InvalidMethodException] , identifier[InvocationException] , identifier[ControllerPersistenceException] {
Keyword[return] identifier[register] operator[SEP] identifier[type] , Other[null] operator[SEP] operator[SEP]
}
|
public void classChanged(ClassInfo oldInfo, ClassInfo newInfo)
throws DiffException
{
Node currentNode = this.currentNode;
Element tmp = doc.createElementNS(XML_URI, "classchange");
Element from = doc.createElementNS(XML_URI, "from");
Element to = doc.createElementNS(XML_URI, "to");
tmp.appendChild(from);
tmp.appendChild(to);
currentNode.appendChild(tmp);
this.currentNode = from;
writeClassInfo(oldInfo);
this.currentNode = to;
writeClassInfo(newInfo);
this.currentNode = currentNode;
} | class class_name[name] begin[{]
method[classChanged, return_type[void], modifier[public], parameter[oldInfo, newInfo]] begin[{]
local_variable[type[Node], currentNode]
local_variable[type[Element], tmp]
local_variable[type[Element], from]
local_variable[type[Element], to]
call[tmp.appendChild, parameter[member[.from]]]
call[tmp.appendChild, parameter[member[.to]]]
call[currentNode.appendChild, parameter[member[.tmp]]]
assign[THIS[member[None.currentNode]], member[.from]]
call[.writeClassInfo, parameter[member[.oldInfo]]]
assign[THIS[member[None.currentNode]], member[.to]]
call[.writeClassInfo, parameter[member[.newInfo]]]
assign[THIS[member[None.currentNode]], member[.currentNode]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[classChanged] operator[SEP] identifier[ClassInfo] identifier[oldInfo] , identifier[ClassInfo] identifier[newInfo] operator[SEP] Keyword[throws] identifier[DiffException] {
identifier[Node] identifier[currentNode] operator[=] Keyword[this] operator[SEP] identifier[currentNode] operator[SEP] identifier[Element] identifier[tmp] operator[=] identifier[doc] operator[SEP] identifier[createElementNS] operator[SEP] identifier[XML_URI] , literal[String] operator[SEP] operator[SEP] identifier[Element] identifier[from] operator[=] identifier[doc] operator[SEP] identifier[createElementNS] operator[SEP] identifier[XML_URI] , literal[String] operator[SEP] operator[SEP] identifier[Element] identifier[to] operator[=] identifier[doc] operator[SEP] identifier[createElementNS] operator[SEP] identifier[XML_URI] , literal[String] operator[SEP] operator[SEP] identifier[tmp] operator[SEP] identifier[appendChild] operator[SEP] identifier[from] operator[SEP] operator[SEP] identifier[tmp] operator[SEP] identifier[appendChild] operator[SEP] identifier[to] operator[SEP] operator[SEP] identifier[currentNode] operator[SEP] identifier[appendChild] operator[SEP] identifier[tmp] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[currentNode] operator[=] identifier[from] operator[SEP] identifier[writeClassInfo] operator[SEP] identifier[oldInfo] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[currentNode] operator[=] identifier[to] operator[SEP] identifier[writeClassInfo] operator[SEP] identifier[newInfo] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[currentNode] operator[=] identifier[currentNode] operator[SEP]
}
|
private boolean isUrlRelevant(String url) {
// die Indexseite der Lokalzeit herausfiltern, da alle Beiträge
// um die Lokalzeitenseiten der entsprechenden Regionen gefunden werden
if(url.endsWith("lokalzeit/index.html")) {
return false;
} else if(url.contains("wdr.de/hilfe")) {
return false;
}
return true;
} | class class_name[name] begin[{]
method[isUrlRelevant, return_type[type[boolean]], modifier[private], parameter[url]] begin[{]
if[call[url.endsWith, parameter[literal["lokalzeit/index.html"]]]] begin[{]
return[literal[false]]
else begin[{]
if[call[url.contains, parameter[literal["wdr.de/hilfe"]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[isUrlRelevant] operator[SEP] identifier[String] identifier[url] operator[SEP] {
Keyword[if] operator[SEP] identifier[url] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[url] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void setBody(/* @Nullable */ JvmExecutable logicalContainer, /* @Nullable */ XExpression expr) {
if (logicalContainer == null || expr == null)
return;
removeExistingBody(logicalContainer);
associator.associateLogicalContainer(expr, logicalContainer);
} | class class_name[name] begin[{]
method[setBody, return_type[void], modifier[public], parameter[logicalContainer, expr]] begin[{]
if[binary_operation[binary_operation[member[.logicalContainer], ==, literal[null]], ||, binary_operation[member[.expr], ==, literal[null]]]] begin[{]
return[None]
else begin[{]
None
end[}]
call[.removeExistingBody, parameter[member[.logicalContainer]]]
call[associator.associateLogicalContainer, parameter[member[.expr], member[.logicalContainer]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setBody] operator[SEP] identifier[JvmExecutable] identifier[logicalContainer] , identifier[XExpression] identifier[expr] operator[SEP] {
Keyword[if] operator[SEP] identifier[logicalContainer] operator[==] Other[null] operator[||] identifier[expr] operator[==] Other[null] operator[SEP] Keyword[return] operator[SEP] identifier[removeExistingBody] operator[SEP] identifier[logicalContainer] operator[SEP] operator[SEP] identifier[associator] operator[SEP] identifier[associateLogicalContainer] operator[SEP] identifier[expr] , identifier[logicalContainer] operator[SEP] operator[SEP]
}
|
public static String buildDeleteSql(BeanDescFactory beanDescFactory, EntityOperator entityOperator, Class<?> entityType, NameConverter nameConverter,
List<PropertyDesc> propDescs){
StringBuilder sb = new StringBuilder();
sb.append("DELETE FROM ").append(getTableName(entityType, nameConverter));
sb.append(" WHERE ");
boolean hasPrimaryKey = false;
BeanDesc beanDesc = beanDescFactory.getBeanDesc(entityType);
for(int i=0;i<beanDesc.getPropertyDescSize();i++){
PropertyDesc pd = beanDesc.getPropertyDesc(i);
PrimaryKeyInfo primaryKey = entityOperator.getPrimaryKeyInfo(entityType, pd, nameConverter);
if(primaryKey != null && pd.isReadable()){
if(!propDescs.isEmpty()){
sb.append(" AND ");
}
sb.append(getColumnName(entityOperator, entityType, pd, nameConverter)).append(" = ?");
propDescs.add(pd);
hasPrimaryKey = true;
}
}
if(hasPrimaryKey == false){
throw new RuntimeException(
"Primary key is not found: " + entityType.getName());
}
return sb.toString();
} | class class_name[name] begin[{]
method[buildDeleteSql, return_type[type[String]], modifier[public static], parameter[beanDescFactory, entityOperator, entityType, nameConverter, propDescs]] begin[{]
local_variable[type[StringBuilder], sb]
call[sb.append, parameter[literal["DELETE FROM "]]]
call[sb.append, parameter[literal[" WHERE "]]]
local_variable[type[boolean], hasPrimaryKey]
local_variable[type[BeanDesc], beanDesc]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPropertyDesc, postfix_operators=[], prefix_operators=[], qualifier=beanDesc, selectors=[], type_arguments=None), name=pd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PropertyDesc, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=entityType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nameConverter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPrimaryKeyInfo, postfix_operators=[], prefix_operators=[], qualifier=entityOperator, selectors=[], type_arguments=None), name=primaryKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PrimaryKeyInfo, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=primaryKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isReadable, postfix_operators=[], prefix_operators=[], qualifier=pd, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=propDescs, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" AND ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=entityOperator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=entityType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=pd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nameConverter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getColumnName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" = ?")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=pd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=propDescs, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=hasPrimaryKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getPropertyDescSize, postfix_operators=[], prefix_operators=[], qualifier=beanDesc, 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)
if[binary_operation[member[.hasPrimaryKey], ==, literal[false]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Primary key is not found: "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=entityType, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[buildDeleteSql] operator[SEP] identifier[BeanDescFactory] identifier[beanDescFactory] , identifier[EntityOperator] identifier[entityOperator] , identifier[Class] operator[<] operator[?] operator[>] identifier[entityType] , identifier[NameConverter] identifier[nameConverter] , identifier[List] operator[<] identifier[PropertyDesc] operator[>] identifier[propDescs] operator[SEP] {
identifier[StringBuilder] identifier[sb] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[getTableName] operator[SEP] identifier[entityType] , identifier[nameConverter] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[hasPrimaryKey] operator[=] literal[boolean] operator[SEP] identifier[BeanDesc] identifier[beanDesc] operator[=] identifier[beanDescFactory] operator[SEP] identifier[getBeanDesc] operator[SEP] identifier[entityType] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[beanDesc] operator[SEP] identifier[getPropertyDescSize] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[PropertyDesc] identifier[pd] operator[=] identifier[beanDesc] operator[SEP] identifier[getPropertyDesc] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[PrimaryKeyInfo] identifier[primaryKey] operator[=] identifier[entityOperator] operator[SEP] identifier[getPrimaryKeyInfo] operator[SEP] identifier[entityType] , identifier[pd] , identifier[nameConverter] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[primaryKey] operator[!=] Other[null] operator[&&] identifier[pd] operator[SEP] identifier[isReadable] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[propDescs] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[getColumnName] operator[SEP] identifier[entityOperator] , identifier[entityType] , identifier[pd] , identifier[nameConverter] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[propDescs] operator[SEP] identifier[add] operator[SEP] identifier[pd] operator[SEP] operator[SEP] identifier[hasPrimaryKey] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[hasPrimaryKey] operator[==] literal[boolean] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[entityType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public Set<PropertyKey> getModifiedProperties () {
HashSet<PropertyKey> modifiedKeys = new HashSet<>();
for (GraphObjectModificationState state : getSortedModifications()) {
for (PropertyKey key : state.getModifiedProperties().keySet()) {
if (!modifiedKeys.contains(key)) {
modifiedKeys.add(key);
}
}
}
return modifiedKeys;
} | class class_name[name] begin[{]
method[getModifiedProperties, return_type[type[Set]], modifier[public], parameter[]] begin[{]
local_variable[type[HashSet], modifiedKeys]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=modifiedKeys, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=modifiedKeys, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getModifiedProperties, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[MethodInvocation(arguments=[], member=keySet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PropertyKey, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getSortedModifications, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=state)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=GraphObjectModificationState, sub_type=None))), label=None)
return[member[.modifiedKeys]]
end[}]
END[}] | Keyword[public] identifier[Set] operator[<] identifier[PropertyKey] operator[>] identifier[getModifiedProperties] operator[SEP] operator[SEP] {
identifier[HashSet] operator[<] identifier[PropertyKey] operator[>] identifier[modifiedKeys] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[GraphObjectModificationState] identifier[state] operator[:] identifier[getSortedModifications] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[PropertyKey] identifier[key] operator[:] identifier[state] operator[SEP] identifier[getModifiedProperties] operator[SEP] operator[SEP] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[modifiedKeys] operator[SEP] identifier[contains] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[modifiedKeys] operator[SEP] identifier[add] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[modifiedKeys] operator[SEP]
}
|
public static ns[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
{
ns obj = new ns();
options option = new options();
option.set_filter(filter);
ns[] response = (ns[]) obj.getfiltered(service, option);
return response;
} | class class_name[name] begin[{]
method[get_filtered, return_type[type[ns]], modifier[public static], parameter[service, filter]] begin[{]
local_variable[type[ns], obj]
local_variable[type[options], option]
call[option.set_filter, parameter[member[.filter]]]
local_variable[type[ns], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ns] operator[SEP] operator[SEP] identifier[get_filtered] operator[SEP] identifier[nitro_service] identifier[service] , identifier[filtervalue] operator[SEP] operator[SEP] identifier[filter] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[ns] identifier[obj] operator[=] Keyword[new] identifier[ns] operator[SEP] operator[SEP] operator[SEP] identifier[options] identifier[option] operator[=] Keyword[new] identifier[options] operator[SEP] operator[SEP] operator[SEP] identifier[option] operator[SEP] identifier[set_filter] operator[SEP] identifier[filter] operator[SEP] operator[SEP] identifier[ns] operator[SEP] operator[SEP] identifier[response] operator[=] operator[SEP] identifier[ns] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[getfiltered] operator[SEP] identifier[service] , identifier[option] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
private static List<ActionRef> getRefs(Xml node)
{
final Collection<Xml> children = node.getChildren(NODE_ACTION);
final List<ActionRef> actions = new ArrayList<>(children.size());
for (final Xml action : children)
{
final String path = action.readString(ATT_PATH);
final boolean cancel = action.readBoolean(false, ATT_CANCEL);
actions.add(new ActionRef(path, cancel, getRefs(action)));
}
return actions;
} | class class_name[name] begin[{]
method[getRefs, return_type[type[List]], modifier[private static], parameter[node]] begin[{]
local_variable[type[Collection], children]
local_variable[type[List], actions]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ATT_PATH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readString, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), name=path)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=ATT_CANCEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readBoolean, postfix_operators=[], prefix_operators=[], qualifier=action, selectors=[], type_arguments=None), name=cancel)], modifiers={'final'}, type=BasicType(dimensions=[], name=boolean)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cancel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=action, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRefs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ActionRef, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=actions, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=children, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=action)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Xml, sub_type=None))), label=None)
return[member[.actions]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[List] operator[<] identifier[ActionRef] operator[>] identifier[getRefs] operator[SEP] identifier[Xml] identifier[node] operator[SEP] {
Keyword[final] identifier[Collection] operator[<] identifier[Xml] operator[>] identifier[children] operator[=] identifier[node] operator[SEP] identifier[getChildren] operator[SEP] identifier[NODE_ACTION] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[ActionRef] operator[>] identifier[actions] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[children] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Xml] identifier[action] operator[:] identifier[children] operator[SEP] {
Keyword[final] identifier[String] identifier[path] operator[=] identifier[action] operator[SEP] identifier[readString] operator[SEP] identifier[ATT_PATH] operator[SEP] operator[SEP] Keyword[final] Keyword[boolean] identifier[cancel] operator[=] identifier[action] operator[SEP] identifier[readBoolean] operator[SEP] literal[boolean] , identifier[ATT_CANCEL] operator[SEP] operator[SEP] identifier[actions] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ActionRef] operator[SEP] identifier[path] , identifier[cancel] , identifier[getRefs] operator[SEP] identifier[action] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[actions] operator[SEP]
}
|
public String convertIfcCooledBeamTypeEnumToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
} | class class_name[name] begin[{]
method[convertIfcCooledBeamTypeEnumToString, return_type[type[String]], modifier[public], parameter[eDataType, instanceValue]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=instanceValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=instanceValue, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}] | Keyword[public] identifier[String] identifier[convertIfcCooledBeamTypeEnumToString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[Object] identifier[instanceValue] operator[SEP] {
Keyword[return] identifier[instanceValue] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[instanceValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private static void createAndShowGUI() {
// Create and set up the window.
JFrame frame = new JFrame("XChart Style Demo");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
XChartStyleDemo demo = new XChartStyleDemo();
// Add content to the window.
frame.add(demo.styleSplitPane);
// Display the window.
frame.pack();
frame.setVisible(true);
} | class class_name[name] begin[{]
method[createAndShowGUI, return_type[void], modifier[private static], parameter[]] begin[{]
local_variable[type[JFrame], frame]
call[frame.setDefaultCloseOperation, parameter[member[WindowConstants.EXIT_ON_CLOSE]]]
local_variable[type[XChartStyleDemo], demo]
call[frame.add, parameter[member[demo.styleSplitPane]]]
call[frame.pack, parameter[]]
call[frame.setVisible, parameter[literal[true]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[createAndShowGUI] operator[SEP] operator[SEP] {
identifier[JFrame] identifier[frame] operator[=] Keyword[new] identifier[JFrame] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[setDefaultCloseOperation] operator[SEP] identifier[WindowConstants] operator[SEP] identifier[EXIT_ON_CLOSE] operator[SEP] operator[SEP] identifier[XChartStyleDemo] identifier[demo] operator[=] Keyword[new] identifier[XChartStyleDemo] operator[SEP] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[add] operator[SEP] identifier[demo] operator[SEP] identifier[styleSplitPane] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[pack] operator[SEP] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[setVisible] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
private void updateOtherClientRenamed() throws IOException
{
final byte cid = in.readByte();
final String cname = readString();
for (final ConnectionListener listener : listeners)
{
listener.notifyClientNameChanged(Byte.valueOf(cid), cname);
}
} | class class_name[name] begin[{]
method[updateOtherClientRenamed, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[byte], cid]
local_variable[type[String], cname]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=cid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Byte, selectors=[], type_arguments=None), MemberReference(member=cname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=notifyClientNameChanged, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=listeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ConnectionListener, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[updateOtherClientRenamed] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] Keyword[byte] identifier[cid] operator[=] identifier[in] operator[SEP] identifier[readByte] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[cname] operator[=] identifier[readString] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[ConnectionListener] identifier[listener] operator[:] identifier[listeners] operator[SEP] {
identifier[listener] operator[SEP] identifier[notifyClientNameChanged] operator[SEP] identifier[Byte] operator[SEP] identifier[valueOf] operator[SEP] identifier[cid] operator[SEP] , identifier[cname] operator[SEP] operator[SEP]
}
}
|
@Override
protected final int serializeBytes1to3 () {
int line = 0;
line |= taskAttributes.value() << Constants.TWO_BYTES_SHIFT;
if (writeExpectedFlag) {
line |= WRITE_EXPECTED_FLAG_MASK;
}
if (readExpectedFlag) {
line |= READ_EXPECTED_FLAG_MASK;
}
return line;
} | class class_name[name] begin[{]
method[serializeBytes1to3, return_type[type[int]], modifier[final protected], parameter[]] begin[{]
local_variable[type[int], line]
assign[member[.line], binary_operation[call[taskAttributes.value, parameter[]], <<, member[Constants.TWO_BYTES_SHIFT]]]
if[member[.writeExpectedFlag]] begin[{]
assign[member[.line], member[.WRITE_EXPECTED_FLAG_MASK]]
else begin[{]
None
end[}]
if[member[.readExpectedFlag]] begin[{]
assign[member[.line], member[.READ_EXPECTED_FLAG_MASK]]
else begin[{]
None
end[}]
return[member[.line]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[final] Keyword[int] identifier[serializeBytes1to3] operator[SEP] operator[SEP] {
Keyword[int] identifier[line] operator[=] Other[0] operator[SEP] identifier[line] operator[|=] identifier[taskAttributes] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[<<] identifier[Constants] operator[SEP] identifier[TWO_BYTES_SHIFT] operator[SEP] Keyword[if] operator[SEP] identifier[writeExpectedFlag] operator[SEP] {
identifier[line] operator[|=] identifier[WRITE_EXPECTED_FLAG_MASK] operator[SEP]
}
Keyword[if] operator[SEP] identifier[readExpectedFlag] operator[SEP] {
identifier[line] operator[|=] identifier[READ_EXPECTED_FLAG_MASK] operator[SEP]
}
Keyword[return] identifier[line] operator[SEP]
}
|
public static boolean isDiamond(JCTree tree) {
switch(tree.getTag()) {
case TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty();
case NEWCLASS: return isDiamond(((JCNewClass)tree).clazz);
case ANNOTATED_TYPE: return isDiamond(((JCAnnotatedType)tree).underlyingType);
default: return false;
}
} | class class_name[name] begin[{]
method[isDiamond, return_type[type[boolean]], modifier[public static], parameter[tree]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['TYPEAPPLY'], statements=[ReturnStatement(expression=Cast(expression=MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JCTypeApply, sub_type=None)), label=None)]), SwitchStatementCase(case=['NEWCLASS'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JCNewClass, sub_type=None))], member=isDiamond, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=['ANNOTATED_TYPE'], statements=[ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JCAnnotatedType, sub_type=None))], member=isDiamond, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[], statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])], expression=MethodInvocation(arguments=[], member=getTag, postfix_operators=[], prefix_operators=[], qualifier=tree, selectors=[], type_arguments=None), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isDiamond] operator[SEP] identifier[JCTree] identifier[tree] operator[SEP] {
Keyword[switch] operator[SEP] identifier[tree] operator[SEP] identifier[getTag] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[TYPEAPPLY] operator[:] Keyword[return] operator[SEP] operator[SEP] identifier[JCTypeApply] operator[SEP] identifier[tree] operator[SEP] operator[SEP] identifier[getTypeArguments] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] Keyword[case] identifier[NEWCLASS] operator[:] Keyword[return] identifier[isDiamond] operator[SEP] operator[SEP] operator[SEP] identifier[JCNewClass] operator[SEP] identifier[tree] operator[SEP] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] Keyword[case] identifier[ANNOTATED_TYPE] operator[:] Keyword[return] identifier[isDiamond] operator[SEP] operator[SEP] operator[SEP] identifier[JCAnnotatedType] operator[SEP] identifier[tree] operator[SEP] operator[SEP] identifier[underlyingType] operator[SEP] operator[SEP] Keyword[default] operator[:] Keyword[return] literal[boolean] operator[SEP]
}
}
|
public void configureForRoundTripping()
{
// StAX (1.0)
doCoalesceText(false);
doReplaceEntityRefs(false);
// StAX2:
doReportCData(true);
doReportPrologWhitespace(true);
// Woodstox specific settings
doTreatCharRefsAsEnts(true);
doNormalizeLFs(false);
// effectively prevents from reporting partial segments:
setShortestReportedTextSegment(Integer.MAX_VALUE);
} | class class_name[name] begin[{]
method[configureForRoundTripping, return_type[void], modifier[public], parameter[]] begin[{]
call[.doCoalesceText, parameter[literal[false]]]
call[.doReplaceEntityRefs, parameter[literal[false]]]
call[.doReportCData, parameter[literal[true]]]
call[.doReportPrologWhitespace, parameter[literal[true]]]
call[.doTreatCharRefsAsEnts, parameter[literal[true]]]
call[.doNormalizeLFs, parameter[literal[false]]]
call[.setShortestReportedTextSegment, parameter[member[Integer.MAX_VALUE]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[configureForRoundTripping] operator[SEP] operator[SEP] {
identifier[doCoalesceText] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[doReplaceEntityRefs] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[doReportCData] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[doReportPrologWhitespace] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[doTreatCharRefsAsEnts] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[doNormalizeLFs] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[setShortestReportedTextSegment] operator[SEP] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP]
}
|
static SanitizedContent create(String content, ContentKind kind, @Nullable Dir dir) {
checkArgument(
kind != ContentKind.TEXT, "Use UnsanitizedString for SanitizedContent with a kind of TEXT");
if (Flags.stringIsNotSanitizedContent()) {
return new SanitizedContent(content, kind, dir);
}
return SanitizedCompatString.create(content, kind, dir);
} | class class_name[name] begin[{]
method[create, return_type[type[SanitizedContent]], modifier[static], parameter[content, kind, dir]] begin[{]
call[.checkArgument, parameter[binary_operation[member[.kind], !=, member[ContentKind.TEXT]], literal["Use UnsanitizedString for SanitizedContent with a kind of TEXT"]]]
if[call[Flags.stringIsNotSanitizedContent, parameter[]]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=content, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=kind, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dir, 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=SanitizedContent, sub_type=None))]
else begin[{]
None
end[}]
return[call[SanitizedCompatString.create, parameter[member[.content], member[.kind], member[.dir]]]]
end[}]
END[}] | Keyword[static] identifier[SanitizedContent] identifier[create] operator[SEP] identifier[String] identifier[content] , identifier[ContentKind] identifier[kind] , annotation[@] identifier[Nullable] identifier[Dir] identifier[dir] operator[SEP] {
identifier[checkArgument] operator[SEP] identifier[kind] operator[!=] identifier[ContentKind] operator[SEP] identifier[TEXT] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Flags] operator[SEP] identifier[stringIsNotSanitizedContent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[SanitizedContent] operator[SEP] identifier[content] , identifier[kind] , identifier[dir] operator[SEP] operator[SEP]
}
Keyword[return] identifier[SanitizedCompatString] operator[SEP] identifier[create] operator[SEP] identifier[content] , identifier[kind] , identifier[dir] operator[SEP] operator[SEP]
}
|
public static <T> NamingEnumeration<T> namingEnumeration(final Collection<T> collection) {
final Iterator<T> iterator = collection.iterator();
return new NamingEnumeration<T>() {
public T next() {
return nextElement();
}
public boolean hasMore() {
return hasMoreElements();
}
public void close() {
}
public boolean hasMoreElements() {
return iterator.hasNext();
}
public T nextElement() {
return iterator.next();
}
};
} | class class_name[name] begin[{]
method[namingEnumeration, return_type[type[NamingEnumeration]], modifier[public static], parameter[collection]] begin[{]
local_variable[type[Iterator], iterator]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=next, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None), throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=hasMore, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[], documentation=None, modifiers={'public'}, name=close, parameters=[], return_type=None, throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=hasMoreElements, parameters=[], return_type=BasicType(dimensions=[], name=boolean), throws=None, type_parameters=None), MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=nextElement, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=T, 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=NamingEnumeration, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[NamingEnumeration] operator[<] identifier[T] operator[>] identifier[namingEnumeration] operator[SEP] Keyword[final] identifier[Collection] operator[<] identifier[T] operator[>] identifier[collection] operator[SEP] {
Keyword[final] identifier[Iterator] operator[<] identifier[T] operator[>] identifier[iterator] operator[=] identifier[collection] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[NamingEnumeration] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] {
Keyword[public] identifier[T] identifier[next] operator[SEP] operator[SEP] {
Keyword[return] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[public] Keyword[boolean] identifier[hasMore] operator[SEP] operator[SEP] {
Keyword[return] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
}
Keyword[public] Keyword[boolean] identifier[hasMoreElements] operator[SEP] operator[SEP] {
Keyword[return] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[public] identifier[T] identifier[nextElement] operator[SEP] operator[SEP] {
Keyword[return] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
private void addValuesToSelection(Selection results, byte key) {
if (key != DEFAULT_RETURN_VALUE) {
int i = 0;
for (byte next : values) {
if (key == next) {
results.add(i);
}
i++;
}
}
} | class class_name[name] begin[{]
method[addValuesToSelection, return_type[void], modifier[private], parameter[results, key]] begin[{]
if[binary_operation[member[.key], !=, member[.DEFAULT_RETURN_VALUE]]] begin[{]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=next, 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=add, postfix_operators=[], prefix_operators=[], qualifier=results, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=next)], modifiers=set(), type=BasicType(dimensions=[], name=byte))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addValuesToSelection] operator[SEP] identifier[Selection] identifier[results] , Keyword[byte] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] operator[!=] identifier[DEFAULT_RETURN_VALUE] operator[SEP] {
Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[byte] identifier[next] operator[:] identifier[values] operator[SEP] {
Keyword[if] operator[SEP] identifier[key] operator[==] identifier[next] operator[SEP] {
identifier[results] operator[SEP] identifier[add] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
identifier[i] operator[++] operator[SEP]
}
}
}
|
public void addUser(UserDefinition userDef) {
String userID = userDef.getID();
Utils.require(!Utils.isEmpty(userID), "User ID must be set");
Utils.require(!m_users.containsKey(userID), "Duplicate user ID: " + userID);
m_users.put(userID, userDef);
} | class class_name[name] begin[{]
method[addUser, return_type[void], modifier[public], parameter[userDef]] begin[{]
local_variable[type[String], userID]
call[Utils.require, parameter[call[Utils.isEmpty, parameter[member[.userID]]], literal["User ID must be set"]]]
call[Utils.require, parameter[call[m_users.containsKey, parameter[member[.userID]]], binary_operation[literal["Duplicate user ID: "], +, member[.userID]]]]
call[m_users.put, parameter[member[.userID], member[.userDef]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addUser] operator[SEP] identifier[UserDefinition] identifier[userDef] operator[SEP] {
identifier[String] identifier[userID] operator[=] identifier[userDef] operator[SEP] identifier[getID] operator[SEP] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[require] operator[SEP] operator[!] identifier[Utils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[userID] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[Utils] operator[SEP] identifier[require] operator[SEP] operator[!] identifier[m_users] operator[SEP] identifier[containsKey] operator[SEP] identifier[userID] operator[SEP] , literal[String] operator[+] identifier[userID] operator[SEP] operator[SEP] identifier[m_users] operator[SEP] identifier[put] operator[SEP] identifier[userID] , identifier[userDef] operator[SEP] operator[SEP]
}
|
public static byte[] decode(String s) {
if (s == null) {
throw new NullPointerException("Input string was null.");
}
byte[] bytes = s.getBytes(UTF_8);
return decode(bytes, 0, bytes.length);
} | class class_name[name] begin[{]
method[decode, return_type[type[byte]], modifier[public static], parameter[s]] begin[{]
if[binary_operation[member[.s], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Input string was null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[byte], bytes]
return[call[.decode, parameter[member[.bytes], literal[0], member[bytes.length]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[decode] operator[SEP] identifier[String] identifier[s] operator[SEP] {
Keyword[if] operator[SEP] identifier[s] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[s] operator[SEP] identifier[getBytes] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] Keyword[return] identifier[decode] operator[SEP] identifier[bytes] , Other[0] , identifier[bytes] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
|
public DataChannelReader getDataChannelSource(TransferContext context)
throws Exception {
String id = getHandlerID(session.transferMode, session.transferType, SOURCE);
logger.debug("type/mode: " + id);
Class clazz = (Class)dataHandlers.get(id);
if (clazz == null) {
throw new Exception("No data reader for type/mode" + id);
}
DataChannelReader reader = (DataChannelReader)clazz.newInstance();
if (reader instanceof EBlockAware) {
((EBlockAware)reader).setTransferContext((EBlockParallelTransferContext)context);
}
return reader;
} | class class_name[name] begin[{]
method[getDataChannelSource, return_type[type[DataChannelReader]], modifier[public], parameter[context]] begin[{]
local_variable[type[String], id]
call[logger.debug, parameter[binary_operation[literal["type/mode: "], +, member[.id]]]]
local_variable[type[Class], clazz]
if[binary_operation[member[.clazz], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No data reader for type/mode"), operandr=MemberReference(member=id, 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=Exception, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[DataChannelReader], reader]
if[binary_operation[member[.reader], instanceof, type[EBlockAware]]] begin[{]
Cast(expression=MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=EBlockAware, sub_type=None))
else begin[{]
None
end[}]
return[member[.reader]]
end[}]
END[}] | Keyword[public] identifier[DataChannelReader] identifier[getDataChannelSource] operator[SEP] identifier[TransferContext] identifier[context] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[String] identifier[id] operator[=] identifier[getHandlerID] operator[SEP] identifier[session] operator[SEP] identifier[transferMode] , identifier[session] operator[SEP] identifier[transferType] , identifier[SOURCE] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[id] operator[SEP] operator[SEP] identifier[Class] identifier[clazz] operator[=] operator[SEP] identifier[Class] operator[SEP] identifier[dataHandlers] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[clazz] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Exception] operator[SEP] literal[String] operator[+] identifier[id] operator[SEP] operator[SEP]
}
identifier[DataChannelReader] identifier[reader] operator[=] operator[SEP] identifier[DataChannelReader] operator[SEP] identifier[clazz] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reader] Keyword[instanceof] identifier[EBlockAware] operator[SEP] {
operator[SEP] operator[SEP] identifier[EBlockAware] operator[SEP] identifier[reader] operator[SEP] operator[SEP] identifier[setTransferContext] operator[SEP] operator[SEP] identifier[EBlockParallelTransferContext] operator[SEP] identifier[context] operator[SEP] operator[SEP]
}
Keyword[return] identifier[reader] operator[SEP]
}
|
public Set<Constructor> getConstructorsAnnotatedWith(final Annotation annotation) {
return filter(getConstructorsAnnotatedWith(annotation.annotationType()), withAnnotation(annotation));
} | class class_name[name] begin[{]
method[getConstructorsAnnotatedWith, return_type[type[Set]], modifier[public], parameter[annotation]] begin[{]
return[call[.filter, parameter[call[.getConstructorsAnnotatedWith, parameter[call[annotation.annotationType, parameter[]]]], call[.withAnnotation, parameter[member[.annotation]]]]]]
end[}]
END[}] | Keyword[public] identifier[Set] operator[<] identifier[Constructor] operator[>] identifier[getConstructorsAnnotatedWith] operator[SEP] Keyword[final] identifier[Annotation] identifier[annotation] operator[SEP] {
Keyword[return] identifier[filter] operator[SEP] identifier[getConstructorsAnnotatedWith] operator[SEP] identifier[annotation] operator[SEP] identifier[annotationType] operator[SEP] operator[SEP] operator[SEP] , identifier[withAnnotation] operator[SEP] identifier[annotation] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void inheritParentProperties(ApplicationContext inheriting,
GenericApplicationContext context) {
if (!(inheriting instanceof AbstractApplicationContext)) return;
List<BeanFactoryPostProcessor> processors =
((AbstractApplicationContext) inheriting).getBeanFactoryPostProcessors();
for (BeanFactoryPostProcessor processor : processors) {
if (processor instanceof PropertyResourceConfigurer)
context.addBeanFactoryPostProcessor(processor);
}
} | class class_name[name] begin[{]
method[inheritParentProperties, return_type[void], modifier[public static], parameter[inheriting, context]] begin[{]
if[binary_operation[member[.inheriting], instanceof, type[AbstractApplicationContext]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[List], processors]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=PropertyResourceConfigurer, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=processor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addBeanFactoryPostProcessor, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), label=None))]), control=EnhancedForControl(iterable=MemberReference(member=processors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=processor)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BeanFactoryPostProcessor, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[inheritParentProperties] operator[SEP] identifier[ApplicationContext] identifier[inheriting] , identifier[GenericApplicationContext] identifier[context] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[inheriting] Keyword[instanceof] identifier[AbstractApplicationContext] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[List] operator[<] identifier[BeanFactoryPostProcessor] operator[>] identifier[processors] operator[=] operator[SEP] operator[SEP] identifier[AbstractApplicationContext] operator[SEP] identifier[inheriting] operator[SEP] operator[SEP] identifier[getBeanFactoryPostProcessors] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[BeanFactoryPostProcessor] identifier[processor] operator[:] identifier[processors] operator[SEP] {
Keyword[if] operator[SEP] identifier[processor] Keyword[instanceof] identifier[PropertyResourceConfigurer] operator[SEP] identifier[context] operator[SEP] identifier[addBeanFactoryPostProcessor] operator[SEP] identifier[processor] operator[SEP] operator[SEP]
}
}
|
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the ContentService.
ContentServiceInterface contentService =
adManagerServices.get(session, ContentServiceInterface.class);
// Create a statement to get all content.
StatementBuilder statementBuilder =
new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get content by statement.
ContentPage page = contentService.getContentByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Content content : page.getResults()) {
System.out.printf(
"%d) Content with ID %d and name '%s' was found.%n",
i++, content.getId(), content.getName());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | class class_name[name] begin[{]
method[runExample, return_type[void], modifier[public static], parameter[adManagerServices, session]] begin[{]
local_variable[type[ContentServiceInterface], contentService]
local_variable[type[StatementBuilder], statementBuilder]
local_variable[type[int], totalResultSetSize]
do[binary_operation[call[statementBuilder.getOffset, parameter[]], <, member[.totalResultSetSize]]] begin[{]
local_variable[type[ContentPage], page]
if[binary_operation[call[page.getResults, parameter[]], !=, literal[null]]] begin[{]
assign[member[.totalResultSetSize], call[page.getTotalResultSetSize, parameter[]]]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%d) Content with ID %d and name '%s' was found.%n"), MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=content, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getResults, postfix_operators=[], prefix_operators=[], qualifier=page, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=content)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Content, sub_type=None))), label=None)
else begin[{]
None
end[}]
call[statementBuilder.increaseOffsetBy, parameter[member[StatementBuilder.SUGGESTED_PAGE_LIMIT]]]
end[}]
call[System.out.printf, parameter[literal["Number of results found: %d%n"], member[.totalResultSetSize]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[runExample] operator[SEP] identifier[AdManagerServices] identifier[adManagerServices] , identifier[AdManagerSession] identifier[session] operator[SEP] Keyword[throws] identifier[RemoteException] {
identifier[ContentServiceInterface] identifier[contentService] operator[=] identifier[adManagerServices] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[ContentServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[StatementBuilder] identifier[statementBuilder] operator[=] Keyword[new] identifier[StatementBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[orderBy] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[limit] operator[SEP] identifier[StatementBuilder] operator[SEP] identifier[SUGGESTED_PAGE_LIMIT] operator[SEP] operator[SEP] Keyword[int] identifier[totalResultSetSize] operator[=] Other[0] operator[SEP] Keyword[do] {
identifier[ContentPage] identifier[page] operator[=] identifier[contentService] operator[SEP] identifier[getContentByStatement] operator[SEP] identifier[statementBuilder] operator[SEP] identifier[toStatement] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[page] operator[SEP] identifier[getResults] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[totalResultSetSize] operator[=] identifier[page] operator[SEP] identifier[getTotalResultSetSize] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[page] operator[SEP] identifier[getStartIndex] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Content] identifier[content] operator[:] identifier[page] operator[SEP] identifier[getResults] operator[SEP] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[i] operator[++] , identifier[content] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[content] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[statementBuilder] operator[SEP] identifier[increaseOffsetBy] operator[SEP] identifier[StatementBuilder] operator[SEP] identifier[SUGGESTED_PAGE_LIMIT] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[statementBuilder] operator[SEP] identifier[getOffset] operator[SEP] operator[SEP] operator[<] identifier[totalResultSetSize] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[totalResultSetSize] operator[SEP] operator[SEP]
}
|
@Nonnull
public static String encode(@Nonnull String s) {
try {
boolean escaped = false;
StringBuilder out = new StringBuilder(s.length());
ByteArrayOutputStream buf = new ByteArrayOutputStream();
OutputStreamWriter w = new OutputStreamWriter(buf, StandardCharsets.UTF_8);
for (int i = 0; i < s.length(); i++) {
int c = s.charAt(i);
if (c<128 && c!=' ') {
out.append((char) c);
} else {
// 1 char -> UTF8
w.write(c);
w.flush();
for (byte b : buf.toByteArray()) {
out.append('%');
out.append(toDigit((b >> 4) & 0xF));
out.append(toDigit(b & 0xF));
}
buf.reset();
escaped = true;
}
}
return escaped ? out.toString() : s;
} catch (IOException e) {
throw new Error(e); // impossible
}
} | class class_name[name] begin[{]
method[encode, return_type[type[String]], modifier[public static], parameter[s]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), name=escaped)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringBuilder, sub_type=None)), name=out)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuilder, 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=ByteArrayOutputStream, sub_type=None)), name=buf)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteArrayOutputStream, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=StandardCharsets, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OutputStreamWriter, sub_type=None)), name=w)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=OutputStreamWriter, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=128), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=' '), operator=!=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=w, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=w, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='%')], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), operator=>>), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xF), operator=&)], member=toDigit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xF), operator=&)], member=toDigit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=toByteArray, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=b)], modifiers=set(), type=BasicType(dimensions=[], name=byte))), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=reset, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=escaped, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=char))], member=append, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, 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), ReturnStatement(expression=TernaryExpression(condition=MemberReference(member=escaped, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=out, 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=Error, 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[Nonnull] Keyword[public] Keyword[static] identifier[String] identifier[encode] operator[SEP] annotation[@] identifier[Nonnull] identifier[String] identifier[s] operator[SEP] {
Keyword[try] {
Keyword[boolean] identifier[escaped] operator[=] literal[boolean] operator[SEP] identifier[StringBuilder] identifier[out] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ByteArrayOutputStream] identifier[buf] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[OutputStreamWriter] identifier[w] operator[=] Keyword[new] identifier[OutputStreamWriter] operator[SEP] identifier[buf] , identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[int] identifier[c] operator[=] identifier[s] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[<] Other[128] operator[&&] identifier[c] operator[!=] literal[String] operator[SEP] {
identifier[out] operator[SEP] identifier[append] operator[SEP] operator[SEP] Keyword[char] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[w] operator[SEP] identifier[write] operator[SEP] identifier[c] operator[SEP] operator[SEP] identifier[w] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[byte] identifier[b] operator[:] identifier[buf] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] operator[SEP] {
identifier[out] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[toDigit] operator[SEP] operator[SEP] identifier[b] operator[>] operator[>] Other[4] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[append] operator[SEP] identifier[toDigit] operator[SEP] identifier[b] operator[&] literal[Integer] operator[SEP] operator[SEP] operator[SEP]
}
identifier[buf] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[escaped] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[return] identifier[escaped] operator[?] identifier[out] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[:] identifier[s] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[Error] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public void onBindViewHolder(@NonNull T items, int position,
@NonNull RecyclerView.ViewHolder holder, List payloads) {
AdapterDelegate<T> delegate = getDelegateForViewType(holder.getItemViewType());
if (delegate == null) {
throw new NullPointerException("No delegate found for item at position = "
+ position
+ " for viewType = "
+ holder.getItemViewType());
}
delegate.onBindViewHolder(items, position, holder,
payloads != null ? payloads : PAYLOADS_EMPTY_LIST);
} | class class_name[name] begin[{]
method[onBindViewHolder, return_type[void], modifier[public], parameter[items, position, holder, payloads]] begin[{]
local_variable[type[AdapterDelegate], delegate]
if[binary_operation[member[.delegate], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No delegate found for item at position = "), operandr=MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" for viewType = "), operator=+), operandr=MethodInvocation(arguments=[], member=getItemViewType, postfix_operators=[], prefix_operators=[], qualifier=holder, 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=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[delegate.onBindViewHolder, parameter[member[.items], member[.position], member[.holder], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=payloads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=MemberReference(member=PAYLOADS_EMPTY_LIST, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=payloads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[onBindViewHolder] operator[SEP] annotation[@] identifier[NonNull] identifier[T] identifier[items] , Keyword[int] identifier[position] , annotation[@] identifier[NonNull] identifier[RecyclerView] operator[SEP] identifier[ViewHolder] identifier[holder] , identifier[List] identifier[payloads] operator[SEP] {
identifier[AdapterDelegate] operator[<] identifier[T] operator[>] identifier[delegate] operator[=] identifier[getDelegateForViewType] operator[SEP] identifier[holder] operator[SEP] identifier[getItemViewType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[delegate] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[+] identifier[position] operator[+] literal[String] operator[+] identifier[holder] operator[SEP] identifier[getItemViewType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[delegate] operator[SEP] identifier[onBindViewHolder] operator[SEP] identifier[items] , identifier[position] , identifier[holder] , identifier[payloads] operator[!=] Other[null] operator[?] identifier[payloads] operator[:] identifier[PAYLOADS_EMPTY_LIST] operator[SEP] operator[SEP]
}
|
public List<String> getTables() {
List<String> tables = new ArrayList<>();
List<Extensions> extensions = getExtensions(EXTENSION_NAME);
if (extensions != null) {
for (Extensions extension : extensions) {
tables.add(extension.getTableName());
}
}
return tables;
} | class class_name[name] begin[{]
method[getTables, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], tables]
local_variable[type[List], extensions]
if[binary_operation[member[.extensions], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTableName, postfix_operators=[], prefix_operators=[], qualifier=extension, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=tables, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=extensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=extension)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Extensions, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.tables]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[String] operator[>] identifier[getTables] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[tables] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Extensions] operator[>] identifier[extensions] operator[=] identifier[getExtensions] operator[SEP] identifier[EXTENSION_NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[extensions] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Extensions] identifier[extension] operator[:] identifier[extensions] operator[SEP] {
identifier[tables] operator[SEP] identifier[add] operator[SEP] identifier[extension] operator[SEP] identifier[getTableName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[tables] operator[SEP]
}
|
public Object prepare(Xid xid, List<? extends TransactionBranchInfo> branches) throws LogException {
int branchCount = branches.size();
byte[][] data = new byte[3 + 2 * branchCount][];
data[0] = intToBytes(xid.getFormatId());
data[1] = xid.getGlobalTransactionId();
data[2] = xid.getBranchQualifier();
int i = 3;
for (TransactionBranchInfo transactionBranchInfo : branches) {
data[i++] = transactionBranchInfo.getBranchXid().getBranchQualifier();
data[i++] = transactionBranchInfo.getResourceName().getBytes();
}
try {
return logger.putCommit(data);
} catch (LogClosedException | LogRecordSizeException | InterruptedException | LogFileOverflowException e) {
throw new IllegalStateException(e);
} catch (IOException e) {
throw new LogException(e);
}
} | class class_name[name] begin[{]
method[prepare, return_type[type[Object]], modifier[public], parameter[xid, branches]] begin[{]
local_variable[type[int], branchCount]
local_variable[type[byte], data]
assign[member[.data], call[.intToBytes, parameter[call[xid.getFormatId, parameter[]]]]]
assign[member[.data], call[xid.getGlobalTransactionId, parameter[]]]
assign[member[.data], call[xid.getBranchQualifier, parameter[]]]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=getBranchXid, postfix_operators=[], prefix_operators=[], qualifier=transactionBranchInfo, selectors=[MethodInvocation(arguments=[], member=getBranchQualifier, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=getResourceName, postfix_operators=[], prefix_operators=[], qualifier=transactionBranchInfo, selectors=[MethodInvocation(arguments=[], member=getBytes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=branches, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=transactionBranchInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TransactionBranchInfo, sub_type=None))), label=None)
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putCommit, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['LogClosedException', 'LogRecordSizeException', 'InterruptedException', 'LogFileOverflowException'])), 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=LogException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Object] identifier[prepare] operator[SEP] identifier[Xid] identifier[xid] , identifier[List] operator[<] operator[?] Keyword[extends] identifier[TransactionBranchInfo] operator[>] identifier[branches] operator[SEP] Keyword[throws] identifier[LogException] {
Keyword[int] identifier[branchCount] operator[=] identifier[branches] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[3] operator[+] Other[2] operator[*] identifier[branchCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] Other[0] operator[SEP] operator[=] identifier[intToBytes] operator[SEP] identifier[xid] operator[SEP] identifier[getFormatId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] Other[1] operator[SEP] operator[=] identifier[xid] operator[SEP] identifier[getGlobalTransactionId] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] Other[2] operator[SEP] operator[=] identifier[xid] operator[SEP] identifier[getBranchQualifier] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[3] operator[SEP] Keyword[for] operator[SEP] identifier[TransactionBranchInfo] identifier[transactionBranchInfo] operator[:] identifier[branches] operator[SEP] {
identifier[data] operator[SEP] identifier[i] operator[++] operator[SEP] operator[=] identifier[transactionBranchInfo] operator[SEP] identifier[getBranchXid] operator[SEP] operator[SEP] operator[SEP] identifier[getBranchQualifier] operator[SEP] operator[SEP] operator[SEP] identifier[data] operator[SEP] identifier[i] operator[++] operator[SEP] operator[=] identifier[transactionBranchInfo] operator[SEP] identifier[getResourceName] operator[SEP] operator[SEP] operator[SEP] identifier[getBytes] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[logger] operator[SEP] identifier[putCommit] operator[SEP] identifier[data] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[LogClosedException] operator[|] identifier[LogRecordSizeException] operator[|] identifier[InterruptedException] operator[|] identifier[LogFileOverflowException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[LogException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static void readFully(final InputStream in, final byte[] buf, int off, final int len)
throws IOException {
int toRead = len;
while (toRead > 0) {
final int ret = in.read(buf, off, toRead);
if (ret < 0) {
throw new IOException("Premeture EOF from inputStream");
}
toRead -= ret;
off += ret;
}
} | class class_name[name] begin[{]
method[readFully, return_type[void], modifier[public static], parameter[in, buf, off, len]] begin[{]
local_variable[type[int], toRead]
while[binary_operation[member[.toRead], >, literal[0]]] begin[{]
local_variable[type[int], ret]
if[binary_operation[member[.ret], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Premeture EOF from inputStream")], 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)
else begin[{]
None
end[}]
assign[member[.toRead], member[.ret]]
assign[member[.off], member[.ret]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[readFully] operator[SEP] Keyword[final] identifier[InputStream] identifier[in] , Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[buf] , Keyword[int] identifier[off] , Keyword[final] Keyword[int] identifier[len] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[toRead] operator[=] identifier[len] operator[SEP] Keyword[while] operator[SEP] identifier[toRead] operator[>] Other[0] operator[SEP] {
Keyword[final] Keyword[int] identifier[ret] operator[=] identifier[in] operator[SEP] identifier[read] operator[SEP] identifier[buf] , identifier[off] , identifier[toRead] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ret] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[toRead] operator[-=] identifier[ret] operator[SEP] identifier[off] operator[+=] identifier[ret] operator[SEP]
}
}
|
public void extractVariables(Message message, TestContext context) {
if (CollectionUtils.isEmpty(headerMappings)) { return; }
for (Entry<String, String> entry : headerMappings.entrySet()) {
String headerElementName = entry.getKey();
String targetVariableName = entry.getValue();
if (message.getHeader(headerElementName) == null) {
throw new UnknownElementException("Could not find header element " + headerElementName + " in received header");
}
context.setVariable(targetVariableName, message.getHeader(headerElementName).toString());
}
} | class class_name[name] begin[{]
method[extractVariables, return_type[void], modifier[public], parameter[message, context]] begin[{]
if[call[CollectionUtils.isEmpty, parameter[member[.headerMappings]]]] begin[{]
return[None]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=headerElementName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=targetVariableName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=headerElementName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getHeader, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not find header element "), operandr=MemberReference(member=headerElementName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" in received header"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=UnknownElementException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=targetVariableName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=headerElementName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getHeader, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setVariable, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=headerMappings, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[extractVariables] operator[SEP] identifier[Message] identifier[message] , identifier[TestContext] identifier[context] operator[SEP] {
Keyword[if] operator[SEP] identifier[CollectionUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[headerMappings] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[>] identifier[entry] operator[:] identifier[headerMappings] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[headerElementName] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[targetVariableName] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[message] operator[SEP] identifier[getHeader] operator[SEP] identifier[headerElementName] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[UnknownElementException] operator[SEP] literal[String] operator[+] identifier[headerElementName] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[context] operator[SEP] identifier[setVariable] operator[SEP] identifier[targetVariableName] , identifier[message] operator[SEP] identifier[getHeader] operator[SEP] identifier[headerElementName] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public List<SDVariable> multiHeadDotProductAttention(String name, SDVariable queries, SDVariable keys, SDVariable values, SDVariable Wq, SDVariable Wk, SDVariable Wv, SDVariable Wo, SDVariable mask, boolean scaled, boolean withWeights){
List<SDVariable> result = f().multiHeadDotProductAttention(queries, keys, values, Wq, Wk, Wv, Wo, mask, scaled, withWeights);
if(withWeights){
return Collections.singletonList(updateVariableNameAndReference(result.get(0), name));
}else{
return Arrays.asList(
updateVariableNameAndReference(result.get(0), name),
updateVariableNameAndReference(result.get(1), name+":weights")
);
}
} | class class_name[name] begin[{]
method[multiHeadDotProductAttention, return_type[type[List]], modifier[public], parameter[name, queries, keys, values, Wq, Wk, Wv, Wo, mask, scaled, withWeights]] begin[{]
local_variable[type[List], result]
if[member[.withWeights]] begin[{]
return[call[Collections.singletonList, parameter[call[.updateVariableNameAndReference, parameter[call[result.get, parameter[literal[0]]], member[.name]]]]]]
else begin[{]
return[call[Arrays.asList, parameter[call[.updateVariableNameAndReference, parameter[call[result.get, parameter[literal[0]]], member[.name]]], call[.updateVariableNameAndReference, parameter[call[result.get, parameter[literal[1]]], binary_operation[member[.name], +, literal[":weights"]]]]]]]
end[}]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[SDVariable] operator[>] identifier[multiHeadDotProductAttention] operator[SEP] identifier[String] identifier[name] , identifier[SDVariable] identifier[queries] , identifier[SDVariable] identifier[keys] , identifier[SDVariable] identifier[values] , identifier[SDVariable] identifier[Wq] , identifier[SDVariable] identifier[Wk] , identifier[SDVariable] identifier[Wv] , identifier[SDVariable] identifier[Wo] , identifier[SDVariable] identifier[mask] , Keyword[boolean] identifier[scaled] , Keyword[boolean] identifier[withWeights] operator[SEP] {
identifier[List] operator[<] identifier[SDVariable] operator[>] identifier[result] operator[=] identifier[f] operator[SEP] operator[SEP] operator[SEP] identifier[multiHeadDotProductAttention] operator[SEP] identifier[queries] , identifier[keys] , identifier[values] , identifier[Wq] , identifier[Wk] , identifier[Wv] , identifier[Wo] , identifier[mask] , identifier[scaled] , identifier[withWeights] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[withWeights] operator[SEP] {
Keyword[return] identifier[Collections] operator[SEP] identifier[singletonList] operator[SEP] identifier[updateVariableNameAndReference] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] , identifier[name] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[updateVariableNameAndReference] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] , identifier[name] operator[SEP] , identifier[updateVariableNameAndReference] operator[SEP] identifier[result] operator[SEP] identifier[get] operator[SEP] Other[1] operator[SEP] , identifier[name] operator[+] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
|
protected void attachExpansionRuleCitation(Statement statement) {
AnnotationGroup ag = new AnnotationGroup();
Citation citation = getInstance().createCitation(getName());
citation.setType(CitationType.OTHER);
citation.setReference(getName());
ag.setCitation(citation);
statement.setAnnotationGroup(ag);
} | class class_name[name] begin[{]
method[attachExpansionRuleCitation, return_type[void], modifier[protected], parameter[statement]] begin[{]
local_variable[type[AnnotationGroup], ag]
local_variable[type[Citation], citation]
call[citation.setType, parameter[member[CitationType.OTHER]]]
call[citation.setReference, parameter[call[.getName, parameter[]]]]
call[ag.setCitation, parameter[member[.citation]]]
call[statement.setAnnotationGroup, parameter[member[.ag]]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[attachExpansionRuleCitation] operator[SEP] identifier[Statement] identifier[statement] operator[SEP] {
identifier[AnnotationGroup] identifier[ag] operator[=] Keyword[new] identifier[AnnotationGroup] operator[SEP] operator[SEP] operator[SEP] identifier[Citation] identifier[citation] operator[=] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] identifier[createCitation] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[citation] operator[SEP] identifier[setType] operator[SEP] identifier[CitationType] operator[SEP] identifier[OTHER] operator[SEP] operator[SEP] identifier[citation] operator[SEP] identifier[setReference] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ag] operator[SEP] identifier[setCitation] operator[SEP] identifier[citation] operator[SEP] operator[SEP] identifier[statement] operator[SEP] identifier[setAnnotationGroup] operator[SEP] identifier[ag] operator[SEP] operator[SEP]
}
|
public int getBitsToCheck()
{
if (m_iBitsToCheck == 0)
{
Record record = this.makeReferenceRecord();
try {
record.close();
while (record.hasNext()) // 0 = First Day -> 6 = Last Day of Week
{
record.next();
int sBitPosition = (int)record.getCounterField().getValue();
m_iBitsToCheck |= 1 << sBitPosition;
}
} catch (DBException e) {
e.printStackTrace();
}
}
return m_iBitsToCheck;
} | class class_name[name] begin[{]
method[getBitsToCheck, return_type[type[int]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.m_iBitsToCheck], ==, literal[0]]] begin[{]
local_variable[type[Record], record]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[], type_arguments=None), label=None), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=getCounterField, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=BasicType(dimensions=[], name=int)), name=sBitPosition)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_iBitsToCheck, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=|=, value=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operandr=MemberReference(member=sBitPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<<)), label=None)]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['DBException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.m_iBitsToCheck]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[getBitsToCheck] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_iBitsToCheck] operator[==] Other[0] operator[SEP] {
identifier[Record] identifier[record] operator[=] Keyword[this] operator[SEP] identifier[makeReferenceRecord] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[record] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[record] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[record] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[sBitPosition] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[record] operator[SEP] identifier[getCounterField] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[m_iBitsToCheck] operator[|=] Other[1] operator[<<] identifier[sBitPosition] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[DBException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[m_iBitsToCheck] operator[SEP]
}
|
public static ZMatrixRMaj householderVector(ZMatrixRMaj x ) {
ZMatrixRMaj u = x.copy();
double max = CommonOps_ZDRM.elementMaxAbs(u);
CommonOps_ZDRM.elementDivide(u, max, 0, u);
double nx = NormOps_ZDRM.normF(u);
Complex_F64 c = new Complex_F64();
u.get(0,0,c);
double realTau,imagTau;
if( c.getMagnitude() == 0 ) {
realTau = nx;
imagTau = 0;
} else {
realTau = c.real/c.getMagnitude()*nx;
imagTau = c.imaginary/c.getMagnitude()*nx;
}
u.set(0,0,c.real + realTau,c.imaginary + imagTau);
CommonOps_ZDRM.elementDivide(u,u.getReal(0,0),u.getImag(0,0),u);
return u;
} | class class_name[name] begin[{]
method[householderVector, return_type[type[ZMatrixRMaj]], modifier[public static], parameter[x]] begin[{]
local_variable[type[ZMatrixRMaj], u]
local_variable[type[double], max]
call[CommonOps_ZDRM.elementDivide, parameter[member[.u], member[.max], literal[0], member[.u]]]
local_variable[type[double], nx]
local_variable[type[Complex_F64], c]
call[u.get, parameter[literal[0], literal[0], member[.c]]]
local_variable[type[double], realTau]
if[binary_operation[call[c.getMagnitude, parameter[]], ==, literal[0]]] begin[{]
assign[member[.realTau], member[.nx]]
assign[member[.imagTau], literal[0]]
else begin[{]
assign[member[.realTau], binary_operation[binary_operation[member[c.real], /, call[c.getMagnitude, parameter[]]], *, member[.nx]]]
assign[member[.imagTau], binary_operation[binary_operation[member[c.imaginary], /, call[c.getMagnitude, parameter[]]], *, member[.nx]]]
end[}]
call[u.set, parameter[literal[0], literal[0], binary_operation[member[c.real], +, member[.realTau]], binary_operation[member[c.imaginary], +, member[.imagTau]]]]
call[CommonOps_ZDRM.elementDivide, parameter[member[.u], call[u.getReal, parameter[literal[0], literal[0]]], call[u.getImag, parameter[literal[0], literal[0]]], member[.u]]]
return[member[.u]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ZMatrixRMaj] identifier[householderVector] operator[SEP] identifier[ZMatrixRMaj] identifier[x] operator[SEP] {
identifier[ZMatrixRMaj] identifier[u] operator[=] identifier[x] operator[SEP] identifier[copy] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[max] operator[=] identifier[CommonOps_ZDRM] operator[SEP] identifier[elementMaxAbs] operator[SEP] identifier[u] operator[SEP] operator[SEP] identifier[CommonOps_ZDRM] operator[SEP] identifier[elementDivide] operator[SEP] identifier[u] , identifier[max] , Other[0] , identifier[u] operator[SEP] operator[SEP] Keyword[double] identifier[nx] operator[=] identifier[NormOps_ZDRM] operator[SEP] identifier[normF] operator[SEP] identifier[u] operator[SEP] operator[SEP] identifier[Complex_F64] identifier[c] operator[=] Keyword[new] identifier[Complex_F64] operator[SEP] operator[SEP] operator[SEP] identifier[u] operator[SEP] identifier[get] operator[SEP] Other[0] , Other[0] , identifier[c] operator[SEP] operator[SEP] Keyword[double] identifier[realTau] , identifier[imagTau] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[SEP] identifier[getMagnitude] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[realTau] operator[=] identifier[nx] operator[SEP] identifier[imagTau] operator[=] Other[0] operator[SEP]
}
Keyword[else] {
identifier[realTau] operator[=] identifier[c] operator[SEP] identifier[real] operator[/] identifier[c] operator[SEP] identifier[getMagnitude] operator[SEP] operator[SEP] operator[*] identifier[nx] operator[SEP] identifier[imagTau] operator[=] identifier[c] operator[SEP] identifier[imaginary] operator[/] identifier[c] operator[SEP] identifier[getMagnitude] operator[SEP] operator[SEP] operator[*] identifier[nx] operator[SEP]
}
identifier[u] operator[SEP] identifier[set] operator[SEP] Other[0] , Other[0] , identifier[c] operator[SEP] identifier[real] operator[+] identifier[realTau] , identifier[c] operator[SEP] identifier[imaginary] operator[+] identifier[imagTau] operator[SEP] operator[SEP] identifier[CommonOps_ZDRM] operator[SEP] identifier[elementDivide] operator[SEP] identifier[u] , identifier[u] operator[SEP] identifier[getReal] operator[SEP] Other[0] , Other[0] operator[SEP] , identifier[u] operator[SEP] identifier[getImag] operator[SEP] Other[0] , Other[0] operator[SEP] , identifier[u] operator[SEP] operator[SEP] Keyword[return] identifier[u] operator[SEP]
}
|
private void endMainBlock() {
BlockTabRec btr = blockTab[0];
btr.tPosContentsEnd = templateText.length();
btr.tPosEnd = templateText.length();
btr.definitionIsOpen = false;
currentNestingLevel--;
} | class class_name[name] begin[{]
method[endMainBlock, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[BlockTabRec], btr]
assign[member[btr.tPosContentsEnd], call[templateText.length, parameter[]]]
assign[member[btr.tPosEnd], call[templateText.length, parameter[]]]
assign[member[btr.definitionIsOpen], literal[false]]
member[.currentNestingLevel]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[endMainBlock] operator[SEP] operator[SEP] {
identifier[BlockTabRec] identifier[btr] operator[=] identifier[blockTab] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[btr] operator[SEP] identifier[tPosContentsEnd] operator[=] identifier[templateText] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[btr] operator[SEP] identifier[tPosEnd] operator[=] identifier[templateText] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[btr] operator[SEP] identifier[definitionIsOpen] operator[=] literal[boolean] operator[SEP] identifier[currentNestingLevel] operator[--] operator[SEP]
}
|
@Override
public void saveCheckOutHistory() {
if (ThreadCacheContext.exists()) { // e.g. in action
checkingOutRequestPath = ThreadCacheContext.findRequestPath();
checkingOutEntryExp = convertMethodToMethodExp(ThreadCacheContext.findEntryMethod());
checkingOutUserExp = convertUserBeanToUserExp(ThreadCacheContext.findUserBean());
checkingOutMillis = currentTimeMillis();
}
super.saveCheckOutHistory();
} | class class_name[name] begin[{]
method[saveCheckOutHistory, return_type[void], modifier[public], parameter[]] begin[{]
if[call[ThreadCacheContext.exists, parameter[]]] begin[{]
assign[member[.checkingOutRequestPath], call[ThreadCacheContext.findRequestPath, parameter[]]]
assign[member[.checkingOutEntryExp], call[.convertMethodToMethodExp, parameter[call[ThreadCacheContext.findEntryMethod, parameter[]]]]]
assign[member[.checkingOutUserExp], call[.convertUserBeanToUserExp, parameter[call[ThreadCacheContext.findUserBean, parameter[]]]]]
assign[member[.checkingOutMillis], call[.currentTimeMillis, parameter[]]]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[], member=saveCheckOutHistory, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[saveCheckOutHistory] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ThreadCacheContext] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
identifier[checkingOutRequestPath] operator[=] identifier[ThreadCacheContext] operator[SEP] identifier[findRequestPath] operator[SEP] operator[SEP] operator[SEP] identifier[checkingOutEntryExp] operator[=] identifier[convertMethodToMethodExp] operator[SEP] identifier[ThreadCacheContext] operator[SEP] identifier[findEntryMethod] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[checkingOutUserExp] operator[=] identifier[convertUserBeanToUserExp] operator[SEP] identifier[ThreadCacheContext] operator[SEP] identifier[findUserBean] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[checkingOutMillis] operator[=] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[super] operator[SEP] identifier[saveCheckOutHistory] operator[SEP] operator[SEP] operator[SEP]
}
|
protected List<Image> stageIcons() {
// TODO to be rewritten with ImageSet Resource when available
return StageParameters.APPLICATION_ICONS.get()
.stream()
.map(p -> Resources.create(p).get())
.collect(Collectors.toList());
} | class class_name[name] begin[{]
method[stageIcons, return_type[type[List]], modifier[protected], parameter[]] begin[{]
return[call[StageParameters.APPLICATION_ICONS.get, parameter[]]]
end[}]
END[}] | Keyword[protected] identifier[List] operator[<] identifier[Image] operator[>] identifier[stageIcons] operator[SEP] operator[SEP] {
Keyword[return] identifier[StageParameters] operator[SEP] identifier[APPLICATION_ICONS] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[p] operator[->] identifier[Resources] operator[SEP] identifier[create] operator[SEP] identifier[p] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Bitmap onStackBlurClip(Bitmap original, int radius) {
Bitmap bitmap = checkSource(original, radius);
// Return this none blur
if (radius == 1) {
return bitmap;
}
int h = bitmap.getHeight();
int w = bitmap.getWidth();
final int clipPixels = 1024 * 256;
float clipScale = (h * w) / clipPixels;
int minLen = radius + radius + 50;
if (clipScale >= 2) {
float itemLen = h / clipScale;
itemLen = itemLen < minLen ? minLen : itemLen;
clipScale = h / itemLen;
}
if (clipScale < 2) {
//Jni BitMap Blur
nativeStackBlurBitmap(bitmap, radius);
} else {
if (clipScale > 12)
clipScale = 12;
//Jni BitMap Blur
onStackBlurClip(bitmap, radius, (int) clipScale);
}
return (bitmap);
} | class class_name[name] begin[{]
method[onStackBlurClip, return_type[type[Bitmap]], modifier[public static], parameter[original, radius]] begin[{]
local_variable[type[Bitmap], bitmap]
if[binary_operation[member[.radius], ==, literal[1]]] begin[{]
return[member[.bitmap]]
else begin[{]
None
end[}]
local_variable[type[int], h]
local_variable[type[int], w]
local_variable[type[int], clipPixels]
local_variable[type[float], clipScale]
local_variable[type[int], minLen]
if[binary_operation[member[.clipScale], >=, literal[2]]] begin[{]
local_variable[type[float], itemLen]
assign[member[.itemLen], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=itemLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=minLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), if_false=MemberReference(member=itemLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=minLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
assign[member[.clipScale], binary_operation[member[.h], /, member[.itemLen]]]
else begin[{]
None
end[}]
if[binary_operation[member[.clipScale], <, literal[2]]] begin[{]
call[.nativeStackBlurBitmap, parameter[member[.bitmap], member[.radius]]]
else begin[{]
if[binary_operation[member[.clipScale], >, literal[12]]] begin[{]
assign[member[.clipScale], literal[12]]
else begin[{]
None
end[}]
call[.onStackBlurClip, parameter[member[.bitmap], member[.radius], Cast(expression=MemberReference(member=clipScale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int))]]
end[}]
return[member[.bitmap]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Bitmap] identifier[onStackBlurClip] operator[SEP] identifier[Bitmap] identifier[original] , Keyword[int] identifier[radius] operator[SEP] {
identifier[Bitmap] identifier[bitmap] operator[=] identifier[checkSource] operator[SEP] identifier[original] , identifier[radius] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[radius] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[bitmap] operator[SEP]
}
Keyword[int] identifier[h] operator[=] identifier[bitmap] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[w] operator[=] identifier[bitmap] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[clipPixels] operator[=] Other[1024] operator[*] Other[256] operator[SEP] Keyword[float] identifier[clipScale] operator[=] operator[SEP] identifier[h] operator[*] identifier[w] operator[SEP] operator[/] identifier[clipPixels] operator[SEP] Keyword[int] identifier[minLen] operator[=] identifier[radius] operator[+] identifier[radius] operator[+] Other[50] operator[SEP] Keyword[if] operator[SEP] identifier[clipScale] operator[>=] Other[2] operator[SEP] {
Keyword[float] identifier[itemLen] operator[=] identifier[h] operator[/] identifier[clipScale] operator[SEP] identifier[itemLen] operator[=] identifier[itemLen] operator[<] identifier[minLen] operator[?] identifier[minLen] operator[:] identifier[itemLen] operator[SEP] identifier[clipScale] operator[=] identifier[h] operator[/] identifier[itemLen] operator[SEP]
}
Keyword[if] operator[SEP] identifier[clipScale] operator[<] Other[2] operator[SEP] {
identifier[nativeStackBlurBitmap] operator[SEP] identifier[bitmap] , identifier[radius] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[clipScale] operator[>] Other[12] operator[SEP] identifier[clipScale] operator[=] Other[12] operator[SEP] identifier[onStackBlurClip] operator[SEP] identifier[bitmap] , identifier[radius] , operator[SEP] Keyword[int] operator[SEP] identifier[clipScale] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[bitmap] operator[SEP] operator[SEP]
}
|
@Override
public StreamObserver<HelloRequest> bidiHello(StreamObserver<HelloReply> responseObserver) {
return new StreamObserver<HelloRequest>() {
@Override
public void onNext(HelloRequest value) {
// Respond to every request received.
responseObserver.onNext(buildReply(toMessage(value.getName())));
}
@Override
public void onError(Throwable t) {
responseObserver.onError(t);
}
@Override
public void onCompleted() {
responseObserver.onCompleted();
}
};
} | class class_name[name] begin[{]
method[bidiHello, return_type[type[StreamObserver]], modifier[public], parameter[responseObserver]] begin[{]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=toMessage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=buildReply, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=onNext, postfix_operators=[], prefix_operators=[], qualifier=responseObserver, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onNext, parameters=[FormalParameter(annotations=[], modifiers=set(), name=value, type=ReferenceType(arguments=None, dimensions=[], name=HelloRequest, 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=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onError, postfix_operators=[], prefix_operators=[], qualifier=responseObserver, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onError, parameters=[FormalParameter(annotations=[], modifiers=set(), name=t, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, 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=[], member=onCompleted, postfix_operators=[], prefix_operators=[], qualifier=responseObserver, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onCompleted, parameters=[], return_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=HelloRequest, sub_type=None))], dimensions=None, name=StreamObserver, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[StreamObserver] operator[<] identifier[HelloRequest] operator[>] identifier[bidiHello] operator[SEP] identifier[StreamObserver] operator[<] identifier[HelloReply] operator[>] identifier[responseObserver] operator[SEP] {
Keyword[return] Keyword[new] identifier[StreamObserver] operator[<] identifier[HelloRequest] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onNext] operator[SEP] identifier[HelloRequest] identifier[value] operator[SEP] {
identifier[responseObserver] operator[SEP] identifier[onNext] operator[SEP] identifier[buildReply] operator[SEP] identifier[toMessage] operator[SEP] identifier[value] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onError] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[responseObserver] operator[SEP] identifier[onError] operator[SEP] identifier[t] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onCompleted] operator[SEP] operator[SEP] {
identifier[responseObserver] operator[SEP] identifier[onCompleted] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
protected final void setResultImage(final ImageConsumer consumer, final ImageResult result, final boolean animate) {
decorateResult(consumer, result);
consumer.setImage(createDrawable(result.getBitmap()), animate);
consumer.reset();
} | class class_name[name] begin[{]
method[setResultImage, return_type[void], modifier[final protected], parameter[consumer, result, animate]] begin[{]
call[.decorateResult, parameter[member[.consumer], member[.result]]]
call[consumer.setImage, parameter[call[.createDrawable, parameter[call[result.getBitmap, parameter[]]]], member[.animate]]]
call[consumer.reset, parameter[]]
end[}]
END[}] | Keyword[protected] Keyword[final] Keyword[void] identifier[setResultImage] operator[SEP] Keyword[final] identifier[ImageConsumer] identifier[consumer] , Keyword[final] identifier[ImageResult] identifier[result] , Keyword[final] Keyword[boolean] identifier[animate] operator[SEP] {
identifier[decorateResult] operator[SEP] identifier[consumer] , identifier[result] operator[SEP] operator[SEP] identifier[consumer] operator[SEP] identifier[setImage] operator[SEP] identifier[createDrawable] operator[SEP] identifier[result] operator[SEP] identifier[getBitmap] operator[SEP] operator[SEP] operator[SEP] , identifier[animate] operator[SEP] operator[SEP] identifier[consumer] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public final synchronized int writePage(P page) {
int pageid = setPageID(page);
writePage(pageid, page);
return pageid;
} | class class_name[name] begin[{]
method[writePage, return_type[type[int]], modifier[synchronized final public], parameter[page]] begin[{]
local_variable[type[int], pageid]
call[.writePage, parameter[member[.pageid], member[.page]]]
return[member[.pageid]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[synchronized] Keyword[int] identifier[writePage] operator[SEP] identifier[P] identifier[page] operator[SEP] {
Keyword[int] identifier[pageid] operator[=] identifier[setPageID] operator[SEP] identifier[page] operator[SEP] operator[SEP] identifier[writePage] operator[SEP] identifier[pageid] , identifier[page] operator[SEP] operator[SEP] Keyword[return] identifier[pageid] operator[SEP]
}
|
public static void writeObject(File file, Object object) throws IOException {
FileOutputStream fileOut = new FileOutputStream(file);
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(fileOut));
try {
out.writeObject(object);
out.flush();
// Force sync
fileOut.getFD().sync();
} finally {
IoUtils.safeClose(out);
}
} | class class_name[name] begin[{]
method[writeObject, return_type[void], modifier[public static], parameter[file, object]] begin[{]
local_variable[type[FileOutputStream], fileOut]
local_variable[type[ObjectOutputStream], out]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeObject, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=out, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getFD, postfix_operators=[], prefix_operators=[], qualifier=fileOut, selectors=[MethodInvocation(arguments=[], member=sync, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=out, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=safeClose, postfix_operators=[], prefix_operators=[], qualifier=IoUtils, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[writeObject] operator[SEP] identifier[File] identifier[file] , identifier[Object] identifier[object] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[FileOutputStream] identifier[fileOut] operator[=] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[ObjectOutputStream] identifier[out] operator[=] Keyword[new] identifier[ObjectOutputStream] operator[SEP] Keyword[new] identifier[BufferedOutputStream] operator[SEP] identifier[fileOut] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[out] operator[SEP] identifier[writeObject] operator[SEP] identifier[object] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[fileOut] operator[SEP] identifier[getFD] operator[SEP] operator[SEP] operator[SEP] identifier[sync] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[IoUtils] operator[SEP] identifier[safeClose] operator[SEP] identifier[out] operator[SEP] operator[SEP]
}
}
|
public static HttpURLConnection list(final URI uri, final QueueRequestOptions queueOptions,
final OperationContext opContext, final ListingContext listingContext,
final QueueListingDetails detailsIncluded) throws URISyntaxException, IOException, StorageException {
final UriQueryBuilder builder = BaseRequest.getListUriQueryBuilder(listingContext);
if (detailsIncluded == QueueListingDetails.ALL || detailsIncluded == QueueListingDetails.METADATA) {
builder.add(Constants.QueryConstants.INCLUDE, Constants.QueryConstants.METADATA);
}
final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext);
request.setRequestMethod(Constants.HTTP_GET);
return request;
} | class class_name[name] begin[{]
method[list, return_type[type[HttpURLConnection]], modifier[public static], parameter[uri, queueOptions, opContext, listingContext, detailsIncluded]] begin[{]
local_variable[type[UriQueryBuilder], builder]
if[binary_operation[binary_operation[member[.detailsIncluded], ==, member[QueueListingDetails.ALL]], ||, binary_operation[member[.detailsIncluded], ==, member[QueueListingDetails.METADATA]]]] begin[{]
call[builder.add, parameter[member[Constants.QueryConstants.INCLUDE], member[Constants.QueryConstants.METADATA]]]
else begin[{]
None
end[}]
local_variable[type[HttpURLConnection], request]
call[request.setRequestMethod, parameter[member[Constants.HTTP_GET]]]
return[member[.request]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[HttpURLConnection] identifier[list] operator[SEP] Keyword[final] identifier[URI] identifier[uri] , Keyword[final] identifier[QueueRequestOptions] identifier[queueOptions] , Keyword[final] identifier[OperationContext] identifier[opContext] , Keyword[final] identifier[ListingContext] identifier[listingContext] , Keyword[final] identifier[QueueListingDetails] identifier[detailsIncluded] operator[SEP] Keyword[throws] identifier[URISyntaxException] , identifier[IOException] , identifier[StorageException] {
Keyword[final] identifier[UriQueryBuilder] identifier[builder] operator[=] identifier[BaseRequest] operator[SEP] identifier[getListUriQueryBuilder] operator[SEP] identifier[listingContext] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[detailsIncluded] operator[==] identifier[QueueListingDetails] operator[SEP] identifier[ALL] operator[||] identifier[detailsIncluded] operator[==] identifier[QueueListingDetails] operator[SEP] identifier[METADATA] operator[SEP] {
identifier[builder] operator[SEP] identifier[add] operator[SEP] identifier[Constants] operator[SEP] identifier[QueryConstants] operator[SEP] identifier[INCLUDE] , identifier[Constants] operator[SEP] identifier[QueryConstants] operator[SEP] identifier[METADATA] operator[SEP] operator[SEP]
}
Keyword[final] identifier[HttpURLConnection] identifier[request] operator[=] identifier[BaseRequest] operator[SEP] identifier[createURLConnection] operator[SEP] identifier[uri] , identifier[queueOptions] , identifier[builder] , identifier[opContext] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setRequestMethod] operator[SEP] identifier[Constants] operator[SEP] identifier[HTTP_GET] operator[SEP] operator[SEP] Keyword[return] identifier[request] operator[SEP]
}
|
public static byte[] toAsn1Der(byte[] signature, String algorithm) throws NoSuchAlgorithmException {
Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm);
// verify the given algoritm could be resolved
if (baseAlgorithm == null) {
throw new NoSuchAlgorithmException(algorithm);
}
// verify the given algoritm is an Ecdsa signature algorithm
if (!(baseAlgorithm instanceof Ecdsa)) {
throw new IllegalArgumentException("Invalid algorithm; must be an instance of ECDSA.");
}
return SignatureEncoding.toAsn1Der(signature, (Ecdsa) baseAlgorithm);
} | class class_name[name] begin[{]
method[toAsn1Der, return_type[type[byte]], modifier[public static], parameter[signature, algorithm]] begin[{]
local_variable[type[Algorithm], baseAlgorithm]
if[binary_operation[member[.baseAlgorithm], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[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=NoSuchAlgorithmException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.baseAlgorithm], instanceof, type[Ecdsa]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid algorithm; must be an instance of ECDSA.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[SignatureEncoding.toAsn1Der, parameter[member[.signature], Cast(expression=MemberReference(member=baseAlgorithm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Ecdsa, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[toAsn1Der] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[signature] , identifier[String] identifier[algorithm] operator[SEP] Keyword[throws] identifier[NoSuchAlgorithmException] {
identifier[Algorithm] identifier[baseAlgorithm] operator[=] identifier[AlgorithmResolver] operator[SEP] identifier[Default] operator[SEP] identifier[get] operator[SEP] identifier[algorithm] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[baseAlgorithm] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoSuchAlgorithmException] operator[SEP] identifier[algorithm] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[baseAlgorithm] Keyword[instanceof] identifier[Ecdsa] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[SignatureEncoding] operator[SEP] identifier[toAsn1Der] operator[SEP] identifier[signature] , operator[SEP] identifier[Ecdsa] operator[SEP] identifier[baseAlgorithm] operator[SEP] operator[SEP]
}
|
public static List<MutableLongTuple> deepCopy(
Collection<? extends LongTuple> tuples)
{
List<MutableLongTuple> result =
new ArrayList<MutableLongTuple>(tuples.size());
for (LongTuple t : tuples)
{
if (t == null)
{
result.add(null);
}
else
{
result.add(LongTuples.copy(t));
}
}
return result;
} | class class_name[name] begin[{]
method[deepCopy, return_type[type[List]], modifier[public static], parameter[tuples]] begin[{]
local_variable[type[List], result]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=t, 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=[MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copy, postfix_operators=[], prefix_operators=[], qualifier=LongTuples, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=tuples, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=t)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LongTuple, sub_type=None))), label=None)
return[member[.result]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[MutableLongTuple] operator[>] identifier[deepCopy] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[LongTuple] operator[>] identifier[tuples] operator[SEP] {
identifier[List] operator[<] identifier[MutableLongTuple] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[MutableLongTuple] operator[>] operator[SEP] identifier[tuples] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[LongTuple] identifier[t] operator[:] identifier[tuples] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[==] Other[null] operator[SEP] {
identifier[result] operator[SEP] identifier[add] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[LongTuples] operator[SEP] identifier[copy] operator[SEP] identifier[t] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
void clearCounter(String counterName) {
final Counter counter = getCounterByName(counterName);
if (counter != null) {
final List<CounterRequest> requests = counter.getRequests();
// on réinitialise le counter
counter.clear();
// et on purge les données correspondantes du collector utilisées pour les deltas
globalRequestsByCounter.remove(counter);
for (final CounterRequest request : requests) {
requestsById.remove(request.getId());
requestJRobinsById.remove(request.getId());
}
}
} | class class_name[name] begin[{]
method[clearCounter, return_type[void], modifier[default], parameter[counterName]] begin[{]
local_variable[type[Counter], counter]
if[binary_operation[member[.counter], !=, literal[null]]] begin[{]
local_variable[type[List], requests]
call[counter.clear, parameter[]]
call[globalRequestsByCounter.remove, parameter[member[.counter]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=requestsById, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)], member=remove, postfix_operators=[], prefix_operators=[], qualifier=requestJRobinsById, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=requests, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=request)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=CounterRequest, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[void] identifier[clearCounter] operator[SEP] identifier[String] identifier[counterName] operator[SEP] {
Keyword[final] identifier[Counter] identifier[counter] operator[=] identifier[getCounterByName] operator[SEP] identifier[counterName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[counter] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[CounterRequest] operator[>] identifier[requests] operator[=] identifier[counter] operator[SEP] identifier[getRequests] operator[SEP] operator[SEP] operator[SEP] identifier[counter] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[globalRequestsByCounter] operator[SEP] identifier[remove] operator[SEP] identifier[counter] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[CounterRequest] identifier[request] operator[:] identifier[requests] operator[SEP] {
identifier[requestsById] operator[SEP] identifier[remove] operator[SEP] identifier[request] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[requestJRobinsById] operator[SEP] identifier[remove] operator[SEP] identifier[request] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public static <T> byte[] writeAvroEntity(T entity, DatumWriter<T> writer) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Encoder encoder = new EncoderFactory().binaryEncoder(outputStream, null);
writeAvroEntity(entity, encoder, writer);
return outputStream.toByteArray();
} | class class_name[name] begin[{]
method[writeAvroEntity, return_type[type[byte]], modifier[public static], parameter[entity, writer]] begin[{]
local_variable[type[ByteArrayOutputStream], outputStream]
local_variable[type[Encoder], encoder]
call[.writeAvroEntity, parameter[member[.entity], member[.encoder], member[.writer]]]
return[call[outputStream.toByteArray, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[byte] operator[SEP] operator[SEP] identifier[writeAvroEntity] operator[SEP] identifier[T] identifier[entity] , identifier[DatumWriter] operator[<] identifier[T] operator[>] identifier[writer] operator[SEP] {
identifier[ByteArrayOutputStream] identifier[outputStream] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] identifier[Encoder] identifier[encoder] operator[=] Keyword[new] identifier[EncoderFactory] operator[SEP] operator[SEP] operator[SEP] identifier[binaryEncoder] operator[SEP] identifier[outputStream] , Other[null] operator[SEP] operator[SEP] identifier[writeAvroEntity] operator[SEP] identifier[entity] , identifier[encoder] , identifier[writer] operator[SEP] operator[SEP] Keyword[return] identifier[outputStream] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void printTableMeta(String outputDirPath, File pdfFile, String meta) {
try {
File middleDir = new File(outputDirPath, "metadata");
if (!middleDir.exists()) {
middleDir.mkdirs();
}
File tableMetaFile = new File(middleDir, pdfFile.getName() + ".metadata");
BufferedWriter bw0 = new BufferedWriter(new FileWriter(tableMetaFile));
//System.out.println(meta);
bw0.write(meta);
bw0.close();
}
catch (IOException e){
System.out.printf("[Debug Error] IOException\n");
}
} | class class_name[name] begin[{]
method[printTableMeta, return_type[void], modifier[public static], parameter[outputDirPath, pdfFile, meta]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=outputDirPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="metadata")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=middleDir)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=['!'], qualifier=middleDir, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=mkdirs, postfix_operators=[], prefix_operators=[], qualifier=middleDir, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=middleDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=pdfFile, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".metadata"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=tableMetaFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=tableMetaFile, 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=FileWriter, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedWriter, sub_type=None)), name=bw0)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BufferedWriter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=meta, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=bw0, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=bw0, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[Debug Error] IOException\n")], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[printTableMeta] operator[SEP] identifier[String] identifier[outputDirPath] , identifier[File] identifier[pdfFile] , identifier[String] identifier[meta] operator[SEP] {
Keyword[try] {
identifier[File] identifier[middleDir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[outputDirPath] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[middleDir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
identifier[middleDir] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP]
}
identifier[File] identifier[tableMetaFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[middleDir] , identifier[pdfFile] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[BufferedWriter] identifier[bw0] operator[=] Keyword[new] identifier[BufferedWriter] operator[SEP] Keyword[new] identifier[FileWriter] operator[SEP] identifier[tableMetaFile] operator[SEP] operator[SEP] operator[SEP] identifier[bw0] operator[SEP] identifier[write] operator[SEP] identifier[meta] operator[SEP] operator[SEP] identifier[bw0] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
private static void loadConfig() throws FileNotFoundException, IOException {
try (InputStream configStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(CONFIG_FILE)) {
if (configStream == null) {
throw new FileNotFoundException();
}
properties = new Properties();
properties.load(configStream);
}
// Read properties
accountId = properties.getProperty("customerAccountId");
createS3Bucket = Boolean.valueOf(properties.getProperty("createS3Bucket"));
s3RegionName = properties.getProperty("s3RegionName");
s3BucketName = properties.getProperty("s3BucketName").trim();
s3BucketARN = getBucketARN(s3BucketName);
s3ObjectPrefix = properties.getProperty("s3ObjectPrefix").trim();
String sizeInMBsProperty = properties.getProperty("destinationSizeInMBs");
s3DestinationSizeInMBs = StringUtils.isNullOrEmpty(sizeInMBsProperty) ? null : Integer.parseInt(sizeInMBsProperty.trim());
String intervalInSecondsProperty = properties.getProperty("destinationIntervalInSeconds");
s3DestinationIntervalInSeconds = StringUtils.isNullOrEmpty(intervalInSecondsProperty) ? null : Integer.parseInt(intervalInSecondsProperty.trim());
clusterJDBCUrl = properties.getProperty("clusterJDBCUrl");
username = properties.getProperty("username");
password = properties.getProperty("password");
dataTableName = properties.getProperty("dataTableName");
copyOptions = properties.getProperty("copyOptions");
deliveryStreamName = properties.getProperty("deliveryStreamName");
firehoseRegion = properties.getProperty("firehoseRegion");
iamRoleName = properties.getProperty("iamRoleName");
iamRegion = properties.getProperty("iamRegion");
// Update Delivery Stream Destination related properties
enableUpdateDestination = Boolean.valueOf(properties.getProperty("updateDestination"));
updatedCopyOptions = properties.getProperty("updatedCopyOptions");
} | class class_name[name] begin[{]
method[loadConfig, return_type[void], modifier[private static], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=configStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileNotFoundException, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=properties, 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=Properties, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=configStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=load, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=configStream, type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None), value=MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[], member=getContextClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CONFIG_FILE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResourceAsStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None))])
assign[member[.accountId], call[properties.getProperty, parameter[literal["customerAccountId"]]]]
assign[member[.createS3Bucket], call[Boolean.valueOf, parameter[call[properties.getProperty, parameter[literal["createS3Bucket"]]]]]]
assign[member[.s3RegionName], call[properties.getProperty, parameter[literal["s3RegionName"]]]]
assign[member[.s3BucketName], call[properties.getProperty, parameter[literal["s3BucketName"]]]]
assign[member[.s3BucketARN], call[.getBucketARN, parameter[member[.s3BucketName]]]]
assign[member[.s3ObjectPrefix], call[properties.getProperty, parameter[literal["s3ObjectPrefix"]]]]
local_variable[type[String], sizeInMBsProperty]
assign[member[.s3DestinationSizeInMBs], TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=sizeInMBsProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNullOrEmpty, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=sizeInMBsProperty, selectors=[], type_arguments=None)], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
local_variable[type[String], intervalInSecondsProperty]
assign[member[.s3DestinationIntervalInSeconds], TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=intervalInSecondsProperty, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNullOrEmpty, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=intervalInSecondsProperty, selectors=[], type_arguments=None)], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
assign[member[.clusterJDBCUrl], call[properties.getProperty, parameter[literal["clusterJDBCUrl"]]]]
assign[member[.username], call[properties.getProperty, parameter[literal["username"]]]]
assign[member[.password], call[properties.getProperty, parameter[literal["password"]]]]
assign[member[.dataTableName], call[properties.getProperty, parameter[literal["dataTableName"]]]]
assign[member[.copyOptions], call[properties.getProperty, parameter[literal["copyOptions"]]]]
assign[member[.deliveryStreamName], call[properties.getProperty, parameter[literal["deliveryStreamName"]]]]
assign[member[.firehoseRegion], call[properties.getProperty, parameter[literal["firehoseRegion"]]]]
assign[member[.iamRoleName], call[properties.getProperty, parameter[literal["iamRoleName"]]]]
assign[member[.iamRegion], call[properties.getProperty, parameter[literal["iamRegion"]]]]
assign[member[.enableUpdateDestination], call[Boolean.valueOf, parameter[call[properties.getProperty, parameter[literal["updateDestination"]]]]]]
assign[member[.updatedCopyOptions], call[properties.getProperty, parameter[literal["updatedCopyOptions"]]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[loadConfig] operator[SEP] operator[SEP] Keyword[throws] identifier[FileNotFoundException] , identifier[IOException] {
Keyword[try] operator[SEP] identifier[InputStream] identifier[configStream] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getContextClassLoader] operator[SEP] operator[SEP] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[CONFIG_FILE] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[configStream] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[FileNotFoundException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[properties] operator[=] Keyword[new] identifier[Properties] operator[SEP] operator[SEP] operator[SEP] identifier[properties] operator[SEP] identifier[load] operator[SEP] identifier[configStream] operator[SEP] operator[SEP]
}
identifier[accountId] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[createS3Bucket] operator[=] identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[s3RegionName] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[s3BucketName] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[s3BucketARN] operator[=] identifier[getBucketARN] operator[SEP] identifier[s3BucketName] operator[SEP] operator[SEP] identifier[s3ObjectPrefix] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[sizeInMBsProperty] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[s3DestinationSizeInMBs] operator[=] identifier[StringUtils] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[sizeInMBsProperty] operator[SEP] operator[?] Other[null] operator[:] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[sizeInMBsProperty] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[intervalInSecondsProperty] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[s3DestinationIntervalInSeconds] operator[=] identifier[StringUtils] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[intervalInSecondsProperty] operator[SEP] operator[?] Other[null] operator[:] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[intervalInSecondsProperty] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[clusterJDBCUrl] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[username] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[password] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dataTableName] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[copyOptions] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[deliveryStreamName] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[firehoseRegion] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[iamRoleName] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[iamRegion] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[enableUpdateDestination] operator[=] identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[updatedCopyOptions] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public AssetRef retrieveRef(Long id) throws IOException, SQLException {
String select = "select definition_id, name, ref from ASSET_REF where definition_id = ?";
try (Connection conn = getDbConnection();
PreparedStatement stmt = conn.prepareStatement(select)) {
stmt.setLong(1, id);
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
return new AssetRef(rs.getString("name"), id, rs.getString("ref"));
}
}
}
return null;
} | class class_name[name] begin[{]
method[retrieveRef, return_type[type[AssetRef]], modifier[public], parameter[id]] begin[{]
local_variable[type[String], select]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setLong, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="name")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ref")], member=getString, postfix_operators=[], prefix_operators=[], qualifier=rs, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AssetRef, sub_type=None)), label=None)]))], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=rs, type=ReferenceType(arguments=None, dimensions=[], name=ResultSet, sub_type=None), value=MethodInvocation(arguments=[], member=executeQuery, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None))])], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=conn, type=ReferenceType(arguments=None, dimensions=[], name=Connection, sub_type=None), value=MethodInvocation(arguments=[], member=getDbConnection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), TryResource(annotations=[], modifiers=set(), name=stmt, type=ReferenceType(arguments=None, dimensions=[], name=PreparedStatement, sub_type=None), value=MethodInvocation(arguments=[MemberReference(member=select, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=prepareStatement, postfix_operators=[], prefix_operators=[], qualifier=conn, selectors=[], type_arguments=None))])
return[literal[null]]
end[}]
END[}] | Keyword[public] identifier[AssetRef] identifier[retrieveRef] operator[SEP] identifier[Long] identifier[id] operator[SEP] Keyword[throws] identifier[IOException] , identifier[SQLException] {
identifier[String] identifier[select] operator[=] literal[String] operator[SEP] Keyword[try] operator[SEP] identifier[Connection] identifier[conn] operator[=] identifier[getDbConnection] operator[SEP] operator[SEP] operator[SEP] identifier[PreparedStatement] identifier[stmt] operator[=] identifier[conn] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[select] operator[SEP] operator[SEP] {
identifier[stmt] operator[SEP] identifier[setLong] operator[SEP] Other[1] , identifier[id] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[ResultSet] identifier[rs] operator[=] identifier[stmt] operator[SEP] identifier[executeQuery] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[rs] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[AssetRef] operator[SEP] identifier[rs] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] , identifier[id] , identifier[rs] operator[SEP] identifier[getString] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public Packet nextResult(long timeout) {
try {
return resultQueue.poll(timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} | class class_name[name] begin[{]
method[nextResult, return_type[type[Packet]], modifier[public], parameter[timeout]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=MILLISECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[])], member=poll, postfix_operators=[], prefix_operators=[], qualifier=resultQueue, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InterruptedException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[Packet] identifier[nextResult] operator[SEP] Keyword[long] identifier[timeout] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[resultQueue] operator[SEP] identifier[poll] operator[SEP] identifier[timeout] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity", "checkstyle:magicnumber"})
private DBaseFileRecord readDBFRecord(int recordNumber) throws IOException {
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.fields == null) {
throw new MustCallReadHeaderFunctionException();
}
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 0 1 byte deleted flag:
// '*' (star) if deleted
// ' ' (space) if not deleted
// 1..m n bytes contents of fields, for n see
// the bytes 10..11 of the dBASE header
// Compute the offset
final long offset = this.readingPosition * this.recordSize + this.firstRecordOffset;
// Read the record
final byte[] rawData = new byte[this.recordSize];
this.stream.readFully(rawData);
// Read the deleted flag
final int deletedFlag = rawData[0] & 0xFF;
if (deletedFlag == 0x1A) {
// END-OF-FILE character
throw new EOFException();
}
if (deletedFlag != '*' && deletedFlag != ' ') {
throw new InvalidDeletionFlagFormatException(recordNumber, deletedFlag);
}
if (deletedFlag == '*') {
return null;
}
int rawOffset = 1;
final DBaseFileRecord record = new DBaseFileRecord(recordNumber, offset);
for (int i = 0; i < this.fieldCount; ++i) {
final DBaseFileField field = this.fields.get(i);
if (field != null) {
Object value = null;
// Read the content of the record
switch (field.getType()) {
//
// Read a list of characters
case STRING:
final OutputParameter<String> strvalue = new OutputParameter<>();
rawOffset += readStringRecordValue(
field,
recordNumber, i + 1,
rawData, rawOffset,
strvalue);
value = strvalue.get();
break;
//
// Read a date
case DATE:
final OutputParameter<Date> datevalue = new OutputParameter<>();
rawOffset += readDateRecordValue(field, recordNumber, i + 1, rawData, rawOffset, datevalue);
value = datevalue.get();
break;
//
// Read a number
case NUMBER:
case FLOATING_NUMBER:
final OutputParameter<Double> dblvalue = new OutputParameter<>();
rawOffset += readNumberRecordValue(field, recordNumber, i + 1, rawData, rawOffset, dblvalue);
value = dblvalue.get();
break;
//
// Read a boolean
case BOOLEAN:
final OutputParameter<Boolean> boolvalue = new OutputParameter<>();
rawOffset += readBooleanRecordValue(field, recordNumber, i + 1, rawData, rawOffset, boolvalue);
value = boolvalue.get();
break;
//
// Read a 2 byte integer
case INTEGER_2BYTES:
final OutputParameter<Integer> intvalue = new OutputParameter<>();
rawOffset += read2ByteIntegerRecordValue(field, recordNumber, i + 1, rawData, rawOffset, intvalue);
value = intvalue.get();
break;
//
// Read a 4 byte integer
case INTEGER_4BYTES:
final OutputParameter<Long> longvalue = new OutputParameter<>();
rawOffset += read4ByteIntegerRecordValue(field, recordNumber, i + 1, rawData, rawOffset, longvalue);
value = longvalue.get();
break;
//
// Read a 8 byte double
case DOUBLE:
final OutputParameter<Double> dblvalue2 = new OutputParameter<>();
rawOffset += read8ByteDoubleRecordValue(field, recordNumber, i + 1, rawData, rawOffset, dblvalue2);
value = dblvalue2.get();
break;
//$CASES-OMITTED$
default:
}
if (value != null) {
record.add(value);
} else {
record.add(null);
}
}
}
return record;
} | class class_name[name] begin[{]
method[readDBFRecord, return_type[type[DBaseFileRecord]], modifier[private], parameter[recordNumber]] begin[{]
if[THIS[member[None.finished]]] 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=EOFDBaseFileException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.fields]], ==, literal[null]]] 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=MustCallReadHeaderFunctionException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[long], offset]
local_variable[type[byte], rawData]
THIS[member[None.stream]call[None.readFully, parameter[member[.rawData]]]]
local_variable[type[int], deletedFlag]
if[binary_operation[member[.deletedFlag], ==, literal[0x1A]]] 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=EOFException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.deletedFlag], !=, literal['*']], &&, binary_operation[member[.deletedFlag], !=, literal[' ']]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=recordNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=deletedFlag, 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=InvalidDeletionFlagFormatException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.deletedFlag], ==, literal['*']]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[int], rawOffset]
local_variable[type[DBaseFileRecord], record]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=fields, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=field)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=DBaseFileField, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), SwitchStatement(cases=[SwitchStatementCase(case=['STRING'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=OutputParameter, sub_type=None)), name=strvalue)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=OutputParameter, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recordNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=rawData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=strvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readStringRecordValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=strvalue, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DATE'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=OutputParameter, sub_type=None)), name=datevalue)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None))], dimensions=[], name=OutputParameter, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recordNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=rawData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=datevalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readDateRecordValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=datevalue, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['NUMBER', 'FLOATING_NUMBER'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=OutputParameter, sub_type=None)), name=dblvalue)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None))], dimensions=[], name=OutputParameter, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recordNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=rawData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dblvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readNumberRecordValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=dblvalue, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['BOOLEAN'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=OutputParameter, sub_type=None)), name=boolvalue)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))], dimensions=[], name=OutputParameter, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recordNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=rawData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=boolvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readBooleanRecordValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=boolvalue, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['INTEGER_2BYTES'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=OutputParameter, sub_type=None)), name=intvalue)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=[], name=OutputParameter, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recordNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=rawData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=intvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read2ByteIntegerRecordValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=intvalue, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['INTEGER_4BYTES'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=OutputParameter, sub_type=None)), name=longvalue)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Long, sub_type=None))], dimensions=[], name=OutputParameter, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recordNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=rawData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=longvalue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read4ByteIntegerRecordValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=longvalue, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['DOUBLE'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=OutputParameter, sub_type=None)), name=dblvalue2)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Double, sub_type=None))], dimensions=[], name=OutputParameter, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=recordNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), MemberReference(member=rawData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=rawOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dblvalue2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=read8ByteDoubleRecordValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=dblvalue2, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[])], expression=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=add, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=record, selectors=[], type_arguments=None), label=None)]))]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=fieldCount, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
return[member[.record]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String] , literal[String]
} operator[SEP] Keyword[private] identifier[DBaseFileRecord] identifier[readDBFRecord] operator[SEP] Keyword[int] identifier[recordNumber] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[finished] operator[SEP] {
Keyword[throw] Keyword[new] identifier[EOFDBaseFileException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[fields] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MustCallReadHeaderFunctionException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[long] identifier[offset] operator[=] Keyword[this] operator[SEP] identifier[readingPosition] operator[*] Keyword[this] operator[SEP] identifier[recordSize] operator[+] Keyword[this] operator[SEP] identifier[firstRecordOffset] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[rawData] operator[=] Keyword[new] Keyword[byte] operator[SEP] Keyword[this] operator[SEP] identifier[recordSize] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[stream] operator[SEP] identifier[readFully] operator[SEP] identifier[rawData] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[deletedFlag] operator[=] identifier[rawData] operator[SEP] Other[0] operator[SEP] operator[&] literal[Integer] operator[SEP] Keyword[if] operator[SEP] identifier[deletedFlag] operator[==] literal[Integer] operator[SEP] {
Keyword[throw] Keyword[new] identifier[EOFException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[deletedFlag] operator[!=] literal[String] operator[&&] identifier[deletedFlag] operator[!=] literal[String] operator[SEP] {
Keyword[throw] Keyword[new] identifier[InvalidDeletionFlagFormatException] operator[SEP] identifier[recordNumber] , identifier[deletedFlag] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[deletedFlag] operator[==] literal[String] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[int] identifier[rawOffset] operator[=] Other[1] operator[SEP] Keyword[final] identifier[DBaseFileRecord] identifier[record] operator[=] Keyword[new] identifier[DBaseFileRecord] operator[SEP] identifier[recordNumber] , identifier[offset] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] Keyword[this] operator[SEP] identifier[fieldCount] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[final] identifier[DBaseFileField] identifier[field] operator[=] Keyword[this] operator[SEP] identifier[fields] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[field] operator[!=] Other[null] operator[SEP] {
identifier[Object] identifier[value] operator[=] Other[null] operator[SEP] Keyword[switch] operator[SEP] identifier[field] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[STRING] operator[:] Keyword[final] identifier[OutputParameter] operator[<] identifier[String] operator[>] identifier[strvalue] operator[=] Keyword[new] identifier[OutputParameter] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[rawOffset] operator[+=] identifier[readStringRecordValue] operator[SEP] identifier[field] , identifier[recordNumber] , identifier[i] operator[+] Other[1] , identifier[rawData] , identifier[rawOffset] , identifier[strvalue] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[strvalue] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DATE] operator[:] Keyword[final] identifier[OutputParameter] operator[<] identifier[Date] operator[>] identifier[datevalue] operator[=] Keyword[new] identifier[OutputParameter] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[rawOffset] operator[+=] identifier[readDateRecordValue] operator[SEP] identifier[field] , identifier[recordNumber] , identifier[i] operator[+] Other[1] , identifier[rawData] , identifier[rawOffset] , identifier[datevalue] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[datevalue] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[NUMBER] operator[:] Keyword[case] identifier[FLOATING_NUMBER] operator[:] Keyword[final] identifier[OutputParameter] operator[<] identifier[Double] operator[>] identifier[dblvalue] operator[=] Keyword[new] identifier[OutputParameter] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[rawOffset] operator[+=] identifier[readNumberRecordValue] operator[SEP] identifier[field] , identifier[recordNumber] , identifier[i] operator[+] Other[1] , identifier[rawData] , identifier[rawOffset] , identifier[dblvalue] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[dblvalue] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[BOOLEAN] operator[:] Keyword[final] identifier[OutputParameter] operator[<] identifier[Boolean] operator[>] identifier[boolvalue] operator[=] Keyword[new] identifier[OutputParameter] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[rawOffset] operator[+=] identifier[readBooleanRecordValue] operator[SEP] identifier[field] , identifier[recordNumber] , identifier[i] operator[+] Other[1] , identifier[rawData] , identifier[rawOffset] , identifier[boolvalue] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[boolvalue] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[INTEGER_2BYTES] operator[:] Keyword[final] identifier[OutputParameter] operator[<] identifier[Integer] operator[>] identifier[intvalue] operator[=] Keyword[new] identifier[OutputParameter] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[rawOffset] operator[+=] identifier[read2ByteIntegerRecordValue] operator[SEP] identifier[field] , identifier[recordNumber] , identifier[i] operator[+] Other[1] , identifier[rawData] , identifier[rawOffset] , identifier[intvalue] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[intvalue] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[INTEGER_4BYTES] operator[:] Keyword[final] identifier[OutputParameter] operator[<] identifier[Long] operator[>] identifier[longvalue] operator[=] Keyword[new] identifier[OutputParameter] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[rawOffset] operator[+=] identifier[read4ByteIntegerRecordValue] operator[SEP] identifier[field] , identifier[recordNumber] , identifier[i] operator[+] Other[1] , identifier[rawData] , identifier[rawOffset] , identifier[longvalue] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[longvalue] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[DOUBLE] operator[:] Keyword[final] identifier[OutputParameter] operator[<] identifier[Double] operator[>] identifier[dblvalue2] operator[=] Keyword[new] identifier[OutputParameter] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[rawOffset] operator[+=] identifier[read8ByteDoubleRecordValue] operator[SEP] identifier[field] , identifier[recordNumber] , identifier[i] operator[+] Other[1] , identifier[rawData] , identifier[rawOffset] , identifier[dblvalue2] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[dblvalue2] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[default] operator[:]
}
Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
identifier[record] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[record] operator[SEP] identifier[add] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[record] operator[SEP]
}
|
static int sizeImpl(Multiset<?> multiset) {
long size = 0;
for (Entry<?> entry : multiset.entrySet()) {
size += entry.getCount();
}
return Ints.saturatedCast(size);
} | class class_name[name] begin[{]
method[sizeImpl, return_type[type[int]], modifier[static], parameter[multiset]] begin[{]
local_variable[type[long], size]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getCount, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=multiset, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Entry, sub_type=None))), label=None)
return[call[Ints.saturatedCast, parameter[member[.size]]]]
end[}]
END[}] | Keyword[static] Keyword[int] identifier[sizeImpl] operator[SEP] identifier[Multiset] operator[<] operator[?] operator[>] identifier[multiset] operator[SEP] {
Keyword[long] identifier[size] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Entry] operator[<] operator[?] operator[>] identifier[entry] operator[:] identifier[multiset] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[size] operator[+=] identifier[entry] operator[SEP] identifier[getCount] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Ints] operator[SEP] identifier[saturatedCast] operator[SEP] identifier[size] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("unchecked")
public static <T> List<List<T>> split(List<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure closure) {
return (List<List<T>>) (List<?>) split((Collection<T>) self, closure);
} | class class_name[name] begin[{]
method[split, return_type[type[List]], modifier[public static], parameter[self, closure]] begin[{]
return[Cast(expression=Cast(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=self, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), MemberReference(member=closure, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=split, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=List, sub_type=None)), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=List, sub_type=None))], dimensions=[], name=List, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[List] operator[<] identifier[T] operator[>] operator[>] identifier[split] operator[SEP] identifier[List] operator[<] identifier[T] operator[>] identifier[self] , annotation[@] identifier[ClosureParams] operator[SEP] identifier[FirstParam] operator[SEP] identifier[FirstGenericType] operator[SEP] Keyword[class] operator[SEP] identifier[Closure] identifier[closure] operator[SEP] {
Keyword[return] operator[SEP] identifier[List] operator[<] identifier[List] operator[<] identifier[T] operator[>] operator[>] operator[SEP] operator[SEP] identifier[List] operator[<] operator[?] operator[>] operator[SEP] identifier[split] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[T] operator[>] operator[SEP] identifier[self] , identifier[closure] operator[SEP] operator[SEP]
}
|
public static boolean isSslKeyManagerEnabled(HttpClientConfig config) {
return StringUtils.isNotEmpty(config.getSslContextType())
&& StringUtils.isNotEmpty(config.getKeyManagerType())
&& StringUtils.isNotEmpty(config.getKeyStoreType())
&& StringUtils.isNotEmpty(config.getKeyStorePath());
} | class class_name[name] begin[{]
method[isSslKeyManagerEnabled, return_type[type[boolean]], modifier[public static], parameter[config]] begin[{]
return[binary_operation[binary_operation[binary_operation[call[StringUtils.isNotEmpty, parameter[call[config.getSslContextType, parameter[]]]], &&, call[StringUtils.isNotEmpty, parameter[call[config.getKeyManagerType, parameter[]]]]], &&, call[StringUtils.isNotEmpty, parameter[call[config.getKeyStoreType, parameter[]]]]], &&, call[StringUtils.isNotEmpty, parameter[call[config.getKeyStorePath, parameter[]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isSslKeyManagerEnabled] operator[SEP] identifier[HttpClientConfig] identifier[config] operator[SEP] {
Keyword[return] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[config] operator[SEP] identifier[getSslContextType] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[config] operator[SEP] identifier[getKeyManagerType] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[config] operator[SEP] identifier[getKeyStoreType] operator[SEP] operator[SEP] operator[SEP] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[config] operator[SEP] identifier[getKeyStorePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public GetCelebrityRecognitionResult getCelebrityRecognition(GetCelebrityRecognitionRequest request) {
request = beforeClientExecution(request);
return executeGetCelebrityRecognition(request);
} | class class_name[name] begin[{]
method[getCelebrityRecognition, return_type[type[GetCelebrityRecognitionResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeGetCelebrityRecognition, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[GetCelebrityRecognitionResult] identifier[getCelebrityRecognition] operator[SEP] identifier[GetCelebrityRecognitionRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeGetCelebrityRecognition] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
@Pure
@Override
public boolean epsilonEquals(T t1, double epsilon) {
double diff;
diff = this.x - t1.getX();
if(Double.isNaN(diff)) return false;
if((diff<0?-diff:diff) > epsilon) return false;
diff = this.y - t1.getY();
if(Double.isNaN(diff)) return false;
if((diff<0?-diff:diff) > epsilon) return false;
diff = this.z - t1.getZ();
if(Double.isNaN(diff)) return false;
if((diff<0?-diff:diff) > epsilon) return false;
return true;
} | class class_name[name] begin[{]
method[epsilonEquals, return_type[type[boolean]], modifier[public], parameter[t1, epsilon]] begin[{]
local_variable[type[double], diff]
assign[member[.diff], binary_operation[THIS[member[None.x]], -, call[t1.getX, parameter[]]]]
if[call[Double.isNaN, parameter[member[.diff]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), if_false=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=diff, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])), >, member[.epsilon]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.diff], binary_operation[THIS[member[None.y]], -, call[t1.getY, parameter[]]]]
if[call[Double.isNaN, parameter[member[.diff]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), if_false=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=diff, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])), >, member[.epsilon]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
assign[member[.diff], binary_operation[THIS[member[None.z]], -, call[t1.getZ, parameter[]]]]
if[call[Double.isNaN, parameter[member[.diff]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), if_false=MemberReference(member=diff, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=diff, postfix_operators=[], prefix_operators=['-'], qualifier=, selectors=[])), >, member[.epsilon]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | annotation[@] identifier[Pure] annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[epsilonEquals] operator[SEP] identifier[T] identifier[t1] , Keyword[double] identifier[epsilon] operator[SEP] {
Keyword[double] identifier[diff] operator[SEP] identifier[diff] operator[=] Keyword[this] operator[SEP] identifier[x] operator[-] identifier[t1] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Double] operator[SEP] identifier[isNaN] operator[SEP] identifier[diff] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[diff] operator[<] Other[0] operator[?] operator[-] identifier[diff] operator[:] identifier[diff] operator[SEP] operator[>] identifier[epsilon] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[diff] operator[=] Keyword[this] operator[SEP] identifier[y] operator[-] identifier[t1] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Double] operator[SEP] identifier[isNaN] operator[SEP] identifier[diff] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[diff] operator[<] Other[0] operator[?] operator[-] identifier[diff] operator[:] identifier[diff] operator[SEP] operator[>] identifier[epsilon] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[diff] operator[=] Keyword[this] operator[SEP] identifier[z] operator[-] identifier[t1] operator[SEP] identifier[getZ] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Double] operator[SEP] identifier[isNaN] operator[SEP] identifier[diff] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[diff] operator[<] Other[0] operator[?] operator[-] identifier[diff] operator[:] identifier[diff] operator[SEP] operator[>] identifier[epsilon] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public void setRollbackOnly() throws IllegalStateException, SystemException
{
Transaction tx = threadLocal.get();
if (tx == null)
{
throw new IllegalStateException("Cannot get Transaction for setRollbackOnly");
}
tx.setRollbackOnly();
} | class class_name[name] begin[{]
method[setRollbackOnly, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[Transaction], tx]
if[binary_operation[member[.tx], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot get Transaction for setRollbackOnly")], 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[tx.setRollbackOnly, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setRollbackOnly] operator[SEP] operator[SEP] Keyword[throws] identifier[IllegalStateException] , identifier[SystemException] {
identifier[Transaction] identifier[tx] operator[=] identifier[threadLocal] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tx] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[tx] operator[SEP] identifier[setRollbackOnly] operator[SEP] operator[SEP] operator[SEP]
}
|
public final void mOCTAL_ESC() throws RecognitionException {
try {
// MessageFilter.g:232:5: ( '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) ( '0' .. '7' ) | '\\\\' ( '0' .. '7' ) )
int alt18=3;
int LA18_0 = input.LA(1);
if ( (LA18_0=='\\') ) {
int LA18_1 = input.LA(2);
if ( ((LA18_1 >= '0' && LA18_1 <= '3')) ) {
int LA18_2 = input.LA(3);
if ( ((LA18_2 >= '0' && LA18_2 <= '7')) ) {
int LA18_4 = input.LA(4);
if ( ((LA18_4 >= '0' && LA18_4 <= '7')) ) {
alt18=1;
}
else {
alt18=2;
}
}
else {
alt18=3;
}
}
else if ( ((LA18_1 >= '4' && LA18_1 <= '7')) ) {
int LA18_3 = input.LA(3);
if ( ((LA18_3 >= '0' && LA18_3 <= '7')) ) {
alt18=2;
}
else {
alt18=3;
}
}
else {
NoViableAltException nvae =
new NoViableAltException("", 18, 1, input);
throw nvae;
}
}
else {
NoViableAltException nvae =
new NoViableAltException("", 18, 0, input);
throw nvae;
}
switch (alt18) {
case 1 :
// MessageFilter.g:232:9: '\\\\' ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
{
match('\\');
if ( (input.LA(1) >= '0' && input.LA(1) <= '3') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
case 2 :
// MessageFilter.g:233:9: '\\\\' ( '0' .. '7' ) ( '0' .. '7' )
{
match('\\');
if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
case 3 :
// MessageFilter.g:234:9: '\\\\' ( '0' .. '7' )
{
match('\\');
if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
}
}
finally {
// do for sure before leaving
}
} | class class_name[name] begin[{]
method[mOCTAL_ESC, return_type[void], modifier[final public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), name=alt18)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA18_0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=LA18_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\'), operator===), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=18), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoViableAltException, sub_type=None)), name=nvae)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NoViableAltException, sub_type=None)), ThrowStatement(expression=MemberReference(member=nvae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA18_1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=LA18_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=LA18_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='3'), operator=<=), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=LA18_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='4'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=LA18_1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=18), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoViableAltException, sub_type=None)), name=nvae)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NoViableAltException, sub_type=None)), ThrowStatement(expression=MemberReference(member=nvae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA18_3)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=LA18_3, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=LA18_3, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt18, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt18, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA18_2)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=LA18_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=LA18_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt18, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA18_4)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=LA18_4, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MemberReference(member=LA18_4, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt18, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt18, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)]))]))]))])), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='3'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MismatchedSetException, sub_type=None)), name=mse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MismatchedSetException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=consume, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MismatchedSetException, sub_type=None)), name=mse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MismatchedSetException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=consume, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MismatchedSetException, sub_type=None)), name=mse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MismatchedSetException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=consume, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None)]))]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MismatchedSetException, sub_type=None)), name=mse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MismatchedSetException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=consume, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MismatchedSetException, sub_type=None)), name=mse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MismatchedSetException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=consume, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None)]))]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0'), operator=>=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='7'), operator=<=), operator=&&), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MismatchedSetException, sub_type=None)), name=mse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MismatchedSetException, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=mse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=consume, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), label=None)]))]), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=alt18, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[mOCTAL_ESC] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[try] {
Keyword[int] identifier[alt18] operator[=] Other[3] operator[SEP] Keyword[int] identifier[LA18_0] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[LA18_0] operator[==] literal[String] operator[SEP] operator[SEP] {
Keyword[int] identifier[LA18_1] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[LA18_1] operator[>=] literal[String] operator[&&] identifier[LA18_1] operator[<=] literal[String] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[LA18_2] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[3] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[LA18_2] operator[>=] literal[String] operator[&&] identifier[LA18_2] operator[<=] literal[String] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[LA18_4] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[4] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[LA18_4] operator[>=] literal[String] operator[&&] identifier[LA18_4] operator[<=] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[alt18] operator[=] Other[1] operator[SEP]
}
Keyword[else] {
identifier[alt18] operator[=] Other[2] operator[SEP]
}
}
Keyword[else] {
identifier[alt18] operator[=] Other[3] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[LA18_1] operator[>=] literal[String] operator[&&] identifier[LA18_1] operator[<=] literal[String] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[LA18_3] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[3] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[LA18_3] operator[>=] literal[String] operator[&&] identifier[LA18_3] operator[<=] literal[String] operator[SEP] operator[SEP] operator[SEP] {
identifier[alt18] operator[=] Other[2] operator[SEP]
}
Keyword[else] {
identifier[alt18] operator[=] Other[3] operator[SEP]
}
}
Keyword[else] {
identifier[NoViableAltException] identifier[nvae] operator[=] Keyword[new] identifier[NoViableAltException] operator[SEP] literal[String] , Other[18] , Other[1] , identifier[input] operator[SEP] operator[SEP] Keyword[throw] identifier[nvae] operator[SEP]
}
}
Keyword[else] {
identifier[NoViableAltException] identifier[nvae] operator[=] Keyword[new] identifier[NoViableAltException] operator[SEP] literal[String] , Other[18] , Other[0] , identifier[input] operator[SEP] operator[SEP] Keyword[throw] identifier[nvae] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[alt18] operator[SEP] {
Keyword[case] Other[1] operator[:] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[>=] literal[String] operator[&&] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[input] operator[SEP] identifier[consume] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[MismatchedSetException] identifier[mse] operator[=] Keyword[new] identifier[MismatchedSetException] operator[SEP] Other[null] , identifier[input] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[mse] operator[SEP] operator[SEP] Keyword[throw] identifier[mse] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[>=] literal[String] operator[&&] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[input] operator[SEP] identifier[consume] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[MismatchedSetException] identifier[mse] operator[=] Keyword[new] identifier[MismatchedSetException] operator[SEP] Other[null] , identifier[input] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[mse] operator[SEP] operator[SEP] Keyword[throw] identifier[mse] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[>=] literal[String] operator[&&] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[input] operator[SEP] identifier[consume] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[MismatchedSetException] identifier[mse] operator[=] Keyword[new] identifier[MismatchedSetException] operator[SEP] Other[null] , identifier[input] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[mse] operator[SEP] operator[SEP] Keyword[throw] identifier[mse] operator[SEP]
}
}
Keyword[break] operator[SEP] Keyword[case] Other[2] operator[:] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[>=] literal[String] operator[&&] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[input] operator[SEP] identifier[consume] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[MismatchedSetException] identifier[mse] operator[=] Keyword[new] identifier[MismatchedSetException] operator[SEP] Other[null] , identifier[input] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[mse] operator[SEP] operator[SEP] Keyword[throw] identifier[mse] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[>=] literal[String] operator[&&] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[input] operator[SEP] identifier[consume] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[MismatchedSetException] identifier[mse] operator[=] Keyword[new] identifier[MismatchedSetException] operator[SEP] Other[null] , identifier[input] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[mse] operator[SEP] operator[SEP] Keyword[throw] identifier[mse] operator[SEP]
}
}
Keyword[break] operator[SEP] Keyword[case] Other[3] operator[:] {
identifier[match] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[>=] literal[String] operator[&&] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[<=] literal[String] operator[SEP] operator[SEP] {
identifier[input] operator[SEP] identifier[consume] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[MismatchedSetException] identifier[mse] operator[=] Keyword[new] identifier[MismatchedSetException] operator[SEP] Other[null] , identifier[input] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[mse] operator[SEP] operator[SEP] Keyword[throw] identifier[mse] operator[SEP]
}
}
Keyword[break] operator[SEP]
}
}
Keyword[finally] {
}
}
|
@Override
public String get(String key) {
if("dn".equals(key)) {
return this.dn;
} else if (key != null
&& attributes != null
&& getKeys().contains(key)
&& attributes.get(key) != null) {
return attributes.get(key).toString().replace(key + ":", "").trim();
}
return null;
} | class class_name[name] begin[{]
method[get, return_type[type[String]], modifier[public], parameter[key]] begin[{]
if[literal["dn"]] begin[{]
return[THIS[member[None.dn]]]
else begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.key], !=, literal[null]], &&, binary_operation[member[.attributes], !=, literal[null]]], &&, call[.getKeys, parameter[]]], &&, binary_operation[call[attributes.get, parameter[member[.key]]], !=, literal[null]]]] begin[{]
return[call[attributes.get, parameter[member[.key]]]]
else begin[{]
None
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[get] operator[SEP] identifier[String] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[dn] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[key] operator[!=] Other[null] operator[&&] identifier[attributes] operator[!=] Other[null] operator[&&] identifier[getKeys] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[key] operator[SEP] operator[&&] identifier[attributes] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[attributes] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[replace] operator[SEP] identifier[key] operator[+] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
writer.addAnnotationTypeSignature(utils.modifiersToString(annotationType, true),
annotationInfoTree);
} | class class_name[name] begin[{]
method[buildAnnotationTypeSignature, return_type[void], modifier[public], parameter[node, annotationInfoTree]] begin[{]
call[writer.addAnnotationTypeSignature, parameter[call[utils.modifiersToString, parameter[member[.annotationType], literal[true]]], member[.annotationInfoTree]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[buildAnnotationTypeSignature] operator[SEP] identifier[XMLNode] identifier[node] , identifier[Content] identifier[annotationInfoTree] operator[SEP] {
identifier[writer] operator[SEP] identifier[addAnnotationTypeSignature] operator[SEP] identifier[utils] operator[SEP] identifier[modifiersToString] operator[SEP] identifier[annotationType] , literal[boolean] operator[SEP] , identifier[annotationInfoTree] operator[SEP] operator[SEP]
}
|
protected void updateIndicatorClipRect() {
mActiveView.getDrawingRect(mActiveRect);
offsetDescendantRectToMyCoords(mActiveView, mActiveRect);
final float openRatio = mIsStatic ? 1.0f : Math.abs(mOffsetPixels) / mMenuSize;
final float interpolatedRatio = 1.f - INDICATOR_INTERPOLATOR.getInterpolation((1.f - openRatio));
final int indicatorWidth = mActiveIndicator.getWidth();
final int indicatorHeight = mActiveIndicator.getHeight();
final int interpolatedWidth = (int) (indicatorWidth * interpolatedRatio);
final int interpolatedHeight = (int) (indicatorHeight * interpolatedRatio);
final int startPos = mIndicatorStartPos;
int left = 0;
int top = 0;
int right = 0;
int bottom = 0;
switch (getPosition()) {
case LEFT:
case RIGHT:
final int finalTop = mActiveRect.top + ((mActiveRect.height() - indicatorHeight) / 2);
if (mIndicatorAnimating) {
top = (int) (startPos + ((finalTop - startPos) * mIndicatorOffset));
} else {
top = finalTop;
}
bottom = top + indicatorHeight;
break;
case TOP:
case BOTTOM:
final int finalLeft = mActiveRect.left + ((mActiveRect.width() - indicatorWidth) / 2);
if (mIndicatorAnimating) {
left = (int) (startPos + ((finalLeft - startPos) * mIndicatorOffset));
} else {
left = finalLeft;
}
right = left + indicatorWidth;
break;
}
switch (getPosition()) {
case LEFT: {
right = ViewHelper.getLeft(mContentContainer);
left = right - interpolatedWidth;
break;
}
case TOP: {
bottom = ViewHelper.getTop(mContentContainer);
top = bottom - interpolatedHeight;
break;
}
case RIGHT: {
left = ViewHelper.getRight(mContentContainer);
right = left + interpolatedWidth;
break;
}
case BOTTOM: {
top = ViewHelper.getBottom(mContentContainer);
bottom = top + interpolatedHeight;
break;
}
}
mIndicatorClipRect.left = left;
mIndicatorClipRect.top = top;
mIndicatorClipRect.right = right;
mIndicatorClipRect.bottom = bottom;
} | class class_name[name] begin[{]
method[updateIndicatorClipRect, return_type[void], modifier[protected], parameter[]] begin[{]
call[mActiveView.getDrawingRect, parameter[member[.mActiveRect]]]
call[.offsetDescendantRectToMyCoords, parameter[member[.mActiveView], member[.mActiveRect]]]
local_variable[type[float], openRatio]
local_variable[type[float], interpolatedRatio]
local_variable[type[int], indicatorWidth]
local_variable[type[int], indicatorHeight]
local_variable[type[int], interpolatedWidth]
local_variable[type[int], interpolatedHeight]
local_variable[type[int], startPos]
local_variable[type[int], left]
local_variable[type[int], top]
local_variable[type[int], right]
local_variable[type[int], bottom]
SwitchStatement(cases=[SwitchStatementCase(case=['LEFT', 'RIGHT'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=mActiveRect, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=height, postfix_operators=[], prefix_operators=[], qualifier=mActiveRect, selectors=[], type_arguments=None), operandr=MemberReference(member=indicatorHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/), operator=+), name=finalTop)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=MemberReference(member=mIndicatorAnimating, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=finalTop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=BinaryOperation(operandl=MemberReference(member=startPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=finalTop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=startPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=mIndicatorOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), type=BasicType(dimensions=[], name=int))), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bottom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=indicatorHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['TOP', 'BOTTOM'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=mActiveRect, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=width, postfix_operators=[], prefix_operators=[], qualifier=mActiveRect, selectors=[], type_arguments=None), operandr=MemberReference(member=indicatorWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=/), operator=+), name=finalLeft)], modifiers={'final'}, type=BasicType(dimensions=[], name=int)), IfStatement(condition=MemberReference(member=mIndicatorAnimating, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=finalLeft, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=BinaryOperation(operandl=MemberReference(member=startPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=finalLeft, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=startPos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), operandr=MemberReference(member=mIndicatorOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operator=+), type=BasicType(dimensions=[], name=int))), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=right, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=indicatorWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[], member=getPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
SwitchStatement(cases=[SwitchStatementCase(case=['LEFT'], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=right, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=mContentContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLeft, postfix_operators=[], prefix_operators=[], qualifier=ViewHelper, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=right, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=interpolatedWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)), label=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=['TOP'], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bottom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=mContentContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTop, postfix_operators=[], prefix_operators=[], qualifier=ViewHelper, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=bottom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=interpolatedHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)), label=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=['RIGHT'], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=mContentContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRight, postfix_operators=[], prefix_operators=[], qualifier=ViewHelper, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=right, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=left, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=interpolatedWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=['BOTTOM'], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=mContentContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getBottom, postfix_operators=[], prefix_operators=[], qualifier=ViewHelper, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=bottom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=top, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=interpolatedHeight, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None), BreakStatement(goto=None, label=None)])])], expression=MethodInvocation(arguments=[], member=getPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)
assign[member[mIndicatorClipRect.left], member[.left]]
assign[member[mIndicatorClipRect.top], member[.top]]
assign[member[mIndicatorClipRect.right], member[.right]]
assign[member[mIndicatorClipRect.bottom], member[.bottom]]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[updateIndicatorClipRect] operator[SEP] operator[SEP] {
identifier[mActiveView] operator[SEP] identifier[getDrawingRect] operator[SEP] identifier[mActiveRect] operator[SEP] operator[SEP] identifier[offsetDescendantRectToMyCoords] operator[SEP] identifier[mActiveView] , identifier[mActiveRect] operator[SEP] operator[SEP] Keyword[final] Keyword[float] identifier[openRatio] operator[=] identifier[mIsStatic] operator[?] literal[Float] operator[:] identifier[Math] operator[SEP] identifier[abs] operator[SEP] identifier[mOffsetPixels] operator[SEP] operator[/] identifier[mMenuSize] operator[SEP] Keyword[final] Keyword[float] identifier[interpolatedRatio] operator[=] literal[Float] operator[-] identifier[INDICATOR_INTERPOLATOR] operator[SEP] identifier[getInterpolation] operator[SEP] operator[SEP] literal[Float] operator[-] identifier[openRatio] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[indicatorWidth] operator[=] identifier[mActiveIndicator] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[indicatorHeight] operator[=] identifier[mActiveIndicator] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[interpolatedWidth] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[indicatorWidth] operator[*] identifier[interpolatedRatio] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[interpolatedHeight] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[indicatorHeight] operator[*] identifier[interpolatedRatio] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[startPos] operator[=] identifier[mIndicatorStartPos] operator[SEP] Keyword[int] identifier[left] operator[=] Other[0] operator[SEP] Keyword[int] identifier[top] operator[=] Other[0] operator[SEP] Keyword[int] identifier[right] operator[=] Other[0] operator[SEP] Keyword[int] identifier[bottom] operator[=] Other[0] operator[SEP] Keyword[switch] operator[SEP] identifier[getPosition] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[LEFT] operator[:] Keyword[case] identifier[RIGHT] operator[:] Keyword[final] Keyword[int] identifier[finalTop] operator[=] identifier[mActiveRect] operator[SEP] identifier[top] operator[+] operator[SEP] operator[SEP] identifier[mActiveRect] operator[SEP] identifier[height] operator[SEP] operator[SEP] operator[-] identifier[indicatorHeight] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mIndicatorAnimating] operator[SEP] {
identifier[top] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[startPos] operator[+] operator[SEP] operator[SEP] identifier[finalTop] operator[-] identifier[startPos] operator[SEP] operator[*] identifier[mIndicatorOffset] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[top] operator[=] identifier[finalTop] operator[SEP]
}
identifier[bottom] operator[=] identifier[top] operator[+] identifier[indicatorHeight] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[TOP] operator[:] Keyword[case] identifier[BOTTOM] operator[:] Keyword[final] Keyword[int] identifier[finalLeft] operator[=] identifier[mActiveRect] operator[SEP] identifier[left] operator[+] operator[SEP] operator[SEP] identifier[mActiveRect] operator[SEP] identifier[width] operator[SEP] operator[SEP] operator[-] identifier[indicatorWidth] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[mIndicatorAnimating] operator[SEP] {
identifier[left] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[startPos] operator[+] operator[SEP] operator[SEP] identifier[finalLeft] operator[-] identifier[startPos] operator[SEP] operator[*] identifier[mIndicatorOffset] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[left] operator[=] identifier[finalLeft] operator[SEP]
}
identifier[right] operator[=] identifier[left] operator[+] identifier[indicatorWidth] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[switch] operator[SEP] identifier[getPosition] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[LEFT] operator[:] {
identifier[right] operator[=] identifier[ViewHelper] operator[SEP] identifier[getLeft] operator[SEP] identifier[mContentContainer] operator[SEP] operator[SEP] identifier[left] operator[=] identifier[right] operator[-] identifier[interpolatedWidth] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[case] identifier[TOP] operator[:] {
identifier[bottom] operator[=] identifier[ViewHelper] operator[SEP] identifier[getTop] operator[SEP] identifier[mContentContainer] operator[SEP] operator[SEP] identifier[top] operator[=] identifier[bottom] operator[-] identifier[interpolatedHeight] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[case] identifier[RIGHT] operator[:] {
identifier[left] operator[=] identifier[ViewHelper] operator[SEP] identifier[getRight] operator[SEP] identifier[mContentContainer] operator[SEP] operator[SEP] identifier[right] operator[=] identifier[left] operator[+] identifier[interpolatedWidth] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[case] identifier[BOTTOM] operator[:] {
identifier[top] operator[=] identifier[ViewHelper] operator[SEP] identifier[getBottom] operator[SEP] identifier[mContentContainer] operator[SEP] operator[SEP] identifier[bottom] operator[=] identifier[top] operator[+] identifier[interpolatedHeight] operator[SEP] Keyword[break] operator[SEP]
}
}
identifier[mIndicatorClipRect] operator[SEP] identifier[left] operator[=] identifier[left] operator[SEP] identifier[mIndicatorClipRect] operator[SEP] identifier[top] operator[=] identifier[top] operator[SEP] identifier[mIndicatorClipRect] operator[SEP] identifier[right] operator[=] identifier[right] operator[SEP] identifier[mIndicatorClipRect] operator[SEP] identifier[bottom] operator[=] identifier[bottom] operator[SEP]
}
|
public Clob getClob(int columnIndex) throws SQLException {
checkObjectRange(columnIndex);
if (row.lastValueWasNull()) {
return null;
}
return new MariaDbClob(row.buf, row.pos, row.length);
} | class class_name[name] begin[{]
method[getClob, return_type[type[Clob]], modifier[public], parameter[columnIndex]] begin[{]
call[.checkObjectRange, parameter[member[.columnIndex]]]
if[call[row.lastValueWasNull, parameter[]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=buf, postfix_operators=[], prefix_operators=[], qualifier=row, selectors=[]), MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=row, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=row, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MariaDbClob, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Clob] identifier[getClob] operator[SEP] Keyword[int] identifier[columnIndex] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[checkObjectRange] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[row] operator[SEP] identifier[lastValueWasNull] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] Keyword[new] identifier[MariaDbClob] operator[SEP] identifier[row] operator[SEP] identifier[buf] , identifier[row] operator[SEP] identifier[pos] , identifier[row] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.